Repository navigation
fix(codex): recover admitted native completions after restart - #147903
fuller-stack-dev merged 9 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 16, 2026, 6:35 PM ET / 22:35 UTC (Revision 7). ClawSweeper reviewWhat this changesRecovers admitted native child completions after restart, preserves their authority through channel delivery, and retains child-process output during startup and cleanup. Merge readiness⛔ Blocked before merge - 1 item remains This PR still addresses a recovery gap on main. The final changes introduce no new blocking findings, the earlier delivery-authority findings remain resolved, and the recorded compatibility disposition does not require another decision. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw records native child results as tasks and admits their completion into a parent conversation. Gateway recovery resumes eligible interrupted replies, while the outbound delivery owner records whether the final response reached its channel. flowchart TD
A[Native child result] --> B[Task and requester identity]
B --> C[Admitted parent completion]
C --> D[Gateway restart recovery]
D --> E{Current task and session?}
E -->|Yes| F[Guarded channel delivery]
E -->|No| G[Retain pending task]
F --> H[Final receipt settles task]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1453, Tests +3838, Docs +18, Other 0. Total +5309 across 60 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep completion recovery within the existing task, session and delivery owners, with coupled core/plugin updates and the accepted backup-based rollback contract. Do we have a high-confidence way to reproduce the issue? Yes: kill the Gateway and native processes after the parent consumes a child completion but before final delivery. The recorded native run demonstrates this boundary, and main's completion-report reconciliation explains the missing continuation; this review did not rerun it. Is this the best way to solve the issue? Yes: the patch extends existing recovery and receipt ownership while retaining cancellation, requester identity and replay fences; the final test naming and inventory corrections preserve that design. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6f08e4ea3c56. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review Exact head CI's separate test-merge startup-JS budget overage remains unresolved and is being coordinated with the current UI owner; no check waiver or tolerance increase is requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Exact head Final independent P0-P2 review has no actionable findings; required checks and the exact-source public build pass. The original 34 recovery files are byte-identical to the completed native crash/two-replacement and installed-package transition proofs. The body records those boundaries, actual older-writer/candidate reopen evidence, and the maintainer compatibility disposition under the existing repair-and-land mandate. Earlier findings and failed attempts remain preserved. Fresh exact-head CI is required. The previous head's UI startup-budget failure is not waived, and no tolerance increase or automated merge is requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Exact head The prior hosted run exposed inherited line-cap growth and two stale test assumptions. The final15-file repair extracts existing owners/test fixtures without widening baselines or dropping assertions, awaits the maintained database-close operation, and narrows the Matrix observed dispatch. Independent P0–P2 review of this exact delta passed. All679 focused tests, full core/extension production and test types, all20 canonical core-test graphs, changed lint/ratchets, and the full build passed. Prior132 transport and32 Matrix results remain source-scoped; no original runtime proof is relabeled. Canonical #150316 has landed the separate main publisher-inventory correction. The body preserves the earlier failures, actual behavior evidence, compatibility disposition and remaining proof boundaries. Fresh exact-head CI is required; this requests review only, not automated merge. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Updated head The documented coupled core/plugin update and verified pre-upgrade backup rollback disposition remains accepted and unchanged; no mixed-version or lost-ack exactly-once claim is made. Please review this final delta and current integration; historical proof remains source-scoped. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…aw#147903) * fix(codex): recover admitted native completions after restart * fix(agents): retain completion custody through final delivery * fix(matrix): revalidate authority for every wire event * fix(agents): preserve recovery contracts under current CI * test(agents): classify recovery registrations as test harnesses
Previous qualified head:
2dcfff81328c84a178155f7e216df7b6d6c8229b. The earlier Matrix follow-up preserved all 34 then-qualified recovery files. Current transport integration and main synchronization are described below; earlier results remain source-scoped historical evidence.What Problem This Solves
Recover an already-admitted native child completion when the Gateway and native processes die while the parent is preparing its final reply. Keep the original task and input identities, and mark delivery complete only after a qualifying final response.
Why This Change Was Made
The native task remains succeeded with delivery pending after process loss. Ordinary completion-report cascade protection retires the interrupted parent turn, while native restoration waits for another parent registration. Neither owns autonomous completion of that already-admitted reply.
User Impact
A parent can finish an already-admitted native child completion after process loss. The child is not rerun, and pending work is not credited as delivered. Existing cancellation, lifecycle and ordinary-report replay protections remain.
Evidence
Unmodified pinned upstream reproduced the missing continuation after a real native child finished, its parent consumed the completion input, and the owned Gateway/native processes were killed during final processing. The result remained stored and pending; the observation is bounded, not a claim of permanent loss under every schedule.
The retained
971fa3acandidate passed the same process-loss cut using the real native app-server, a local synthetic provider, SQLite custody and a recording QA channel:Retained original 29-file qualification (unchanged by the five-file follow-up):
664eb250f8ca4b8797e1cb1cef1153ad85a7bb8d, qualification base5bdea2bb29fb832e6d6493c8925b8b26ee791661.The failed intermediate runtime that exposed the recorder/mirror ordering defect is retained. Its final real-recorder regressions fail twice before the repair, retain four rejection controls, and pass after repair. Earlier review disagreements are also retained: automatic outbound delivery is separate from message-tool authority, and the alleged native-history rewrite was not produced by the native writer. Real task-store controls preserve creation-time ownership through replacement and cold reload; arbitrary explicit internal metadata rewrites are not covered by that evidence.
Final-send review repair
Previously qualified head:
971fa3a495f92051870375e63cf26240ea1e4759. Its tree matches tested local commit60aa83398fb45846ef26ca5e8be454139da9a0a3after native publication.Hosted review found that command delivery checked completion custody before send preparation, but did not forward that check to the final platform boundary. Four real-store cases reproduced stale writes after cancellation or outcome replacement during a reply hook or adapter preparation. Two more cases reproduced stale writes after a retryable transport failure and actual persisted-queue recovery.
The follow-up carries the existing batch completion explicitly through the command payload projection, preserves its exact task/outcome join in the existing session-writer authority, and revalidates it at live and recovered transport handoff. Execution cleanup does not invalidate an otherwise authorized persisted transport intent. No additional queue, table, or scheduler is introduced.
All 208 affected tests pass, including 12 sender/SQLite cases across hook, preparation, queued retry and post-cleanup retry. The follow-up's independent P0–P2 review found no actionable issues. Prior failed regressions and the incomplete-attribution review are retained; neither is relabeled as clean. The final callback annotation was requalified with all 12 cases passing. Required checks passed via the retained unchanged-source prefix plus all 11 final continuation stages. The final exact-source build and native crash/replacement proof passed on the published tree. Runtime5 retains one child request, one input and one final across two process replacements; its 29 artifact hashes and owned cleanup verify. The canonical public package passed its closure/integrity checks and the installed CLI/SDK upgrade and backup-restore sequence below. The earlier private-QA archive was correctly rejected by public-package integrity rules and is retained as a failed packaging attempt, not a passing release artifact.
Compatibility and scope
No database schema, canonical codec or storage-version change. Added fields live in existing optional, bounded session metadata; the published 2026.9.4 Doctor/upsert envelope probe retained the raw fields, but its normalized receipt reader omitted the task join and result count. This synthetic envelope probe is not a database downgrade or complete upgrade proof. Core and the native plugin must both be updated for recovery joining.
Installed-package transition on task-owned state:
[email protected]created an ordinary session and a verified pre-upgrade backup.newer-schema/gateway.maintenance_required.205e09d6a1ee8ee8a3063fbe402238a88286e968466b3ade2fb362c22d538bbd.The package proof exercises installed CLI/SDK state behavior. npm 11.19 emitted default install-hook restriction warnings; it does not establish execution of every third-party lifecycle hook. The actual bundled native process recovery is covered by the separately pinned exact-source runtime proof above.
This covers newly recorded admitted completions with an outbound channel route. It does not claim route-less/Control UI recovery, pre-admission recovery, remote-worker recovery, or exactly-once external effects after a lost acknowledgment. The actual channel proof uses the recording QA transport, not a live messaging service.
The earlier native yield/teardown work in #137822 and ordinary requester-settlement work in #140956 have different failure boundaries and remain separate. The landed execution-owner restore repair #147585 is included in the qualification base.
Release-note context
Recover an admitted native child completion after Gateway process loss without rerunning the child or crediting unfinished delivery. Preserve cancellation, requester-generation and ordinary-report replay protections.
Earlier recovery size and design tradeoff
Production: +1312 / -97. Tests: +2929 / -2. Docs: +18 / -0. Config: +1 / -1. The growth adds the previously absent durable task/outcome/input binding and validates it through the existing recovery and delivery owners. Removing the ordinary completion-report guard would be smaller but would authorize replay without custody. A separate scheduler or receipt store would duplicate those owners. No schema or storage-version bump is introduced.
Recording-channel runtime verdict:
{ "result": "pass", "head": "971fa3a495f92051870375e63cf26240ea1e4759", "nativeAppServer": "real installed binary", "provider": "local synthetic", "channel": "recording QA transport", "childRequests": 1, "originalCompletionInputs": 1, "parentFinals": 1, "taskDelivery": "pending -> delivered", "secondReplacementObservationMs": 65000, "heartbeatEnabled": false, "artifactHashesVerified": 29, "ownedCleanupConfirmed": true }Matrix multi-event follow-up
The hosted review correctly found that Matrix invoked the final authority callback only for its first event. Actual matrix-js-sdk loopback HTTP reproduced four stale sends after canonical task cancellation or outcome replacement, in durable and non-durable modes. Both unchanged controls sent all three chunks. The repair validates every event, after network preparation and across redirects; ephemeral transaction IDs use the SDK's existing generator. No queue schema, receipt store, shared channel policy, or retry budget changed.
Four affected Matrix suites pass 288 tests; the separate six-case actual task/SQLite/HTTP proof passes. Additional real HTTP controls cover SDK preparation and 307 redirects, including unchanged redirects. The already-accepted first event is retained; no later event is sent after revocation. This is actual loopback protocol transport, not an authenticated Matrix homeserver, encrypted-room end-to-end proof, or lost-ack exactly-once claim.
All earlier 34 files are byte-identical to the native restart/package-qualified head. The follow-up changes four Matrix production files, adds the HTTP regression file, and shrinks the existing assertion baseline by one after removing a cast. Final independent P0–P2 review found no actionable issues with 0.95 confidence. Final SDK/HTTP requalification passed 158 tests, and all six canonical task/HTTP cases passed again. Formatting, both extension type lanes, lint, export and boundary checks, storage/media/sidecar guards, and import-cycle checks passed through recorded source-bound continuations. Earlier failed checks remain recorded; they are not relabeled as passing. The canonical public artifact build passed in 1 minute 36 seconds with all forty source-file hashes unchanged. The prior native restart and installed-package transition remain qualified on their unchanged core/plugin paths; they were not rerun for this Matrix-only correction.
Candidate reopen after older writer
The installed candidate Doctor and public SDK reopened a copy of the genuine released session after the released Doctor/upsert round trip of the captured metadata envelope. Ordinary session identity, the admitted claim, and one joined receipt with its result count survived. This is a synthetic future-metadata envelope on a real released database, separate from the installed full-database upgrade/refusal/backup rollback already reported. It does not make a newer-schema database readable by the older release.
Maintainer compatibility disposition
Accept the narrow coupled core/native-plugin recovery contract under the existing repair-and-land mandate. The published-driver upgrade, actual older-writer metadata round trip, installed candidate reopen, older-reader refusal, and verified-backup rollback are now measured. Missing saved ownership remains a fail-closed recovery condition. Do not downgrade in place with pending new-protocol obligations; finish them on the candidate or use the verified pre-upgrade backup. This adds no schema migration or retention policy, and does not waive Matrix authority or CI checks.
Production transport integration
The actual supervisor and child callers now receive the relay adapter before asynchronous private-input readiness completes, so output and exact raw stream errors remain observable throughout construction and final cleanup. Premature stream close rejects instead of being treated as EOF. Successful native cleanup joins final output drainage; a known native cleanup failure rejects promptly even while a pipe remains open. Terminal results are immutable.
The maintained awaited-stdout owner, secret-delivery disposal, cancellation and original monotonic cleanup deadline remain intact. The merge with main composes Matrix recovery-key persistence with the existing per-request authority guard, including redirects; it does not introduce another fetch wrapper or authority owner. No live Gateway restart or deployment is part of this integration.
Source qualification for local commit
550e13d57c1017a52518069dd1052e9b36ec11e5(tree3aec4d0e7363fabb190aa56b4190ec5d8497e1ce):Native full build and repository check passed, including final Matrix lint and all configured type/format/policy lanes. The broad local test command selected 722 shards and was deliberately stopped in favor of the maintained hosted exact-head CI gate; no complete local-suite pass is claimed. Published-head CI remains pending. Historical synthetic controller/provider afterimages and their 102 TypeScript/22 Python cases were preserved, not transplanted into production or replayed.
Published integration head:
25f6db55a47eab3d89a0f35940d424c4013d1ad5. GitHub verifies its SSH signature. Signing changed only commit metadata; the reviewed tree and upstream/contributor ancestry are preserved.Current CI repair
Hosted CI exposed inherited source-file growth and two stale test type assumptions. The repair extracts registry state, final-delivery authority, native completion parsing, and complete recovery test fixtures without changing their owners or widening baselines. The cancellation test awaits the maintained asynchronous database close operation; the Matrix test narrows its observed dispatch before asserting its transaction ID.
20230c35f018997ae72b562327dd370f44d43ffc. The subsequent upstream fix: keep source-only sessions free of dependency installs #149587 restored pre-deferral expectations; the follow-up below restores the exact current declarations without changing publication eligibility.Earlier failures remain recorded. The next publication requires fresh exact-head CI; the interrupted 722-shard local run remains incomplete.
Published repair head:
6fe18abbe12e6fb5d97e405584664a45bf9d8a74, tested/reviewed tree82ca7897857e8a3b5cdb99fe62003dd491abe200. GitHub verifies the maintainer SSH signature. Fresh exact-head CI and the updated hosted review are required before native landing.Final CI reconciliation
The next hosted run exposed a runtime-boundary scan of the moved test registration modules. They now use the established
.test-harness.tsnaming convention; both module bodies are byte-identical, and only their two import paths changed. No guard or allowlist changed. Five task-boundary tests and all 13 moved recovery cases passed (18 selected; 340 unselected cases skipped), as did both owning test type graphs and formatting.The current committed inventory test passed against the actual package declarations: 95 npm / 91 ClawHub, preserving #150316's three bundled-only deferrals after #149587 restored stale 98/94 expectations. Only those exact assertions changed; producer rules, manifests and catalog entries are untouched. One selected inventory test passed; 107 unrelated cases were skipped.
Canonical #150330 landed the unrelated main formatting repair. Its two whitespace-only joins are consumed from main, not duplicated here. All nine independently reviewed integration files and all four naming-fix files remain hash-identical after the final main merge. Earlier source-scoped qualifications and failures remain retained; these focused checks are not a replay of the full 679-test or historical runtime suites.
Final signed candidate:
02956a0aabdd8abf5acbbedc3e646f4b8e31f8cc. Current-head hosted CI and review are required before native landing. The coupled core/plugin compatibility disposition above remains unchanged.Final landing gates
Exact-head CI run35157494788 and required
openclaw/ci-gatepassed for02956a0aabdd8abf5acbbedc3e646f4b8e31f8cc. The current-head review completed with no actionable findings and explicitly confirms that the documented compatibility disposition requires no further decision. Native hosted preparation passed without changing or repushing the candidate.