Skip to content

fix(codex): preserve steered turns after final replies - #184992

Merged
steipete merged 2 commits into
mainfrom
fix/codex-steered-turns-180935
Oct 26, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/codex-steered-turns-180935

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a follow-up steered into native Codex while an earlier final reply is delivered can be interrupted before it receives an answer. The earlier reply's delivery state can also suppress that answer, and discarding the earlier terminal candidate can lose a successful sibling sessions_yield.

Related: #147759. This does not claim to fix #176028 or stale native-thread ownership.

User Impact

Steered follow-ups remain eligible for an answer after an earlier final reply, while a successful independent yield still ends the turn. No configuration, schema, migration, dependency, or public SDK changes are required.

Why This Change Was Made

The lifecycle controller remembers that steering was submitted even after its consumption receipt arrives. It removes the earlier final reply's terminal authority while preserving an independent terminal sibling. Confirmed consumption resets current-input reply suppression; previously suppressed item identities remain suppressed in terminal snapshots. Finalization reports the latest input's delivery state independently of historical send receipts and runtime refresh.

Once any steering is submitted, even a later final send answering that steer finishes through the existing native loop instead of the host's early-terminal optimization. Consumption confirms history admission, not completion of an answer. Explicit yield retains its existing authority. Ordinary non-steered final replies keep their existing behavior.

This incorporates main's bounded steering drain from #184062; that change handles acknowledgement-to-consumption timing but does not address the later answer, projection, and finalization gaps above. The current contributor head also preserves upstream raw-item role checks and terminal admission/drain handling.

Evidence

Independent autoreview of this integrated head remains pending. Earlier helper attempts did not produce a complete verdict and are not counted as a passing review.

  • Regression proof: both consumption/release orderings fail on base 837a38a625cc915ab17c9d204c8106235c5dafd1 by losing the steered partial reply; the repaired candidate passed 130 tests across seven suites, followed by 38 affected tests after the final helper extraction. Inventory checks passed 32 tests. These local runs precede the contributor's latest integration.
  • Current contributor head f1b1a0eca5896871578efab899e004d4d08ae886: the contributor reports 122/122 tests across seven lifecycle, steering, assistant projection, and finalization suites, with targeted typed lint, formatting, and normal commit hooks passing. Exact-head hosted CI passed, including the new test's full-suite registration, openclaw/ci-gate, and security checks: https://github.com/openclaw/openclaw/actions/runs/40311973916 and https://github.com/openclaw/openclaw/actions/runs/40313846648.
  • Production +93/-24 (net +69); tests and inventory +447/-202 (net +245). Existing test scaffolding was extracted and reused; the remaining production growth keeps submitted steering, suppressed item identity, independent yield, and current-input delivery facts with their existing owners.
  • Historical contributor live proof used an isolated Gateway, native Codex 0.160.0, a real model, and a synthetic QA HTTP channel. With A's delivery receipt held, native steering accepted B; releasing A produced actual outbound PROOF_ANSWER_A and PROOF_ANSWER_B. The earlier repair delivered only A; the fixed run passed in 20.262 seconds of test execution (58.81 seconds command time).
  • No fresh real-model/Gateway run was made for the latest integration. The prior live proof remains evidence for its original head; direct/nested successful-yield sibling orderings have regression coverage, not live-model proof. No live installation was changed.

Credit: original fix, regression coverage, and Gateway investigation by @LeoStehlik.

Replacement validation

Replaces #180935; credit @LeoStehlik. The original PR cannot initialize its retained native workflow after the shared tooling state advanced beyond that workflow’s supported schema. Its binding remains untouched.

This replacement starts from current main and carries the same reviewed change: stable patch ID 6cc17a0e0c531ee402502ca66428a56c22127ded; all ten affected Codex source/test files are byte-identical to reviewed head a188d68d1d6c76619527887041800c2e8bf45fdb. The test inventory preserves main’s unrelated entry. Leo’s change is authored by Leo, followed by the existing repair commit.

The historical pending-review sentence above is superseded: three complete owner-scoped independent reviews finished clean after repairs. Two additional regressions were red on the contributor head and green on the reviewed repair: mixed final/authored terminal authority and host TTS provenance. Typed lint and formatting passed. The replacement rerun passed all 58 tests with one worker per file: steering 8 (116.37s wall), media lifetime 1 (37.81s), lifecycle 46 (44.63s), and steering settlement 3 (51.62s). The unchanged Codex owner bytes retain the three completed clean autoreviews and targeted typed lint/format proof; commit hooks also formatted the carried change.

Whole change: production +73; tests/inventory +296. No new live Gateway/model round-trip; prior contributor live traces remain prior-head evidence.

Co-authored-by: Leo Stehlik [email protected]

LeoStehlik and others added 2 commits October 26, 2026 13:26
Keep accepted steering alive through native completion and scope reply suppression and delivery state to the input it answers. Preserve independent terminal yields and earlier suppressed item identities.

Replaces the reviewed contributor change from #180935.
Prevent an authored sibling from restoring a delivered reply's terminal authority after steering, while preserving independent explicit yields.

Keep the projector result identity carrying host-issued TTS delivery provenance through finalization.

Co-authored-by: Leo Stehlik <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review October 26, 2026 20:32
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T20:32:48.107869Z d243c10 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves answers to steered Codex follow-ups after an earlier final reply while retaining independent terminal yields.

Example: Codex delivers PROOF_ANSWER_A while a second question is steered into the active turn.

  • Before: The first delivery can interrupt the turn or suppress PROOF_ANSWER_B.
  • After: The second question remains eligible for its answer, while an explicit successful yield can still finish the turn.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused repair with historical production-entry evidence and no actionable finding; live evidence is prior-head and exact-head CI is unfinished.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; the supplied historical Gateway/native Codex/real-model run exercised held A delivery and accepted B steering with outbound A then B, while replacement-head evidence remains focused tests rather than a fresh live run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A follow-up accepted while Codex finishes an earlier reply can receive no visible answer.
Reason: The repair addresses concrete answer loss, and the maintainer-authored body explicitly accepts native completion after steering.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a current Codex follow-up delivery defect; no actionable introduced bug was found, and exact-head CI remains pending.

Priority: P1
Reviewed head: d243c10ca1a84a2cff76ba19ceeba5b058ea0d82

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The recorded live Gateway run predates this replacement, and successful final-send-plus-yield combinations have regression coverage rather than live-model coverage.
Agent review details

How this fits together

The Codex plugin translates Gateway follow-ups into native steering, projects native assistant events, and combines delivery receipts with native completion into the final run result.

flowchart TD
A[Gateway follow-up] --> B[Steering queue]
B --> C[Native Codex turn]
C --> D[Consumption notification]
D --> E[Assistant projection]
F[Tool delivery receipts] --> G[Lifecycle and finalizer]
E --> G
G --> H[Visible answer and run outcome]
Loading

Technical review

Best possible solution:

Keep steering custody, input-specific reply suppression, independent yields, and delivery accounting with their existing owners as this patch does.

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

Current-main source exposes premature terminal release and persistent reply suppression after steering consumption, corroborated by the linked independent reproduction; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch repairs the existing owners without adding a competing execution path, and its documented native-completion tradeoff is accepted by the maintainer-authored direction.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Final-source-reply termination and suppression changes intended behavior with a stated reason (7a5529f: Avoid extra model requests and redundant replies after a confirmed final action on the current source.)
  • Steering consumption identity keeps the original intent (7a3c26b: Separate RPC acceptance from matching transcript consumption so interruption cannot falsely report delivery.)
  • Whole-batch terminal sibling admission keeps the original intent (9c9b2bb: Preserve finished tool-authored replies without hiding unfinished or failed sibling work.)
  • Steered transcript ordering and item identity keeps the original intent (c108ae6: Preserve already-visible assistant output before steering and prevent replay or disappearance during transcript reconciliation.)
  • Refresh-specific accepted steering snapshots keeps the original intent (cf9cbef: Carry accepted prepared input across managed runtime refresh without replaying completed effects.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 236bce8 adds extensions/codex/src/app-server/run-attempt-lifecycle-controller.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 236bce82535c; files: extensions/codex/src/app-server/run-attempt-lifecycle-controller.ts)
  • Alexis Gallagher: Raw commit 7a3c26b adds extensions/codex/src/app-server/attempt-steering.ts:182 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7a3c26b509f1; files: extensions/codex/src/app-server/attempt-steering.ts)
  • Paul Bohm: Raw commit f83b7ad adds extensions/codex/src/app-server/attempt-steering.ts:500 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: f83b7ade15f3; files: extensions/codex/src/app-server/attempt-steering.ts)

PR surface

Source +73, Tests +296. Total +369 across 11 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 6 93 20 +73
Tests 5 498 202 +296
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 591 222 +369

Review metrics

Metric Value Why it matters
Production versus test growth Production +93/-20; tests and inventory +498/-202. Production growth retains distinct lifecycle and delivery facts in existing owners; test growth reuses extracted scaffolding and covers receipt ordering, suppression, authored siblings, and direct/nested yields.

Root-cause cluster

Relationship: canonical
Canonical: #184992
Summary: This PR is the explicit replacement for the earlier steering repair; the merged consumption drain addresses only an adjacent stage.

Members:

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

Labels

Label changes:

  • add P1: Accepted follow-ups can receive no visible answer during an active Codex conversation.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: Accepted follow-ups can receive no visible answer during an active Codex conversation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 execution lanes are retired.

Reviewed October 26, 2026, 4:39 PM ET / 20:39 UTC.

@steipete
steipete merged commit 349c1a4 into main Oct 26, 2026
213 of 216 checks passed
@steipete
steipete deleted the fix/codex-steered-turns-180935 branch October 26, 2026 20:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
Preserve a follow-up steered into native Codex while an earlier final reply is delivered. A steering consumption receipt records the input, not completion of its answer, so the earlier reply must not interrupt the native turn or suppress the follow-up answer.

Retain submitted steering through terminal release, reset current-input suppression on confirmed consumption, preserve suppressed assistant item identities in terminal snapshots, and report current-input delivery independently of historical receipts. Independent successful yield retains its terminal authority, including nested Code Mode siblings. Non-steered final replies retain their existing behavior.

Mixed final-send/authored-reply batches cannot restore discarded terminal authority after steering, while independent explicit yields remain effective. Preserve the projector result object so host-issued TTS delivery provenance survives finalization.

Once steering is submitted, later final sends also finish through the existing native loop instead of the host's early-terminal optimization. No configuration, schema, dependency, or public SDK change is introduced.

Replaces openclaw#180935.

Related: openclaw#147759

Co-authored-by: Leo Stehlik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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]: Steering skips the message-tool answer on message-tool-only turns, so the earlier message never gets its reply

2 participants