Skip to content

fix: keep browser and Canvas tool results bounded and actionable - #125126

Merged
steipete merged 10 commits into
mainfrom
steipete/brave-ramanujan-5cccf5
Aug 17, 2026
Merged

steipete merged 10 commits into
mainfrom
steipete/brave-ramanujan-5cccf5

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where browser and Canvas tool calls could return unbounded page-controlled output, lose the resolved tab or node identity, collapse host/profile failures into empty results, or acknowledge work without returning the facts an agent needs to continue.

Why This Change Was Made

Bound page activity at capture and all model-visible browser/Canvas text with shared limits; carry canonical tab and node identities through the owning routes; preserve actionable stale-target and proxy/profile recovery; and store Canvas snapshots in lifecycle-owned media storage instead of unmanaged temp files. This is AI-assisted maintainer work.

User Impact

Agents receive bounded, untrusted-wrapped output; focus/close and Canvas actions identify the target they actually used; degraded host discovery explains what is unavailable; stale node recovery keeps the original useful guidance; structured Canvas eval results are visible; and snapshot files no longer accumulate outside managed cleanup.

Evidence

  • Regression tests were added before production edits and failed on the original F1-F6 paths: unbounded capture/JSON, bare Canvas acknowledgements and structured eval loss, stale proxy refresh masking, discarded canonical IDs, collapsed host profile failures, and unmanaged Canvas snapshot paths.
  • node scripts/run-vitest.mjs extensions/browser/src/browser/pw-session.test.ts extensions/browser/src/browser-tool.test.ts extensions/browser/src/browser-node-proxy.test.ts extensions/browser/src/browser/routes/tabs.test.ts extensions/browser/src/browser/server-context.tab-reference-parity.contract.test.ts extensions/canvas/src/tool.test.ts — 313 passed.
  • Changed-file oxfmt and targeted extension oxlint — passed.
  • git diff --check — passed.
  • Changed classifier — extensions, extensionTests.
  • Fresh autoreview — clean, no accepted/actionable findings.
  • Production LOC: +177/-105 (net +72). Tests: +394/-54 (net +340).
  • Live proof gap: no isolated paired Canvas node plus browser runtime was available, so the focused owner-boundary proof is not described as live.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 17, 2026 06:43
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:36 AM ET / 10:36 UTC.

ClawSweeper review

What this changes

This PR bounds Browser and Canvas model-facing results, preserves resolved tab/node identities, improves recovery guidance, and stages Canvas snapshots through managed media storage.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main still has the unbounded Browser/Canvas paths, and the latest head addresses the prior sanitizer-bound finding with focused regressions; no new blocking patch defect was found. The maintainer-owned PR remains behind main with exact-head checks in progress.

Priority: P1
Reviewed head: fd89608a44afdaa62da59490602ae67a79c04e64

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The latest head has focused source-level regression coverage and resolves the prior sanitizer-bound concern; exact-head validation remains the material merge check.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR states the paired live Browser/Canvas setup was unavailable and supplies focused regression evidence; no external-contributor proof action applies.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR states the paired live Browser/Canvas setup was unavailable and supplies focused regression evidence; no external-contributor proof action applies.
Evidence reviewed 6 items Current-main gap: Current main serializes Browser payloads and wraps them without a live-result cap; Canvas eval only treats string results as meaningful output.
Latest-head bound: The latest head uses the sanitizer-aware truncation helper, reserves wrapper overhead, and rechecks the final wrapped size for Browser and Canvas text.
Tool-result boundary: The agent runtime defines content as model-returned text or images and details as logs/UI data, so the new caps correctly sit on content construction.
Findings None None.
Security None None.

How this fits together

Browser and Canvas extensions turn page or node responses into agent tool results. They sanitize and bound untrusted model-visible text, then return action facts and media observations to the agent loop.

flowchart LR
  A[Agent tool call] --> B[Browser or Canvas extension]
  B --> C[Page or node response]
  C --> D[Sanitize and bound content]
  D --> E[Wrap untrusted text or stage media]
  E --> F[Agent tool result]
  F --> G[Next agent action]
Loading

Before merge

  • Resolve merge risk (P1) - Canvas snapshots may now retain up to 18.7 MiB decoded content to fit the Gateway frame; this is an availability-sensitive memory and result-size boundary that needs the exact-head validation to finish.
  • Resolve merge risk (P1) - The branch is mergeable but behind main, so the final checks and review must apply to its refreshed exact head.
  • Complete next step (P2) - The meaningful maintainer-owned repair has no remaining mechanical finding; it needs the normal exact-head CI and maintainer landing review.
Agent review details

Security

None.

PR surface

Source +160, Tests +412. Total +572 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 10 284 124 +160
Tests 6 470 58 +412
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 754 182 +572

Review metrics

Metric Value Why it matters
Production versus test delta production +284/-124 (net +160); tests +470/-58 (net +412) The production growth implements bounds, recovery facts, and snapshot lifecycle handling; the focused test growth covers the newly added owner boundaries.

Stored data model

Persistent data-model change detected: serialized state: extensions/browser/src/browser-node-proxy.ts, serialized state: extensions/canvas/src/tool.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate the large-snapshot boundary (recommended)
    Keep the Gateway-headroom cap and complete exact-head validation of large Canvas snapshot processing before merge.

Technical review

Best possible solution:

Retain the sanitizer-aware owner-path bounds and action-specific recovery guidance, then refresh against main and validate the exact head before landing.

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

Yes, source-reproducible: current main directly wraps unbounded Browser JSON and only handles string Canvas eval output; the read-only review did not execute the reported regression command.

Is this the best way to solve the issue?

Yes. Capping at the Browser/Canvas result owners preserves action-specific recovery guidance and media handling; a generic downstream clamp would lose that context.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Unbounded page-controlled Browser or Canvas output can disrupt an active agent tool workflow.
  • merge-risk: 🚨 availability: The PR changes result-size and snapshot-buffer limits on an agent-facing runtime path.
  • 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 maintainer-authored PR states the paired live Browser/Canvas setup was unavailable and supplies focused regression evidence; no external-contributor proof action applies.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame for the affected Browser and Canvas lines and the latest PR-head commit both point to Peter Steinberger; shallow history limits a broader ownership attribution. (role: current and historical area contributor; confidence: high; commits: 2a556234c29a, fd89608a44af; files: extensions/browser/src/browser-tool.snapshot.ts, extensions/canvas/src/tool.ts)

Rank-up moves

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

  • Refresh the branch against main and let the exact-head checks complete.

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 (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-17T07:30:40.155Z sha 6bfef54 :: found issues before merge. :: [P1] Preserve snapshots larger than the media-store default
  • reviewed 2026-08-17T07:47:09.387Z sha 6355cf1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T08:38:34.725Z sha 30e6b69 :: found issues before merge. :: [P1] Cap the remaining captured network text
  • reviewed 2026-08-17T08:59:11.008Z sha cc6a214 :: found issues before merge. :: [P1] Cap AI snapshot text before wrapping it | [P1] Reserve Gateway frame headroom for Canvas snapshots | [P2] Give capped Browser results action-specific recovery guidance
  • reviewed 2026-08-17T09:15:38.321Z sha db99a9f :: needs changes before merge. :: [P1] Cap final wrapped Browser text | [P1] Give Canvas snapshots a default cleanup lifecycle | [P2] Keep node tab-refresh failures actionable
  • reviewed 2026-08-17T09:40:01.909Z sha e7b08de :: found issues before merge. :: [P1] Cap final wrapped Canvas eval text
  • reviewed 2026-08-17T10:09:04.991Z sha 84210cba7e9300a297ec24e962b0fccee9184447 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T10:19:01.234Z sha c381abb :: found issues before merge. :: [P1] Cap Browser text after sanitization | [P1] Cap Canvas eval text after sanitization

@clawsweeper clawsweeper Bot added 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. 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 status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. labels Aug 17, 2026
@steipete steipete self-assigned this Aug 17, 2026
@steipete
steipete force-pushed the steipete/brave-ramanujan-5cccf5 branch from 6355cf1 to 30e6b69 Compare August 17, 2026 08:32
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
@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. labels Aug 17, 2026
@steipete
steipete force-pushed the steipete/brave-ramanujan-5cccf5 branch from 84210cb to c381abb Compare August 17, 2026 10:13
@clawsweeper clawsweeper Bot added 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 17, 2026
@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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer proof for fd89608a44afdaa62da59490602ae67a79c04e64:

  • Final rebase onto 7efd0f0feb667c75c0fe16654393b4c03eba0979 was mechanical: all nine commits compared = in git range-diff.
  • Focused proof passed: node scripts/run-vitest.mjs extensions/browser/src/browser/pw-session.test.ts extensions/browser/src/browser-tool.test.ts extensions/browser/src/browser-node-proxy.test.ts extensions/browser/src/browser/routes/tabs.test.ts extensions/browser/src/browser/server-context.tab-reference-parity.contract.test.ts extensions/canvas/src/tool.test.ts — 6 files, 318 tests (Browser 274, Canvas 44).
  • Changed-file oxfmt passed on all 16 files; targeted type-aware oxlint, assertion-safety ratchet, and git diff --check passed.
  • Fresh Codex autoreview is clean with no accepted/actionable findings. The final pass covered sanitizer-aware Browser/Canvas bounds and the adversarial special-token/forged-marker regressions.
  • Exact-head pull-request CI is green: run 32020494138, attached to the full head SHA above.
  • Production LOC: +284/-124 (net +160). Tests: +470/-58 (net +412). The growth owns distinct result-cap, canonical-target, recovery, Gateway-headroom, and snapshot-staging lifecycle contracts; Browser and Canvas now share the existing sanitizer-aware SDK primitive.
  • The earlier unrelated main-CI blocker was repaired by fix(ci): record legitimate Control UI startup growth #125156, merged at faed554dd674b15fd13795f420ee815ebd8ff7e5.
  • Latest ClawSweeper review is on this exact head with no actionable findings. Its exact-head CI rank-up is complete.

Maintainer decision: accept the documented live-proof gap for this landing. No isolated paired Canvas-node plus Browser runtime was available in this environment, so the focused owner-boundary regressions and exact-head CI are not described as live proof.

@steipete
steipete merged commit 90969ff into main Aug 17, 2026
106 checks passed
@steipete
steipete deleted the steipete/brave-ramanujan-5cccf5 branch August 17, 2026 10:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…nclaw#125126)

* fix: bound browser and Canvas tool results

* fix: type host profile availability result

* fix: reuse Canvas snapshot format normalizer

* fix: preserve large Canvas snapshots

* fix(browser): bound captured network text

* fix: close tool result limit gaps

* fix: finalize tool result lifecycle bounds

* fix(canvas): narrow snapshot cleanup errors

* fix(canvas): bound final eval output

* fix: cap sanitized tool results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser extensions: canvas maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant