Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

fix(agent): shared commit-field identity, kind-consistent refresh

Emre Sokullu67119d61a989
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index d888f6935..3a60a7ab0 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -1783,9 +1783,7 @@ export class Agent extends LoopDetector {
&& record?.taskToken === activeTaskToken
&& !!record?.readbackSha256
&& this._normalizeUrl(record.pageUrl || '') === this._normalizeUrl(pageUrl)
- && /^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- ))
+ && this._isGithubCommitMessageField(record?.fieldMeta)
));
const summaryVerified = !!expectedSummarySha256 && commitFieldRecords.some(record => (
String(record?.fieldMeta?.tag || '').toLowerCase() !== 'textarea'
@@ -20935,9 +20933,21 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return record?.fieldMeta?.contentEditable === true && record?.fieldMeta?.codeMirror === true;
}
+ // Commit-message field identity shared by mint classification, the
+ // binding filter, refresh, and per-kind invalidation: summary
+ // (commit-message-input / commit_message) and extended-description
+ // (commit-description-input / commit_description) spellings, matching id
+ // OR name independently β€” a non-matching id must never shadow a matching
+ // name or vice versa.
+ _isGithubCommitMessageField(meta = null) {
+ if (!meta || typeof meta !== 'object') return false;
+ const pattern = /^(?:commit-(?:message-input|description-input)|commit_(?:message|description))$/i;
+ return pattern.test(String(meta.id || '')) || pattern.test(String(meta.name || ''));
+ }
+
_focusedGithubFieldKind(meta = null) {
if (!meta || typeof meta !== 'object') return '';
- if (/^(?:commit-message-input|commit_message)$/i.test(String(meta.id || meta.name || ''))) {
+ if (this._isGithubCommitMessageField(meta)) {
return 'commit-message';
}
if (meta.contentEditable === true) return 'editor';
@@ -20966,19 +20976,33 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return fallbackMeta || null;
}
- _focusedReplacementTarget(tabId, kind) {
+ // Stable per-field discriminator for focused commit-message proofs so the
+ // summary and extended-description proofs coexist (and invalidate
+ // independently). Lowercase alphanumerics; anything unusable β†’ 'field'.
+ _focusedCommitFieldRef(meta = null) {
+ const ref = String(meta?.id || meta?.name || meta?.tag || 'field')
+ .toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40);
+ return ref || 'field';
+ }
+
+ _focusedReplacementTarget(tabId, kind, fieldMeta = null) {
const scope = this._lastAxScopes.get(tabId) || {};
const documentToken = String(scope.documentToken || '');
const pageUrl = String(scope.pageUrl || '');
const doc = documentToken || pageUrl || 'document';
+ // Commit-message proofs scope per field (summary vs extended
+ // description); editor proofs keep the single stable key. The ref rides
+ // along on the record so per-field invalidation needs no key parsing.
+ const commitFieldRef = kind === 'commit-message' ? this._focusedCommitFieldRef(fieldMeta) : '';
return {
- key: `focused:${doc}:${kind}`,
+ key: `focused:${doc}:${kind}${commitFieldRef ? `:${commitFieldRef}` : ''}`,
locatorType: 'focused',
documentToken,
pageUrl,
ambiguous: false,
focusedProof: true,
focusedKind: kind,
+ ...(commitFieldRef ? { commitFieldRef } : {}),
// Pre-submit revalidation locator, filled from the write-time live
// digest's element-derived stableSelector when the replacement record
// is minted. Stays null until then: refresh drops locator-less proofs
@@ -21091,9 +21115,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
} catch { current = null; }
const kindOk = record.focusedKind === 'editor'
? this._isGithubFileEditorRecord({ fieldMeta: current?.fieldMeta })
- : /^(?:commit-message-input|commit_message)$/i.test(String(
- current?.fieldMeta?.id || current?.fieldMeta?.name || '',
- ));
+ : this._isGithubCommitMessageField(current?.fieldMeta);
if (!current
|| !record.readbackSha256
|| !kindOk
@@ -21107,9 +21129,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Same identity as the authorization filter by construction β€” every
// editor proof the gate can authorize is re-digested here.
const githubEditor = this._isGithubFileEditorRecord(record);
- const commitMessage = /^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- ));
+ const commitMessage = this._isGithubCommitMessageField(record?.fieldMeta);
if (!githubEditor && !commitMessage) continue;
const current = await this._textMutationValueDigest(tabId, record);
// Revalidate against the CURRENT element, not the stale record: a DOM
@@ -21119,12 +21139,15 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// and must not be proven distinct from the stored metadata β€” otherwise
// the proof is dropped fail-closed instead of authorizing the commit.
const currentEditor = this._isGithubFileEditorRecord({ fieldMeta: current?.fieldMeta });
- const currentMessage = /^(?:commit-message-input|commit_message)$/i.test(String(
- current?.fieldMeta?.id || current?.fieldMeta?.name || '',
- ));
+ const currentMessage = this._isGithubCommitMessageField(current?.fieldMeta);
+ // Kind consistency: the refreshed element must still prove the SAME
+ // kind the record was bound as. A locator repointed across kinds with
+ // identical bytes (editor proof now reading a commit field or vice
+ // versa) would otherwise keep stale original metadata authorizing a
+ // changed field β€” so require (editor, editor) or (message, message).
if (!current
|| !record.readbackSha256
- || (!currentEditor && !currentMessage)
+ || !((githubEditor && currentEditor) || (commitMessage && currentMessage))
|| this._textMutationFieldsProvenDistinct(record.fieldMeta, current.fieldMeta)
|| current.valueLength !== record.readbackLength
|| current.valueSha256 !== record.readbackSha256) {
@@ -21338,7 +21361,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
verifiedReplacements = new Map();
this._verifiedTextReplacements.set(tabId, verifiedReplacements);
}
- const effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind);
+ const effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind, normalizedFocusedMeta);
verifiedReplacements.set(effectiveTarget.key, await this._verifiedTextReplacementRecord(
tabId, effectiveTarget, text, normalizedFocusedMeta,
));
@@ -21563,7 +21586,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
);
const focusedKind = this._focusedGithubFieldKind(normalizedFocusedMeta);
if ((focusedKind === 'editor' || focusedKind === 'commit-message') && args.clear === true) {
- effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind);
+ effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind, normalizedFocusedMeta);
effectiveFieldMeta = normalizedFocusedMeta;
}
}
@@ -21574,20 +21597,31 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const verifiedReplacements = this._verifiedTextReplacements.get(tabId);
if (verifiedReplacements instanceof Map) {
if (target.ambiguous && name === 'type_text') {
- const focusedKind = this._focusedGithubFieldKind(this._normalizeFocusedFieldMeta(
+ const normalizedNewMeta = this._normalizeFocusedFieldMeta(
result.focusedField || null, result.fieldMeta || null,
- ));
+ );
+ const focusedKind = this._focusedGithubFieldKind(normalizedNewMeta);
if (focusedKind === 'editor' || focusedKind === 'commit-message') {
+ const newCommitRef = focusedKind === 'commit-message'
+ ? this._focusedCommitFieldRef(normalizedNewMeta)
+ : '';
for (const [key, record] of verifiedReplacements) {
const recordKind = record?.focusedKind
|| this._focusedGithubFieldKind(record?.fieldMeta || null)
|| (/contenteditable/i.test(String(record?.key || key)) ? 'editor' : '');
- const sameKind = focusedKind === 'editor'
- ? (recordKind === 'editor' || record?.fieldMeta?.contentEditable === true
- || /contenteditable/i.test(String(record?.key || key)))
- : (/^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- )) || recordKind === 'commit-message');
+ let sameKind = false;
+ if (focusedKind === 'editor') {
+ sameKind = recordKind === 'editor' || record?.fieldMeta?.contentEditable === true
+ || /contenteditable/i.test(String(record?.key || key));
+ } else if (this._isGithubCommitMessageField(record?.fieldMeta) || recordKind === 'commit-message') {
+ // Per-field scoping for focused proofs: a write to one
+ // commit field keeps the other's proof. Anything
+ // unidentifiable drops fail-closed, as do all non-focused
+ // commit proofs (same field, new value).
+ const recordRef = record?.focusedProof === true
+ ? String(record.commitFieldRef || '') : '';
+ sameKind = !recordRef || !newCommitRef || recordRef === newCommitRef;
+ }
if (sameKind) verifiedReplacements.delete(key);
}
} else verifiedReplacements.clear();
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index c6be6d21d..63f9b2618 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -1497,9 +1497,7 @@ export class Agent extends LoopDetector {
&& record?.taskToken === activeTaskToken
&& !!record?.readbackSha256
&& this._normalizeUrl(record.pageUrl || '') === this._normalizeUrl(pageUrl)
- && /^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- ))
+ && this._isGithubCommitMessageField(record?.fieldMeta)
));
const summaryVerified = !!expectedSummarySha256 && commitFieldRecords.some(record => (
String(record?.fieldMeta?.tag || '').toLowerCase() !== 'textarea'
@@ -18492,9 +18490,21 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return record?.fieldMeta?.contentEditable === true && record?.fieldMeta?.codeMirror === true;
}
+ // Commit-message field identity shared by mint classification, the
+ // binding filter, refresh, and per-kind invalidation: summary
+ // (commit-message-input / commit_message) and extended-description
+ // (commit-description-input / commit_description) spellings, matching id
+ // OR name independently β€” a non-matching id must never shadow a matching
+ // name or vice versa.
+ _isGithubCommitMessageField(meta = null) {
+ if (!meta || typeof meta !== 'object') return false;
+ const pattern = /^(?:commit-(?:message-input|description-input)|commit_(?:message|description))$/i;
+ return pattern.test(String(meta.id || '')) || pattern.test(String(meta.name || ''));
+ }
+
_focusedGithubFieldKind(meta = null) {
if (!meta || typeof meta !== 'object') return '';
- if (/^(?:commit-message-input|commit_message)$/i.test(String(meta.id || meta.name || ''))) {
+ if (this._isGithubCommitMessageField(meta)) {
return 'commit-message';
}
if (meta.contentEditable === true) return 'editor';
@@ -18523,19 +18533,33 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return fallbackMeta || null;
}
- _focusedReplacementTarget(tabId, kind) {
+ // Stable per-field discriminator for focused commit-message proofs so the
+ // summary and extended-description proofs coexist (and invalidate
+ // independently). Lowercase alphanumerics; anything unusable β†’ 'field'.
+ _focusedCommitFieldRef(meta = null) {
+ const ref = String(meta?.id || meta?.name || meta?.tag || 'field')
+ .toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40);
+ return ref || 'field';
+ }
+
+ _focusedReplacementTarget(tabId, kind, fieldMeta = null) {
const scope = this._lastAxScopes.get(tabId) || {};
const documentToken = String(scope.documentToken || '');
const pageUrl = String(scope.pageUrl || '');
const doc = documentToken || pageUrl || 'document';
+ // Commit-message proofs scope per field (summary vs extended
+ // description); editor proofs keep the single stable key. The ref rides
+ // along on the record so per-field invalidation needs no key parsing.
+ const commitFieldRef = kind === 'commit-message' ? this._focusedCommitFieldRef(fieldMeta) : '';
return {
- key: `focused:${doc}:${kind}`,
+ key: `focused:${doc}:${kind}${commitFieldRef ? `:${commitFieldRef}` : ''}`,
locatorType: 'focused',
documentToken,
pageUrl,
ambiguous: false,
focusedProof: true,
focusedKind: kind,
+ ...(commitFieldRef ? { commitFieldRef } : {}),
// Pre-submit revalidation locator, filled from the write-time live
// digest's element-derived stableSelector when the replacement record
// is minted. Stays null until then: refresh drops locator-less proofs
@@ -18648,9 +18672,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
} catch { current = null; }
const kindOk = record.focusedKind === 'editor'
? this._isGithubFileEditorRecord({ fieldMeta: current?.fieldMeta })
- : /^(?:commit-message-input|commit_message)$/i.test(String(
- current?.fieldMeta?.id || current?.fieldMeta?.name || '',
- ));
+ : this._isGithubCommitMessageField(current?.fieldMeta);
if (!current
|| !record.readbackSha256
|| !kindOk
@@ -18664,9 +18686,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Same identity as the authorization filter by construction β€” every
// editor proof the gate can authorize is re-digested here.
const githubEditor = this._isGithubFileEditorRecord(record);
- const commitMessage = /^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- ));
+ const commitMessage = this._isGithubCommitMessageField(record?.fieldMeta);
if (!githubEditor && !commitMessage) continue;
const current = await this._textMutationValueDigest(tabId, record);
// Revalidate against the CURRENT element, not the stale record: a DOM
@@ -18676,12 +18696,15 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// and must not be proven distinct from the stored metadata β€” otherwise
// the proof is dropped fail-closed instead of authorizing the commit.
const currentEditor = this._isGithubFileEditorRecord({ fieldMeta: current?.fieldMeta });
- const currentMessage = /^(?:commit-message-input|commit_message)$/i.test(String(
- current?.fieldMeta?.id || current?.fieldMeta?.name || '',
- ));
+ const currentMessage = this._isGithubCommitMessageField(current?.fieldMeta);
+ // Kind consistency: the refreshed element must still prove the SAME
+ // kind the record was bound as. A locator repointed across kinds with
+ // identical bytes (editor proof now reading a commit field or vice
+ // versa) would otherwise keep stale original metadata authorizing a
+ // changed field β€” so require (editor, editor) or (message, message).
if (!current
|| !record.readbackSha256
- || (!currentEditor && !currentMessage)
+ || !((githubEditor && currentEditor) || (commitMessage && currentMessage))
|| this._textMutationFieldsProvenDistinct(record.fieldMeta, current.fieldMeta)
|| current.valueLength !== record.readbackLength
|| current.valueSha256 !== record.readbackSha256) {
@@ -18895,7 +18918,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
verifiedReplacements = new Map();
this._verifiedTextReplacements.set(tabId, verifiedReplacements);
}
- const effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind);
+ const effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind, normalizedFocusedMeta);
verifiedReplacements.set(effectiveTarget.key, await this._verifiedTextReplacementRecord(
tabId, effectiveTarget, text, normalizedFocusedMeta,
));
@@ -19125,7 +19148,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
);
const focusedKind = this._focusedGithubFieldKind(normalizedFocusedMeta);
if ((focusedKind === 'editor' || focusedKind === 'commit-message') && args.clear === true) {
- effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind);
+ effectiveTarget = this._focusedReplacementTarget(tabId, focusedKind, normalizedFocusedMeta);
effectiveFieldMeta = normalizedFocusedMeta;
}
}
@@ -19136,20 +19159,31 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const verifiedReplacements = this._verifiedTextReplacements.get(tabId);
if (verifiedReplacements instanceof Map) {
if (target.ambiguous && name === 'type_text') {
- const focusedKind = this._focusedGithubFieldKind(this._normalizeFocusedFieldMeta(
+ const normalizedNewMeta = this._normalizeFocusedFieldMeta(
result.focusedField || null, result.fieldMeta || null,
- ));
+ );
+ const focusedKind = this._focusedGithubFieldKind(normalizedNewMeta);
if (focusedKind === 'editor' || focusedKind === 'commit-message') {
+ const newCommitRef = focusedKind === 'commit-message'
+ ? this._focusedCommitFieldRef(normalizedNewMeta)
+ : '';
for (const [key, record] of verifiedReplacements) {
const recordKind = record?.focusedKind
|| this._focusedGithubFieldKind(record?.fieldMeta || null)
|| (/contenteditable/i.test(String(record?.key || key)) ? 'editor' : '');
- const sameKind = focusedKind === 'editor'
- ? (recordKind === 'editor' || record?.fieldMeta?.contentEditable === true
- || /contenteditable/i.test(String(record?.key || key)))
- : (/^(?:commit-message-input|commit_message)$/i.test(String(
- record?.fieldMeta?.id || record?.fieldMeta?.name || '',
- )) || recordKind === 'commit-message');
+ let sameKind = false;
+ if (focusedKind === 'editor') {
+ sameKind = recordKind === 'editor' || record?.fieldMeta?.contentEditable === true
+ || /contenteditable/i.test(String(record?.key || key));
+ } else if (this._isGithubCommitMessageField(record?.fieldMeta) || recordKind === 'commit-message') {
+ // Per-field scoping for focused proofs: a write to one
+ // commit field keeps the other's proof. Anything
+ // unidentifiable drops fail-closed, as do all non-focused
+ // commit proofs (same field, new value).
+ const recordRef = record?.focusedProof === true
+ ? String(record.commitFieldRef || '') : '';
+ sameKind = !recordRef || !newCommitRef || recordRef === newCommitRef;
+ }
if (sameKind) verifiedReplacements.delete(key);
}
} else verifiedReplacements.clear();
diff --git a/test/run.js b/test/run.js
index bb37018f5..14cffd878 100644
--- a/test/run.js
+++ b/test/run.js
@@ -75953,6 +75953,93 @@ test('multi-line commit messages bind summary plus description', async () => {
}
});
+test('commit description identifiers authorize with kind-consistent refresh', async () => {
+ for (const [label, AgentClass] of [['chrome', AgentCh], ['firefox', AgentFx]]) {
+ const agent = new AgentClass({});
+ // Identity matrix: all four spellings, id/name independence, negatives.
+ for (const [meta, expected, note] of [
+ [{ id: 'commit-message-input' }, true, 'summary id'],
+ [{ name: 'commit_message' }, true, 'message name'],
+ [{ id: 'commit-description-input' }, true, 'description id'],
+ [{ name: 'commit_description' }, true, 'description name'],
+ [{ id: 'unrelated-id', name: 'commit_message' }, true, 'name laid over a foreign id'],
+ [{ id: 'commit-message-input', name: 'unrelated-name' }, true, 'id laid over a foreign name'],
+ [{ id: 'comment-box' }, false, 'unrelated field'],
+ [{}, false, 'empty metadata'],
+ [null, false, 'missing metadata'],
+ ]) {
+ assert.equal(agent._isGithubCommitMessageField(meta), expected,
+ `${label}: commit-field identity wrong for ${note}`);
+ }
+ }
+ const originalChrome = globalThis.chrome;
+ const originalBrowser = globalThis.browser;
+ try {
+ const pageUrl = 'https://github.com/Example/Repo/edit/main/docs/plan.md';
+ for (const [label, AgentClass, resolveJob, tabId] of [
+ ['chrome', AgentCh, resolveAdapterWorkflowJob, 9544],
+ ['firefox', AgentFx, resolveAdapterWorkflowJobFx, 9545],
+ ]) {
+ const agent = new AgentClass({});
+ agent._planExecutionGuards.set(tabId, {
+ enabled: true,
+ siteWorkflow: resolveJob(pageUrl, 'edit-file-and-commit'),
+ workflowMetadataRequirements: [{ field: 'commit_message', value: 'Title\n\nDetails' }],
+ workflowMetadataRequirementsResolved: true,
+ });
+ agent._taskTokens.set(tabId, 'task-desc-id');
+ const editorBody = '# Doc\n';
+ const editorRecord = {
+ key: 'ax:doc:ref_editor', locatorType: 'ax', refId: 'ref_editor',
+ documentToken: 'doc', pageUrl, ambiguous: false,
+ expectedLength: editorBody.length, expectedSha256: await agent._sha256Text(editorBody),
+ expectedFp: agent._workflowInventoryFingerprint(editorBody),
+ fieldMeta: { contentEditable: true, ariaLabelledByText: 'Editing file contents' },
+ readbackLength: editorBody.length, readbackSha256: await agent._sha256Text(editorBody),
+ verifiedAt: Date.now(), taskToken: 'task-desc-id',
+ };
+ const messageRecordFor = async (key, text, fieldMeta) => ({
+ key, locatorType: 'ax', refId: 'ref_msg', documentToken: 'doc', pageUrl, ambiguous: false,
+ expectedLength: text.length, expectedSha256: await agent._sha256Text(text),
+ expectedFp: agent._workflowInventoryFingerprint(text), fieldMeta,
+ readbackLength: text.length, readbackSha256: await agent._sha256Text(text),
+ verifiedAt: Date.now(), taskToken: 'task-desc-id',
+ });
+ // Extended description identified by its own id (not the summary's).
+ agent._verifiedTextReplacements.set(tabId, new Map([
+ ['ax:doc:ref_editor', editorRecord],
+ ['ax:doc:ref_summary', await messageRecordFor('ax:doc:ref_summary', 'Title',
+ { tag: 'input', id: 'commit-message-input' })],
+ ['ax:doc:ref_desc', await messageRecordFor('ax:doc:ref_desc', 'Details',
+ { tag: 'textarea', id: 'commit-description-input' })],
+ ]));
+ assert.ok(agent._workflowSubmitBindingForAttempt(tabId, pageUrl, {})?.githubFileCommit,
+ `${label}: description-identified body did not authorize`);
+ // Cross-kind repoint with identical bytes: an editor proof now reading
+ // a commit field (and vice versa) must drop, not keep stale metadata.
+ const liveMeta = { tag: 'input', id: 'commit-message-input' };
+ const tabs = {
+ async sendMessage(_tabId, message) {
+ assert.equal(message.action, 'field_value_digest');
+ return { success: true,
+ valueLength: editorBody.length, valueSha256: await agent._sha256Text(editorBody),
+ fieldMeta: { ...liveMeta } };
+ },
+ };
+ globalThis.chrome = { tabs };
+ globalThis.browser = { tabs };
+ await agent._refreshGithubTextReplacementProofs(tabId, pageUrl);
+ assert.ok(!agent._verifiedTextReplacements.get(tabId)?.has('ax:doc:ref_editor'),
+ `${label}: editor proof repointed at a commit field survived refresh`);
+ }
+ } finally {
+ if (originalChrome === undefined) delete globalThis.chrome;
+ else globalThis.chrome = originalChrome;
+ if (originalBrowser === undefined) delete globalThis.browser;
+ else globalThis.browser = originalBrowser;
+ }
+});
+
test('terminal path match compares verbatim request text', async () => {
for (const [label, AgentClass, tabId] of [
['chrome', AgentCh, 9516],
@@ -76723,7 +76810,9 @@ test('focused editor and commit-message writes authorize a commit', async () =>
: { success: true, verified: true, fieldMeta: { id: 'commit-message-input', name: 'commit-message-input' } };
await agent._finalizeTextMutationResult(tabId, 'type_text', { text: commitMsg, clear: true }, messageResult);
const keys = [...(agent._verifiedTextReplacements.get(tabId)?.keys() || [])];
- assert.ok(keys.some(key => String(key).endsWith(':editor')) && keys.some(key => String(key).endsWith(':commit-message')),
+ const editorKey = keys.find(key => String(key).endsWith(':editor'));
+ const messageKey = keys.find(key => String(key).includes(':commit-message:'));
+ assert.ok(editorKey && messageKey && editorKey !== messageKey,
`${label}: focused editor and commit-message proofs collided (keys: ${keys})`);
const binding = agent._workflowSubmitBindingForAttempt(tabId, pageUrl, {});
assert.ok(binding?.githubFileCommit, `${label}: focused proofs did not authorize a commit`);
@@ -76753,7 +76842,7 @@ test('focused editor and commit-message writes authorize a commit', async () =>
const afterKeys = [...(agent._verifiedTextReplacements.get(tabId)?.keys() || [])];
assert.ok(!afterKeys.some(key => String(key).endsWith(':editor')),
`${label}: focused editor append kept a stale editor proof`);
- assert.ok(afterKeys.some(key => String(key).endsWith(':commit-message')),
+ assert.ok(afterKeys.some(key => String(key).includes(':commit-message:')),
`${label}: focused editor append cleared the commit-message proof`);
}
} finally {