Skip to content

fix: keep browser annotation context coupled to its screenshot - #120848

Merged
shakkernerd merged 8 commits into
mainfrom
fix/browser-annotation-composer
Aug 9, 2026
Merged

shakkernerd merged 8 commits into
mainfrom
fix/browser-annotation-composer

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #120744

What Problem This Solves

Fixes an issue where removing a browser annotation from the Control UI composer removed its screenshot but left generated page context in the editable draft. That stale text could claim a screenshot was still attached and made replacing an annotation risk deleting unrelated user-written text.

Why This Change Was Made

Browser annotations now remain one structured, attachment-owned composer package: the marked screenshot, bounded page metadata, and generated model context share one lifecycle. The textarea remains exclusively user-authored.

Removal and bounded Undo operate on the complete annotation package. Send materializes each remaining annotation once before queue admission. A bounded annotation-only handoff preserves complete annotations across same-tab route and active split-pane remounts without changing ordinary attachment behavior.

User Impact

Users can identify, remove, replace, and undo browser annotations without losing their draft or sending context for a screenshot they removed. Complete annotations survive supported same-tab navigation, while pane closure, ownership changes, hard reload, and application shutdown clean them up without leaving hidden context.

When the annotation limit is reached, the browser capture remains available so the user can remove a card and retry.

Evidence

  • Focused coverage exercises bounded producer metadata, active-pane admission, structured cards, atomic removal and Undo, queue/retry/reply/steer/failure delivery, route and split-pane remounts, ownership mismatch, hard reload, and terminal cleanup.
  • Isolated OCM and real-browser verification covered desktop and narrow layouts, pointer and keyboard removal, deterministic focus, four-card admission, visible fifth-card rejection with retained capture, retry after removal, and Undo refusal at capacity.
  • A real provider send confirmed that only the remaining replacement annotation image and context reached the model.
  • Targeted lint, UI and UI-test typechecks, 404 focused tests, the production Control UI build, and performance budgets pass.
  • Fresh independent Workloop review found no blocking defect across the complete bounded outcome.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 9, 2026
@shakkernerd
shakkernerd marked this pull request as ready for review August 9, 2026 03:07
@shakkernerd shakkernerd self-assigned this Aug 9, 2026
@shakkernerd
shakkernerd force-pushed the fix/browser-annotation-composer branch from 413276c to 406d5d3 Compare August 9, 2026 03:40
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 9, 2026, 7:44 AM ET / 11:44 UTC.

ClawSweeper review

What this changes

This PR represents browser screenshots and generated page context as structured composer attachments, adding removal, Undo, send, and pane-remount lifecycle handling.

Merge readiness

⛔ Blocked by patch quality or review findings - 6 items remain

Keep this maintainer-owned PR open: its attachment-owned annotation design addresses the linked defect, but it still turns slash commands with an attached annotation into ordinary model messages.

Priority: P1
Reviewed head: 7868e652a7b8672ee4752fa0c1897cdfdd7b865f

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The structured lifecycle repair is substantive, but the unresolved P1 command regression makes the current patch not merge-ready.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; the supplied real-browser claim was not independently inspectable in the read-only environment.
Patch quality 🧂 unranked krab (1/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; the supplied real-browser claim was not independently inspectable in the read-only environment.
Evidence reviewed 4 items Unresolved command regression: The PR composes prefixed annotation context before stop and slash-command handling; with an annotation attached, /new and /stop no longer begin the inspected message and fall through to ordinary delivery.
Command contract: The current parser accepts only trimmed input beginning with /, while stop handling recognizes exact normalized aliases.
Correct ownership direction: Current main appends generated annotation text to the editable draft while attachment removal releases only the image payload; the PR's structured attachment direction places that context at the attachment lifecycle owner.
Findings 2 actionable findings [P1] Classify commands before adding annotation context
[P3] Remove the release-owned changelog entry
Security None None.

How this fits together

The Control UI browser panel creates marked screenshots with page context for the active chat composer. The composer decides whether typed text is a local command or a model message, then owns attachment delivery and pane cleanup.

flowchart LR
  Capture[Browser capture] --> Package[Annotation package]
  Package --> Composer[Chat composer]
  Composer --> Command[Command classification]
  Command --> Delivery[Model message delivery]
  Composer --> Lifecycle[Pane lifecycle]
  Lifecycle --> Cleanup[Payload cleanup]
Loading

Before merge

  • Classify commands before adding annotation context (P1) - With a browser annotation attached, this prefix means /new, /stop, and other slash commands no longer start the value passed to local command handling, so they are sent as ordinary model messages. Classify userMessage first and compose annotation context only after command branches exit.
  • Remove the release-owned changelog entry (P3) - CHANGELOG.md is release-generated in this repository. Keep the release-note context in the PR body or commit message and remove this normal-PR entry.
  • Resolve merge risk (P1) - Merging would make existing local slash commands such as /new and /stop send as annotated model messages whenever a browser annotation is staged.
  • Complete next step (P2) - The remaining P1 is a narrow mechanical send-path repair with clear focused regressions.
  • Improve patch quality - Classify raw composer text before annotation-context composition and add /new and /stop annotation regressions.
  • Improve patch quality - Remove the release-owned changelog entry.

Findings

  • [P1] Classify commands before adding annotation context — ui/src/pages/chat/chat-send-submit.ts:216
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:68
Agent review details

Security

None.

PR surface

Source +790, Tests +1422, Docs +5. Total +2217 across 39 files.

View PR surface stats
Area Files Added Removed Net
Source 24 938 148 +790
Tests 13 1452 30 +1422
Docs 2 7 2 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 39 2397 180 +2217

Review metrics

Metric Value Why it matters
Production vs test delta production +938/-150; tests +1459/-30 The large but owner-boundary-justified lifecycle change needs its command-routing invariant repaired before merge.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/chat/chat-send-submit.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #120744
Summary: This PR is the candidate repair for the linked browser-annotation composer-state bug.

Members:

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

Merge-risk options

Maintainer options:

  1. Restore command classification before merge (recommended)
    Run local command and stop handling against the raw composer text, compose annotation context only after those branches, and add annotated command regressions.

Technical review

Best possible solution:

Classify and execute the raw user-authored message first, then materialize annotation context only for ordinary model sends while retaining the attachment-owned lifecycle design.

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

Yes, from source: stage a browser annotation and submit /new or /stop; prefixed generated context prevents the command parser from recognizing it.

Is this the best way to solve the issue?

No. Attachment-owned context is the right repair boundary, but composing it before command classification regresses existing command behavior.

Full review comments:

  • [P1] Classify commands before adding annotation context — ui/src/pages/chat/chat-send-submit.ts:216
    With a browser annotation attached, this prefix means /new, /stop, and other slash commands no longer start the value passed to local command handling, so they are sent as ordinary model messages. Classify userMessage first and compose annotation context only after command branches exit.
    Confidence: 0.98
  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:68
    CHANGELOG.md is release-generated in this repository. Keep the release-note context in the PR body or commit message and remove this normal-PR entry.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A staged annotation can break normal Control UI slash-command and stop workflows.
  • merge-risk: 🚨 compatibility: The PR changes established composer command semantics when annotations are present.
  • merge-risk: 🚨 message-delivery: The patch can route intended local commands into model-message delivery.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This MEMBER-authored PR is not subject to the external-contributor proof gate; the supplied real-browser claim was not independently inspectable in the read-only environment.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs ui/src/pages/chat/chat-send-submit.test.ts.
  • [P1] node scripts/run-vitest.mjs ui/src/pages/chat/chat-pane-browser-annotation.test.ts.

What I checked:

  • Unresolved command regression: The PR composes prefixed annotation context before stop and slash-command handling; with an annotation attached, /new and /stop no longer begin the inspected message and fall through to ordinary delivery. (ui/src/pages/chat/chat-send-submit.ts:216, a1d43067187b)
  • Command contract: The current parser accepts only trimmed input beginning with /, while stop handling recognizes exact normalized aliases. (ui/src/lib/chat/commands.ts:544, 4cb33d48cddb)
  • Correct ownership direction: Current main appends generated annotation text to the editable draft while attachment removal releases only the image payload; the PR's structured attachment direction places that context at the attachment lifecycle owner. (ui/src/pages/chat/chat-pane-lifecycle.ts:324, 4cb33d48cddb)
  • Release-owned changelog: The added changelog entry conflicts with repository policy that reserves CHANGELOG.md for release generation. (CHANGELOG.md:68, 7868e652a7b8)

Likely related people:

  • Peter Steinberger: Recent main history covers chat-send, attachment/run ownership, and command preconditions. (role: recent chat-send contributor; confidence: medium; commits: 6f56d797d7be, 708c4d68dc50, c519e01a240; files: ui/src/pages/chat/chat-send-submit.ts, ui/src/pages/chat/run-lifecycle.ts)
  • Goutam Adwant: Available blame attributes the original browser-annotation event/composer path to this contributor; shallow history limits certainty. (role: original composer-path contributor; confidence: low; commits: 13cb098c; files: ui/src/pages/chat/chat-pane-lifecycle.ts)

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-09T03:46:15.383Z sha 406d5d3 :: needs changes before merge. :: [P1] Parse commands before adding annotation context | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-09T04:39:45.953Z sha 406d5d3 :: found issues before merge. :: [P1] Parse commands before materializing annotation context | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-09T10:48:35.583Z sha 28cf3c8 :: found issues before merge. :: [P1] Classify commands before adding annotation context | [P3] Remove the release-owned changelog entry

@shakkernerd
shakkernerd marked this pull request as draft August 9, 2026 04:04
@shakkernerd
shakkernerd force-pushed the fix/browser-annotation-composer branch from 406d5d3 to 28cf3c8 Compare August 9, 2026 10:15
@shakkernerd
shakkernerd marked this pull request as ready for review August 9, 2026 10:15
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@shakkernerd
shakkernerd force-pushed the fix/browser-annotation-composer branch from 2cac2e1 to 7868e65 Compare August 9, 2026 11:37
@shakkernerd
shakkernerd force-pushed the fix/browser-annotation-composer branch from 7868e65 to 0a898b7 Compare August 9, 2026 12:01
@shakkernerd
shakkernerd merged commit 0a898b7 into main Aug 9, 2026
20 of 21 checks passed
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 docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Removing a browser annotation leaves text claiming it is attached

1 participant