Repository navigation
fix(control-ui): show reasoning while replies are generating - #117721
Conversation
|
Codex review: needs changes before merge. What this changesShows 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before merge
FindingsNone. Agent review detailsHow this fits togetherNative 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +330, Tests +756, Docs +1. Total +1087 across 29 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (27 earlier review cycles; latest 8 shown)
Reviewed October 10, 2026, 8:28 AM ET / 12:28 UTC (Revision 28). |
|
🦞🧹
This is fix-only; I will not merge this PR. Re-review progress:
|
aef90a4 to
e92f3b6
Compare
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
|
@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. |
|
🦞👀 Re-review progress:
|
|
@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. |
|
🦞👀 Re-review progress:
|
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
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 onnow shows reasoning during generation and hands it over to the saved transcript once./reasoning streamshows only the live preview, and/reasoning offkeeps 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.finalwith 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 beforechat.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 livestreamrun received 27 thinking events, showed the preview, honored View off/on while generating, and hid reasoning at final. Withoff, 66 thinking events arrived but every sampled rendered frame and the final transcript kept reasoning hidden.Before, during real generation with
/reasoning on:After, while the same native model is still generating:
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-gatefails 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 main41c5bf805402: 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.