Skip to content

fix: keep Codex activity ordered when steering active runs - #126997

Merged
shakkernerd merged 3 commits into
mainfrom
fix/codex-steer-transcript-order
Aug 21, 2026
Merged

shakkernerd merged 3 commits into
mainfrom
fix/codex-steer-transcript-order

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #126938

What Problem This Solves

Fixes an issue where steering an active Codex run could preserve prior commentary and tool activity only while the run was live, then rebuild the completed transcript with that work in the wrong position or leave it expanded instead of the normal Worked for … disclosure.

Why This Change Was Made

OpenClaw now mirrors the stable pre-steer activity prefix and commits the steering user turn at Codex's confirmed user-message boundary, before terminal reconciliation can append later output. The Control UI uses the persisted steer marker to keep the linked run expanded while active and collapse its completed work before the steering message.

User Impact

Users can steer an active Codex run without losing or rearranging previously visible work. After completion, the transcript matches Codex Desktop: pre-steer activity appears under Worked for … before the steer, and the final response remains after it.

Evidence

  • Live OCM/Codex reproduction preserved commentary and sleep 30 above the steer during execution.
  • Read-only SQLite inspection confirmed durable order: initial user turn, pre-steer commentary/tool activity, steering user turn, final assistant reply.
  • Rebuilt Control UI verified in Chrome that Worked for 46s renders before the steering message after completion.
  • Testbox: 199 focused Codex and Control UI tests passed, with extension/UI production and test typechecks green.
  • Control UI production build passed.
  • Autoreview completed with no accepted or actionable findings.

Visual proof

Before: completed work appears after the steering message.

clipboard

After: completed work collapses before the steering message.

clipboard

@clawsweeper

clawsweeper Bot commented Aug 21, 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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 21, 2026, 1:59 AM ET / 05:59 UTC.

ClawSweeper review

What this changes

The PR persists pre-steer Codex commentary and tool activity before the accepted steering user message, then renders that activity as completed work before the steering message in Control UI.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep this maintainer-authored PR open: it addresses a current-main transcript-ordering gap, but retains the release-owned changelog edit and lacks the required direct Codex app-server contract inspection.

Priority: P1
Reviewed head: 663c85b8d9cb3933996db6e3466bfd4d235319b8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has strong behavior evidence and focused regression coverage, but needs the small changelog cleanup and a direct Codex contract check for a higher-confidence merge verdict.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The PR body provides after-fix live Codex/Control UI behavior, durable SQLite ordering evidence, and before/after screenshots; the remaining gap is reviewer-side protocol inspection, not contributor proof.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR body provides after-fix live Codex/Control UI behavior, durable SQLite ordering evidence, and before/after screenshots; the remaining gap is reviewer-side protocol inspection, not contributor proof.
Evidence reviewed 7 items Current-main gap: Current main creates the steering queue without a pre-confirm persistence hook, so an accepted steering user-message completion resolves the batch without first mirroring the existing activity prefix.
Persistence owner boundary: The PR attaches the pre-confirm hook at the active Codex turn, mirrors completed pre-steer activity, and persists the accepted inbound steering turn before queue delivery resolves.
UI continuation grouping: The PR derives continuation links from durable steering metadata and uses the linked terminal reply to collapse the earlier turn's work while keeping the active chain expanded.
Findings 1 actionable finding [P3] Remove the release-owned changelog entry
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126997-dWt3rl/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 107.53 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 14.1s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4295ms (slowest: built plugin control-plane loads 3573ms)

OpenClaw 2026.8.1 (663c85b) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Commands:

How this fits together

The Codex extension receives app-server events and mirrors them into the durable session transcript. Control UI rebuilds that transcript into chat turns, keeping active work expanded and collapsing completed intermediate work.

flowchart LR
A[Codex app-server events] --> B[Codex event projector]
B --> C[Durable session transcript]
D[Accepted steering message] --> C
C --> E[Control UI turn grouping]
E --> F[Worked for disclosure]
E --> G[Final chat reply]
Loading

Decision needed

Question Recommendation
Should merge wait for direct inspection of the Codex app-server userMessage completion/clientId contract, or should maintainers accept the supplied live, SQLite, and UI evidence without that contract check? Require direct Codex contract verification: Have a reviewer with the sibling Codex checkout verify the item/completed userMessage clientId behavior before merge.

Why: The PR depends on Codex app-server protocol semantics, and repository policy requires direct sibling-source inspection before a Codex verdict; that checkout is absent and cannot be fetched in this environment.

Before merge

  • Remove the release-owned changelog entry (P3) - CHANGELOG.md is generated by the release flow, while the PR body already contains the required user-facing context. Remove this normal-PR entry before merge.
  • Resolve merge risk (P1) - The bug fix adds approximately net +220 production lines across durable transcript persistence and Control UI continuation grouping; this state-machine growth needs the missing app-server contract check before merge.
  • Resolve merge risk (P1) - The Codex user-message completion contract cannot be independently verified because the required sibling Codex source is unavailable in this review environment.

Findings

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:72
Agent review details

Security

None.

PR surface

Source +220, Tests +153, Docs +1. Total +374 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 8 248 28 +220
Tests 3 153 0 +153
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 402 28 +374

Review metrics

Metric Value Why it matters
Production versus test LOC production +248/-28 (net +220); tests +153/-0; release file +1 The bug fix substantially expands persistence and UI grouping logic, so the owner-boundary justification and protocol proof matter before merge.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/chat/session-message-apply.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the canonical steering boundary (recommended)
    Remove the release-owned changelog line and verify the Codex completion contract before merging the changed transcript-persistence sequence.
  2. Accept the remaining protocol-proof gap
    Merge based on the supplied live and visual evidence while explicitly accepting that this review could not inspect the upstream Codex event contract.

Technical review

Best possible solution:

Remove the release-owned changelog entry and have a reviewer with the Codex source confirm that the correlated userMessage completion is the canonical persistence boundary; no simpler owner-level seam currently serializes durable prefix, steering turn, and terminal transcript order.

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

Yes, source reproducibility is medium-confidence: current main lacks the pre-confirm durable-prefix write and continuation grouping present in this branch, but the exact Codex completion-event contract could not be inspected locally.

Is this the best way to solve the issue?

Unclear: the persistence and UI changes sit at the apparent owners, but a best-fix verdict requires direct verification that Codex's correlated userMessage completion is the intended authoritative boundary.

Full review comments:

  • [P3] Remove the release-owned changelog entry — CHANGELOG.md:72
    CHANGELOG.md is generated by the release flow, while the PR body already contains the required user-facing context. Remove this normal-PR entry before merge.
    Confidence: 0.99

Overall correctness: patch is correct
Overall confidence: 0.63

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

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

Label justifications:

  • P1: The PR repairs a user-visible active-run transcript ordering defect in the Codex workflow.
  • merge-risk: 🚨 session-state: The patch changes durable transcript ordering and live-to-completed session-state reconciliation around steering.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body provides after-fix live Codex/Control UI behavior, durable SQLite ordering evidence, and before/after screenshots; the remaining gap is reviewer-side protocol inspection, not contributor proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix live Codex/Control UI behavior, durable SQLite ordering evidence, and before/after screenshots; the remaining gap is reviewer-side protocol inspection, not contributor proof.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body provides after-fix live Codex/Control UI behavior, durable SQLite ordering evidence, and before/after screenshots; the remaining gap is reviewer-side protocol inspection, not contributor proof.

Evidence

Acceptance criteria:

  • [P1] git diff --check.
  • [P1] git diff --numstat.

What I checked:

Likely related people:

  • Peter Steinberger: Authored recent merged work on Codex input persistence and streamed-reply ordering across steering. (role: recent Codex and Control UI contributor; confidence: high; commits: 7e0b599ca484, 08622cd76694; files: extensions/codex/src/app-server/attempt-steering.ts, ui/src/pages/chat/chat-thread-grouping.ts)

Rank-up moves

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

  • Remove the release-owned CHANGELOG.md line.
  • Have a reviewer with ../codex inspect the correlated userMessage completion/clientId contract 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 (3 earlier review cycles)
  • reviewed 2026-08-21T04:31:01.292Z sha 4312a36 :: found issues before merge. :: [P1] Associate the steer with its persisted target run | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-21T05:10:37.934Z sha a39a6ee009c2811b766dd26f1296dfa408f4a052 :: found issues before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-21T05:28:21.073Z sha 05713cf714af3068c19b8e0a9461a8367b7b52f7 :: found issues before merge. :: [P3] Remove the release-owned changelog entry

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. labels Aug 21, 2026
@shakkernerd
shakkernerd force-pushed the fix/codex-steer-transcript-order branch from a39a6ee to 05713cf Compare August 21, 2026 05:21
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 21, 2026
@shakkernerd
shakkernerd force-pushed the fix/codex-steer-transcript-order branch from 05713cf to 663c85b Compare August 21, 2026 05:53
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 21, 2026
@shakkernerd
shakkernerd force-pushed the fix/codex-steer-transcript-order branch from 663c85b to c4eab4a Compare August 21, 2026 06:33
@shakkernerd shakkernerd self-assigned this Aug 21, 2026
@shakkernerd
shakkernerd force-pushed the fix/codex-steer-transcript-order branch from c4eab4a to faa1cfc Compare August 21, 2026 06:46
@shakkernerd
shakkernerd merged commit faa1cfc into main Aug 21, 2026
10 checks passed
@shakkernerd
shakkernerd deleted the fix/codex-steer-transcript-order branch August 21, 2026 06:46
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Codex steering now preserves activity order, removes transient commentary duplication, and settles completed work smoothly.

vincentkoc added a commit that referenced this pull request Aug 21, 2026
* origin/main: (107 commits)
  perf(test): speed up Agents page observation polling (#127063)
  fix(android): explicitly target notification intents (#127055)
  fix(agents): preserve literal Unicode-space paths (#126797)
  fix(agents): distinguish review routing from enforcement (#126216)
  fix(ui): associate steering work by target run (#126997)
  fix(ui): collapse completed pre-steer work
  fix(codex): preserve steering transcript order
  fix(gateway): retain Bonjour cleanup on startup failure (#127062)
  fix(release): require concrete validation retry groups (#127012)
  fix(file-transfer): expose directory page tokens (#127051)
  perf: trim setup detection worker imports (#127053)
  fix(onboard): make --auth-choice help match the accepted set (#127030)
  fix(gateway): await cron exit watcher drain (#126963)
  fix(telegram): preserve direct-topic self-history (#127050)
  fix: dismiss sidebar session menu tooltip (#127044)
  perf(test): speed up pairing access polling (#127047)
  perf(cli): remove ineffective dynamic imports (#127046)
  fix(gateway): recover credential-file accounts after secrets reload (#126999)
  fix(gateway): restore scheduler-owned Gateway context (#126640)
  fix(macos): keep first-run onboarding visible after Gateway changes (#127038)
  ...

# Conflicts:
#	.github/workflows/full-release-validation.yml
#	test/scripts/full-release-validation-at-sha.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
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 extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant