Skip to content

fix(control-ui): show reasoning while replies are generating - #117721

Merged
steipete merged 9 commits into
mainfrom
clawsweeper/issue-openclaw-openclaw-88079
Oct 10, 2026
Merged

steipete merged 9 commits into
mainfrom
clawsweeper/issue-openclaw-openclaw-88079

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #88079
Fixes #163567

What Problem This Solves

Control UI received native model reasoning but displayed it only after the saved transcript arrived, leaving users watching “Waiting for a response…” while the model was already thinking.

User Impact

With View → Reasoning enabled, /reasoning on now shows reasoning during generation and hands it over to the saved transcript once. /reasoning stream shows only the live preview, and /reasoning off keeps reasoning hidden. History refreshes retain the active preview. No new settings, dependencies, stored schema, or operator action are required.

Why This Change Was Made

The original branch wrote temporary reasoning directly into the durable message array. Current UI ownership requires a separate transient preview and an exact handoff through the transcript reducer. The repair reuses native/worker assistant occurrence IDs and publishes their stable committed message ID, so repeated reasoning after a tool call cannot be mistaken for an earlier message. Source run IDs remain distinct from client run IDs. Display positions can be renumbered after a session reset; stable message IDs keep that handoff from briefly duplicating the reasoning. Native Ollama’s delayed durable reply blocks from #156389 are unchanged.

The original commits are preserved, with main merged rather than rebased. Token updates retain the existing incremental transcript path. The repair covers native provider and worker reasoning; unowned CLI/harness reasoning is unchanged. A fresh browser reload still waits for the next thinking snapshot or saved transcript; this does not add server-side thinking replay.

Evidence

Current-main reproduction used real Control UI → Gateway → native Ollama, with isolated state and a dedicated headless Playwright Chromium. Qwen3:8b delivered 25 thinking events without live reasoning. The matched Qwen3:4b baseline delivered 48 thinking events; 43 DOM samples after thinking began still had no reasoning, which appeared only 161 ms before chat.final with durable transcript installation.

On the final candidate with Qwen3:4b and /think low, 54 native thinking events were received. Reasoning became visible 62 ms after the first thinking event and 4,121 ms before chat.final. Across 239 rendered-frame samples from first visibility to final, there was exactly one visible reasoning block and no missing frame. The persisted row retained one copy after completion. A separate live stream run received 27 thinking events, showed the preview, honored View off/on while generating, and hid reasoning at final. With off, 66 thinking events arrived but every sampled rendered frame and the final transcript kept reasoning hidden.

Before, during real generation with /reasoning on:

Before: thinking events arrive while Control UI still waits for a response

After, while the same native model is still generating:

After: reasoning is visible during generation, before the final answer

Both captures use synthetic content and masked avatars.

Validation: the new Gateway and UI regressions fail on main for missing occurrence identity and missing reasoning DOM. Additional red/green regressions cover exclusive worker claims, the observed append-18/display-7 handoff, and an empty worker snapshot discarding prior reasoning. After merging main, the reasoning and transcript-budget suites pass 23/23 in 15.71 s wrapper wall (the standalone reasoning suite previously passed 16/16 in 5.35 s); stable-ID Gateway suite: 6/6, 77.40 s (test bodies 3–18 ms). Broader UI reasoning/projection/catalog proof passed 53 tests (80.58 s); existing chat/history/tool/reconciliation siblings also passed. Gateway/native/Ollama proof passed 40 tests (191.79 s), including #156389 stop/length/two-tool-round delayed reply blocks; worker proof passed 14 tests. Test bodies use fake time and no per-test Gateway boots. Transform/setup costs dominate the cold wrapper times. Production and selected test typechecks, touched-file lint, and JSON/Swift/Kotlin protocol generation passed.

Independent Codex autoreview: scoped-clean through P2 on 795139d7106f6768f8b89c3bc27a1f4815a1df4b, after fixing worker-authority and empty-snapshot findings. Runtime build passed in 1m 42.9s; the live proof above was repeated on that exact merged head. ClawSweeper's prior-head code finding was the type-import cycle; moving the reasoning type into the existing leaf stream contract resolves it (Madge: zero cycles, UI types/lint pass).

Final exact-head ClawSweeper review: no actionable code findings, proof sufficient (5/6, with inspected screenshots). The prior image-host limitation is resolved. Its remaining hold requests matching-base failure classification or the native inherited-failure exception for the CI failures below.

Final-head CI run 38049890122 is red: openclaw/ci-gate fails only the two inherited Details-layout E2E shards. The architecture guard and guest-publication shard now pass. Remaining failures reproduce the same four short-pane Send-button geometry cases and two new-session handoffs shifting by exactly 50px. The pending preview has no Details reserve, while the admitted chat adds 50px; this PR changes neither layout owner nor their tests. Source attribution is recorded against main 41c5bf805402: pending preview has no Details reserve, while the admitted transcript reserves 50px. These layout owners and failing tests are unchanged from the first CI merge base. A base-only E2E replay was not run; the remaining CI classification/native exception is a maintainer follow-up and is not claimed green.

Affected line-cap, assertion-safety, timer-race, mock-export, config-docs, and plugin-inventory ratchets pass. The max-lines suppression ratchet passes; its chained environment-count check inherits 456 names against a 455 budget from the merged main revision (zero names added here). The matched pre-integration startup comparison measured only +47 B (374,081 B versus 374,034 B), within 64 B build variance, with unchanged request counts and CSS. The final merged build reports 375,381 B against its 374,861 B ceiling (520 B over); the earlier baseline also exceeded its ceiling. No budget was raised. The runtime build used the supported declaration-build skip; this is not full-release validation.

Production: +392/−62 (net +330); tests: +812/−56 (net +756); docs: +1, relative to merged main 41c5bf805402. Production growth implements the missing live reasoning owner, exact durable occurrence receipts with original worker authority, and incremental transcript projection. Nearby renderer guards were consolidated; the obsolete direct transcript mutation is gone. No changelog edit or model-facing prompt change.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex review: needs changes before merge.

What this changes

Shows native and worker reasoning during generation and reconciles the preview with the saved transcript.

Example: Ask qwen3:4b “What is 2 + 2?” with /reasoning on and View → Reasoning enabled.

  • Before: Control UI displays “Waiting for a response…” while thinking events arrive.
  • After: Reasoning appears during generation and remains as one saved block after completion.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful owner-based repair with inspected shipped-flow proof, targeted regressions and no actionable findings; failed CI remains a separate landing gate.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected native Ollama → Gateway → Control UI before/after screenshots and the exact-head live-run account; on shows reasoning during generation, stream removes it at final, and off hides it throughout. Gateway boundary regressions exercise allowed receipt emission and reject wrong-session, revoked and successor-claim receipts.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users enabling reasoning watch a silent wait even though their model is already producing thinking events.
Reason: Restores existing reasoning controls using the current owners and preserves the established saved-reasoning policy.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this PR fixes a current Control UI bug, has inspected live browser proof, and has no actionable code findings.

Priority: P2
Reviewed head: 795139d7106f6768f8b89c3bc27a1f4815a1df4b

Before merge

  • Complete next step - Qualify both failed browser geometry shards against the actual tested checkout for the native inherited-failure exception, or establish their cause with matching baseline evidence before landing.

Findings

None.

Agent review details

How this fits together

Native subscriptions and worker events send reasoning through Gateway pacing to the browser; transcript receipts identify when durable history owns the displayed occurrence.

flowchart LR
  A[Native model subscription] --> C[Gateway event owner]
  B[Worker runtime] --> C
  C --> D[Transient reasoning preview]
  E[Committed transcript] --> F[Stable identity receipt]
  F --> D
  D --> G[Control UI transcript]
Loading

Technical review

Best possible solution:

Land the existing reasoning repair once required CI is satisfied or its inherited failures qualify for the native exception.

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

Current-main source forwards thinking events without a browser consumer, consistent with the supplied baseline screenshot and the linked report's backend-to-browser trace.

Is this the best way to solve the issue?

The repair uses the existing event, transcript and rendering owners, preserves visibility policy, and identifies handoff by stable occurrence IDs rather than text similarity.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bfe58537cadc.

Provenance checked

  • Saved reasoning visibility keeps the original intent (9846f18: Show saved reasoning only for on plus the local visibility toggle; keep off and stream hidden after reload.)
  • Embedded reasoning emission keeps the original intent (22b3c25: Split streaming ownership while retaining rendering, reset and delivery behavior.)
  • Gateway paced progress keeps the original intent (1d68ad3: Keep progress in the run-owned trailing batch and revalidate the original claim before delivery.)
  • Worker live events keeps the original intent (6cd1133: Provide restricted worker execution with bounded, degradable previews and durable transcript settlement.)
  • Transcript projection performance keeps the original intent (d53b32b: Keep unchanged and streaming renders independent of loaded history length.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 22b3c25 adds src/agents/embedded-agent-subscribe.stream-rendering.ts:548 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 22b3c2530f11; files: src/agents/embedded-agent-subscribe.stream-rendering.ts)
  • Robert: Raw commit 9c068e1 adds src/agents/embedded-agent-subscribe.stream-rendering.ts:587 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9c068e13bd18; files: src/agents/embedded-agent-subscribe.stream-rendering.ts)

PR surface

Source +330, Tests +756, Docs +1. Total +1087 across 29 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 24 392 62 +330
Tests 4 812 56 +756
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 29 1205 118 +1087

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +392/−62; tests +812/−56 Growth supplies transient reasoning, stable occurrence receipts and incremental projection, with distinct UI lifecycle, worker protocol and Gateway authority regressions.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Reasoning-enabled browser sessions silently hide model progress, while final-answer delivery remains usable.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (27 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-25T05:28:25.396Z sha e92f3b6 :: found issues before merge. :: [P1] Replay live thinking after history resets
  • reviewed 2026-09-02T00:21:18.616Z sha e92f3b6 :: found issues before merge. :: [P1] Replay live thinking after a history reset
  • reviewed 2026-09-17T09:08:13.366Z sha e92f3b6 :: blocked before merge. :: [P1] Replay live thinking after a history reset
  • reviewed 2026-09-25T18:40:56.468Z sha e92f3b6 :: blocked before merge. :: [P1] Replay live thinking after a history reset
  • reviewed 2026-10-02T14:11:31.314Z sha e92f3b6 :: blocked before merge. :: [P1] Replay live thinking after a history reset
  • reviewed 2026-10-10T10:12:00.725Z sha e92f3b6 :: needs changes before merge. :: [P1] Replay live thinking after a history reset
  • reviewed 2026-10-10T11:21:34.790Z sha 997cab7 :: needs changes before merge. :: [P2] Remove the reasoning module's circular contract import
  • reviewed 2026-10-10T12:00:05.874Z sha 795139d :: needs changes before merge. :: none

Reviewed October 10, 2026, 8:28 AM ET / 12:28 UTC (Revision 28).

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞🧹
ClawSweeper autofix is enabled.

  • Head: aef90a4f964e
  • Label: clawsweeper:autofix
  • Action: exact-head review queued (workflow sweep.yml, event repository_dispatch).
  • Flow: review this head, repair/rebase only if needed, then re-review the exact repaired head until no actionable findings remain.

This is fix-only; I will not merge this PR.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞🔧
ClawSweeper applied a repair to this PR branch.

Repair: kept the fix on this contributor branch instead of opening a replacement PR.
Validation: pnpm check:changed
Updated head: e92f3b61d62e
Run: https://github.com/openclaw/clawsweeper/actions/runs/30727766810

Current state: exact-head review queued immediately; GitHub checks and the review verdict gate final merge.

Automerge progress:

  • 2026-08-02 01:49:32 UTC review requested repair aef90a4f964e (structured ClawSweeper marker: fix-required (finding=review-feedback sha=aef90a...)
  • 2026-08-02 02:05:52 UTC review queued e92f3b61d62e (after repair)

@clawsweeper
clawsweeper Bot force-pushed the clawsweeper/issue-openclaw-openclaw-88079 branch from aef90a4 to e92f3b6 Compare August 2, 2026 02:05
@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: 🧂 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. labels Aug 2, 2026
@clawsweeper clawsweeper Bot added clawsweeper:human-review Needs maintainer review before ClawSweeper can continue and removed merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Replay live thinking after a history reset (P1) - During a thinking-only active run, loadChatHistory() reaches maybeResetToolStream() because no assistant-text stream or live tool cards exist. This added clean...; Review finding: [P1] Replay live thinking after a history reset — ui/src/pages/chat/tool-stream.ts:351-355 (sha=e92f3b61d62e2cbd2002ed17fad903e7267511c3)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 2, 2026
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 10, 2026
@steipete steipete changed the title fix(control-ui): render live thinking agent events in WebChat fix(control-ui): show reasoning while replies are generating Oct 10, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The branch now preserves the original commits and merges current main. Live native Ollama proof, inspected before/after images, regression results, and the clean independent review are in the updated body. The reasoning preview hands off by stable message ID and retains the original worker authority.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Oct 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XL and removed size: S labels Oct 10, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The circular type dependency is removed through the existing leaf stream contract; Madge reports zero cycles. Main is merged through 41c5bf8, and the exact-head native Ollama proof was repeated with updated inspected screenshots in the body. The body also records the separate inherited Details-layout CI failures and the automated review's image-host limitation.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Complete next step - Qualify both failed browser geometry shards against the actual tested checkout for the native inherited-failure exception, or establish their cause with matching baseline evidence before l... (sha=795139d7106f6768f8b89c3bc27a1f4815a1df4b)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 10, 2026
@steipete

Copy link
Copy Markdown
Contributor

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui ci:no-fail-fast Keep all selected CI matrix jobs running after failures on the next PR run. clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:human-review Needs maintainer review before ClawSweeper can continue clawsweeper Tracked by ClawSweeper automation 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 [Regression] WebChat: reasoning_content not streamed for Kimi Code & DeepSeek Reasoner — only MiniMax works

2 participants