Skip to content

fix(codex): resume parent sessions after workers finish - #160608

Merged
fuller-stack-dev merged 3 commits into
openclaw:mainfrom
fuller-stack-dev:fix/codex-yield-continuation-20260928
Sep 28, 2026
Merged

fuller-stack-dev merged 3 commits into
openclaw:mainfrom
fuller-stack-dev:fix/codex-yield-continuation-20260928

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes Codex parent sessions stopping after their workers finish when the parent has yielded or its native turn has already ended.

User Impact

Parents retain the completion needed to resume, and recovery can read history containing earlier yield records. Active parents still avoid duplicate completion delivery, and explicit parent retirement still prevents a wake. This change requires an updated runtime; it does not replay previously failed deliveries automatically.

Why This Change Was Made

Native completion input can be queued without starting a parent turn. A receipt therefore counts as delivered only while the exact parent owner can consume it. Yielded, settled, and cancelled owners leave the result pending for the existing detached continuation path.

Recovery now converts durable custom, shell, and summary history through the shared message converter after evidence verification, while retaining content, pairing, exclusion, and size checks.

Evidence

  • Reproduced both failures before the fix: real accepted sessions_yield followed by a worker receipt before teardown lost the wake; earlier yield history rejected finalization capture for both file and SQLite sessions.
  • 110 history tests, 82 native completion tests, and 23 Gateway/completion-authority tests passed. Final lifecycle extraction rerun passed all 9 cases. Independent source-blind checks passed 11 history and 14 completion scenarios.
  • Full build, built SDK import smoke, all selected core/extension typechecks, lint, and repository guards passed. Independent review completed with no P0-P2 findings.
  • Whole touched test files and the extracted fixture helper were audited. Existing assertions were retained; shared fixture setup was moved without deleting coverage. Fixtures own private stores and join cleanup.
  • Measured local wrapper costs: history selection 120.07s; native selection 148.07s; final 9-case native rerun 75.04s. The file/SQLite capture suite rerun took 58.56s with cold transform overhead and passed both cases. These exercise the actual history-worker/finalization boundary rather than mocking away the failure.

After incorporating current main, all 43 affected tests passed: real Gateway completion authority, direct announcement delivery, and accepted-yield continuation. The rebase preserved the reviewed patch exactly. Live Gateway deployment is separate from this source change.

Test cost

Measured each file separately on head fc1b7ee339260b2976cb9c35b6d267a501fd0120 with node scripts/run-vitest.mjs extensions/codex/src/app-server/<file> --maxWorkers=1. All 79 cases passed. Local wall includes startup, transforms, imports, test execution and joined cleanup; the first process starts with an empty compiler cache and later processes reuse it. CI seconds below are the sum of Vitest-reported case durations in the linked passing job, not job wall or isolated-process timing.

Test file Local wall CI case time CI evidence
native-subagent-monitor.terminal-receipts.test.ts 95.75s 0.030s passed job
settled-turn-projection.test.ts 19.67s 0.044s passed job
session-history-control.test.ts 41.40s 18.634s passed job
session-history.test.ts 53.63s 35.047s passed job
run-attempt.native-followup-custody.test.ts 66.81s 20.985s passed job

The extracted session-history.test-support.ts helper has no standalone tests; both history files exercise it. The first receipt-file process spent 93% of its 91.04s Vitest phase transforming source. The actual new yield-receipt case took 1.321s locally and 2.410s in CI. The slower history and yield tests cross the real history worker, private SQLite storage, and accepted-yield lifecycle; a mocked converter or receipt predicate would bypass the original failures. No sleeps, retry increases or time-limit changes were added.

Hosted CI attribution

Run 36462471023, attempt 1, reports an inherited Gateway fixture type error: session-row-projection.config-commits.test.ts:76 omits the reloader scheduler required on main. The fixture and reloader blobs are identical in the tested merge, its main base and current main; this PR changes neither file. Canonical main independently repaired it in 4bd105408ccdac229eee8f719f082ba143f0c26c, with passing fixture, Gateway typecheck and lint proof recorded in that commit. This PR now includes that repair through normal merges at head 93dd50c5516b55dbe7c267b92c3ed93899cf85d7; #160615 adds separate fixture cleanup and is no longer a dependency. The authored 12-file patch is byte-identical to the reviewed and tested patch. The historical failure remains recorded; Current-head CI, attempt 2 passed. Attempt 1 left 143 jobs unassigned; the documented hosted-runner retry completed the remaining checks while reusing passed jobs. ClawSweeper also reviewed this exact head with no blocking findings.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 28, 2026 18:03
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 2:40 PM ET / 18:40 UTC (Revision 2).

ClawSweeper review

What this changes

The Codex plugin retains worker completions for a yielded or settled parent and converts earlier durable session history during final-answer recovery.

Merge readiness

✅ Ready for maintainer review

Current main still has both reported failure paths. The branch addresses them in the existing Codex owners, the prior request for per-file test costs is satisfied, and this review found no discrete blocking defect.

Priority: P1
Reviewed head: 93dd50c5516b55dbe7c267b92c3ed93899cf85d7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused owner-level patch has substantive boundary coverage and measured test costs, with no blocking finding from this review.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The member-authored PR is exempt from external-contributor setup proof. Its reported before/after cases exercise the production monitor and file/SQLite history worker with a simulated Codex client; no live app-server run is shown, and no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from external-contributor setup proof. Its reported before/after cases exercise the production monitor and file/SQLite history worker with a simulated Codex client; no live app-server run is shown, and no stored-data contract changes.
Evidence reviewed 9 items Current-main receipt behavior: Current main marks a native result delivered when its turn ID is known, without checking whether the parent owner has yielded or settled.
Current-main history behavior: The current-main projection rejects earlier custom, shell, and summary messages as unsupported.
Introduced receipt guard: The patch requires the exact active parent owner to be unsettled, uncancelled, and not yielded before its receipt can consume a completion.
Findings None None.
Security None None.

How this fits together

The Codex plugin receives native worker notifications and tracks whether a parent session can consume them. Unconsumed results enter OpenClaw’s detached continuation path, which reads session history before resuming the parent.

flowchart LR
A[Worker completion] --> B[Native receipt monitor]
C[Parent turn state] --> B
B --> D{Parent can consume?}
D -->|Yes| E[Foreground receipt]
D -->|No| F[Pending continuation]
F --> G[Verified session history]
G --> H[Resumed parent response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +43, Tests +317. Total +360 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 6 54 11 +43
Tests 6 432 115 +317
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 486 126 +360

Review metrics

Metric Value Why it matters
Production and test LOC production +43 net, tests and fixtures +317 net Production growth is confined to receipt ownership and history conversion; the PR body explains the added boundary tests and their measured cost.

Technical review

Best possible solution:

A yielded or settled Codex parent receives each worker result through one authorized continuation, with verified bounded history and no wake after explicit retirement.

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

Yes. Current main’s turn-ID-only receipt check and rejection of durable control history identify focused failing paths; the PR reports pre-fix reproductions, which this read-only review did not execute.

Is this the best way to solve the issue?

Yes. The patch changes receipt eligibility in the existing native monitor and uses the shared converter inside the verified history projection, without adding a second delivery owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The branch adds one public Plugin SDK converter export; its shared use is described in the PR, and it removes no existing call.

Label justifications:

  • P1: A yielded parent can silently miss a worker completion, interrupting an active agent workflow.
  • merge-risk: 🚨 message-delivery: Receipt eligibility determines whether a worker result is acknowledged in the foreground or delivered through a detached continuation.
  • merge-risk: 🚨 compatibility: The branch adds one public Plugin SDK converter export; its shared use is described in the PR, and it removes no existing call.
  • 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. Not applicable: The member-authored PR is exempt from external-contributor setup proof. Its reported before/after cases exercise the production monitor and file/SQLite history worker with a simulated Codex client; no live app-server run is shown, and no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Baris Albayrak: 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-28T18:12:52.561Z sha fc1b7ee :: needs changes before merge. :: none

@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) September 28, 2026 18:39
@fuller-stack-dev
fuller-stack-dev merged commit 7c8c71b into openclaw:main Sep 28, 2026
276 of 420 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/codex-yield-continuation-20260928 branch September 28, 2026 19:25
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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.

1 participant