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
fix: keep timed-out sensitive choices unconfirmed
Emre Sokullu91c6dcf18791
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 9a2c2994b..4be56520e 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -23541,7 +23541,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaiguard.pendingRecipientAuthorization = false;guard.observedRecipientCandidates = null;if (!pending || !pendingType || observed.length === 0) return false;- if (!answer || (source === 'timeout' && !clarifyContext?.safeFirst) || source === 'auto') return false;+ if (!answer || source === 'timeout' || source === 'auto') return false;if (pendingType === 'recipient_change') {if (!clarifyContext || !this._isRecipientClarification(clarifyContext, 'recipient_change', observed)) {return false;@@ -33857,7 +33857,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaiconst options = Array.isArray(args?.options)? args.options.map(s => String(s).slice(0, 200)).filter(Boolean).slice(0, 4): [];- const safeFirst = args?.safe_first === true;+ const safeFirst = args?.safe_first === true && options.length > 0;const reason = args?.reason ? String(args.reason).slice(0, 300) : null;const purpose = args?.purpose === 'research_escalation'? 'research_escalation'@@ -33982,7 +33982,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaithis._bindClarifiedMessageRecipient(tabId, answer, source, { question, options, reason, purpose, safeFirst: entrySafeFirst });this._recordSocialPublicationClarification(tabId, clarificationGuard, question, answer, source);const explicitResearchApproval = isResearchEscalation- && (source !== 'timeout' || entrySafeFirst)+ && source !== 'timeout'&& source !== 'auto'&& answer === approveOption;const authorizationToken = explicitResearchApprovaldiff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 9c1721470..2062498a6 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -21254,7 +21254,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dguard.pendingRecipientAuthorization = false;guard.observedRecipientCandidates = null;if (!pending || !pendingType || observed.length === 0) return false;- if (!answer || (source === 'timeout' && !clarifyContext?.safeFirst) || source === 'auto') return false;+ if (!answer || source === 'timeout' || source === 'auto') return false;if (pendingType === 'recipient_change') {if (!clarifyContext || !this._isRecipientClarification(clarifyContext, 'recipient_change', observed)) {return false;@@ -30566,7 +30566,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dconst options = Array.isArray(args?.options)? args.options.map(s => String(s).slice(0, 200)).filter(Boolean).slice(0, 4): [];- const safeFirst = args?.safe_first === true;+ const safeFirst = args?.safe_first === true && options.length > 0;const reason = args?.reason ? String(args.reason).slice(0, 300) : null;const purpose = args?.purpose === 'research_escalation'? 'research_escalation'@@ -30691,7 +30691,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dthis._bindClarifiedMessageRecipient(tabId, answer, source, { question, options, reason, purpose, safeFirst: entrySafeFirst });this._recordSocialPublicationClarification(tabId, clarificationGuard, question, answer, source);const explicitResearchApproval = isResearchEscalation- && (source !== 'timeout' || entrySafeFirst)+ && source !== 'timeout'&& source !== 'auto'&& answer === approveOption;const authorizationToken = explicitResearchApprovaldiff --git a/test/run.js b/test/run.jsindex 1532a06fc..39892166d 100644--- a/test/run.js+++ b/test/run.js@@ -48799,6 +48799,16 @@ test('clarify result distinguishes waited timeout from user and Instant authorizassert.equal(unsafeTimeout.authorized, false, `${AgentClass.name}: timed-out destructive Yes without safe_first was accepted`);assert.equal(agent._clarificationAuthorizationGuards.get(tabId)?.authorized, false, `${AgentClass.name}: unsafe timeout left no guard armed`);+ const emptyOptionsTimeout = await agent.executeTool(+ tabId,+ 'clarify',+ { question: 'Continue?', safe_first: true },+ (type, data) => {+ if (type === 'clarify') agent.submitClarifyResponse(tabId, data.clarifyId, '(no response - timed out)', 'timeout');+ },+ );+ assert.equal(emptyOptionsTimeout.authorized, false, `${AgentClass.name}: safe_first without options was accepted`);+const userReply = await agent.executeTool(tabId,'clarify',