Skip to content

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

Remember an ordinary commit on the guard for the deletion caveat

Claudeaab7a80947e0
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index af02dc0d4..2982b1f19 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -2627,6 +2627,11 @@ export class Agent extends LoopDetector {
};
}
this._completionSubmitStates.set(tabId, state);
+ // A later non-committing form (a GET search) replaces this receipt, so the
+ // guard remembers that something other than a deletion was committed.
+ if (state.dispatched && publicationGuard && state.nonCommitting !== true && state.mutationKind !== 'delete') {
+ publicationGuard.ordinaryCommitDispatched = true;
+ }
if (state.dispatched && publicationGuard?.resourceMutationAuthorization) {
const record = state.actionRecord;
(publicationGuard.resourceMutationDispatches ||= []).push({ key: publicationGuard.resourceMutationAuthorization.key,
@@ -6578,6 +6583,7 @@ export class Agent extends LoopDetector {
socialPublication: structuredClone(previous?.socialPublication || null),
} : null);
guard.resourceMutationDispatches = structuredClone(previous?.resourceMutationDispatches || []);
+ guard.ordinaryCommitDispatched = previous?.ordinaryCommitDispatched === true;
if (priorSubmission || attemptedPublication) guard.evidenceTaskKey = guard.taskKey;
guard.socialPublicationSteering = previous?.socialPublicationSteering || null;
guard.socialPublicationClarifications = previous?.socialPublicationClarifications || [];
@@ -40012,6 +40018,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
steeringPriorContext: carryMatches ? structuredClone(carried.steeringPriorContext || null) : null,
steeringPriorSubmissionReconciliation: carryMatches ? structuredClone(carried.steeringPriorSubmissionReconciliation || null) : null,
resourceMutationDispatches: carryMatches ? structuredClone(carried.resourceMutationDispatches || []) : [],
+ ordinaryCommitDispatched: carryMatches && carried.ordinaryCommitDispatched === true,
// The user's answers on WebBrain's deletion card hold for the same task.
deletionDecisions: carryMatches && Array.isArray(carried.deletionDecisions)
? structuredClone(carried.deletionDecisions.slice(-32)) : [],
@@ -40559,6 +40566,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
steeringPriorContext: structuredClone(guard.steeringPriorContext || null),
steeringPriorSubmissionReconciliation: structuredClone(guard.steeringPriorSubmissionReconciliation || null),
resourceMutationDispatches: structuredClone(guard.resourceMutationDispatches || []),
+ ordinaryCommitDispatched: guard.ordinaryCommitDispatched === true,
deletionDecisions: structuredClone((guard.deletionDecisions || []).slice(-32)),
unverifiedStepDecisions: structuredClone(this._carriedUnverifiedStepDecisions(guard)),
socialPublication: guard.socialPublication ? structuredClone(guard.socialPublication) : null,
@@ -40899,6 +40907,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const missingDeletion = missingRequiredSubmission
&& Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
&& state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete')
+ && state.ordinaryCommitDispatched !== true
&& (currentReceipt?.dispatched !== true || currentReceipt.mutationKind === 'delete' || currentReceipt.nonCommitting === true);
const advisory = this._planGuardAdvisory(tabId, state, { viaDone, looksPlanOnly, runtimeModeContradiction,
structuredPlan: structuredPlan
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index d1d1bc5b3..5f4586dc8 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -2184,6 +2184,11 @@ export class Agent extends LoopDetector {
};
}
this._completionSubmitStates.set(tabId, state);
+ // A later non-committing form (a GET search) replaces this receipt, so the
+ // guard remembers that something other than a deletion was committed.
+ if (state.dispatched && publicationGuard && state.nonCommitting !== true && state.mutationKind !== 'delete') {
+ publicationGuard.ordinaryCommitDispatched = true;
+ }
if (state.dispatched && publicationGuard?.resourceMutationAuthorization) {
const record = state.actionRecord;
(publicationGuard.resourceMutationDispatches ||= []).push({ key: publicationGuard.resourceMutationAuthorization.key,
@@ -6119,6 +6124,7 @@ export class Agent extends LoopDetector {
socialPublication: structuredClone(previous?.socialPublication || null),
} : null);
guard.resourceMutationDispatches = structuredClone(previous?.resourceMutationDispatches || []);
+ guard.ordinaryCommitDispatched = previous?.ordinaryCommitDispatched === true;
if (priorSubmission || attemptedPublication) guard.evidenceTaskKey = guard.taskKey;
guard.socialPublicationSteering = previous?.socialPublicationSteering || null;
guard.socialPublicationClarifications = previous?.socialPublicationClarifications || [];
@@ -36755,6 +36761,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
steeringPriorContext: carryMatches ? structuredClone(carried.steeringPriorContext || null) : null,
steeringPriorSubmissionReconciliation: carryMatches ? structuredClone(carried.steeringPriorSubmissionReconciliation || null) : null,
resourceMutationDispatches: carryMatches ? structuredClone(carried.resourceMutationDispatches || []) : [],
+ ordinaryCommitDispatched: carryMatches && carried.ordinaryCommitDispatched === true,
// The user's answers on WebBrain's deletion card hold for the same task.
deletionDecisions: carryMatches && Array.isArray(carried.deletionDecisions)
? structuredClone(carried.deletionDecisions.slice(-32)) : [],
@@ -37302,6 +37309,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
steeringPriorContext: structuredClone(guard.steeringPriorContext || null),
steeringPriorSubmissionReconciliation: structuredClone(guard.steeringPriorSubmissionReconciliation || null),
resourceMutationDispatches: structuredClone(guard.resourceMutationDispatches || []),
+ ordinaryCommitDispatched: guard.ordinaryCommitDispatched === true,
deletionDecisions: structuredClone((guard.deletionDecisions || []).slice(-32)),
unverifiedStepDecisions: structuredClone(this._carriedUnverifiedStepDecisions(guard)),
socialPublication: guard.socialPublication ? structuredClone(guard.socialPublication) : null,
@@ -37642,6 +37650,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const missingDeletion = missingRequiredSubmission
&& Array.isArray(state.resourceMutationDispatches) && state.resourceMutationDispatches.length > 0
&& state.resourceMutationDispatches.every(attempt => attempt?.mutationKind === 'delete')
+ && state.ordinaryCommitDispatched !== true
&& (currentReceipt?.dispatched !== true || currentReceipt.mutationKind === 'delete' || currentReceipt.nonCommitting === true);
const advisory = this._planGuardAdvisory(tabId, state, { viaDone, looksPlanOnly, runtimeModeContradiction,
structuredPlan: structuredPlan
diff --git a/test/guard-advisory-completion.mjs b/test/guard-advisory-completion.mjs
index 83a626997..54565f899 100644
--- a/test/guard-advisory-completion.mjs
+++ b/test/guard-advisory-completion.mjs
@@ -1034,6 +1034,15 @@ for (const build of ['chrome', 'firefox']) {
h.agent._completionSubmitStates.set(h.tab, { dispatched: true, nonCommitting: true, mutationKind: 'submit', actionSequence: 4, taskKey: guard.taskKey });
}), { summary: 'Deleted the post.', outcome: 'success' }, 'I couldn\'t confirm that the deletion took effect.', `${build} deletion then search`);
+ // Deletion, then an ordinary form submission, then a GET search that overwrites its receipt:
+ // the form submission is still the unverified mutation.
+ 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', actionSequence: 3 }];
+ guard.ordinaryCommitDispatched = true;
+ h.agent._completionSubmitStates.set(h.tab, { dispatched: true, nonCommitting: true, mutationKind: 'submit', actionSequence: 5, taskKey: guard.taskKey });
+ }), { summary: 'Deleted the post and sent the form.', outcome: 'success' }, 'I couldn\'t confirm that the submission went through.', `${build} deletion, form, then search`);
+
// 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) => {