Skip to content

fix(agents): resume yielded parents after restart retires completion - #198640

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-restart-yield-requester-store-retired-20260919
Nov 14, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-restart-yield-requester-store-retired-20260919

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes parent sessions remaining parked after a restart when they were waiting for a paused subagent whose old completion authority was retired.

User Impact

Affected parents resume through ordinary restart recovery, inspect saved results, or continue retained child tasks through fresh admission. No configuration or schema migration is required.

Why This Change Was Made

Registry restore deliberately retires completion authority from the previous process. Yield reachability checked that fact only for non-yielded terminal children. Apply the same existing check before following message or nested waits, preserving retirement and the current recovery owner. Production line count is unchanged.

Evidence

The actual Gateway regression uses a deterministic external provider, real tools and SQLite, and graceful process shutdown. It verifies that the original yielded parent survives shutdown. On exact pre-fix main 3cd6a3ed497469fcce9288b1621df968244c2e7c, startup reports resumed: 0 / parked: 2 and the parent never resumes. With the fix, the parent resumes, continues the saved child, and receives its result. Siblings cover a child completing before restart, a child on another agent, and an interrupted child.

All six Gateway scenarios pass together. A separate credentialed OpenAI model replay of the parked-parent flow also passes using synthetic sessions and constrained tool choices (27.8 seconds of behavioral execution). Focused owner, stable-record recovery, sweep and requester-receipt tests pass. The real retired-store rejection already records a visible durable failure on the baseline; its new regression preserves that behavior. Codex autoreview is scoped-clean at P0–P2.

pnpm check:changed has unrelated unused-export failures reproduced on the exact main parent: REQUIRED_ACTION_STOP (introduced by #196951 / de0ea1efe5f9), resolvePackageDistCommonJs (#198567 / 5f99927e134e), and prepareTranscriptFactsBackfillStress (#194519 / 72f90dde293d). These are tracked main regressions, not ignored failures.

Synthetic owner measurement

Linux btrfs, Node 24.22.1, 4 CPUs / 12 GiB; synthetic 35.13 GiB database, 10,000 sessions, one million transcript events, and 62,000 workspace files (1.116 GB). Five counterbalanced pairs, ten calls per sample, separate timing/allocation A/A controls.

Baseline admits one of four parents and leaves three parked; fixed admits all four. Both perform 14 transcript-worker tasks per call. Median process CPU rises from 188.4 to 209.7 ms and sampled main-isolate allocation from 10.34 to 11.99 MB for the three additional recovery admissions. Allocation A/A differs by −0.37%. Wall medians are 142.6 versus 155.1 ms, with substantial A/A drift; no latency improvement is claimed. Worker allocation is outside the inspector sample. Model execution is outside this owner benchmark.

Check retired completion authority before following yielded child waits so restart recovery can resume the parent and reconcile saved child tasks. Preserve durable rejection outcomes and cover graceful restart ordering and cross-agent children.
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T04:13:16.107339Z c00ed96 PR opened
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: L labels Nov 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Please review the restart recovery owner change and the graceful restart regression at head c00ed96. The completion authority must remain retired; the parent must enter current restart recovery instead of parking behind an unreachable message wait. Local Codex review and production-path regression proof are recorded in the PR body.

@clawsweeper

clawsweeper Bot commented Nov 14, 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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR resumes yielded parents when their children's previous-process completion authority has retired.

Example: The dashboard parent agent:main:dashboard:yield-restart awaits a message-waiting child during a graceful Gateway restart.

  • Before: Restore retires the child's completion authority, but startup classifies its saved message wait as reachable and leaves the parent parked.
  • After: The parent enters ordinary restart recovery and can continue the retained child through fresh admission.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and its regression scenarios exercise the relevant boundaries, but the required real-behavior capture is unavailable.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
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 parent waiting for a paused child can remain parked indefinitely after a Gateway restart.
Reason: The maintainer-authored repair restores the existing recovery contract without introducing another runtime policy or owner.

Regression provenance

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

Merge readiness

✅ Ready for maintainer review

This PR repairs a current-main restart deadlock through the existing recovery owner. No actionable correctness or security findings were identified.

Priority: P2
Reviewed head: c00ed9696057f1bcf29b7101752e40e06f10cfe0

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach redacted logs or a terminal capture from the reported live-model graceful-restart replay showing parent retention, fresh recovery, and the returned child result; redact IPs, API keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The subagent registry classifies recorded child waits for Gateway restart recovery, which either preserves a reachable pause or admits a fresh parent recovery turn.

flowchart TD
  A[Gateway restart] --> B[Restore subagent registry]
  B --> C[Retire previous completion authority]
  C --> D[Classify parent yield source]
  D --> E[Preserve reachable wait]
  D --> F[Current restart admission]
  F --> G[Parent reconciles retained child]
Loading

Technical review

Best possible solution:

Keep retirement authoritative and use the existing restart admission owner to reconcile affected parents.

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

Source establishes the failure: restore retires child completion custody, but main follows the yielded child's message wait and parks the parent; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Moving the existing check ahead of traversal is the smallest complete repair, preserving identity filters, reachable current waits, child retention, and fresh admission.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Yield reachability classification changes intended behavior with a stated reason (bbf0d73: Preserve reachable yielded waits while routing stopped descendants to parent reconciliation, without restoring obsolete execution authority.)
  • Retained message-wait lifecycle keeps the original intent (9464adb: Preserve paused children across restart without model replay or old delivery authority, allowing later fresh continuation.)
  • Stable-record recovery expectations changes intended behavior with a stated reason (bbf0d73: Exercise literal stable serialized records through restoration; the changed expectation now recovers the parent because restored child custody is retired.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source 0, Tests +103, Docs +5, Other +101. Total +209 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 10 10 0
Tests 5 293 190 +103
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 1 105 4 +101
Total 8 413 204 +209

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Benchmark option 1 new flag: --yield-read-baseline Selects paired classifier implementations in the existing measurement script; it adds no Gateway configuration setting.

Labels

Label changes:

  • add P2: A specific yielded-parent workflow can remain parked after restart, with a focused repair and limited affected surface.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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:

  • P2: A specific yielded-parent workflow can remain parked after restart, with a focused repair and limited affected surface.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 November 13, 2026, 11:17 PM ET / November 14, 2026, 04:17 UTC.

@steipete

steipete commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

ClawSweeper reviewed final head c00ed9696057f1bcf29b7101752e40e06f10cfe0 with zero findings / zero open checklist items. Here is the requested synthetic-only log excerpt from the separate real OpenAI inference replay. Tool choices were constrained; Gateway lifecycle, SQLite, tools, graceful restart, and provider responses were real.

[yield-restart-proof] {"childKey":"agent:main:dashboard:7f1667f6-2d6e-456d-8703-38be51f36796","before":{"lifecycleRunId":"c2c02a48-dfc0-4514-aa7d-23e9f4a2089a"},"after":{"lifecycleRunId":"65264d13-7d56-4796-aeb5-54907c10a7fb"},"childCalls":1,"rootResumes":1}
✓ test/gateway-yield-restart.live.test.ts > preserves yielded work through an actual Gateway restart (retired-message) 27840ms
Test Files  1 passed (1)
Tests       1 passed | 5 skipped (6)
Duration    85.18s

That temporary replay uses the same lifecycle and final-result assertions as the committed regression: original parent retained across shutdown, fresh parent recovery, and final parent transcript contains REQUESTER_RECEIVED_CHILD_COMPLETION. The final transcript assertion passed; the excerpt above does not itself print transcript content.

The identical committed deterministic-provider regression on exact pre-fix parent 3cd6a3ed497469fcce9288b1621df968244c2e7c instead recorded:

[restart-resume] startup restart resume: [{"agentId":"main","resumed":0,"skipped":2,"reasons":{"parked":2}}]
× preserves yielded work through an actual Gateway restart (retired-message) 37937ms
Test Files  1 failed (1)

The failure was the post-restart parent-resume expectation, after the original-yielded-parent retention assertion passed. All six committed Gateway scenarios pass together with the fix. No Team data or sessions were used.

@steipete
steipete merged commit 272e2da into main Nov 14, 2026
137 of 142 checks passed
@steipete
steipete deleted the steipete/perf-micro-restart-yield-requester-store-retired-20260919 branch November 14, 2026 04:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…penclaw#198640)

Check retired completion authority before following yielded child waits so restart recovery can resume the parent and reconcile saved child tasks. Preserve durable rejection outcomes and cover graceful restart ordering and cross-agent children.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts 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