Skip to content

fix(codex): restore child tasks after native parent rotation - #159735

Merged
steipete merged 1 commit into
mainfrom
codex/native-recovery-preparation-20260927
Sep 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/native-recovery-preparation-20260927

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #159325

What Problem This Solves

Fixes saved Codex child-task recovery failing when task records change while a native parent resumes.

User Impact

Resumed parents recover their original child assignments and accepted follow-ups. Closing a child during preparation revokes its pending admission before it can acquire authority. No operator action is required.

Why This Change Was Made

A registration-time task reader can require fresh preparation after concurrent publication. Native admission now consumes a current reader through its existing persistence owner while retaining the original source, parent, receiver, and receipt custody. Initial task creation is queued before retirement can observe the child; cold receipt restoration joins its initial reconciliation, while warm observation remains independent of notification completion.

The synchronous direct-spawn path uses a guarded resident reader only when that capability is current. Stale reads use asynchronous preparation. Existing task guards, public SDK contracts, schemas, and retention rules are unchanged.

Evidence

  • Real SQLite and registered-notification regressions reproduced the original read-preparation failure and the close-during-preparation race, then passed with the repair.
  • 415 native and sibling cases passed, including the original failing shard, cold recovery, closure, direct authority, contention, model configuration, and hook relay ownership. No unhandled errors were reported.
  • Scoped core and Codex production/test type checks, typed lint, and the full build passed. The build took 6m28s.
  • Independent P2 review completed with no actionable findings. The final test-only variable rename preserves that reviewed behavior.
  • Existing recorded-runtime receipt cases moved unchanged into their own test module to keep the real SQLite fixture within its line limit; no cases or assertions were removed.

The same feature bytes also passed a separate composition check on main a67c5aac (including the worker-ownership replacement): the causal core case plus all 21 rotated-parent and cold-recovery cases passed with no unhandled errors. The relevant task projection contracts and dependency graph were checked explicitly.

Measured with the maintained two-worker lanes: the real SQLite rotated-parent file took 27.82s (24.88s test time), and the moved receipt-ownership file took 2.80s (0.06s test time). The core custody file passed in 33.52s; it retains the registered harness-to-worker/storage boundary needed to prove ownership and publication ordering. The focused causal case took 2.34s.

@clawsweeper

clawsweeper Bot commented Sep 27, 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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 11:46 AM ET / 15:46 UTC (Revision 3).

ClawSweeper review

What this changes

The Codex plugin prepares fresh task records before restoring or admitting native child tasks, and adds recovery and closure regression coverage.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still uses the task reader implicated in saved-child recovery after parent rotation. The merged database-contention work is related, but does not cover this distinct failure. No discrete introduced correctness defect was established.

Priority: P1
Reviewed head: be5d0f912118bd96d0dbe21bab710dbf6ffcf30f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused recovery and refusal coverage with no confirmed correctness finding; required test-cost reporting remains incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a member-authored internal recovery PR, so the external-contributor proof gate does not apply. Its registered-notification and real-SQLite tests provide supplemental after-fix evidence, including refusal when a child closes during preparation; this review did not run them. No stored-data format changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a member-authored internal recovery PR, so the external-contributor proof gate does not apply. Its registered-notification and real-SQLite tests provide supplemental after-fix evidence, including refusal when a child closes during preparation; this review did not run them. No stored-data format changes.
Evidence reviewed 8 items Current main: The fetched main revision still passes a registration-time reader through native child recovery; it lacks this branch's per-admission preparation path.
Introduced recovery path: The branch prepares task records through the existing runtime, checks parent and child currency after the awaited read, and consumes the records inside the mirror's persistence queue.
Regression boundary: The added core test makes an earlier prepared reader fail after concurrent task publication, then sends a native resume notification through the registered monitor and checks the original saved task row.
Findings None None.
Security None None.

How this fits together

Codex reports native child-thread events to OpenClaw's plugin. The plugin matches those events to saved task records and controls which child assignments and results appear in OpenClaw.

flowchart LR
  A[Codex child events] --> B[Native task monitor]
  C[Saved task records] --> D[Prepared task read]
  D --> B
  B --> E{Parent and child current?}
  E -->|Yes| F[Task assignment and result]
  E -->|No| G[Refuse admission]
Loading

Before merge

  • Resolve merge risk (P1) - Single-worker wall times and CI seconds remain unreported for the new or materially changed tests. The reported 33.52-second two-worker core custody run also needs its cost assessed against the repository's per-file budget.
  • Complete next step (P2) - Add single-worker wall times and CI seconds for each new or materially changed test file to the PR body, and explain any run above 30 seconds.
Agent review details

Security

None.

PR surface

Source +617, Tests +342. Total +959 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 11 1110 493 +617
Tests 4 636 294 +342
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 1746 787 +959

Review metrics

Metric Value Why it matters
Production and test growth production +617 net lines, tests +341 net lines The PR explains the added preparation and custody handling through concurrent recovery and revocation cases; the growth warrants an owner-boundary review.
Single-worker timing coverage 3 changed test files timed at two workers; 0 at one worker The recorded timings do not satisfy the repository's per-file cost measurement.

Merge-risk options

Maintainer options:

  1. Complete test-cost evidence (recommended)
    Record the required single-worker wall times and CI seconds in the PR body, and justify any file above 30 seconds against the contract it proves.

Technical review

Best possible solution:

Keep fresh task reads and child-admission checks with the existing task persistence owner, preserving exact assignment and completion custody through parent rotation.

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

Yes. The current-main reader path and the supplied core regression give a high-confidence sequence: publish a concurrent task change, rotate the parent, then observe a native child resume. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Preparing current records through the existing task runtime is a narrow owner-level repair, and the added cases exercise both recovery and close-during-read refusal.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5c3cb0a11b9b.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Saved Codex child tasks can fail to recover during a native parent resume, interrupting an existing agent workflow.
  • merge-risk: 🚨 session-state: The diff changes when saved child assignments and result receipts become current across parent rotation.
  • merge-risk: 🚨 automation: The diff adds a test to the database-worker CI lane while required per-file cost measurements remain incomplete.
  • 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: The supplied repository state identifies a member-authored internal recovery PR, so the external-contributor proof gate does not apply. Its registered-notification and real-SQLite tests provide supplemental after-fix evidence, including refusal when a child closes during preparation; this review did not run them. No stored-data format changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Publish single-worker wall times and CI seconds for the changed test files, with a contract-based explanation for any file above 30 seconds.

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 (2 earlier review cycles)
  • reviewed 2026-09-27T15:21:08.863Z sha be5d0f9 :: blocked before merge. :: none
  • reviewed 2026-09-27T15:35:29.263Z sha be5d0f9 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 27, 2026 15:28
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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 Sep 27, 2026
@steipete
steipete merged commit 77847b5 into main Sep 27, 2026
243 of 246 checks passed
@steipete
steipete deleted the codex/native-recovery-preparation-20260927 branch September 27, 2026 16:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 27, 2026
Integrate canonical main at 77847 and the canonical rotated-parent recovery repair from
#159735. Preserve current managed creation/backing checks and the actual
SQLite transaction owner while retaining worker cancellation dispatch,
commit admission, and test routing.

Remove the obsolete, unused lifecycle option retired by #157413. The
composed candidate passes 546 selected cases, current type graphs and
review through P2; exact-head CI remains the landing gate.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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