Skip to content

fix(browser): keep inspection state independent of error wording - #128625

Merged
vyctorbrzezowski merged 4 commits into
mainfrom
brzezowski/facts-error-codes
Aug 27, 2026
Merged

vyctorbrzezowski merged 4 commits into
mainfrom
brzezowski/facts-error-codes

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Closes #128624

What Problem This Solves

Fixes an issue where operators using the Control UI Browser panel could get the wrong inspection availability state when Browser error wording changed or the Browser request was routed through a node. The Browser route already emitted ACT_EVALUATE_DISABLED, but intermediate Browser boundaries dropped that fact and the UI matched human-readable prose instead.

Why This Change Was Made

The Browser plugin now owns one closed ACT_* code set and preserves validated codes through direct HTTP and node-proxy error envelopes. Gateway browser.request already carries the route body in additive error details, so the Control UI can consume details.code without a Gateway protocol field change or version bump.

Unknown metadata remains discarded at both Browser boundaries. The patch does not remove shipped Gateway text fallbacks: PRs #111013 and #120505 deliberately retained compatibility with older string-only gateways. Unknown-method and audit-cursor cases also remain unchanged because they still require new additive Gateway detail codes.

Blast radius checked:

  • Producer: Browser /act route and all six stable ACT_* codes.
  • Local transport: Browser HTTP client and BrowserServiceError.
  • Remote transport: node-host Browser proxy sanitization, Gateway browser.request, and GatewayRequestError.details.
  • Consumer: Control UI Browser panel inspection/evaluate state.
  • Siblings: no-display Browser metadata remains validated and preserved; unknown metadata/codes remain dropped.
  • Native/TUI/channel runtimes do not consume this Control UI Browser-panel predicate.

User Impact

Browser inspection now becomes unavailable from the machine-readable Browser fact, independent of human error wording and whether Browser execution is local or node-proxied. Operators keep the localized unavailable state instead of a generic request failure.

Evidence

Pre-fix deterministic reproduction on main at 082cdc88661:

node --import tsx --input-type=module -e 'const { createBrowserProxyFailure, parseBrowserProxyFailure } = await import("./extensions/browser/src/browser-proxy-envelope.ts"); const input = { error: "evaluation disabled", code: "ACT_EVALUATE_DISABLED" }; const output = parseBrowserProxyFailure(createBrowserProxyFailure(403, input)); console.log(JSON.stringify({ input, output }, null, 2)); if (output?.error.body.code !== input.code) process.exitCode = 1;'

Observed pre-fix: exit 1; { error: "evaluation disabled", code: "ACT_EVALUATE_DISABLED" } became { error: "evaluation disabled" }.

Regression proof against pre-fix source:

node scripts/run-vitest.mjs extensions/browser/src/browser/errors.test.ts extensions/browser/src/browser-proxy-envelope.test.ts extensions/browser/src/browser/client-fetch.error-body-boundary.test.ts ui/src/components/browser/browser-panel-controller-input.test.ts

Observed pre-fix: 4 new tests failed for the intended reason: code absent from the parser, proxy envelope, HTTP BrowserServiceError, and Control UI state classification.

Observed fixed head:

  • Same focused command: 33 tests passed across UI and Browser plugin shards.
  • Rebased final head b8c0bc20114c7e954816b9b13f1d6702b046b40f: 123 focused Browser/UI boundary tests passed, plus 2/2 isolated mocked-Gateway Control UI flows for structured-code and legacy no-code responses.
  • Fresh full-branch autoreview against current origin/main with gpt-5.6-sol, high reasoning, and P1 scope returned clean with no accepted/actionable findings.
  • Production LOC: +62/-26, net +36. The growth is the closed Browser code vocabulary and bounded code-state preservation in both supported Browser transports; duplicated payload shapes were consolidated. Tests: +175/-13.
  • check-changed passed formatting, guards, plugin boundaries, dead-code scans, and i18n before local typecheck hit the host's stale shared dependency tree (@types/pako missing). Exact-head hosted CI is the clean typecheck authority.
  • Exact-head visual proof: fix(browser): keep inspection state independent of error wording #128625 (comment)

No visual layout or copy changed, so screenshot evidence is not applicable. The observable state transition is covered at the real Control UI controller boundary with a GatewayRequestError whose message intentionally does not contain evaluateEnabled=false.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 4:20 AM ET / 08:20 UTC.

ClawSweeper review

What this changes

The PR preserves validated Browser action-error codes through direct HTTP and browser-node proxy failures so the Control UI can classify disabled inspection without parsing error wording.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness defect was found in the proposed structured-error path. Keep this maintainer-authored, maintainer-labeled PR open for explicit maintainer review after its exact-head CI failure is resolved and in-progress checks finish.

Priority: P2
Reviewed head: b8c0bc20114c7e954816b9b13f1d6702b046b40f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repair has focused owner-boundary coverage and no concrete correctness or security defect was found in review.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused boundary-test evidence remains supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused boundary-test evidence remains supplemental.
Evidence reviewed 6 items Current-main failure path: Current main's Browser payload parser returns only the error string after valid no-display metadata handling, so action codes are discarded at this boundary.
Current-main UI classification: Current main identifies disabled evaluation solely by matching evaluateEnabled=false in the error message.
PR owner-boundary repair: The proposed parser retains only known action codes or an opaque unrecognized marker, and the UI prefers that structured state before falling back to legacy prose when no code state exists.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw browser --help

Result: PASS (completed)

$ node scripts/run-node.mjs browser --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 115.13 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.8s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋ
… output truncated …
                      List open tabs
  trace                     Record a Playwright trace
  type                      Type into an element by ref from snapshot
  upload                    Arm file upload for the next file chooser
  wait                      Wait for time, selector, URL, load state, or JS conditions
  waitfordownload           Wait for the next download (and save it)

Examples:
  openclaw browser status
  openclaw browser start
  openclaw browser start --headless
  openclaw browser stop
  openclaw browser tabs
  openclaw browser open https://example.com
  openclaw browser focus abcd1234
  openclaw browser close abcd1234
  openclaw browser screenshot
  openclaw browser screenshot --full-page
  openclaw browser screenshot --ref 12
  openclaw browser snapshot
  openclaw browser snapshot --format aria --limit 200
  openclaw browser snapshot --efficient
  openclaw browser snapshot --labels
  openclaw browser navigate https://example.com
  openclaw browser resize 1280 720
  openclaw browser click 12 --double
  openclaw browser click-coords 120 340
  openclaw browser type 23 "hello" --submit
  openclaw browser press Enter
  openclaw browser hover 44
  openclaw browser drag 10 11
  openclaw browser select 9 OptionA OptionB
  openclaw browser upload /tmp/openclaw/uploads/file.pdf
  openclaw browser upload media://inbound/file.pdf
  openclaw browser fill --fields '[{"ref":"1","value":"Ada"}]'
  openclaw browser dialog --accept
  openclaw browser wait --text "Done"
  openclaw browser evaluate --fn '(el) =› el.textContent' --ref 7
  openclaw browser evaluate --fn 'const title = document.title; return title;'
  openclaw browser console --level error
  openclaw browser pdf
  openclaw browser batch --actions-file plan.json
  openclaw browser batch --actions '[{"kind":"wait","timeMs":500},{"kind":"click","ref":"12"},{"kind":"type","ref":"23","text":"hello"}]'
  openclaw browser batch --actions-file plan.json --continue

Docs: docs.openclaw.ai/cli/browser

Assertions:

  • PASS expect_output: Usage: openclaw browser

How this fits together

Browser action routes produce structured failures that travel through either the local Browser client or an optional browser node and Gateway. The Control UI Browser panel consumes the resulting request error to select its inspection state.

flowchart LR
  A[Browser action route] --> B[Validated action error]
  B --> C[Local HTTP client]
  B --> D[Browser node proxy]
  D --> E[Gateway browser request]
  C --> F[Browser service error]
  E --> G[Gateway request error]
  F --> H[Control UI inspection state]
  G --> H
Loading

Decision needed

Question Recommendation
After the exact-head check failure is resolved and remaining checks complete, should this Browser-to-Control-UI transport fix be approved for merge? Resolve CI, then merge: Confirm the failed exact-head check is repaired or unrelated and merge if the final required checks are green.

Why: The PR is authored by a MEMBER and carries the protected maintainer label, so automated cleanup must leave the merge decision to a maintainer despite the clean functional review.

Before merge

  • Resolve merge risk (P1) - The bug fix reports production +62/-26 (net +36); the closed vocabulary and two bounded transport-preservation paths appear necessary, but the final review should retain their single-owner shape rather than introduce parallel error contracts.
  • Resolve merge risk (P1) - The exact head has one failed checks-node-compact-large-9 run and several checks still in progress; this is merge-gating state, not a line-level patch finding.
Agent review details

Security

None.

PR surface

Source +36, Tests +162. Total +198 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 6 62 26 +36
Tests 6 175 13 +162
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 237 39 +198

Review metrics

Metric Value Why it matters
Production versus tests production +62/-26 (net +36); tests +175/-13 The added code centralizes a closed Browser error vocabulary and preserves it through both supported transports; the tests cover the corresponding boundaries.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/browser/src/browser/client-fetch.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128624
Summary: This PR is the linked candidate fix for the open Browser error-code transport report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single Browser-owned closed-code parser and structured-first UI classifier, then merge only after the failed exact-head check is resolved and required checks are green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single Browser-owned closed-code parser and structured-first UI classifier, then merge only after the failed exact-head check is resolved and required checks are green.

Do we have a high-confidence way to reproduce the issue?

Yes for the source-level defect: current main discards the action code in extensions/browser/src/browser/errors.ts:195, while ui/src/components/browser/browser-client.ts:218 requires a message substring to recognize the state.

Is this the best way to solve the issue?

Yes. Preserving the producer-owned code through the existing bounded transports and using prose only when no structured code state exists is more maintainable than extending message matching.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ff45aafc5e18.

Labels

Label justifications:

  • P2: This repairs a bounded Control UI Browser-state defect that affects operators but does not cause data loss, security bypass, or core unavailability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused boundary-test evidence remains supplemental.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the affected parser and UI predicate to Peter Steinberger, and history identifies their Browser-panel feature commit. (role: current-area owner and original feature author; confidence: high; commits: cf8b58cbd9c4, 04865fe44b4c; files: extensions/browser/src/browser/errors.ts, ui/src/components/browser/browser-client.ts)
  • shakkernerd: Recent Control UI Browser history includes ownership and navigation repairs in the same panel area. (role: recent adjacent contributor; confidence: medium; commits: c402b41eb3d4, e5adfc3565a2; files: ui/src/components/browser/browser-client.ts, ui/src/components/browser/browser-panel-operation-ownership.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve or classify the failed exact-head checks-node-compact-large-9 run, then allow remaining required checks to finish.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-24T08:39:01.956Z sha d44ba43 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T09:04:04.071Z sha d44ba43 :: found issues before merge. :: [P1] Retain the legacy fallback when no action code arrives
  • reviewed 2026-08-27T06:28:40.491Z sha bde66fed04b1c2b529a7563dcdf67235689b1778 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 24, 2026
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Addressed the rolling-upgrade finding in exact head bde66fed04b1c2b529a7563dcdf67235689b1778: ACT_EVALUATE_DISABLED remains authoritative, the legacy evaluateEnabled=false matcher runs only when details.code is absent, and a present unknown code is not reinterpreted from prose.

Proof: the new old-node case failed before the repair; 46 focused Control UI tests pass, pnpm check:changed passes, and autoreview is clean with no actionable P0/P1 findings.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 27, 2026
@vyctorbrzezowski
vyctorbrzezowski force-pushed the brzezowski/facts-error-codes branch from bde66fe to 14b1bae Compare August 27, 2026 07:50
@vyctorbrzezowski
vyctorbrzezowski force-pushed the brzezowski/facts-error-codes branch from 14b1bae to 64b2220 Compare August 27, 2026 07:55
@vyctorbrzezowski

vyctorbrzezowski commented Aug 27, 2026 •

Copy link
Copy Markdown
Member Author

@/tmp/opencode/pr-128625-proof-final.md

@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 27, 2026 07:59
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vyctorbrzezowski
vyctorbrzezowski merged commit 15f24c4 into main Aug 27, 2026
217 of 219 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/facts-error-codes branch August 27, 2026 08:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…nclaw#128625)

* fix(browser): preserve action error codes

* fix(browser): retain legacy evaluation fallback

* fix(browser): preserve unknown action-code presence

* fix(browser): preserve error payload narrowing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui extensions: browser maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser error code is lost before Control UI classification

1 participant