Skip to content

improve(ui): Ask in side chat stages selection comments - #160747

Merged
Patrick-Erichsen merged 5 commits into
mainfrom
openclaw/improve-launch-in-sidechat-ux
Sep 29, 2026
Merged

Patrick-Erichsen merged 5 commits into
mainfrom
openclaw/improve-launch-in-sidechat-ux

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Selecting Ask in side chat skipped the comment editor and only inserted a quoted prefix, unlike adding a selection to the main chat.

User Impact

A selection now opens the same comment editor, then stages an editable comment in Side chat. The main draft stays untouched; the full passage and comment reach the Side chat model when the question is sent.

Why This Change Was Made

The selection editor and comment preview are shared between destinations. Side chat sends selected text as bounded, temporary question context rather than as a text-file attachment, which its Gateway deliberately does not accept. The existing image-only attachment policy and ephemeral Side chat history remain unchanged.

Evidence

Before — selection immediately fills the Side chat question box, with no comment input:

Before: quoted draft without a comment editor

After — comment input on the selected passage, followed by a staged comment in Side chat:

After: comment editor over the selected passage

After: editable comment and quoted draft in Side chat

  • Actual Control UI browser harness: 15/15 scenarios passed, including desktop/mobile and all four ClawSweeper findings. Each added browser regression failed against the original production code and passed after repair.
  • UI unit and shared editor coverage after the conflict rebase: 124/124 passed. The final parameter-signature cleanup also passed the 24 controller/preview cases. Gateway invocation/lifecycle and protocol schema coverage: 100/100 passed, including full comment delivery, later-question context omission, and the 16,000-character boundary.
  • Oversized source passages open Side chat with a short quote and a visible explanation. Oversized comments or accumulated context remain correctable in the editor. Selected text bypasses media-file admission; blank text-only comments cannot trigger the image-question fallback.
  • Fresh Codex autoreview of the complete candidate found no P0 issues. The browser uses a mock Gateway; Gateway tests exercise the actual prompt and invocation boundaries with mocked model execution.
  • Rebased after GitHub reported conflicts with the aggregate attachment-frame fix. Main-chat selection files preserve staged and pending byte accounting; replacement excludes the previous comment. A focused regression proves overflow remains editable and an equal-size replacement succeeds.
  • Post-rebase checks passed: 15/15 selected-text browser scenarios, UI production and component-test types, generated Swift protocol check, lint, and max-lines/environment ratchets (476/476). All 22 remaining checks had also passed before rebase. Fresh autoreview of the integrated candidate found no P0 issues. Final normal PR CI passed on exact head 13c42b9e7bec (172 successful jobs, 13 intentional skips); both required merge checks, including the combined Security Review status, passed.

The context field is optional and capped at 16,000 characters. Its size intentionally supports an operator-selected passage and comment beyond the short quoted question; it is used only for that ask, XML-escaped, and omitted from subsequent asks and retained exchanges. No new config, environment, storage schema, or protocol version is introduced.

Measured test cost

Measured at 13c42b9e7bec. All eight changed files passed locally (175 tests), and all five owning CI jobs passed. This addresses the test-cost reporting request in ClawSweeper revisions 4 and 5.

Test file Local command wall Local file tests CI tests CI job
packages/gateway-protocol/src/index.test.ts 4.670s 0.246s 0.686s* checks-node-changed-compact-large-42-1
src/gateway/session-companion-ask.test.ts 44.645s 3.161s 4.347s* checks-node-changed-compact-large-20-1
ui/src/e2e/chat-selection-to-main.e2e.test.ts 43.360s 29.034s 97.740s checks-ui-e2e (3/9)
ui/src/pages/chat/chat-pane-companion-lifecycle.test.ts 5.435s 0.134s 0.199s checks-ui (1/3)
ui/src/pages/chat/chat-session-rail.test.ts 3.438s 0.245s 0.582s checks-ui (3/3)
ui/src/pages/chat/components/chat-comment-controller.test.ts 2.701s 0.091s 0.148s checks-ui (1/3)
ui/src/pages/chat/components/chat-comment-preview.test.ts 2.377s 0.005s 0.012s checks-ui (3/3)
ui/src/pages/chat/components/chat-selection-popup.test.ts 2.360s 0.051s 0.058s checks-ui (1/3)

Local command: pnpm test <file> --maxWorkers=1 --reporter=default; the browser file uses node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner <file> --maxWorkers=1 --reporter=default. Command wall includes startup/transformation. CI UI-unit values are Vitest tests-plus-hooks diagnostics; browser time is the file summary. Asterisked Node values sum every reported case (59 protocol / 17 Gateway), excluding imports, setup, and hooks because those jobs emit no file diagnostic. These are per-file measurements, not whole-job wall time.

Seven local files meet the <5s test-time target. The browser suite takes 29.034s locally and 97.740s in CI. It proves actual DOM selection, visible editing and correction, desktop/mobile layouts, reload behavior, and UI-to-Gateway request wiring against the built app. The unit tests prove admission/serialization cheaply, but cannot prove those browser contracts. The four defect cases cost 5.350s locally / 25.195s in CI; the two Side chat desktop/mobile cases cost 2.314s / 7.907s. The remaining time belongs to existing main-chat and retained-comment coverage. This uses the existing dedicated UI E2E lane; no new serial configuration, worker pin, sleeps, or timeouts were introduced. The Gateway command’s 44.645s wall is mostly transformation (86% of Vitest duration); its tests take 3.161s.

Thanks @Patrick-Erichsen for the UX request.

Work sessions


View the OpenClaw team session

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M labels Sep 28, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 28, 2026 22:00
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 9:47 PM ET / September 29, 2026, 01:47 UTC (Revision 8).

ClawSweeper review

What this changes

Selecting transcript text for Side chat now opens the shared comment editor and sends the staged comment and passage as bounded context with one question.

Merge readiness

✅ Ready for maintainer review

Keep open: the requested workflow is absent from current main, and this branch remains a distinct, well-supported contribution. No blocking defect was established in the reviewed head.

Priority: P2
Reviewed head: 13c42b9e7bec908c304efe4c6fb4df29e8a11669

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Direct visual proof, focused browser coverage, and bounded Gateway handling support a good patch with no established blocking defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after Control UI screenshots directly show the editor and staged Side chat comment. The contributor reports browser scenarios against a mock Gateway for request wiring and Gateway tests for one-question prompt context; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after Control UI screenshots directly show the editor and staged Side chat comment. The contributor reports browser scenarios against a mock Gateway for request wiring and Gateway tests for one-question prompt context; no stored-data contract changes.
Evidence reviewed 16 items Current main behavior: The fetched main revision only prefills Side chat with a quoted question; it does not stage a selection comment.
Current main request contract: The current-main Side chat ask schema has no selection-context field, confirming the branch's request behavior is not already present.
Introduced editor flow: The introduced hunk routes the Side chat selection action through the existing annotation editor while keeping main-chat attachment staging separate.
Findings None None.
Security None None.

How this fits together

The Control UI turns selected transcript text into a Side chat question. The Gateway checks the target session, sends temporary context to the utility model, and retains the question and answer.

flowchart LR
  A[Selected transcript text] --> B[Shared comment editor]
  B --> C[Side chat draft and comment]
  C --> D[Bounded ask request]
  D --> E[Gateway session checks]
  E --> F[Utility model prompt]
  F --> G[Answer and retained question]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +146, Tests +304, Docs +2, Other +4. Total +456 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 18 237 91 +146
Tests 8 324 20 +304
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 0 +4
Total 28 568 112 +456

Review metrics

Metric Value Why it matters
Request contract 1 optional text field; 16,000-character cap Selection context accompanies one ask and does not enter retained exchanges.
Code and test balance production net +146 LOC; tests net +304 LOC The production growth implements the shared editor and bounded request path; the PR body measures all changed test files.

Technical review

Best possible solution:

Provide one shared selection editor for main chat and Side chat, with bounded request-only context, correctable size errors, and a visible quote-only fallback for passages that cannot fit.

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

Not applicable as a defect reproduction: this is a UX addition. Current-main source and the before screenshot establish the existing quote-only flow.

Is this the best way to solve the issue?

Yes. Reusing the existing selection editor and Side chat request avoids sending text through its image-only attachment path, while keeping the added context bounded and temporary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded Control UI usability improvement with direct visual and browser-path evidence.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after Control UI screenshots directly show the editor and staged Side chat comment. The contributor reports browser scenarios against a mock Gateway for request wiring and Gateway tests for one-question prompt context; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after Control UI screenshots directly show the editor and staged Side chat comment. The contributor reports browser scenarios against a mock Gateway for request wiring and Gateway tests for one-question prompt context; no stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after Control UI screenshots directly show the editor and staged Side chat comment. The contributor reports browser scenarios against a mock Gateway for request wiring and Gateway tests for one-question prompt context; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (7 earlier review cycles)
  • reviewed 2026-09-28T22:19:18.259Z sha d566457d3f289c17c100870c400132207475d5b5 :: blocked before merge. :: [P2] Preserve the quote draft when selection context is too long | [P2] Do not apply media upload limits to Side chat text context | [P2] Keep the draft when an edited comment exceeds the context limit
  • reviewed 2026-09-28T22:37:15.183Z sha 0c035b8f77aab143794a8f0ff96fdea347c76710 :: blocked before merge. :: [P2] Preserve a quoted draft when selection context is too long | [P2] Stop applying media file limits to Side chat text context | [P2] Check edited comment size before consuming the draft | [P2] Avoid the image fallback for a text-only comment
  • reviewed 2026-09-28T23:39:50.366Z sha c890a5939e374eb182ab0571e2f15f6a702bb70d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T23:51:50.002Z sha c890a5939e374eb182ab0571e2f15f6a702bb70d :: blocked before merge. :: none
  • reviewed 2026-09-29T00:24:45.118Z sha 13c42b9 :: blocked before merge. :: none
  • reviewed 2026-09-29T00:56:06.681Z sha 13c42b9 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-29T01:12:05.237Z sha 13c42b9 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 28, 2026
@Patrick-Erichsen Patrick-Erichsen self-assigned this Sep 28, 2026
@Patrick-Erichsen

Patrick-Erichsen commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Addressed all four P2 findings and the three Rank-up moves in the latest ClawSweeper review.

Finding Repaired behavior and proof
Oversized passage prevents Side chat opening Opens with the bounded quote and a visible explanation; browser regression goes red → green.
Media byte limit blocks text context Side comments use metadata directly; the browser stages and edits text with a one-byte media limit.
Oversized edit loses the draft on submit The thread owner validates aggregate context before replacement; rejected edits stay open and can be shortened, then sent.
Empty text-only draft asks about an image Button, Enter, and submit share image-aware question resolution; text-only stays disabled, while image-only keeps its existing prompt.

Validation: 15 browser scenarios, 65 UI/shared-editor tests, and 100 Gateway/protocol tests passed. The four added browser cases and blank-question unit test failed before the repair. Gateway coverage verifies the selected text and comment reach the current model prompt, do not enter retained exchanges, and do not leak into the next ask. Fresh Codex autoreview: no P0 findings in the complete candidate.

The repair moves admission into ChatSessionCompanionThreads.setAttachments, removes late request rejection, and shares question resolution. Complete feature delta after rebase: production +237/−91 (net +146), tests +324/−20 (net +304), generated Swift +4, docs +3/−1. The growth adds the requested shared selection editor flow and a distinct bounded text-context contract; image upload behavior stays covered by sibling tests. No new config, environment variables, storage schema, or protocol version.

Dependency/owner review: personally checked Codex codex-rs/protocol/src/user_input.rs:15 and models.rs:1954–1980; both embedded and CLI companion paths receive the fully built question prompt. Context remains bounded to 16,000 characters, escaped, and scoped to one question.

After a real merge conflict with #160071, rebased and preserved its aggregate file-frame admission, including pending reads and replacement byte exclusion. Current head 13c42b9e7bec adds a focused integration test: overflowing replacement stays correctable; equal-size replacement succeeds without double-counting the original.

Post-rebase: 124 UI/shared-editor unit cases and all 15 browser scenarios passed; fresh screenshots were inspected. UI production and test types, generated Swift protocol check, lint, and max-lines/environment ratchets (476/476) passed. The final required-options signature cleanup passed 24 focused controller/preview cases. Fresh integrated-candidate autoreview found no P0 findings. Hosted CI is rerunning on the updated head.

Attached comparison: original PR on the left, repaired editor on the right. The video shows rejecting an oversized edit, correcting it, and submitting. Captures use the actual UI with a mock Gateway and synthetic text; no real provider response is claimed.

oversized-edit-comparison

oversized-edit.mp4

ClawSweeper revisions 4 and 5 test-cost request addressed: the PR body now includes measured single-worker command wall, per-file test time, and linked exact-head CI seconds for all eight changed tests. All 175 local cases and their five owning CI jobs passed. The browser cost and need for real selection/editor/mobile/reload/request-wiring coverage are explained; CI metric limitations are explicit. No requested Rank-up move remains unaddressed.

CI infrastructure follow-up — hosted fallback boundary capacity: recovery run 36502811818 completed all product tests, including iOS, but its plugin boundary job was marked cancelled after exceeding the 20-minute job limit. Its log records all 125 compiles and the negative canary passing; preparation took 269.823s and compilation 874.142s, with checkout/setup taking the job to 20m27s. The manual hosted route admits two compiler workers. The existing ordinary PR route assigns the 32-class runner for cold compilation headroom; the prior PR boundary job passed in 410s. Recovery retriggers ordinary PR CI through draft → ready on unchanged 13c42b9e7bec, then verifies actual runner selection. No assertions, deadlines, workflow settings, or source bytes are changed. The hosted fallback budget mismatch remains a named CI-owner follow-up, not claimed fixed by this UI PR.

Recovery update: a delayed ordinary PR run, 36502871660, had attached to the same head. Its boundary job passed on blacksmith-32vcpu-ubuntu-2404 in 404s. Draft → ready interrupted that run’s final iOS lifecycle step; this was operator-induced cancellation, not a test failure. The redundant new run 36506061357 was cancelled during preflight. Attempt 2 of the original ordinary run now reruns only the interrupted iOS job and dependent gate, retaining all other successful checks on unchanged 13c42b9e7bec.

Final landing gate: exact-head normal CI passed

The fresh normal PR CI run 36508838785 completed successfully on 13c42b9e7bec908c304efe4c6fb4df29e8a11669: 172 successful jobs, 13 intentional skips, and no failures, cancellations, or timeouts. Both required openclaw/ci-gate checks passed, including the combined CI and Security Review status. This is the final qualifying CI run and supersedes the recovery attempts above. ClawSweeper revision 8 reviewed this same head with no findings and “Before merge: None.”

@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. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Sep 28, 2026
@Patrick-Erichsen
Patrick-Erichsen force-pushed the openclaw/improve-launch-in-sidechat-ux branch from c890a59 to 13c42b9 Compare September 29, 2026 00:15
@Patrick-Erichsen
Patrick-Erichsen marked this pull request as draft September 29, 2026 01:03
@Patrick-Erichsen
Patrick-Erichsen marked this pull request as ready for review September 29, 2026 01:03
@Patrick-Erichsen
Patrick-Erichsen marked this pull request as draft September 29, 2026 01:38
@Patrick-Erichsen
Patrick-Erichsen marked this pull request as ready for review September 29, 2026 01:38
@Patrick-Erichsen
Patrick-Erichsen merged commit 4d2baee into main Sep 29, 2026
965 of 1005 checks passed
@Patrick-Erichsen
Patrick-Erichsen deleted the openclaw/improve-launch-in-sidechat-ux branch September 29, 2026 02:16
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
)

* improve(ui): stage selected-text comments in side chat

Co-authored-by: Patrick-Erichsen <[email protected]>

* chore(protocol): update Swift Side chat context model

Co-authored-by: Patrick-Erichsen <[email protected]>

* test(ui): await companion history after reconnect

Co-authored-by: Patrick-Erichsen <[email protected]>

* fix(ui): preserve correctable side-chat selection drafts

* test(ui): cover selection edits at attachment frame limits

---------

Co-authored-by: Patrick-Erichsen <[email protected]>
Co-authored-by: Patrick Erichsen <[email protected]>
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 gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants