Skip to content

Enhance planner recovery actions and trace configuration - #2620

Merged
webbrain-one merged 8 commits into
webbrain-one:mainfrom
esokullu:main
Jul 29, 2026
Merged

Enhance planner recovery actions and trace configuration#2620
webbrain-one merged 8 commits into
webbrain-one:mainfrom
esokullu:main

Conversation

@webbrain-one

Copy link
Copy Markdown
Owner

No description provided.

esokullu and others added 8 commits July 28, 2026 13:18
…context

Fix planner intent recovery and cancellation context
Add recovery actions for planner provider failures
Add safe runtime settings to trace metadata
The recovery card's whole job is deciding whether a failure is fixed by
opening Providers or by retrying, and the first classifier got the two
most common browser cases backwards: Chrome's "Failed to fetch" and
Firefox's "NetworkError…" — what a stopped local provider looks like from
inside the extension — both fell through to `provider`, while a bare scan
for 5xx-shaped digits read "max_tokens 512" as a server error and led
with a Retry that could only fail the same way.

Status codes are now only trusted where they read as a status, textual
auth rejections ("Unauthorized", "invalid_api_key") are recognized
without a code, and a remaining 4xx stays `provider` because retrying an
argument the provider rejected is not the fix.

Also: carry `failureKind` through the planner gate wrapper, which was
dropping it before any caller could read it; name the failing provider in
the card, since "open Providers" is only actionable when the user knows
which one to look at; and end the detail sentence before appending "No
tools ran."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three loose ends around the recovery card: `addErrorRetryButton` only
looked for the error and cost-allowance classes, so a message that also
took an error update could grow a second Retry affordance next to the
card's own; the reconnect path recomputed a fallback that its own
`assistantEl` already applied; and the card said nothing to a screen
reader. The role goes on the emptied container before its content, since
readers announce insertions into a live region rather than a region that
shows up already populated — which also keeps a restored card silent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 29, 2026 14:09
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@esokullu is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@webbrain-one
webbrain-one merged commit e3c729a into webbrain-one:main Jul 29, 2026
1 of 2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enhances planner recovery, cancellation handling, failure UX, and runtime trace metadata across Chrome and Firefox.

Changes:

  • Adds planner intent consistency checks and stale-cancellation recovery.
  • Records allowlisted runtime configuration in local and Cloud traces.
  • Adds categorized planner-failure cards with retry/provider actions.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test/run.js Adds cross-browser coverage for new behavior.
src/chrome/src/agent/agent.js Implements recovery, failure classification, and trace metadata.
src/firefox/src/agent/agent.js Mirrors Chrome agent changes.
src/chrome/src/agent/planner.js Clarifies tool-dependent intent routing.
src/firefox/src/agent/planner.js Mirrors planner prompt changes.
src/chrome/src/background.js Marks planner request failures as failed runs.
src/firefox/src/background.js Mirrors run-status handling.
src/chrome/src/providers/openai.js Adds runtime configuration to Cloud trace context.
src/firefox/src/providers/openai.js Mirrors Cloud trace context changes.
src/chrome/src/trace/runtime-config.js Adds runtime metadata normalization.
src/firefox/src/trace/runtime-config.js Mirrors runtime metadata normalization.
src/chrome/src/trace/recorder.js Persists normalized runtime configuration.
src/firefox/src/trace/recorder.js Mirrors trace persistence changes.
src/chrome/src/ui/sidepanel.js Renders actionable planner failure cards.
src/firefox/src/ui/sidepanel.js Mirrors failure-card behavior.
src/chrome/styles/sidepanel.css Styles planner failure cards.
src/firefox/styles/sidepanel.css Mirrors failure-card styling.
Comments suppressed due to low confidence (2)

src/chrome/src/agent/agent.js:6873

  • The text fallback also classifies assistant messages that carry tool_calls/response_items as local UI status. Models may legally return content plus tool calls; if that content is this phrase, the next request drops the assistant tool-call message but retains its tool results, leaving an invalid/orphaned tool sequence. Limit legacy text detection to plain messages without provider protocol metadata; the explicit webbrainLocalStatus marker remains sufficient for new local cancellations.
  _isLocalConversationStatusMessage(message) {
    if (message?.role !== 'assistant') return false;
    return message.webbrainLocalStatus === 'cancelled'
      || this._isLocalCancellationText(message.content);

src/firefox/src/agent/agent.js:5816

  • The text fallback also classifies assistant messages that carry tool_calls/response_items as local UI status. Models may legally return content plus tool calls; if that content is this phrase, the next request drops the assistant tool-call message but retains its tool results, leaving an invalid/orphaned tool sequence. Limit legacy text detection to plain messages without provider protocol metadata; the explicit webbrainLocalStatus marker remains sufficient for new local cancellations.
  _isLocalConversationStatusMessage(message) {
    if (message?.role !== 'assistant') return false;
    return message.webbrainLocalStatus === 'cancelled'
      || this._isLocalCancellationText(message.content);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}
if (status === 401 || status === 403) return 'auth';
if ([408, 425, 429].includes(status) || (status >= 500 && status <= 599)) return 'transient';
}
}
if (status === 401 || status === 403) return 'auth';
if ([408, 425, 429].includes(status) || (status >= 500 && status <= 599)) return 'transient';
Comment on lines +5127 to +5129
const orderedActions = data.failureKind === 'auth'
? [providerBtn, retryReady ? retryBtn : null]
: [retryReady ? retryBtn : null, providerBtn];
Comment on lines +5290 to +5292
const orderedActions = data.failureKind === 'auth'
? [providerBtn, retryReady ? retryBtn : null]
: [retryReady ? retryBtn : null, providerBtn];
Comment on lines +26 to +29
function safeVersion(value) {
const version = String(value || '').trim();
return /^[0-9A-Za-z][0-9A-Za-z.+_-]{0,63}$/.test(version) ? version : '';
}
Comment on lines +26 to +29
function safeVersion(value) {
const version = String(value || '').trim();
return /^[0-9A-Za-z][0-9A-Za-z.+_-]{0,63}$/.test(version) ? version : '';
}
user_memory_enabled: this.userMemoryEnabled === true,
selection_grounded: tabId != null && this.selectionGroundingScopes.has(tabId),
image_detail: this.imageDetail,
max_agent_steps: this.maxSteps,
user_memory_enabled: this.userMemoryEnabled === true,
selection_grounded: tabId != null && this.selectionGroundingScopes.has(tabId),
image_detail: this.imageDetail,
max_agent_steps: this.maxSteps,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants