Enhance planner recovery actions and trace configuration - #2620
Merged
Conversation
…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>
|
@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. |
Contributor
There was a problem hiding this comment.
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_itemsas 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 explicitwebbrainLocalStatusmarker 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_itemsas 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 explicitwebbrainLocalStatusmarker 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.