Skip to content

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

Keep 'several deliverables' as its own signal so a plan past eight entries still counts

Claude3ef70561319d
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index d369ddf66..016adb3fc 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -7829,6 +7829,7 @@ export class Agent extends LoopDetector {
// submission must still be the run's latest step. And when the plan names
// several deliverables, one verified submission cannot finish the task.
if (!this._completionSubmissionIsLatestAction(tabId)
+ || this._planExecutionGuards.get(tabId)?.multipleDeliverables === true
|| (this._planExecutionGuards.get(tabId)?.deliverables || []).length > 1) return null;
const binding = this._failureRecoveryBinding(tabId);
const actionSequence = invariant.lastAction.sequence;
@@ -26615,6 +26616,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresSubmission: typeof gate.requiresSubmission === 'boolean' ? gate.requiresSubmission : null,
readScope: gate.readScope || null,
deliverables: gate.deliverables || [],
+ multipleDeliverables: gate.multipleDeliverables === true || (gate.deliverables || []).length > 1,
siteWorkflowUrl: gate.siteWorkflowUrl || '',
messaging: normalizeMessageTarget(gate.messaging),
// Who else the request named besides the open conversation, and that
@@ -27010,6 +27012,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& plan.deliverables.every(value => typeof value === 'string' && value.length <= 1000)
? [...plan.deliverables]
: [],
+ // The list above is dropped past eight entries; whether the plan names
+ // several deliverables is kept regardless.
+ multipleDeliverables: Array.isArray(plan?.deliverables) && plan.deliverables.length > 1,
};
}
@@ -28455,6 +28460,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresSubmission: approvedRequiresSubmission,
readScope: approvedReadScope,
deliverables: this._plannerCompletionGateFields(plan).deliverables,
+ multipleDeliverables: this._plannerCompletionGateFields(plan).multipleDeliverables,
siteWorkflowUrl: tabUrl,
messaging: approvedPlanEdited ? null : plan.messaging,
requestedMessaging: approvedPlanEdited ? null : plan.requested_messaging,
@@ -40083,6 +40089,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& gateOutcome.deliverables.every(value => typeof value === 'string' && value.length <= 1000)
? [...gateOutcome.deliverables]
: [],
+ multipleDeliverables: gateOutcome?.multipleDeliverables === true
+ || (Array.isArray(gateOutcome?.deliverables) && gateOutcome.deliverables.length > 1),
siteWorkflowUrl: String(gateOutcome?.siteWorkflowUrl || ''),
messaging,
messagingConversationScope,
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index b406128ca..3f5dcf2d7 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -7370,6 +7370,7 @@ export class Agent extends LoopDetector {
// submission must still be the run's latest step. And when the plan names
// several deliverables, one verified submission cannot finish the task.
if (!this._completionSubmissionIsLatestAction(tabId)
+ || this._planExecutionGuards.get(tabId)?.multipleDeliverables === true
|| (this._planExecutionGuards.get(tabId)?.deliverables || []).length > 1) return null;
const binding = this._failureRecoveryBinding(tabId);
const actionSequence = invariant.lastAction.sequence;
@@ -23661,6 +23662,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresSubmission: typeof gate.requiresSubmission === 'boolean' ? gate.requiresSubmission : null,
readScope: gate.readScope || null,
deliverables: gate.deliverables || [],
+ multipleDeliverables: gate.multipleDeliverables === true || (gate.deliverables || []).length > 1,
siteWorkflowUrl: gate.siteWorkflowUrl || '',
messaging: normalizeMessageTarget(gate.messaging),
// Who else the request named besides the open conversation, and that
@@ -24056,6 +24058,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& plan.deliverables.every(value => typeof value === 'string' && value.length <= 1000)
? [...plan.deliverables]
: [],
+ // The list above is dropped past eight entries; whether the plan names
+ // several deliverables is kept regardless.
+ multipleDeliverables: Array.isArray(plan?.deliverables) && plan.deliverables.length > 1,
};
}
@@ -25486,6 +25491,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
requiresSubmission: approvedRequiresSubmission,
readScope: approvedReadScope,
deliverables: this._plannerCompletionGateFields(plan).deliverables,
+ multipleDeliverables: this._plannerCompletionGateFields(plan).multipleDeliverables,
siteWorkflowUrl: tabUrl,
messaging: approvedPlanEdited ? null : plan.messaging,
requestedMessaging: approvedPlanEdited ? null : plan.requested_messaging,
@@ -36825,6 +36831,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
&& gateOutcome.deliverables.every(value => typeof value === 'string' && value.length <= 1000)
? [...gateOutcome.deliverables]
: [],
+ multipleDeliverables: gateOutcome?.multipleDeliverables === true
+ || (Array.isArray(gateOutcome?.deliverables) && gateOutcome.deliverables.length > 1),
siteWorkflowUrl: String(gateOutcome?.siteWorkflowUrl || ''),
messaging,
messagingConversationScope,
diff --git a/test/post-submit-model-recovery.mjs b/test/post-submit-model-recovery.mjs
index cb0a7e542..34c6a1b6a 100644
--- a/test/post-submit-model-recovery.mjs
+++ b/test/post-submit-model-recovery.mjs
@@ -151,6 +151,20 @@ for (const browser of ['chrome', 'firefox']) {
assert.equal(offer.retryMode, 'resume');
assert.equal(f.updates.some(x => x.type === 'warning'), false, 'No post-submit inspection notice');
});
+ test(`${browser}: a plan with more than eight deliverables is still several deliverables`, async () => {
+ const f = fixture();
+ const plan = { deliverables: Array.from({ length: 9 }, (_, index) => `Post number ${index + 1}.`) };
+ const gate = f.agent._plannerCompletionGateFields(plan);
+ assert.deepEqual(gate.deliverables, [], 'the list itself is bounded');
+ assert.equal(gate.multipleDeliverables, true);
+ assert.equal(f.agent._plannerCompletionGateFields({ deliverables: ['Post it.'] }).multipleDeliverables, false);
+ f.agent._planExecutionGuards.set(f.tab, { deliverables: gate.deliverables, multipleDeliverables: gate.multipleDeliverables });
+ f.agent._completionSubmitStates.set(f.tab, { dispatched: true, actionSequence: 3,
+ originatingUrl: 'https://mastoturk.org/home', currentUrl: 'https://mastoturk.org/home' });
+ assert.equal(await f.agent._recoverPostActionModelFailure(f.tab, f.messages, f.update, {}, 7), null);
+ assert.deepEqual(f.operations, [], 'one verified submission cannot finish nine');
+ });
+
test(`${browser}: a later self-verifying action does not make the earlier submission the latest step`, async () => {
// The submission left verification debt; scheduling a follow-up then
// succeeded and proved itself. lastAction still names the submission, but