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(sidepanel): fail closed at nested URL depth and mark aborted terminal steps as failed
Emre Sokullu7b47e27e6f1a
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.jsindex b8c10210d..e95810309 100644--- a/src/chrome/src/ui/sidepanel.js+++ b/src/chrome/src/ui/sidepanel.js@@ -2997,7 +2997,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confi// values, and nested redirect URLs) before a URL is shown in the always-visible// step label. The full value stays behind the expandable details panel.function redactUrlForLabel(url, depth = 0) {- if (depth > 3) return String(url || '');+ if (depth > 3) return '…';return String(url || '').replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1').replace(SENSITIVE_PATH_SEGMENT_RE, '$1…')@@ -11090,12 +11090,18 @@ function markLastStepFailed() {function finalizeSteps(assistantEl = currentAssistantEl) {if (!assistantEl) return;+ const isAborted = isTabAbortRequested(currentTabId);const actives = assistantEl.querySelectorAll('.step-item.active');actives.forEach(step => {step.classList.remove('active');step.classList.add('done');+ const isTerminal = isTerminalDoneTool(step.dataset?.tool);+ const failed = isAborted || isTerminal;const icon = step.querySelector('.step-icon');- if (icon) { icon.className = 'step-icon check'; icon.textContent = '\u2713'; }+ if (icon) {+ icon.className = failed ? 'step-icon fail' : 'step-icon check';+ icon.textContent = failed ? '\u2717' : '\u2713';+ }restoreStepFriendlyLabel(step);});}diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.jsindex 014d902f2..e8ffdadf6 100644--- a/src/firefox/src/ui/sidepanel.js+++ b/src/firefox/src/ui/sidepanel.js@@ -2858,7 +2858,7 @@ const SENSITIVE_PATH_SEGMENT_RE = /(\/(?:reset|verify|verification|confirm|confi// values, and nested redirect URLs) before a URL is shown in the always-visible// step label. The full value stays behind the expandable details panel.function redactUrlForLabel(url, depth = 0) {- if (depth > 3) return String(url || '');+ if (depth > 3) return '…';return String(url || '').replace(/^((?:[a-z][a-z0-9+.-]*:)?\/\/)(?:[^/?#\s]*@)+/i, '$1').replace(SENSITIVE_PATH_SEGMENT_RE, '$1…')@@ -10700,12 +10700,18 @@ function markLastStepFailed() {function finalizeSteps(assistantEl = currentAssistantEl) {if (!assistantEl) return;+ const isAborted = isTabAbortRequested(currentTabId);const actives = assistantEl.querySelectorAll('.step-item.active');actives.forEach(step => {step.classList.remove('active');step.classList.add('done');+ const isTerminal = isTerminalDoneTool(step.dataset?.tool);+ const failed = isAborted || isTerminal;const icon = step.querySelector('.step-icon');- if (icon) { icon.className = 'step-icon check'; icon.textContent = '\u2713'; }+ if (icon) {+ icon.className = failed ? 'step-icon fail' : 'step-icon check';+ icon.textContent = failed ? '\u2717' : '\u2713';+ }restoreStepFriendlyLabel(step);});}diff --git a/test/run.js b/test/run.jsindex 86b561791..7bbee334e 100644--- a/test/run.js+++ b/test/run.js@@ -45072,12 +45072,14 @@ test('sidepanel friendlyToolLabel localizes get_accessibility_tree and actions aassert.match(panel, /signature\|sig/, `${label}: URL credential redaction must cover signatures`);assert.match(panel, /authorization\|code/, `${label}: URL credential redaction must cover auth code`);assert.match(panel, /ticket\|jwt\|bearer\|credential/, `${label}: URL credential redaction must cover tickets, tokens, and credentials`);+ assert.match(panel, /if \(depth > 3\) return '…';/, `${label}: URL credential redaction must fail closed at depth limit`);assert.match(panel, /redactUrlForLabel\(args\.url\)/, `${label}: fetch/research labels must redact URL credentials`);assert.match(panel, /redactUrlForLabel\(decodedVal, depth \+ 1\)/, `${label}: URL credential redaction must redact nested URLs`);assert.match(panel, /const LABEL_ARG_KEYS =/, `${label}: step metadata must filter arguments to label-relevant keys`);assert.match(panel, /function isTerminalDoneTool\(name\)/, `${label}: done_json must share terminal completion handling`);assert.match(panel, /function restoreStepFriendlyLabel\(step\)/, `${label}: completed/failed steps must restore friendly label and clear progress marker`);assert.match(panel, /failed \? 'sp\.tool\.done\.failed' : 'sp\.tool\.done\.completed'/, `${label}: restoreStepFriendlyLabel must set terminal failure outcome for interrupted done steps`);+ assert.match(panel, /const failed = isAborted \|\| isTerminal;/, `${label}: finalizeSteps must mark aborted terminal steps as failed`);assert.match(panel, /label\.textContent = friendlyToolLabel\(step\.dataset\.tool, stepArgs\);/, `${label}: completed steps must restore the friendly label after progress`);}});