Skip to content

fix(codex): keep live commentary tables and code blocks readable - #129828

Merged
steipete merged 2 commits into
mainfrom
codex/preserve-commentary-markdown
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/preserve-commentary-markdown

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users watching live Codex commentary would see Markdown tables, paragraph breaks, indentation, and fenced code blocks collapse into one unreadable paragraph while an agent was working. The same commentary looked correct after the response completed because persisted transcript entries retained the original Markdown.

Why This Change Was Made

Preserve the original whitespace at the Codex commentary event producer instead of flattening every whitespace run into a space. The upstream Codex app-server protocol forwards assistant-message deltas verbatim (codex-rs/app-server-protocol/src/protocol/event_mapping.rs:362-370), declares each delta as an unmodified string (codex-rs/app-server-protocol/src/protocol/v2/item.rs:1348-1356), and assembles completed agent-message text without whitespace normalization (codex-rs/app-server-protocol/src/protocol/v2/item.rs:826-837). The existing Control UI Markdown renderer already correctly handles multiline streamed tables and fenced code. Outer trimming and per-item duplicate suppression remain unchanged.

User Impact

Live Codex progress updates now keep readable Markdown tables, paragraphs, fenced code blocks, and code indentation instead of becoming a wall of literal pipes and inline code.

Evidence

  • Reproduced the reported issue against the live Control UI and recovered the exact persisted commentary: it contained 21 newline characters, a valid table, and a fenced code block; applying the existing producer's whitespace replacement reproduced the screenshot exactly.
  • Extended the existing Codex commentary projector regression with a real Markdown table and fenced code block. Before the fix it failed because progressText flattened the complete message into one line; after the fix both owner-boundary projector suites pass: 44 tests across two files.
  • node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.commentary.test.ts extensions/codex/src/app-server/event-projector.assistant.test.ts
  • node scripts/check-changed.mjs -- extensions/codex/src/app-server/event-projector-assistant.ts extensions/codex/src/app-server/event-projector.commentary.test.ts
  • Structured Codex autoreview: clean, with no actionable findings.
  • Real Control UI proof: a deterministic mocked Gateway emits the same keyed preamble first with the old flattened producer output and then with the fixed multiline output while the run remains active. Browser assertions verify zero tables/code blocks before, then a two-row table and fenced code block afterward. The screenshots use only synthetic, public-safe fixture data.

Before: live commentary flattened into one paragraph

Before: live commentary renders literal Markdown pipes and an inline code fence

After: live commentary preserves the table and fenced code block

After: live commentary renders a readable Markdown table and fenced code block

Production LOC: +1/-1 (net 0). Tests: +17/-5.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. 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. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 12:27 AM ET / 04:27 UTC.

ClawSweeper review

What this changes

The PR stops collapsing internal whitespace in streamed Codex commentary and adds regression coverage for a live Markdown table and fenced code block.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

The PR cleanly repairs the lossy producer boundary and resolves the prior changelog/proof follow-ups, but it remains maintainer-handled: the branch is behind main, an exact-head build check is in progress, and the required direct Codex-source inspection could not run because the sibling checkout and network access were unavailable.

Priority: P2
Reviewed head: d235c3cad3f523cd5307fa035e40896bc7cff77f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, owner-boundary repair with focused regression coverage and supplied UI evidence; merge readiness awaits contract and exact-head CI refresh.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable because the author is a repository member; the PR body nevertheless provides redacted before/after Control UI screenshots using synthetic fixture data.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable because the author is a repository member; the PR body nevertheless provides redacted before/after Control UI screenshots using synthetic fixture data.
Evidence reviewed 6 items Current-main regression: Current main flattens every whitespace run before emitting commentary progress, which necessarily removes Markdown line boundaries.
Producer-boundary repair: The PR changes only the commentary progress snapshot to trim outer whitespace while retaining interior whitespace and keeps per-item duplicate suppression intact.
UI consumer preserves the payload: The Control UI reads keyed preamble progress text, replaces the matching stream segment, and sends assistant stream text through the Markdown rendering path.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.commentary.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-codex.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129828-YdFo2S/target

 ✓  extension-codex  extensions/codex/src/app-server/event-projector.commentary.test.ts (23 tests) 96ms

 Test Files  1 passed (1)
      Tests  23 passed (23)
   Start at  04:28:14
   Duration  26.22s (transform 21.69s, setup 933ms, import 24.85s, tests 96ms, environment 0ms)

[test] passed 1 Vitest shard in 32.19s
[test] starting test/vitest/vitest.extension-codex.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129828-YdFo2S/target

 ✓  extension-codex  extensions/codex/src/app-server/event-projector.commentary.test.ts (23 tests) 91ms

 Test Files  1 passed (1)
      Tests  23 passed (23)
   Start at  04:28:47
   Duration  11.35s (transform 7.07s, setup 438ms, import 10.60s, tests 91ms, environment 0ms)

[test] passed 1 Vitest shard in 17.28s

Assertions:

  • PASS expect_output: event-projector.commentary.test.ts

How this fits together

The Codex app-server projector receives assistant commentary and emits keyed progress events for the active run. The Control UI stores those events as live stream segments and renders their text as streaming Markdown.

flowchart LR
A[Codex commentary delta] --> B[Commentary projector]
B --> C[Keyed progress event]
C --> D[Control UI stream segment]
D --> E[Streaming Markdown renderer]
E --> F[Readable tables and code blocks]
Loading

Decision needed

Question Recommendation
Should this maintainer-authored PR wait for a fresh direct Codex app-server source inspection and completed exact-head checks before merge? Refresh contract and CI evidence: Re-run the Codex-source inspection and wait for the exact-head build check before making the merge decision.

Why: Repository policy requires direct inspection of the cited Codex protocol before a merge recommendation, but the required checkout could not be accessed in this review environment.

Before merge

  • Resolve merge risk (P1) - The branch is behind main and its exact-head build-artifacts check was still in progress in the supplied state.
  • Resolve merge risk (P1) - The required direct Codex protocol-source check could not be completed because the sibling checkout was absent and network DNS was unavailable.
  • Complete next step (P2) - The protected maintainer label and unavailable direct Codex-source check require maintainer handling rather than an automated repair lane.
Agent review details

Security

None.

PR surface

Source 0, Tests +12. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 17 5 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 18 6 +12

Review metrics

Metric Value Why it matters
Production versus test LOC production net 0 (+1/-1); tests net +12 (+17/-5) The behavior repair is absorbed into the existing projector and adds focused owner-boundary coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the producer-boundary repair, re-run the direct Codex protocol inspection from an available sibling checkout, and merge only after exact-head CI is green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the producer-boundary repair, re-run the direct Codex protocol inspection from an available sibling checkout, and merge only after exact-head CI is green.

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

Yes: current main's whitespace replacement at the commentary producer deterministically flattens multiline Markdown before the live event is emitted.

Is this the best way to solve the issue?

Yes in OpenClaw: preserving structure at the producer is the narrow canonical repair because the downstream UI intentionally renders the progress text as Markdown; upstream Codex-source verification remains outstanding.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable because the author is a repository member; the PR body nevertheless provides redacted before/after Control UI screenshots using synthetic fixture data.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 other: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This fixes a bounded but user-visible Control UI live-commentary rendering defect.
  • 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: Not applicable because the author is a repository member; the PR body nevertheless provides redacted before/after Control UI screenshots using synthetic fixture data.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Authored the focused Codex commentary repair and its follow-up removal of the release-owned changelog change; deeper feature history was unavailable in this partial checkout. (role: current implementation contributor; confidence: medium; commits: fbdd3d8b53ff, d235c3cad3f5; files: extensions/codex/src/app-server/event-projector-assistant.ts, extensions/codex/src/app-server/event-projector.commentary.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Re-run the Codex app-server protocol inspection with the required sibling checkout available.
  • Wait for the exact-head build-artifacts check and review refresh before merge.

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-08-26T03:41:07.414Z sha 1055e3caa7fd11356bdaaef7f4c45c19c3451473 :: found issues before merge. :: [P2] Remove the release-owned changelog entry | [P2] Add sanitized Control UI proof for the live rendering change

@steipete
steipete force-pushed the codex/preserve-commentary-markdown branch from 1055e3c to d235c3c Compare August 26, 2026 04:19
@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: 🦪 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 26, 2026
@steipete
steipete merged commit b1dbdd3 into main Aug 26, 2026
121 checks passed
@steipete
steipete deleted the codex/preserve-commentary-markdown branch August 26, 2026 04:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…nclaw#129828)

* fix(codex): preserve markdown in live commentary

* chore: keep release-owned changelog out of bug fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant