Skip to content

fix(codex): resume stopped parents while native children continue - #172145

Merged
steipete merged 8 commits into
openclaw:mainfrom
Baumus:fix/codex-parent-continuation-20261014
Oct 15, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
Baumus:fix/codex-parent-continuation-20261014

Conversation

@Baumus

@Baumus Baumus commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #171140.
Related approach: #171110 by @VishalJ99 (still an open draft; leave it open until this PR merges).

What Problem This Solves

Stopping or yielding a Codex parent while native children continue can leave the parent claimed, rejecting follow-up messages and child-result continuations as active elsewhere.

User Impact

The original conversation can accept another message after Codex confirms the exact parent turn has ended, while its native children remain observable. Child results retain their original session lineage and once-only delivery. No settings, schema changes, or migration are required.

Why This Change Was Made

Keep the existing subscription owner and distinguish child subscription custody from foreground turn authority. Cleanup joins the exact native interruption before retaining the parent. Publication checks the current source, initiating session lineage, physical client, binding, and claim; replaced sessions and revoked sources cannot inherit it. Native work arriving during foreground admission can use one fresh cleanup admission, and an already-started publication is never replayed.

Fresh main includes #172287 (73c9e39c619a): failed-thread recovery still owns coordinated teardown and configuration refresh. This repair uses its existing thread/subscription lifecycle, without creating another recovery path. Source/history confirm that main's settled-turn-only retention and protected warm-claim release still produce the reported blockage.

Original fix by @Baumus; maintainer cleanup removes a redundant retention predicate and duplicate pre-turn release, shares stop/yield fixtures, strengthens original-session/duplicate-completion and stale-turn assertions, and documents continuation. CI follow-up preserves incognito permission-change retention and rejects stale-lineage publication even when an original background process remains active. The confirmed-interruption approach comes from @VishalJ99; both contributors are credited in the commit.

Evidence

Final head 446b811446b16cd92194d4ed8b1b588a4b736463: CI run 38695728145 passed (42 jobs, 28 intentional skips). All 61 applicable PR checks pass, with no failures or pending checks. Production/test typechecks, typed lint, docs, and both changed-extension test bundles passed.

PR CI is the test and typecheck gate per maintainer policy. Live Gateway proof, leases, local tests/typechecks, and production-revert negative controls were intentionally skipped. No contributor code was executed on the maintainer host; local checks were static only.

Regression coverage for CI:

  • continues an interrupted parent and delivers its child's result (warm: %s): cold/warm continuation, original session destination, and duplicate completion suppression.
  • does not publish an interrupted parent after its %s is replaced: binding and session-lineage replacement.
  • settles a yielded parent under retained source authority (revoked: %s): closed foreground with valid/revoked original source.
  • keeps native yield cleanup alive after its subscription route is released: interrupt acknowledgment, unrelated/stale completion, and exact native terminal receipt.
  • recovers subscription custody when row admission fails %s: arriving native custody and no replay after publication.
  • Existing incognito permission-change cleanup and rechecks %s background custody at subscription retention tables: preserve permission restarts and forbid stale-lineage reusable custody. The active-process row previously expected successful publication after lineage replacement; this source-verified oracle is corrected to require rejection and no reusable subscription. Peer processes retain cleanup-only protection.

Static checks: formatting and git diff --check pass. Changed-file core oxlint reports only the existing run-attempt-resources.ts max-lines limit: both main and this head are 707 counted lines (limit 700); other diagnostics are clean. Tools ran from clean trusted main against copied changed files. The shared install lacks the UI-only Solid lint plugin, so the static config omits only its unmatched ui/**/*.tsx override; all applicable rules remain enabled. No dependencies were installed.

Autoreview: isolated Codex P0-P2 branch review is scoped-clean, with no accepted/actionable findings. Fresh isolated review also covers follow-up commit ac26244daeed; it found no actionable P0-P2 findings, including in the incognito correction and strengthened lineage oracle. The subsequent main merges have no overlapping changes in this owner. The first CI run passed all six parent cases and all production/test typechecks. It exposed an incognito restart regression and the stale-lineage oracle described above; both are repaired in the follow-up. Its unrelated UI lint failure was fixed upstream by e1dbb5644873 and is included by the subsequent main merge. The final CI run passes both repaired cases, including the incognito restart and active-background stale-lineage rejection. No workflow reruns were needed; the second run follows the code correction and required main merge.

Test cost: six table-driven parent cases, one additional subscription-admission variant, and assertions in an existing lifecycle case; no new CI job, real sleeps, polling, or live-model dependency. The parent file shrank from 334 to 317 lines. LOC versus merged main: production +61/-43 (net +18), tests +419/-63 (net +356), docs +7/-0, test routing +1/-0. The necessary production growth records native confirmation and preserves source/lineage checks; no unrelated deletion was used to meet a line target. Maintainer cleanup reduces the contributor delta by 15 total lines. Local wall times are not measured by policy. Final-head CI measured the six parent cases at 4.960s, 0.618s, 0.318s, 0.327s, 3.913s, and 0.707s (10.843s total test time), all passing. The active-background lineage case passed in 0.807s and the incognito permission-restart case in 4.591s. Final extension test job.

ClawSweeper's complete latest review reports no concrete code findings. Its remaining requests concern live native-boundary/final-effect proof; PR CI is the proof per maintainer policy. The authority checks and rejection regressions remain in scope.

Native source and deferred-effect checks

Personally inspected the read-only native Codex checkout at be2951ea34f0d295ed0becf97079f92fa5f6950e:

Captured facts at deferred retention:

Fact Current-owner check or reason to retain it
Original source and cleanup lifetime Retained source assertion plus cleanup-release flag at publication; host liveness remains the fallback when no source exists.
Session identity and lineage Original binding authority's withCurrent/assertCurrent; child completion retains its captured history owner and source custody.
Physical client, thread, and claim Recheck physical client ID, current binding under its lease, and branded live-thread ownership before publication.
Child/process custody Re-evaluate current process inventory or parent protection after awaited admission; protection alone grants no new source or session authority.
Exact stopped turn The attempt records confirmation only after the router's correlated native terminal receipt; unrelated/stale turns cannot satisfy it.
Configuration, service tier, and paths Preserve the loaded thread's fingerprint/policy and that attempt's service tier; the next turn uses the existing configuration/adoption owner. No new deferred filesystem effects.
Time and retry limits Check settlement expiry before optional admission and publication; keep existing bounded interrupt deadlines and one admission retry without polling or replay.

@clawsweeper

clawsweeper Bot commented Oct 14, 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.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR makes stopped Codex parents reusable after confirmed native interruption while retaining subscriptions for their running children.

Example: Parent thread-1 stops while child-thread continues working.

  • Before: The next parent message can fail with “Codex session became active in another runner.”
  • After: After the exact parent turn ends, another message can reuse thread-1 while its child remains observable.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has useful boundary coverage and a green exact-head CI gate, but required real native behavior and final-effect authority evidence remain absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Stopping or yielding a Codex parent can block later messages while its native children continue.
Reason: The reported released-version failure has a matching current-source mechanism, and the existing lifecycle contributor's follow-up commits retain and refine this repair direction.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: current main still exposes the stopped-parent claim failure, and this PR provides a focused repair with no concrete introduced code defect found.

Priority: P1
Reviewed head: 446b811446b16cd92194d4ed8b1b588a4b736463

Before merge

  • Add real behavior proof - Authority-chain proof required: the final-head tests exercise real attempt, subscription, and source owners with an emulated Codex peer, while live proof is explicitly skipped. Show Stop and sessions_yield with a running native child, same-parent continuation, exactly one child-result delivery, and rejection of revoked original-source or replaced-lineage authority before reusable custody or native I/O. Redacted terminal output or logs are sufficient; remove IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security concern: Verify authority after foreground closure - The changed cleanup scope substitutes retained source liveness for foreground host liveness. Source and lineage guards are present, and synthetic rejection tests exercise them, but supplied evidence does not establish the allowed and forbidden native flows through the shipped runtime.
  • Resolve merge risk - Before merge, establish that retained cleanup authority cannot publish reusable custody or permit subsequent native writes for a revoked original source or replaced session lineage.

Findings

  • [medium] Verify authority after foreground closure — extensions/codex/src/app-server/run-attempt-resources.ts:102

Tests

  • Missing end-to-end proof: Missing real Gateway/App Server Stop and sessions_yield flows with an active child, subsequent parent input, once-only child delivery, and forbidden-authority rejection; a final-head pre-fix negative control was intentionally skipped.
Agent review details

How this fits together

The Codex plugin translates Gateway attempts into native App Server turns; its lifecycle and subscription owners coordinate interruption, session authority, retained thread custody, and child-result delivery.

flowchart TD
  A[Gateway conversation] --> B[Codex attempt]
  B --> C[Native parent turn]
  C --> D[Native child work]
  C --> E[Exact interruption receipt]
  E --> F[Subscription owner]
  D --> F
  F --> G[Parent continuation]
Loading

Technical review

Best possible solution:

Keep continuation in the existing subscription owner, requiring exact native interruption confirmation and current original-source, lineage, binding, and claim authority.

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

Current-main retention and protected-claim release establish the failure mechanism, consistent with the reporter's released-version logs; no current-main native end-to-end reproduction was run.

Is this the best way to solve the issue?

The patch repairs the existing lifecycle and subscription owners, preserves incognito permission-restart behavior, and strengthens lineage checks without adding another recovery path.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Verify the retained-authority handoff (recommended)
    Supply allowed and nearest-forbidden final-effect evidence for stopped-parent reuse, original-source revocation, and session-lineage replacement.

Provenance checked

  • Ordinary subscription retention changes intended behavior with a stated reason (64c543a: Retain settled failed conversations under existing ownership and configuration checks so later input can continue the same thread.)
  • Immediate local terminal-tool completion changes intended behavior with a stated reason (033247a: Complete the local terminal-tool path immediately instead of parking parent progress behind the native interruption watcher; this PR keeps local completion immediate while explicitly joining native settlement before subscription transfer.)
  • Initiating lineage and physical-client custody keeps the original intent (283d5e6: Prevent stale sessions from borrowing peer process custody or mutating successor subscriptions.)
  • Original-source background authority keeps the original intent (d97094e: Preserve independently authorized background work while retaining source revocation and prohibiting new admission after release.)
  • Incognito permission-change retention keeps the original intent (67433ff: Apply changed workspace permissions through confirmed native interruption and coordinated continuation.)

Testing

Proof path: in-process harness.

Security

Needs attention: No reachable authorization bypass was found, but the retained-source handoff still needs final-effect verification.

Evidence

Security concerns:

  • [medium] Verify authority after foreground closure — extensions/codex/src/app-server/run-attempt-resources.ts:102
    The changed cleanup scope substitutes retained source liveness for foreground host liveness. Source and lineage guards are present, and synthetic rejection tests exercise them, but supplied evidence does not establish the allowed and forbidden native flows through the shipped runtime.
    Confidence: 0.94

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 283d5e6 adds extensions/codex/src/app-server/run-attempt-resources.ts:92 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 283d5e6fe371; files: extensions/codex/src/app-server/run-attempt-resources.ts)
  • Shakker: Raw commit d97094e adds extensions/codex/src/app-server/native-process-authority.ts:210 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d97094ef2ee4; files: extensions/codex/src/app-server/native-process-authority.ts)
  • Galin Iliev: Raw commit 3f0b58e adds extensions/codex/src/app-server/run-attempt-cleanup.ts:112 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3f0b58e2696b; files: extensions/codex/src/app-server/run-attempt-cleanup.ts)

PR surface

Source +18, Tests +357, Docs +7. Total +382 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 61 43 +18
Tests 5 420 63 +357
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 488 106 +382

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +61/-43 LOC; tests +419/-63 LOC The production growth records native confirmation and retains existing authority checks; most added coverage exercises continuation, child delivery, stale ownership, and publication recovery.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The affected released workflow rejects follow-up messages and a native child-result announcement after parent interruption.
  • merge-risk: 🚨 security-boundary: Reusable subscription publication can now use retained original-source authority after foreground closure, requiring final-effect verification against revocation and session replacement.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Add final-effect proof for revoked original-source and replaced-lineage rejection alongside real native parent continuation and child-result delivery.

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-14T13:20:03.130Z sha 61edba6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-14T13:35:21.300Z sha ee03501 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-14T14:22:51.744Z sha 4840520 :: needs real behavior proof before merge. :: none

Reviewed October 15, 2026, 3:21 AM ET / 07:21 UTC (Revision 4).

steipete and others added 3 commits October 14, 2026 23:35
Keep the exact-interruption custody repair, simplify its cleanup predicate,
and share native-child fixtures across stop and yield. Check original-session
completion delivery, duplicate terminal events, and stale interruption receipts.
Document continuation while native children remain active.

Original fix by @Baumus; confirmed-interruption approach from @VishalJ99.
PR CI owns tests and typechecks; live proof intentionally skipped per
maintainer policy. Related: openclaw#171140.

Co-authored-by: Baumus <[email protected]>
Co-authored-by: Vishal Jain <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 15, 2026
Apply confirmed-interruption child retention only to ordinary parents so
incognito permission changes keep their existing reusable subscription.
Update the active-background custody oracle to reject replaced lineage and
assert that no reusable subscription is published, even with live processes.

CI exposed the incognito regression and the old lineage-bypassing expectation.
The existing permission-change table covers the regression; no new test cases
or local execution were added. PR CI remains the proof gate.
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 66e67a0 into openclaw:main Oct 15, 2026
134 of 135 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…enclaw#172145)

* fix(codex): resume stopped parents while native children continue

* fix(codex): retain newly admitted native work without replaying publication

* fix(codex): tighten stopped-parent continuation coverage

Keep the exact-interruption custody repair, simplify its cleanup predicate,
and share native-child fixtures across stop and yield. Check original-session
completion delivery, duplicate terminal events, and stale interruption receipts.
Document continuation while native children remain active.

Original fix by @Baumus; confirmed-interruption approach from @VishalJ99.
PR CI owns tests and typechecks; live proof intentionally skipped per
maintainer policy. Related: openclaw#171140.

Co-authored-by: Baumus <[email protected]>
Co-authored-by: Vishal Jain <[email protected]>

* fix(codex): preserve incognito permission restart custody

Apply confirmed-interruption child retention only to ordinary parents so
incognito permission changes keep their existing reusable subscription.
Update the active-background custody oracle to reject replaced lineage and
assert that no reusable subscription is published, even with live processes.

CI exposed the incognito regression and the old lineage-bypassing expectation.
The existing permission-change table covers the regression; no new test cases
or local execution were added. PR CI remains the proof gate.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vishal Jain <[email protected]>
Co-authored-by: Baumus <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 14, 2026
Adapt #172145 (66e67a0) to release/2026.11.4. Preserve the six later release cleanup and ownership fixes. Exact-turn interruption joins before subscription transfer; retention remains bound to the original live source and lineage.

Fresh independent review clean on exact patch 3fd03c04dc29c0feb7a92cf5bf51e715ba26828d3fe8436d9496e12288650455. Real cold-parent negative control reproduced unwanted unsubscribe; 125 focused tests across 8 files passed, with scoped types, lint, format and docs checks.

Co-authored-by: RomneyDa <[email protected]>

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

Labels

docs Improvements or additions to documentation extensions: codex merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Interrupted Codex parent with native subagents blocks replies and completion with another-runner/claimed-work errors

2 participants