Repository navigation
fix(ui): keep stopped historical browser panels on Start - #139089
Conversation
…he historical tab's browser is stopped Opening a session with old browser results makes the browser panel follow the latest historical tab. After the tab listing already reported the browser as stopped, the panel still sent a focus request, which the gateway rejects, so every session open rendered a red "Browser request failed" note above the Start browser state. The controller now stops after a route refresh reports running=false and leaves the existing Start affordance. Follow-up to openclaw#139064, which stopped the gateway from launching a browser for historical targets; the UI symptom remained. Related: openclaw#138999
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 10:45 AM ET / 14:45 UTC. ClawSweeper reviewWhat this changesThe Browser panel leaves historical tabs unselected while checking their status or when their browser is stopped, with regression coverage and recovery documentation. Merge readiness✅ Ready for maintainer review This remains a useful follow-up: current main still selects stopped historical targets, and the related merged repair does not resolve the panel error. No introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI Browser panel follows browser results from conversation history and requests current tab information through the Gateway. Its selection state controls focus, screenshots, Reload, and the Start browser display. flowchart TD
A[Historical browser result] --> B[Panel selection]
B --> C[Gateway tab snapshot]
C --> D{Browser running?}
D -->|No| E[Start browser display]
D -->|Yes| F[Resolve tab and capture preview]
E -->|User clicks Start| G[Launch and refresh current tabs]
G --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +61, Docs +8. Total +69 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep selection ownership in the panel controller, using the existing empty-selection and explicit Start paths without adding another startup policy. Do we have a high-confidence way to reproduce the issue? Yes: opening historical browser results with the browser stopped reaches an invalid focus request on current main. Source inspection and the supplied real Linux baseline agree; this review did not execute the scenario. Is this the best way to solve the issue? Yes. Repairing selection before focus also fixes Reload through its existing state dependency; hiding the error or changing Gateway startup policy would leave the panel's invalid selection intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2f5f5de32db3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Re the two "before merge" items: the linked captures were inspected before upload. |
|
Verified the full Browser-panel flow on
The guarded merge remains pending because the unrelated-failure exception needs matching main-run evidence or explicit approval for the completed run. The passing review and product proof are retained. The body records the separate running-tab capture-cancellation follow-up. No claim is made that this stopped-state repair fixes it. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The failed CI test is independent of this Browser repair. Reproduction without this PR: ran the exact recorded 17-file isolated shard on untouched parent Blame and introduction:
The distinction matters: #138910 added the timing-sensitive test; #138059 changed its execution context and exposed the assumption. This does not identify a Browser or subagent production regression. Vitest's actual default wait is 1,000 ms. Diagnostic-only copies retained that assertion and observed successful task settlement after about 7.2 seconds in the first case, versus roughly 0.3 seconds in the next. Preloading the announcement module alone did not eliminate the delay, so no narrower import-only cause is claimed. Candidate failure: run 33970832010, job 101319169150. All other CI jobs passed. The Browser product proof and independent review remain green and unchanged. No unrelated source was edited or committed. |
|
landpr-approve-unrelated-red |
|
Thanks @ylcn91! Landed as d3386f1 from verified source 2f045f3, preserving contributor credit.
|
…9089) Keep historical browser selections empty until the current tab snapshot confirms a running browser. Reuse the existing no-target path to avoid focus and capture requests while stopped, keep Reload disabled, and preserve explicit Start. Retain historical card metadata and running-tab focus/capture behavior. Add regression coverage for stopped selection, a pending routed refresh, and Start recovery. Clarify browser recovery documentation. Follow-up to openclaw#139064 and related to openclaw#138999. Includes the original contribution from @ylcn91. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #134400, #139089 ## What Problem This Solves The Browser panel followed session results through the explicit tab-selection path. That sent `/tabs/focus` and activated the result tab in an attached browser, even when the operator had left another tab active. ## Why This Change Was Made Passive following now skips explicit focus while retaining the shared route, capture, lifecycle, and rollback owners. Card Open and selection of a different panel tab still focus normally. Clicking an already-selected panel tab retains its existing no-op. The selection owner also rejects a historical target absent from its accepted current tab list before capture. This preserves the validation previously supplied by the focus request, restores a valid prior view when safe, and prevents a missing target from entering repeated stream/screenshot recovery. The error directs the operator to select another tab. ## User Impact Successful Browser results can update the panel without changing the operator's physical browser tab. The merged capture-owner repair in #134400 remains in place. Current streaming, screenshot fallback, attach-only policy, native and remote routes, configuration, protocol, and Browser-card semantics are preserved. ## Evidence - A public Control UI agent turn through the real Browser tool reproduced one passive focus request and physical tab activation on pinned main. With the same rendered-tab precondition, the final candidate produced no focus request and preserved the sentinel tab while refreshing the result view. - Fresh source-blind acceptance also exercised the full selection change: the panel and physical browser initially selected Sentinel; a public Browser evaluation of the other Result page changed the panel to Result, displayed newly changed content through routed screenshot/stream capture, and left Sentinel physically active. Explicit Open and different-tab selection each focused once; later results added no focus. Context changes, unavailable history, and recovery were exercised. - The passive-focus regression failed on main. Two additional missing-history cases failed on the initial candidate for invalid selection, lost rollback, and repeated capture. The corrected candidate passed 138 focused tests across selection, routes, input, pending navigation, snapshot races, streaming, and native boundaries. Formatting and keyless language checks passed. - [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/34328435157) passed, including all four cases in the changed [Browser route E2E suite](https://github.com/openclaw/openclaw/actions/runs/34328435157/job/102391432114). The native supplemental E2E attempt hit its 4 GiB limit; that failure was retained and the hosted lane supplied the completed check without raising the native limit. A background Browser-tool screenshot timed out in a separate acceptance attempt. It remains failed evidence, not a passing capture or a claim of general screenshot reliability. The successful evaluation case above verifies the combined background-target selection and fresh-view outcome. Native macOS and remote-node behavior have source/component coverage; no live native-app or remote-node proof is claimed. Raw captures remain private. Thanks @scotthuang for the original passive-focus correction. Contributor ancestry and prior review history are preserved. Co-authored-by: scotthuang <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: openclaw#134400, openclaw#139089 ## What Problem This Solves The Browser panel followed session results through the explicit tab-selection path. That sent `/tabs/focus` and activated the result tab in an attached browser, even when the operator had left another tab active. ## Why This Change Was Made Passive following now skips explicit focus while retaining the shared route, capture, lifecycle, and rollback owners. Card Open and selection of a different panel tab still focus normally. Clicking an already-selected panel tab retains its existing no-op. The selection owner also rejects a historical target absent from its accepted current tab list before capture. This preserves the validation previously supplied by the focus request, restores a valid prior view when safe, and prevents a missing target from entering repeated stream/screenshot recovery. The error directs the operator to select another tab. ## User Impact Successful Browser results can update the panel without changing the operator's physical browser tab. The merged capture-owner repair in openclaw#134400 remains in place. Current streaming, screenshot fallback, attach-only policy, native and remote routes, configuration, protocol, and Browser-card semantics are preserved. ## Evidence - A public Control UI agent turn through the real Browser tool reproduced one passive focus request and physical tab activation on pinned main. With the same rendered-tab precondition, the final candidate produced no focus request and preserved the sentinel tab while refreshing the result view. - Fresh source-blind acceptance also exercised the full selection change: the panel and physical browser initially selected Sentinel; a public Browser evaluation of the other Result page changed the panel to Result, displayed newly changed content through routed screenshot/stream capture, and left Sentinel physically active. Explicit Open and different-tab selection each focused once; later results added no focus. Context changes, unavailable history, and recovery were exercised. - The passive-focus regression failed on main. Two additional missing-history cases failed on the initial candidate for invalid selection, lost rollback, and repeated capture. The corrected candidate passed 138 focused tests across selection, routes, input, pending navigation, snapshot races, streaming, and native boundaries. Formatting and keyless language checks passed. - [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/34328435157) passed, including all four cases in the changed [Browser route E2E suite](https://github.com/openclaw/openclaw/actions/runs/34328435157/job/102391432114). The native supplemental E2E attempt hit its 4 GiB limit; that failure was retained and the hosted lane supplied the completed check without raising the native limit. A background Browser-tool screenshot timed out in a separate acceptance attempt. It remains failed evidence, not a passing capture or a claim of general screenshot reliability. The successful evaluation case above verifies the combined background-target selection and fresh-view outcome. Native macOS and remote-node behavior have source/component coverage; no live native-app or remote-node proof is claimed. Raw captures remain private. Thanks @scotthuang for the original passive-focus correction. Contributor ancestry and prior review history are preserved. Co-authored-by: scotthuang <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #138999. Follow-up to #139064. The running-browser passive-focus change in #134480 remains separate.
What Problem This Solves
Opening historical browser results while the managed browser is stopped showed
Browser request failed: browser not runningabove Start browser. The panel tried to focus an old target after/tabshad already reportedrunning: false.Why This Change Was Made
The selection owner now keeps routed targets unselected until the tab snapshot arrives, and leaves no selected target when the browser is stopped. The existing no-target path skips focus and capture, and Reload stays disabled. The existing Start action launches the browser and refreshes its current tabs.
This also covers selecting the same historical card while its next tab snapshot is pending. Historical title/URL remain visible. No configuration, storage, protocol, or plugin SDK change.
User Impact
Stopped historical sessions show the normal Start browser state without a red error. Explicit Start and valid running-tab focus, screenshots, and thumbnails still work.
Evidence
Real Linux Control UI, Gateway, and managed Chromium; no mocked Gateway or browser responses. A transparent observer recorded browser request/response traffic.
a4514a0aff9de7bd299f70d821398df606df1a4f./tabsreturned stopped, followed by failed/tabs/focusand the visible red note.2f045f307099833ebc5b843f5ca29a7e837c19f1. Stopped history and repeated card selection sent no focus/capture after the stopped snapshot. Reload stayed disabled, including during the pending snapshot.Additional inspected captures: explicit Start, running tab and thumbnail, fresh-client reconnect.
Validation:
node scripts/run-vitest.mjs ui/src/components/browser ui/src/lib/chat/browser-tab-preview.test.ts ui/src/pages/chat/components/browser-tab-card.test.ts— 127 tests passed; the final test-only cleanup reran all 13 route tests.git diff --check, and the combinedpnpm build ciArtifactspassed.Production +4/-4 (net 0); tests +61; docs +8. Contributor intent and ancestry retained.
Proof scope: real managed-browser flow on Linux; host/node route siblings have deterministic test coverage. A separate running-tab capture-cancellation timeout occurred during overlapping refresh/stale-card testing; its capture path is unchanged here and is retained as a follow-up, not claimed fixed by this PR.