Skip to content

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

Address review: keep recovery summary consistent with its outcome; scope deletion caveat

Claude7e52e1392cad
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 64ba18e7b..e861cebfd 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -5992,10 +5992,11 @@ export class Agent extends LoopDetector {
add('plan-publication-evidence-missing', false, caveat);
if (githubFile) add('github-committed-file-verification', false, caveat);
} else if (flags.missingRequiredSubmission && !flags.missingSocialPublishTargets.length) {
- // A deletion is not a "submission" to the user who asked for it.
- const deletions = Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
- && state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete');
- add('plan-submission-evidence-missing', false, deletions
+ // A deletion is not a "submission" to the user who asked for it. The
+ // caller sets missingDeletion only when the run's one dispatched action
+ // was a deletion, so a mixed task with an unverified form submission
+ // keeps the submission wording.
+ add('plan-submission-evidence-missing', false, flags.missingDeletion
? 'I couldn\'t confirm that the deletion took effect.'
: 'I couldn\'t confirm that the submission went through.');
}
@@ -7796,11 +7797,13 @@ export class Agent extends LoopDetector {
const pageUrl = await this._currentUrl(tabId);
if (!current()) return null;
// WebBrain writes this answer, not the model, so it claims only what it
- // checked: the one submission on this page. A request with later steps
- // (another site, more items) did not get them.
+ // checked: the one submission on this page, not that the whole request
+ // is done. It stays a success because the completion check above
+ // established the task's observable requirements; saying here that later
+ // steps were not attempted would contradict that outcome.
const summary = /^https:\/\/addons\.mozilla\.org\//i.test(pageUrl)
? 'The AMO version was submitted for review and the submission confirmation was verified.'
- : 'The model stopped responding after the submission. WebBrain read the page and verified that submission; no later step of the request was attempted.';
+ : 'The model stopped responding after the submission. WebBrain read the page and verified that submission.';
const result = await runReadOnly('done', { outcome: 'success', summary });
if (current() && result?.action === 'return' && !result.status
&& this._completionVerdicts.get(tabId)?.outcome === 'succeeded') {
@@ -40885,10 +40888,17 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// its note once per run, and the next completion is accepted with a
// caveat. The one-nudge budget and run-ending statuses below are the
// strict path.
+ // The unverified action is a deletion only when deletions are all that was
+ // dispatched: an ordinary form submission leaves no resource-mutation
+ // record, but it does leave the current submit receipt.
+ const missingDeletion = missingRequiredSubmission
+ && Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
+ && state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete')
+ && this._currentCompletionSubmitState(tabId)?.dispatched !== true;
const advisory = this._planGuardAdvisory(tabId, state, { viaDone, looksPlanOnly, runtimeModeContradiction,
structuredPlan: structuredPlan
|| (state.allowsPlannerShapedResult !== true && this._isPlannerShapedJson(content)),
- staleCancellation, missingRequiredSchedulingTool, missingRequiredDownload, missingRequiredSubmission,
+ staleCancellation, missingRequiredSchedulingTool, missingRequiredDownload, missingRequiredSubmission, missingDeletion,
forbiddenSubmission, missingJobEvidence, missingDraftEvidence, missingRequiredLedger,
missingSocialPublishTargets, missingEvidence });
if (advisory === 'accept') return null;
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 67d619096..1b7a8b1e0 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -5539,10 +5539,11 @@ export class Agent extends LoopDetector {
add('plan-publication-evidence-missing', false, caveat);
if (githubFile) add('github-committed-file-verification', false, caveat);
} else if (flags.missingRequiredSubmission && !flags.missingSocialPublishTargets.length) {
- // A deletion is not a "submission" to the user who asked for it.
- const deletions = Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
- && state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete');
- add('plan-submission-evidence-missing', false, deletions
+ // A deletion is not a "submission" to the user who asked for it. The
+ // caller sets missingDeletion only when the run's one dispatched action
+ // was a deletion, so a mixed task with an unverified form submission
+ // keeps the submission wording.
+ add('plan-submission-evidence-missing', false, flags.missingDeletion
? 'I couldn\'t confirm that the deletion took effect.'
: 'I couldn\'t confirm that the submission went through.');
}
@@ -7337,11 +7338,13 @@ export class Agent extends LoopDetector {
const pageUrl = await this._currentUrl(tabId);
if (!current()) return null;
// WebBrain writes this answer, not the model, so it claims only what it
- // checked: the one submission on this page. A request with later steps
- // (another site, more items) did not get them.
+ // checked: the one submission on this page, not that the whole request
+ // is done. It stays a success because the completion check above
+ // established the task's observable requirements; saying here that later
+ // steps were not attempted would contradict that outcome.
const summary = /^https:\/\/addons\.mozilla\.org\//i.test(pageUrl)
? 'The AMO version was submitted for review and the submission confirmation was verified.'
- : 'The model stopped responding after the submission. WebBrain read the page and verified that submission; no later step of the request was attempted.';
+ : 'The model stopped responding after the submission. WebBrain read the page and verified that submission.';
const result = await runReadOnly('done', { outcome: 'success', summary });
if (current() && result?.action === 'return' && !result.status
&& this._completionVerdicts.get(tabId)?.outcome === 'succeeded') {
@@ -37628,10 +37631,17 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// its note once per run, and the next completion is accepted with a
// caveat. The one-nudge budget and run-ending statuses below are the
// strict path.
+ // The unverified action is a deletion only when deletions are all that was
+ // dispatched: an ordinary form submission leaves no resource-mutation
+ // record, but it does leave the current submit receipt.
+ const missingDeletion = missingRequiredSubmission
+ && Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
+ && state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete')
+ && this._currentCompletionSubmitState(tabId)?.dispatched !== true;
const advisory = this._planGuardAdvisory(tabId, state, { viaDone, looksPlanOnly, runtimeModeContradiction,
structuredPlan: structuredPlan
|| (state.allowsPlannerShapedResult !== true && this._isPlannerShapedJson(content)),
- staleCancellation, missingRequiredSchedulingTool, missingRequiredDownload, missingRequiredSubmission,
+ staleCancellation, missingRequiredSchedulingTool, missingRequiredDownload, missingRequiredSubmission, missingDeletion,
forbiddenSubmission, missingJobEvidence, missingDraftEvidence, missingRequiredLedger,
missingSocialPublishTargets, missingEvidence });
if (advisory === 'accept') return null;
diff --git a/test/guard-advisory-completion.mjs b/test/guard-advisory-completion.mjs
index 8cba378cd..d20ef0f58 100644
--- a/test/guard-advisory-completion.mjs
+++ b/test/guard-advisory-completion.mjs
@@ -1024,6 +1024,14 @@ for (const build of ['chrome', 'firefox']) {
guard.resourceMutationDispatches = [{ mutationKind: 'delete', resourceUrl: 'https://mastoturk.org/@owned/1' }];
}), { summary: 'Deleted the post.', outcome: 'success' }, 'I couldn\'t confirm that the deletion took effect.', `${build} deletion`);
+ // With an ordinary form submission also dispatched, the unverified action
+ // may be that submission, so the deletion wording is not used.
+ await refusedOnceThenAccepted(Agent, planCase({ requiresStateChange: true, requiresSubmission: true }, (guard, h) => {
+ guard.successfulConsequentialToolCalls = 2; guard.successfulTaskToolCalls = 2; guard.evidenceTaskKey = guard.taskKey;
+ guard.resourceMutationDispatches = [{ mutationKind: 'delete', resourceUrl: 'https://mastoturk.org/@owned/1' }];
+ h.agent._completionSubmitStates.set(h.tab, { dispatched: true, taskKey: guard.taskKey });
+ }), { summary: 'Deleted the post and sent the form.', outcome: 'success' }, 'I couldn\'t confirm that the submission went through.', `${build} deletion plus form`);
+
await refusedOnceThenAccepted(Agent, planCase({ requiresStateChange: true, requiresSubmission: true }, guard => {
guard.siteWorkflow = { adapterName: 'github', job: { id: 'edit-file-and-commit', template: 'publish', requiresSubmission: true } };
guard.successfulConsequentialToolCalls = 1; guard.successfulTaskToolCalls = 1; guard.evidenceTaskKey = guard.taskKey;
diff --git a/test/post-submit-model-recovery.mjs b/test/post-submit-model-recovery.mjs
index c0e3137d6..38a4e24d6 100644
--- a/test/post-submit-model-recovery.mjs
+++ b/test/post-submit-model-recovery.mjs
@@ -107,7 +107,8 @@ for (const browser of ['chrome', 'firefox']) {
const result = await f.agent._recoverPostActionModelFailure(f.tab, f.messages, f.update, {}, 4);
assert.equal(result.status, 'done');
assert.match(result.content, /stopped responding after the submission/);
- assert.match(result.content, /no later step of the request was attempted/);
+ assert.match(result.content, /verified that submission/);
+ assert.doesNotMatch(result.content, /no later step/, 'a success outcome must not report an unattempted remainder');
assert.doesNotMatch(result.content, /requested submission completed/);
});
test(`${browser}: recovery uses the submitted frame when present`, async () => {