Skip to content

fix: show WebChat preamble progress during tool activity#95708

Merged
obviyus merged 6 commits into
openclaw:mainfrom
ragesaq:chisel/webchat-preamble-progress
Jul 1, 2026
Merged

fix: show WebChat preamble progress during tool activity#95708
obviyus merged 6 commits into
openclaw:mainfrom
ragesaq:chisel/webchat-preamble-progress

Conversation

@ragesaq

@ragesaq ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Control UI was not showing WebChat/Codex preamble and commentary progress while tools were active, so users could see an idle-looking run until the final assistant message arrived. This patch projects those progress events into the chat stream, preserves pre-final commentary, and keeps keyed preamble updates from being collapsed into unrelated final messages.

Relation To #92236

PR #92236 covers the same root signal, native Codex app-server stream:"item" / kind:"preamble" progress, with a narrower transient-progress approach: project one progressText value into chatStream, mark it as progress, and clear it on final without saving it to assistant history.

This PR handles the larger WebChat reconciliation path:

Behavior #92236 This PR
Native Codex item/preamble visibility Shows transient progress text Shows preamble/commentary as stream segments
Keyed itemId updates Not the primary contract Replaces prior text for the same key
Keyed retraction Not covered Empty keyed update removes the segment
Same-text distinct items Not covered Keeps distinct keyed items independent
Directive-only progress Not covered Strips inline delivery tags and drops silent NO_REPLY progress
Pre-final commentary before final answer Cleared as progress Materializes visible pre-final commentary before the final answer
Tool-card ordering Not covered Preserves timestamp order around tool cards
Reviewer proof labels Not covered Labels Commentary, Tool call, and Final message blocks

Maintainer choice: these two PRs should not land as divergent UX policies. If maintainers prefer #92236's transient-only behavior, this PR should be treated as the keyed/multi-segment reconciliation variant to fold into that landing path. If maintainers want visible pre-final commentary preserved as chat content, this PR is the more complete path.

Summary

  • Shows Codex/WebChat preamble and commentary progress in Control UI during tool activity.
  • Preserves pre-final stream commentary before final assistant messages.
  • Keeps keyed preamble segments independent from accumulated stream snapshots, supports keyed retraction, strips silent/directive-only progress, and preserves live timestamp ordering around tool cards.
  • Labels the visible chat blocks so reviewer proof distinguishes Commentary, Tool call, and Final message blocks.

Behavior Contract

Case Expected behavior
stream:"item", kind:"preamble", keyed text update Store one visible commentary stream segment for that itemId.
Same itemId updates with new progressText Replace the previous segment text, do not append a duplicate.
Same itemId updates with empty progressText Retract that segment.
Two different itemId values with the same text Keep both visible; they are distinct events.
Inline delivery directive or NO_REPLY-only progress Strip or suppress it before storing UI state.
Tool result persists while keyed preamble is visible Do not prune keyed preambles through tool-index fallback.
Renderable final assistant message arrives Materialize visible pre-final commentary first, then append the final answer.
Live final-answer stream is visible Label it as Final message, never Commentary.

Implementation

  • Projects Codex app-server item and preamble progress events into Control UI chat stream segments.
  • Splits keyed preambles from the existing tool-indexed accumulated stream lane.
  • Materializes pre-final segments by timestamp so history stays chronological.
  • Carries stream item source through the renderer so preamble segments label as Commentary, while live final-answer streams remain Final message.
  • Removes proof media from the PR branch; proof remains PR evidence, not product tree.

Evidence

WebChat proof with Commentary, Tool call, and Final message labels

Animated proof: commentary-persistence toggle (chatPersistCommentary)

The static screenshot above proves the labeled Commentary / Tool call / Final message render path. This animated capture proves the configurable persistence behavior added in the third commit, on the live PR head (c57819e5fd):

Commentary persistence toggle: ON keeps commentary after the final answer; OFF clears it on final

  • Turn 1, toggle ON (default): a streaming turn renders Commentary -> Tool call -> Commentary -> Final message, and the pre-final commentary stays pinned above the final answer.
  • Mid-clip: the chat-settings popover opens and the Keep commentary toggle flips from on (pin) to off (pin-off). A zoomed inset makes the toggle state legible.
  • Turn 2, toggle OFF (transient): commentary appears live during streaming, then clears when the final answer lands (the tool card persists). Turn 1's commentary remains above, confirming this is per-render gating (materializeVisibleStreamState + chatPersistCommentary), not destructive history loss.

Capture environment: the repository's own Control UI e2e harness, which serves the real built Control UI bundle and drives it through real agent/chat stream events from a mock Gateway. The model/transport is mocked; the changed code path (client-side render reconciliation and the persistence toggle) is the real shipped code. Built from a fresh worktree at PR head c57819e5fd after a clean pnpm install.

Behavior or issue addressed: WebChat now surfaces native Codex app-server stream:"item" / kind:"preamble" progress during tool activity, keeps keyed preamble segments independent, and distinguishes commentary/tool/final blocks visually.

Real environment tested: local OpenClaw Control UI source checkout on Linux, exercised through the Control UI render path and a system Chromium browser for the visible proof.

Exact steps or command run after this patch: loaded the mock Control UI proof surface in system Chromium, rendered the WebChat conversation state containing commentary, tool activity, and final message blocks, and captured the browser screenshot above. After rebasing onto current main and adding the keyed-commentary ordering fix, reran the focused UI/runtime validation listed below on head c57819e5fdff037932735b53a442cc2d75b2d47d.

Evidence after fix: the screenshot shows all three labels: Commentary, Tool call, and Final message. The DOM proof for the labeled render path verified the labels exactly as ["Commentary", "Tool call", "Final message"].

Observed result after fix: preamble/commentary progress is visible before the final assistant answer, tool cards remain distinct, and live final-answer streams are labeled as Final message rather than Commentary.

What was not tested: this proof does not launch a live frontier-model WebChat turn after the rebase. The visual capture was taken at the same UI feature diff; the rebase onto current main and the keyed-commentary ordering fix do not change the commentary-persistence UI behavior shown in the GIF, and the ordering fix is covered by a new buildChatItems unit regression. The current head was validated with the focused tests, typecheck, and i18n check listed below.

Proof limitations or environment constraints: the rebase changed the base commit and head SHA, not the UI feature diff. A fresh live Mantis capture would be the strongest proof if maintainers want live-run evidence instead of the local browser proof plus current-head validation.

Fleet-Tool Evidence

  • Rebased branch head: c57819e5fdff037932735b53a442cc2d75b2d47d, 4 commits ahead of current upstream main; git merge-tree against current main reports a clean merge (no conflicts).
  • Commit attribution: all four commits authored and committed by ragesaq <[email protected]>.
  • vitest run ui/src/ui/chat/build-chat-items.test.ts ui/src/ui/chat/stream-reconciliation.test.ts ui/src/ui/chat/grouped-render.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/app-tool-stream.node.test.ts ui/src/ui/storage.node.test.ts (6 files, 293 tests passed, includes the new keyed-commentary ordering regression)
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.ui.json (pass)
  • node --import tsx scripts/control-ui-i18n.ts check (clean; the 2 new keys carry English fallback across all 18 locales)
  • git merge-tree --write-tree upstream/main HEAD (clean, no conflicts)

ClawSweeper Follow-Up

Feedback Status
Refresh the branch so it is no longer conflicting/dirty Addressed: rebased onto current upstream main; mergeable is now true and git merge-tree reports a clean merge. Head c57819e5fd.
Keyed commentary live ordering (build-chat-items.ts) Addressed: keyed commentary now merges into the timestamp ordering path (spliced before the first item with a strictly-later timestamp) instead of being appended after every tool card, so a preamble that arrived before a later tool renders above it while the run is live. New buildChatItems regression covers a keyed preamble between two tools.
Persistent-by-default vs transient (#92236) policy Maintainer decision: this is a UX policy choice, not an author-side defect. chatPersistCommentary defaults to keep; flipping the default to transient (opt-in persistence) is a one-line change if maintainers prefer #92236's behavior as canonical.
Let check-lint finish and address concrete failures Addressed by rebase: the red check-lint and check-prod-types failures both pointed at src/config/sessions/session-accessor.ts, outside this PR diff. Current upstream main contains e3058efa10, which removes that unused binding.
Reconcile overlap with #92236 Addressed above in Relation To #92236; maintainers should choose one policy or fold this keyed reconciliation behavior into the preferred path.
Persistent data-model warning Clarified: this patch does not change vector/embedding storage or durable schema. openclawStreamFallback and keyed chatStreamSegments are Control UI stream metadata used for local render reconciliation.
Copilot inline thread on tool-index pruning Addressed in code: keyed preamble segments do not consume the live-tool index fallback, and tests cover keyed preamble preservation, retraction, and materialization.

AI Disclosure

This PR was authored and submitted under ragesaq's GitHub identity. Implementation assistance was provided by Chisel, a OpenClaw agent. The evidence above lists the verification commands and review loop outputs used before requesting maintainer/bot review.

Copilot AI review requested due to automatic review settings June 22, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Control UI WebChat streaming pipeline so stream:"item" preamble progress events become visible to users during long tool-using turns, aligning WebChat behavior with other UIs that already surface this commentary.

Changes:

  • Teach app-tool-stream.handleAgentEvent to consume stream:"item" + kind:"preamble" progress events and store/update them as keyed chatStreamSegments.
  • Materialize visible pre-final stream segments into assistant message blocks when a renderable final assistant message arrives, then clear the stream segment buffer.
  • Add/adjust node + controller tests to cover keyed preamble progress handling and the updated finalization behavior.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
ui/src/ui/controllers/chat.ts Materializes visible pre-final stream segments before appending a renderable final assistant message.
ui/src/ui/controllers/chat.test.ts Updates expectations to confirm pre-final segments become assistant messages and the segment buffer is cleared.
ui/src/ui/app-tool-stream.ts Adds handling for stream:"item" preamble progress events, storing them as keyed stream segments (itemId).
ui/src/ui/app-tool-stream.node.test.ts Adds test coverage for keyed preamble progress segment storage/update behavior.

Comment on lines +774 to +781
host.chatStreamSegments = [
...host.chatStreamSegments,
{
text: progress.text,
ts: Date.now(),
...(progress.itemId ? { itemId: progress.itemId } : {}),
},
];
@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated proof and validation are in the PR body: annotated WebChat GIF, focused local tests, UI build, and crabbox local-container fresh-PR validation for 147 focused tests.

@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from 7372bcb to 83e04b8 Compare June 22, 2026 09:01
@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated proof and validation were added to the PR body at that point in the review loop: annotated WebChat proof GIF, focused tests, Real behavior proof parser check, and Crabbox fresh-PR validation (cbx_26529f12fce6) with 147 focused tests passing.

@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from 83e04b8 to a47d405 Compare June 22, 2026 10:19
@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from a47d405 to 533fba2 Compare June 22, 2026 11:22
@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up after Codex review and cleanup:

  • Fixed keyed preamble ordering, retraction, and reconciliation issues found by Codex review.
  • Stripped silent/directive-only preamble progress before Control UI stores it.
  • Removed committed proof media from the branch.
  • Re-ran lint, focused UI tests, UI/core type lanes, Codex review, and Crabbox fresh PR checkout proof.
  • Updated the PR body with current fleet-tool evidence and AI disclosure.

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 22, 2026
@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 22, 2026
@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from 533fba2 to 6fe30bb Compare June 22, 2026 11:34
@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

No-code force-push to 6fe30bb9254dfe1fc427e379cea7c060307125f8 retriggered CI after GitHub refused failed-job rerun permissions. The tree matches reviewed commit 533fba216826a7d29b34ab04b0f25277d0daf823.

The previous failing cron shard is outside this PR's UI diff and passes locally with:

pnpm exec vitest --config test/vitest/vitest.gateway-server.config.ts --run src/gateway/server.cron.test.ts (18 passed)

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up on current head 6fe30bb9254dfe1fc427e379cea7c060307125f8:

  • 53 checks passing, 10 skipped.
  • Remaining failure is checks-node-compact-small-7, a gateway cron shard outside this PR's UI diff.
  • GitHub refused failed-job rerun permission for both the ragesaq PAT and installed app path, so I retriggered CI with a no-code force-push.
  • The same compact-small-7 sequence passes locally under Node v24.13.0; the cron group reports 50 passed, and src/gateway/server.cron.test.ts reports 18 passed by itself.
  • PR body is updated with the exact fleet-tool evidence and current CI state.

@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. labels Jun 22, 2026
@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 9:01 PM ET / 01:01 UTC.

Summary
The PR projects Codex/WebChat item/preamble progress into Control UI chat stream segments, adds keyed commentary reconciliation and labels, adds a saved Keep commentary setting, regenerates i18n output, and expands focused UI tests.

PR surface: Source +432, Tests +552. Total +984 across 59 files.

Reproducibility: yes. source inspection gives a high-confidence repro path: send a current-main Control UI agent event with stream=item and data.kind=preamble, and handleAgentEvent returns at the non-tool branch before updating chatStream or chatStreamSegments. I did not run a live browser repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Persisted UI setting: 1 added: chatPersistCommentary default false. A saved viewer setting changes WebChat commentary retention defaults and upgrade behavior, so maintainers should notice it before merge.

Stored data model
Persistent data-model change detected: durable storage schema: ui/src/ui/storage.node.test.ts, durable storage schema: ui/src/ui/storage.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Refresh the PR body with current-head proof for default transient behavior plus the Keep commentary toggle, redacting private details.
  • Get maintainer direction on whether this PR or fix(webchat): surface Codex commentary progress #92236 should be the canonical WebChat commentary policy path.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR includes visual media, but the embedded GIF and body text still point to older heads/default-on persistence while the current head defaults persistence off, so current-head real behavior proof should be refreshed before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A fresh visual proof would materially help verify the visible WebChat commentary, tool-card, final-message, and toggle behavior on the latest head. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify current-head WebChat shows commentary during tool activity, preserves tool-card ordering, and clears or keeps commentary according to the Keep commentary setting.

Risk before merge

  • [P1] Landing this independently from fix(webchat): surface Codex commentary progress #92236 could create two competing WebChat policies for the same Codex item/preamble signal.
  • [P1] The new saved chatPersistCommentary setting changes Control UI upgrade/default behavior and needs maintainer acceptance of the default transient mode versus opt-in persistence.
  • [P1] The embedded proof is stale against current head 878b761 because it still describes older default-on persistence media rather than the current default-off behavior.

Maintainer options:

  1. Choose One Commentary Policy (recommended)
    Decide whether WebChat commentary should be transient-only, persisted by preference, or folded into the narrower related PR before landing either implementation.
  2. Fold Keyed Handling Into The Narrow Path
    If maintainers prefer fix(webchat): surface Codex commentary progress #92236, preserve only the keyed replacement/retraction and ordering pieces needed there and close the divergent setting path.
  3. Accept Configurable Persistence
    Maintainers may intentionally accept the saved setting/default behavior after current-head proof shows fresh-install and upgrade-visible behavior clearly.

Next step before merge

  • [P1] The remaining blocker is maintainer policy/proof review, not a narrow automated code repair.

Security
Cleared: The diff is Control UI rendering, settings, tests, and generated i18n only; I found no concrete secret, dependency, workflow, package, or code-execution supply-chain concern.

Review details

Best possible solution:

Maintainers should choose one WebChat commentary policy, fold or reconcile the keyed multi-segment behavior with the chosen path, then require current-head visual proof for the final default and toggle behavior before merge.

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

Yes, source inspection gives a high-confidence repro path: send a current-main Control UI agent event with stream=item and data.kind=preamble, and handleAgentEvent returns at the non-tool branch before updating chatStream or chatStreamSegments. I did not run a live browser repro in this read-only review.

Is this the best way to solve the issue?

Unclear as the best final solution: the keyed reconciliation is useful, but the saved persistence setting and overlap with #92236 make the policy choice maintainer-owned rather than settled by the patch alone.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority Web UI behavior improvement with limited blast radius but real user-visible chat rendering impact.
  • merge-risk: 🚨 compatibility: The PR adds a persisted Control UI setting and default for commentary retention that existing users will inherit on upgrade.
  • merge-risk: 🚨 message-delivery: The PR changes how live commentary, tool cards, and final messages are ordered, cleared, or materialized in WebChat.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR includes visual media, but the embedded GIF and body text still point to older heads/default-on persistence while the current head defaults persistence off, so current-head real behavior proof should be refreshed before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR includes visual media, but the embedded GIF and body text still point to older heads/default-on persistence while the current head defaults persistence off, so current-head real behavior proof should be refreshed before merge.
Evidence reviewed

PR surface:

Source +432, Tests +552. Total +984 across 59 files.

View PR surface stats
Area Files Added Removed Net
Source 53 550 118 +432
Tests 6 557 5 +552
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 59 1107 123 +984

What I checked:

  • Repository policy read: Root AGENTS.md and ui/AGENTS.md were read fully; their PR review, Codex dependency, generated i18n, and compatibility/config guidance affected this review. (AGENTS.md:16, 23527a456d11)
  • Current main ignores the reported item stream: Current main returns before tool handling for any agent event whose stream is not tool, so stream=item kind=preamble progress cannot reach WebChat rendering today. (ui/src/ui/app-tool-stream.ts:761, 23527a456d11)
  • PR head handles item/preamble progress: The PR head adds readPreambleProgressEvent and handlePreambleProgressEvent, normalizes progressText, updates/retracts keyed itemId segments, and runs that branch before the tool-only return. (ui/src/ui/app-tool-stream.ts:727, 878b7615e027)
  • PR head adds a persisted UI setting: The PR head adds chatPersistCommentary to UiSettings and defaults it to false, which makes commentary retention a saved viewer setting and an upgrade/default policy choice. (ui/src/ui/storage.ts:91, 878b7615e027)
  • Focused tests cover both retention modes: The PR head has controller tests that clear keyed commentary by default and persist it only when chatPersistCommentary is true. (ui/src/ui/controllers/chat.test.ts:586, 878b7615e027)
  • Codex contract inspected: The sibling Codex checkout defines MessagePhase as commentary versus final_answer, with commentary described as mid-turn assistant text such as preamble/progress narration. (codex-rs/protocol/src/models.rs:891, db887d03e1f9)

Likely related people:

  • osolmaz: Authored the recent fix(ui): preserve visible chat stream text commit that created much of the stream reconciliation path this PR extends. (role: introduced adjacent behavior; confidence: high; commits: 17a285f29825; files: ui/src/ui/chat/stream-reconciliation.ts, ui/src/ui/chat/build-chat-items.ts, ui/src/ui/app-tool-stream.ts)
  • steipete: Has repeated current-main history on Control UI chat/tool-stream behavior, including live tool events in Control chat and current Control UI source documentation. (role: adjacent owner; confidence: high; commits: de2ccffec166, 12a56d4d46dd, 5f2273e81efc; files: ui/src/ui/app-tool-stream.ts, ui/src/ui/chat/build-chat-items.ts, ui/src/ui/controllers/chat.ts)
  • vincentkoc: Recent commits touched shared UI helper predicates, controller startup metadata, and chat hydration paths adjacent to this stream/display logic. (role: recent area contributor; confidence: medium; commits: b09b35c13c17, 2c6bdc8b2831, c69a8d633d45; files: ui/src/ui/chat/stream-reconciliation.ts, ui/src/ui/controllers/chat.ts)
  • BunsDev: Recent Control UI chat/run state work touched live transcript state, heartbeat hiding, and run status cleanup near the same rendering lifecycle. (role: recent adjacent contributor; confidence: medium; commits: 119a01c82998, 4935e24c7a7f, 1d6de8da9f03; files: ui/src/ui/chat/build-chat-items.ts, ui/src/ui/app-tool-stream.ts)
  • harjothkhara: Authored a recent build-chat-items change around failed internal tool-call collapsing, directly adjacent to this PR's ordering and grouping surface. (role: recent adjacent contributor; confidence: medium; commits: 355c43fe0c9e; files: ui/src/ui/chat/build-chat-items.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@ragesaq

ragesaq commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper follow-up for the current-head proof request.

Updated head: 7c4764a86199f0b2373500ccf990f1612a46863e.

What changed after the feedback:

  • Added visible labels on the rendered blocks: Commentary, Tool call, and Final message.
  • Fixed the Codex-reviewed edge where live final-answer streams could have been mislabeled as Commentary; live chatStream now carries source: "final", while persisted preamble/tool-adjacent stream segments carry source: "commentary".
  • Added explicit coverage for both the three-label proof path and the live final-answer stream label.

Current-head browser proof:

Current-head WebChat proof with Commentary, Tool call, and Final message labels

Validation:

  • Focused UI/controller suite: 5 files, 262 tests passed.
  • Focused oxlint on touched UI files: pass.
  • tsgo UI test project: pass.
  • git diff --check: pass.
  • Codex review rerun after the label-source fix: no clear regression.

Please re-review this head.

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 22, 2026
@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 22, 2026
@clawsweeper clawsweeper Bot added the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Jun 24, 2026
@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from ce39408 to c57819e Compare June 24, 2026 21:09
@ragesaq

ragesaq commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed the branch and addressed the review findings. New head c57819e5fdff037932735b53a442cc2d75b2d47d.

[P1] Conflicting/dirty → resolved. Rebased the 3 commits onto current upstream main; the only conflicts were the 18 generated ui/src/i18n/.i18n/*.meta.json files (the PR adds chat.commentaryLabel/chat.commentaryToggle; main had regenerated its metadata). Regenerated deterministically with node --import tsx scripts/control-ui-i18n.ts sync offline (English fallback, matching the existing approach) and validated with ui:i18n:check (clean). git merge-tree against current main is now clean and the PR reads mergeable: true.

[P2] Keyed commentary live ordering (build-chat-items.ts) → fixed + regression added. Keyed commentary segments are no longer appended after the whole tool loop; each one now merges into the timestamp ordering path (spliced before the first item with a strictly-later visible timestamp). So a preamble that arrived before a later tool renders above that tool while the run is live, not only after final materialization. Tools that share the commentary timestamp and are already visible still stay above it (existing contract preserved). Added a buildChatItems regression covering a keyed preamble between two tools (46 tests in that file, 293 across the affected UI suites, all green; tsgo test-ui typecheck clean).

Persistent-by-default vs transient (#92236). This is a maintainer UX-policy choice, not an author-side defect. chatPersistCommentary defaults to keep; flipping the default to transient (with persistence as an explicit opt-in) is a one-line change if maintainers prefer #92236's behavior as canonical. Happy to make that change on direction.

Where the proof is: ## Evidence → "Animated proof: commentary-persistence toggle (chatPersistCommentary)" (animated GIF embedded in the body). Direct link: https://raw.githubusercontent.com/ragesaq/openclaw/proof/95708-commentary-persist/.proof/pr95708-commentary-persist.gif

The rebase and the ordering fix do not change the commentary-persistence UI behavior shown in the GIF (single-tool ON/OFF toggle), so the existing capture remains valid for the current head; the ordering fix is covered by the new unit regression rather than a re-capture. Capture environment is stated honestly in the body (real built Control UI bundle + real render/reconciliation path, mock Gateway/transport).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@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 Jun 24, 2026
@ragesaq
ragesaq force-pushed the chisel/webchat-preamble-progress branch from c57819e to f61236c Compare June 29, 2026 17:10
@ragesaq

ragesaq commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main at f61236c5a2; conflicts are cleared and the current check rollup is green (success/skipped only).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 30, 2026
ragesaq and others added 6 commits June 30, 2026 18:01
Render Control UI item and preamble progressText events as chat stream segments and preserve pre-final stream commentary before appending final assistant messages. Keyed preamble segments stay independent from accumulated stream snapshots, so distinct same-text commentary items render intact.

Co-authored-by: Chisel <[email protected]>
Add a per-viewer 'Keep commentary' toggle (UiSettings.chatPersistCommentary,
default true) that controls whether keyed Codex preamble/commentary blocks
stay after the final answer or clear with it.

- Persist (default): keyed commentary materializes as durable blocks, current
  behavior, existing proof unchanged.
- Transient (toggle off): commentary stays live during streaming but is never
  materialized, so it disappears as the final message arrives. This is the
  transient-only behavior from openclaw#92236, now user-selectable instead of a
  maintainer-level either/or policy choice.

Single gating point in materializeVisibleStreamState (skip itemId-keyed parts
when persistCommentary is false); threaded from settings through the chat
event handler. Adds desktop + mobile header toggles and an en.ts label
(locale bundles regenerated via ui:i18n:sync, English fallback).

Tests: reconciliation persist/transient coverage, final-event handler honors
the setting, settings round-trip + header button assertions updated.
Keyed preamble commentary was appended after the whole tool loop, so it relied solely on the final visible-time sort for placement and lost the insertion-order tiebreaker against tool cards. Splice each keyed commentary segment into the items list before the first item with a strictly-later timestamp, so a preamble that arrived before a later tool renders above that tool while the run is live (not only after final materialization). Tools sharing the commentary timestamp that are already visible stay above it. Adds a buildChatItems regression covering a keyed preamble between two tools.
@obviyus
obviyus force-pushed the chisel/webchat-preamble-progress branch from 878b761 to bd1891c Compare July 1, 2026 01:02
@obviyus
obviyus merged commit 7006e6f into openclaw:main Jul 1, 2026
67 of 68 checks passed
@obviyus

obviyus commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Landed via rebase onto main.

  • Scoped tests: node scripts/run-vitest.mjs ui/src/ui/chat/stream-reconciliation.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/storage.node.test.ts; node --import tsx scripts/control-ui-i18n.ts check; node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.ui.json; git diff --check
  • Changelog: not updated; release generation owns CHANGELOG.md
  • Land commit: bd1891c
  • Merge commit: 7006e6f

Thanks @ragesaq!

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 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. P2 Normal backlog priority with limited blast radius. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants