Repository navigation
fix: stop native completion retirement from retrying forever - #200947
shannon0430 wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review The external-PR evidence heading is now corrected and the replacement PR context/evidence run passed. Please review exact head |
|
🦞👀 Re-review progress:
|
|
Codex review: blocked before merge. What this changesThis PR bounds failed native completion-retirement writes and releases the in-memory child while retaining its unresolved assignment. Example: A native child finishes, delivery is blocked, and every assignment-retirement write fails.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR: it fixes a remaining retry loop, follows the maintainer-approved core-owner direction, and has no actionable correctness findings. Reviewed head: Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Codex adapter reports native child completion to the core completion lifecycle, which coordinates delivery, retirement retries, and release of plugin-owned resources. flowchart TD
Child[Native child completion] --> Adapter[Codex adapter]
Adapter --> Core[Core completion lifecycle]
Core --> Delivery[Parent delivery]
Core --> Store[Assignment retirement]
Store --> Core
Core --> Release[In-memory child release]
Technical reviewBest possible solution: Land the bounded retirement budget in the existing core lifecycle once the enforced CI approval and checks complete. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the unbounded retirement retry path, and the report documents repeated failures on official OpenClaw 2026.11.1; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a focused repair using the existing retry schedule and core owner, with a small Codex callback that preserves unresolved storage for recovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aab0aaac5911. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +20, Tests +68. Total +88 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed November 28, 2026, 8:37 AM ET / 13:37 UTC (Revision 5). |
|
Added the exact-head isolated runtime evidence to the PR body (17a80c2). @clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @shannon0430. The completion-owner cutover in #206447 has landed, relocating retry ownership to core. Your bounded-retirement fix remains distinct: the cutover preserves bookkeeping retries and does not add retirement-budget exhaustion. This PR needs adapting to the new core lifecycle rather than closing as superseded; your regression and credit should carry forward. |
|
Adapted this PR to the core completion lifecycle introduced by #206447 at exact head What changed:
Verification on Node 24.22.1:
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Closes #200892.
When a completed native Codex child can no longer retire its persisted assignment, the monitor currently retries the retirement write every 15 seconds forever. This bounds the retirement phase with the existing retry budget, then stops the in-memory monitor while preserving the unresolved assignment for Doctor repair.
User impact
Implementation
The shared detached-completion owner applies the retry budget to failed retirement writes. When the budget is exhausted, the Codex adapter unregisters the in-memory child and leaves the unresolved assignment in storage for repair.
Evidence
Gateway runtime proof for the core retirement owner at
e8d40e11089f657ff9e909a091c3b8d6752d6879An isolated Gateway built from this revision ran a native Codex parent and child against a loopback model. The parent completed and the child produced its final response. A test fixture returned a blocked delivery, refused the retirement write, and shortened the elapsed timer waits. The production core owner selected the intervals and invoked the Codex exhaustion callback. Immediately after the in-memory unregister, an independent read-only SQLite connection found the same child's unresolved assignment.
Focused oxlint on the five changed files completed with zero warnings and zero errors. The run used isolated state and had external delivery disabled.
Earlier evidence at
17a80c2183d28f321bcc7e14569939ee9648a9663f3927816f2cbecause a retry timer remained after the bounded window.native-subagent-inventory.test.ts,native-subagent-completion-delivery.contention.test.ts, andnative-subagent-monitor.completion-delivery.test.ts.The broader changed-lane wrapper completed its selected guards and Doctor tests, then exceeded the local 10-minute wrapper budget at the plugin-boundary phase; that boundary command passed separately. No live Gateway or live Slack configuration was changed for this proof.
Codex contract check
I inspected
codex-rs/app-server-protocol/src/protocol/common.rs,codex-rs/app-server-protocol/src/protocol/v2/turn.rs, andcodex-rs/app-server-protocol/src/protocol/event_mapping.rs. They expose thread/turn completion receipts and collaboration state, but no host assignment-retirement acknowledgement. The bounded retirement lifecycle therefore remains owned by the OpenClaw monitor.Scope
This does not delete unresolved assignment state, change delivery routing, resend completion output, or alter live authentication/channel configuration.
Isolated runtime evidence at
17a80c2183d2An isolated packaged Gateway ran this head with a real native Codex child and loopback model. The parent completed and one child produced its final response. A test-only adapter returned a blocked delivery result and simulated a read-only store at retirement. The packaged retry code selected its normal backoffs (5, 15, 30, 60, 120, 300 seconds); the harness compressed elapsed timer waits. Observed counters: 1 completion delivery attempt, 7 refused writes including the initial attempt, 6 scheduled retries, then exhaustion. The assignment store still contained the matching child at exhaustion. No second delivery attempt or further retry was observed during the observation window. This exercises the Gateway lifecycle with an injected write failure; the original live cause and real wall-clock waits were not reproduced.
Captured Gateway output at
17a80c2183d2The retained projection of the Gateway run above was:
{ "parentStatus": "ok", "spawnCalls": 1, "childFinals": 1, "retirementWarnings": 7, "durabilityWarnings": 7 }The storage adapter recorded these events in order. Delay values are the selected budgets in milliseconds. The trace ends after the retained-assignment readback; it contains one delivery attempt.