Skip to content

fix(ui): hide saved Codex reasoning unless enabled - #136008

Merged
steipete merged 2 commits into
mainfrom
steipete/reasoning-visibility-changes-866326
Sep 2, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/reasoning-visibility-changes-866326

Conversation

@steipete

@steipete steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #135978

Additional instructions

Maintainers can push to this same-repository branch.

What Problem This Solves

Fixes an issue where users who disabled reasoning would still see a Codex reasoning: block as ordinary assistant-answer text in Control UI after a Codex turn completed or the transcript reloaded. The related reasoning-only display path also hid intentionally enabled reasoning or grouped it with the final answer instead of completed work.

Why This Change Was Made

The Codex plugin now preserves standard typed thinking content through the existing transcript mirror, and Control UI preserves that type through normalization, distinguishes it from heartbeat acknowledgments and final replies, and renders it inside completed work. Saved reasoning is visible only when the session uses /reasoning on and View → Reasoning is enabled; off, stream, and missing values do not opt into saved reasoning display.

The old generic title-based mirror constructor and callback plumbing are removed. There are no new settings, protocol/schema changes, provider defaults, or prefix-matching compatibility paths. Existing malformed historical rows are not rewritten, and supported channel streaming previews are unchanged. The separate native external-session catalog view is not part of this repair.

User Impact

Reasoning no longer appears as answer text in newly recorded Codex dashboard turns when it is disabled. When explicitly enabled, it is available inside Worked without hiding the final answer. The behavior survives reload, works with and without tool calls, and respects the local visibility toggle. Mixed text/media answers and actual heartbeat acknowledgment suppression remain intact.

Evidence

Reproduction and owner boundaries

  • Read-only inspection of an affected session confirmed an explicit /reasoning off followed by another completed turn containing a plain-text reasoning row. No private session content or original screenshots are published here.
  • The original producer defect is patch-verified in 9ac7a039 — harden Codex app-server harness. That change added reasoning mirrors as type: "text"; the malformed shape remains present in the v2026.8.1 source tag.
  • Upstream Codex contract personally inspected: event_mapping.rs:378–395 keeps summary/raw reasoning notifications distinct from assistant text.
  • Regression tests failed before the fixes: both native delta variants returned plain text instead of typed thinking; the SQLite read-back reproduced it; UI tests exposed heartbeat misclassification, dropped thinking content, empty-bubble suppression, and final/work grouping. The stream-mode cases separately failed before tightening the visibility gate to on only.

Automated validation

741 focused tests passed across Codex projection/mirroring, Gateway display projection, and UI normalization/grouping/rendering. The SQLite regression was rerun after replacing its incomplete fixture with the existing lifecycle-managed projector fixture: 50/50 passed.

node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector-snapshot.test.ts extensions/codex/src/app-server/event-projector.reasoning.test.ts extensions/codex/src/app-server/outcome-fallback-runtime-contract.test.ts extensions/codex/src/app-server/transcript-mirror.test.ts ui/src/pages/chat/chat-thread-grouping.test.ts ui/src/pages/chat/chat-thread.test.ts ui/src/pages/chat/chat-thread.nested-activity.test.ts ui/src/pages/chat/components/chat-message.test.ts ui/src/pages/chat/components/chat-transcript-render.test.ts ui/src/lib/chat/message-normalizer.test.ts ui/src/lib/chat/message-extract.test.ts ui/src/lib/chat/heartbeat-display.test.ts src/gateway/chat-display-projection.test.ts src/gateway/session-transcript-message.test.ts

20 browser cases passed for the initial repair, covering reasoning, completed work, tool outcomes, and heartbeat rollups. After the explicit on-only requirement, all six reasoning cases passed: off/on/stream × with/without tools, including reload and the local View → Reasoning toggle.

node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-reasoning-visibility.e2e.test.ts ui/src/e2e/chat-worked-for-visualization.e2e.test.ts ui/src/e2e/chat-tool-turn-outcome.e2e.test.ts ui/src/e2e/chat-heartbeat-activity-rollup.e2e.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-reasoning-visibility.e2e.test.ts
node scripts/check-changed.mjs

The full changed gate passed after the fixture correction. UI typecheck, targeted lint, formatting, and git diff --check also passed after the on-only follow-up. A full local pnpm build passed before the initial push, including runtime bundles, public SDK declaration checks, external plugin builds, and the production Control UI. Fresh Codex autoreview at its configured P0 threshold found no blockers. This evidence uses real Chromium and temporary SQLite stores with synthetic Gateway/native-event fixtures; it is not a live provider or live channel test.

Visual proof

The attached screenshots were captured from a running isolated Control UI and inspected in full. They use only synthetic conversation data and public model labels. The before case replays the pre-fix plain-text mirror shape; after cases use the canonical thinking shape verified by the producer-to-SQLite regression.

Attachments, in order: before with reasoning off; after with reasoning off; after with reasoning on and Worked expanded; after with stream mode and Worked expanded.

Scope and size

Production: +50/−41 (net +9). Tests: +309/−66 (net +243). Docs: +5/−2. The remaining production growth supplies the missing normalized thinking variant and activity/display semantics after removing duplicate mirror plumbing and consolidating assistant grouping decisions.

Related work was checked: #117365 proposes a different per-block disclosure UI, and #128249 changes inherited/default reasoning projection. Neither is closed or claimed as fully superseded by this explicit-session Codex visibility repair. Provider-tag parsing reports #89473 and #91804 and non-persistence feature request #54496 are separate scopes.

Before: reasoning appears as answer text with reasoning off

After: reasoning off leaves the final answer visible without reasoning

After: reasoning on reveals typed reasoning only inside expanded Worked

After: stream mode keeps saved reasoning hidden even in expanded Worked

Preserve native Codex reasoning as typed thinking rather than ordinary answer
text. Keep reasoning-only activity out of heartbeat suppression and final
reply grouping, while retaining visible mixed-content answers.

Show saved reasoning only with /reasoning on and the local visibility toggle;
keep off and stream hidden through history reload and Worked expansion.

Remove obsolete mirror-factory plumbing and cover native event projection,
SQLite persistence, normalization, grouping, and real browser behavior. Existing
malformed historical rows are not rewritten and channel previews are unchanged.

Fixes #135978
@steipete steipete self-assigned this Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui extensions: codex size: M maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 05:54
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 2:17 AM ET / 06:17 UTC.

ClawSweeper review

What this changes

The PR stores Codex reasoning as typed thinking content and shows saved reasoning in Control UI only for an explicit on session plus the local Reasoning view toggle.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. The branch still addresses a current-main Codex transcript defect, and the prior P1 concern was resolved by correcting a fixture to the supported visibility enum; no introduced blocking defect was found.

Priority: P1
Reviewed head: e429f2a1e0e6f79e2162c17dc6fe8db8a1f2da1e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch uses the correct producer boundary, addresses the resolved prior review concern, and has focused persistence and browser coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply; the supplied fixture coverage is supplemental. Prepared local images belonged to related PRs rather than this PR, so they were not used as evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply; the supplied fixture coverage is supplemental. Prepared local images belonged to related PRs rather than this PR, so they were not used as evidence.
Evidence reviewed 5 items Current-main producer defect: Fetched main serializes the reasoning mirror as ordinary assistant text with a Codex reasoning: prefix, so the reported UI behavior remains relevant until this PR lands.
Producer-boundary repair: The introduced snapshot path now creates a discriminated thinking block before transcript mirroring, rather than encoding reasoning as answer text.
Codex protocol contract: The inspected sibling Codex source maps summary and raw reasoning deltas to separate reasoning notifications, rather than agent-message text; repository ownership could not be independently verified because its configured remote is a local cache.
Findings None None.
Security None None.

How this fits together

Codex app-server events enter the Codex plugin, which mirrors transcript records into OpenClaw session history. The Gateway supplies that history to Control UI, where typed reasoning is separated from final replies and completed work.

flowchart LR
  A[Codex app-server events] --> B[Codex plugin projector]
  B --> C[Typed reasoning record]
  C --> D[SQLite transcript mirror]
  D --> E[Gateway history]
  E --> F[Control UI transcript]
  F --> G[Worked and reasoning visibility]
Loading

Before merge

  • Resolve merge risk (P1) - Existing sessions using stream will no longer expose saved reasoning in Control UI history; this is a deliberate compatibility-visible change aligned with the updated transient-only documentation.
  • Complete next step (P2) - No repair dispatch is needed: the prior actionable finding is fixed and this maintainer PR now awaits normal exact-head CI and merge handling.
Agent review details

Security

None.

PR surface

Source +9, Tests +243, Docs +3. Total +255 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 10 50 41 +9
Tests 9 311 68 +243
Docs 2 5 2 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 366 111 +255

Review metrics

Metric Value Why it matters
Production versus test LOC production +50/-41 (net +9); tests +311/-68; docs +5/-2 The small production increase supplies the canonical typed-reasoning and activity/reply boundary while removing obsolete mirror plumbing; regression coverage is substantially larger.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #135978
Summary: This PR is the candidate repair for the reported explicit-session Codex reasoning display bug; inherited/default reasoning visibility remains distinct work.

Members:

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

Merge-risk options

Maintainer options:

  1. Retain the documented on-only history rule (recommended)
    Accept the intentional stream-history behavior change because the PR documents it and tests off/on/stream visibility through reload.

Technical review

Best possible solution:

Keep the producer-owned typed reasoning representation and apply the existing Control UI visibility controls so only explicit on sessions reveal saved reasoning.

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

Yes—current-main source shows the plain-text mirror producer, and the PR provides focused SQLite and browser paths for the affected transcript flow; this review did not execute them.

Is this the best way to solve the issue?

Yes—the producer emits the canonical typed content, allowing existing normalization, grouping, and visibility controls to handle it without prefix-based filtering or a new setting.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Fetched main can display Codex reasoning as ordinary assistant text despite the session visibility setting.
  • merge-risk: 🚨 compatibility: The PR intentionally changes how previously saved reasoning is displayed for stream-mode sessions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply; the supplied fixture coverage is supplemental. Prepared local images belonged to related PRs rather than this PR, so they were not used as evidence.

Evidence

What I checked:

  • Current-main producer defect: Fetched main serializes the reasoning mirror as ordinary assistant text with a Codex reasoning: prefix, so the reported UI behavior remains relevant until this PR lands. (extensions/codex/src/app-server/event-projector-assistant-message.ts:152, bdfc22bffbec)
  • Producer-boundary repair: The introduced snapshot path now creates a discriminated thinking block before transcript mirroring, rather than encoding reasoning as answer text. (extensions/codex/src/app-server/event-projector-assistant-message.ts:152, e429f2a1e0e6)
  • Codex protocol contract: The inspected sibling Codex source maps summary and raw reasoning deltas to separate reasoning notifications, rather than agent-message text; repository ownership could not be independently verified because its configured remote is a local cache. (codex-rs/app-server-protocol/src/protocol/event_mapping.rs:378, 78c290807ce710180111df227df3b7a4fe845452)
  • Prior finding resolved: ReasoningLevel only permits off, on, and stream, and session patching rejects high; the follow-up commit changes the browser fixture from invalid high values to valid on values. (src/auto-reply/thinking.shared.ts:27, e429f2a1e0e6)
  • Behavioral coverage: The added browser test covers off, on, and stream, with and without tools, after reload, and after toggling local reasoning visibility; the SQLite test verifies typed reasoning persists beside the final answer. (ui/src/e2e/chat-reasoning-visibility.e2e.test.ts:8, e429f2a1e0e6)

Likely related people:

  • steipete: 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 (1 earlier review cycle)
  • reviewed 2026-09-02T06:03:24.790Z sha ddb6bf1 :: found issues before merge. :: [P1] Preserve saved reasoning for supported enabled levels

@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the CI failure and reviewed the ClawSweeper finding/Rank-up moves against the owning contract.

high is a thinking-effort value, not a supported persisted reasoning-visibility value: ReasoningLevel is off|on|stream; normalizeReasoningLevel does not accept high; sessions.patch rejects it and persists the normalized visibility value.

The history-navigation fixture had confused these fields. e429f2a changes its two reasoningLevel values from high to on, preserving every assertion. The original CI failure now passes locally together with all six visibility cases: 12/12 browser tests, plus the fixture changed-file gate and fresh Codex autoreview at P0.

node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.history-recovery.e2e.test.ts ui/src/e2e/chat-reasoning-visibility.e2e.test.ts
node scripts/check-changed.mjs -- ui/src/e2e/chat-flow.history-recovery.e2e.test.ts

The P1 compatibility finding is therefore not accepted: a permissive test fixture does not establish a supported persisted contract. Both Rank-up moves are explicitly skipped as proposed: preserving high is not supported, and projecting inherited/default-enabled reasoning is outside this repair's maintainer-approved explicit-session on-only requirement. The valid navigation case is retained and proven; off/stream/local-toggle/reload coverage stays intact. PR #128249's effective-default work remains separate, not superseded.

Production code is unchanged from the reviewed head. Existing inspected synthetic before/after screenshots remain in the PR body; none were re-uploaded. Historical malformed rows remain a separate, approval-gated data repair. Exact-head CI is running for e429f2a1e0e6f79e2162c17dc6fe8db8a1f2da1e; this is not yet a merge-ready claim.

@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 Sep 2, 2026
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready preparation completed for e429f2a. Merge is intentionally waiting for the lead checkpoint; no merge/deploy/release has been run.

The producer-owned typed-thinking repair and explicit-session on-only + local Reasoning toggle behavior are unchanged from the reviewed patch. The only follow-up was the two-line history-navigation fixture correction in e429f2a, preserving all assertions. Production is +50/-41 (net +9), tests +311/-68 (net +243), docs +5/-2.

Exact-head CI 33597696413, attempt 1 completed successfully, including build, the previously failing UI shard, and openclaw/ci-gate. The original failed run was diagnosed, not bypassed. Fresh Codex autoreview after the correction was scoped-clean at the configured P0 threshold.

node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.history-recovery.e2e.test.ts ui/src/e2e/chat-reasoning-visibility.e2e.test.ts
node scripts/check-changed.mjs -- ui/src/e2e/chat-flow.history-recovery.e2e.test.ts
node scripts/watch-pr-ci.mjs 136008 e429f2a1e0e6f79e2162c17dc6fe8db8a1f2da1e
scripts/pr review-validate-artifacts 136008
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 136008

The browser pair passed 12/12, and changed-file checks passed. The original 741 focused tests, SQLite projector-to-mirror read-back, Chromium sibling proof, and full build remain recorded in the PR body. Native prepare passed at 2026-09-02 06:22:40 UTC, verified matching local/remote head trees, and reused exact-head hosted CI (hosted_exact_or_recent_parent); it did not rebase or create a separate Testbox lease.

The latest ClawSweeper review, reviewed 06:17:48 UTC on this exact head, has no actionable findings and acknowledges the corrected fixture. The prior finding and Rank-up proposals were addressed explicitly. The intentional change that hides saved reasoning for stream is accepted under the maintainer's explicit on-only contract and is documented/tested; no inherited/default projection is added. The latest review contains no new Rank-up moves.

Four inspected synthetic before/after screenshots are already in the PR body; no re-upload. Proof uses real Chromium with synthetic Gateway/native events and temporary SQLite, not a live provider/channel run. Existing malformed historical rows are not rewritten; that and the external native session catalog conversion remain separate work. No production service restart or state writes.

@steipete
steipete merged commit 9846f18 into main Sep 2, 2026
231 checks passed
@steipete
steipete deleted the steipete/reasoning-visibility-changes-866326 branch September 2, 2026 06:44
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
* fix(ui): honor reasoning visibility in saved Codex replies

Preserve native Codex reasoning as typed thinking rather than ordinary answer
text. Keep reasoning-only activity out of heartbeat suppression and final
reply grouping, while retaining visible mixed-content answers.

Show saved reasoning only with /reasoning on and the local visibility toggle;
keep off and stream hidden through history reload and Worked expansion.

Remove obsolete mirror-factory plumbing and cover native event projection,
SQLite persistence, normalization, grouping, and real browser behavior. Existing
malformed historical rows are not rewritten and channel previews are unchanged.

Fixes openclaw#135978

* test(ui): use valid reasoning visibility in history fixture
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 extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

[Bug]: Control UI shows Codex reasoning with /reasoning off

1 participant