Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
Treat a redacted decision input as partial for plan skipping
Emre Sokullu81debb5f9f5a
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 9ec6cb25d..51ccdcae0 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -9265,10 +9265,11 @@ export class Agent extends LoopDetector {try {const settings = await this._jevSettings(tabId, provider);decisionKey = this._semanticDecisionKey(settings);- const decisionText = redactSystemOneText(JSON.stringify({ request: trusted, page: data }));- // What the decision model reads: the input above, then cut to the- // decision state's budget below.- const partialInput = !inputComplete || systemOneStateBytes(decisionText) > 12000;+ const plainText = JSON.stringify({ request: trusted, page: data });+ const decisionText = redactSystemOneText(plainText);+ // What the decision model reads: the input above, with credential lines+ // and URL queries redacted, then cut to the decision state's budget.+ const partialInput = !inputComplete || decisionText !== plainText || systemOneStateBytes(decisionText) > 12000;// Keep the existing bounded fast route, but use the full-text main// model directly when a relationship question cannot fit in it.const decisionFits = kind !== 'user_turn_kind' || systemOneStateBytes(decisionText) <= 12000;diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 61402a2a4..5a6d26312 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -8974,10 +8974,11 @@ export class Agent extends LoopDetector {try {const settings = await this._jevSettings(tabId, provider);decisionKey = this._semanticDecisionKey(settings);- const decisionText = redactSystemOneText(JSON.stringify({ request: trusted, page: data }));- // What the decision model reads: the input above, then cut to the- // decision state's budget below.- const partialInput = !inputComplete || systemOneStateBytes(decisionText) > 12000;+ const plainText = JSON.stringify({ request: trusted, page: data });+ const decisionText = redactSystemOneText(plainText);+ // What the decision model reads: the input above, with credential lines+ // and URL queries redacted, then cut to the decision state's budget.+ const partialInput = !inputComplete || decisionText !== plainText || systemOneStateBytes(decisionText) > 12000;// Keep the existing bounded fast route, but use the full-text main// model directly when a relationship question cannot fit in it.const decisionFits = kind !== 'user_turn_kind' || systemOneStateBytes(decisionText) <= 12000;diff --git a/test/plan-when-needed.mjs b/test/plan-when-needed.mjsindex 242a2ca92..c004ba2d0 100644--- a/test/plan-when-needed.mjs+++ b/test/plan-when-needed.mjs@@ -126,6 +126,17 @@ for (const build of BUILDS) {assert.equal('plan' in await wide.agent._routeAutoRunMode(6, { ...question, request: 'あ'.repeat(4500) }), false);});+ test(`${build}: a request the decision model reads redacted never skips the planner`, async () => {+ // Credential lines reach the decision model as "[credential omitted]", and+ // URLs without their query: it judged something other than the request.+ for (const request of ['Log in with the password Hunter-2 and open my orders.', 'Open https://shop.example/pay?amount=900&to=other.']) {+ const { agent } = decisionAgent({ run_mode: sure('act'), plan_need: sure('direct') });+ assert.equal('plan' in await agent._routeAutoRunMode(9, { ...question, request }), false, request);+ }+ const plain = decisionAgent({ run_mode: sure('act'), plan_need: sure('direct') });+ assert.equal((await plain.agent._routeAutoRunMode(9, { ...question, request: 'Open https://shop.example/orders.' })).plan, 'direct');+ });+test(`${build}: an earlier task cut to fit the decision data never skips the planner`, async () => {// A short follow-up leans on the earlier task, which the data keeps to 600 characters.const start = 'Read the next row and note its owner. '.repeat(20).slice(0, 600);