Repository navigation
fix: keep worker creation tied to its original caller across restarts - #197875
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: needs maintainer review before merge. What this changesThis PR preserves and restores the original worker-creation caller across preparation, retries, bootstrap, and Gateway restarts. Example: A worker creation request uses idempotency key caller-authority, then its original device is removed before restart recovery.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Both earlier findings are resolved, and no new actionable defect was found in this PR. Keep it open for completion of exact-head CI and the author's stated review-only handoff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway admits worker creation, stores its allocation intent in shared state, and drives provider allocation and bootstrap; recovery now restores the intent's original authentication source before continuing. flowchart TD
A[Authenticated creation request] --> B[Gateway admission]
B --> C[Durable worker intent]
C --> D[Original source restoration]
D --> E[Provider allocation and bootstrap]
D --> F[Refusal or pending recovery]
F --> G[Existing cleanup owner]
Technical reviewBest possible solution: Retain original caller evidence on the existing allocation intent and restore it through the authentication owner while preserving canonical provisioning and cleanup. Do we have a high-confidence way to reproduce the issue? Current main shows manual creation entering the durable provisioning path without original caller evidence; the supplied compiled-app receipts exercise removal, replay and restart through the Gateway. Is this the best way to solve the issue? The change repairs the existing intent and authentication owners, preserves cleanup custody, and includes the coordinated migration, reader fencing and historical catalogs needed for a complete cutover. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8ef78ec2dc4e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +468, Tests +950, Docs +31, Config 0, Other +16. Total +1465 across 57 files. Added test files: 4. 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. Review metrics
LabelsLabel changes: No label 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 (1 earlier review cycle)
Reviewed November 12, 2026, 3:11 PM ET / 20:11 UTC (Revision 2). |
|
@clawsweeper re-review The catalog compatibility and wrapper closure findings are addressed in |
|
🦞👀 Re-review progress:
|
#197985) * fix(test): align agent artifact worker creation fixture Update the injected worker service to the request-shaped creation contract introduced in #197875. Preserve idempotency and invoke the supplied authority check before fixture allocation. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): agent artifact fixture uses the retired worker creation API Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 0f327e11-666e-8123-8350-6617f8a9e77a --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
…openclaw#197875) * fix: keep worker creation tied to its original caller across restarts * fix: retain worker migration catalogs and tooling closure
openclaw#197985) * fix(test): align agent artifact worker creation fixture Update the injected worker service to the request-shaped creation contract introduced in openclaw#197875. Preserve idempotency and invoke the supplied authority check before fixture allocation. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): agent artifact fixture uses the retired worker creation API Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 0f327e11-666e-8123-8350-6617f8a9e77a --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Align the old lifetime oracle with #197875: a fresh attempt that never entered allocation becomes failed even after its provisioning transition committed. Preserve both real COMMIT barriers, the original timeout and no-allocation contract; independently assert persisted state and joined settlement. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]>
* fix(github): recover saved repository publications * fix(test): correct publication recovery test ownership Keep native publication integration in the database worker lane, preserve canonical registration order, and assert the extended requester capability without weakening exact RPC matching. Co-authored-by: galiniliev <[email protected]> * test(github): qualify publication authority before credential effects Exercise current requester roles, live placement reservation, and repository credential admission against a harmless loopback sink. Keep synthetic credential-provider evidence separate from live provider acceptance. Co-authored-by: galiniliev <[email protected]> * test(github): account for scoped publication regression lines Allocate exactly 141 net regression lines: 132 real-owner authority proof, eight Vitest ownership assertions, and one RPC requester matcher. The inherited 80-line base debt remains visible; this does not raise the shared scalar or conceal a failing ratchet. Co-authored-by: galiniliev <[email protected]> * fix(github): repair publication architecture ownership gates Extract the native workspace transfer operation into a leaf contract so merge transport no longer depends back on its client. Register repository reopen writes only under the existing repositoryMutation authority owner, with both admitted and bypass guard coverage. Co-authored-by: galiniliev <[email protected]> * test(github): use default publication registry runtime Co-authored-by: galiniliev <[email protected]> * test(github): compose native publication recovery proof Exercise real requester admission, receipt recovery, native Git and HTTP transport with a task-owned physical ref CAS oracle. Preserve request and checkpoint identity across a synthetic pre-effect 503 and coordinator reconstruction, with revoked authority, changed requester, moving placement and revoked custody controls. Reuse the existing synthetic credential fixture and allocate exactly 432 net new test lines. Provider responses, node enrollment and checkpoint input remain test-controlled; this does not claim live-provider or full Gateway restart acceptance. Existing full-ratchet debt remains unresolved. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): prove publication across Gateway process restart Exercise public repository sessions, authenticated requester admission, dispatched native worker writes, and saved checkpoint publication through a task-local GitHub transport. Restart the actual Gateway OS process while retaining native worker owners, then reopen the original request and verify one physical Git ref CAS. Reject a revoked original requester without additional transport or worker effects. External publisher/model responses are synthetic; actual profile, placement, credential admission, native Git, HTTP, process custody and durable receipts remain production-owned. Allocate exactly 929 new LF-counted test lines; preserve the inherited 80-line global debt and earlier coordinator-only evidence. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): create process proof diagnostics directory Address the scoped independent review finding: create the task-local diagnostics parent before cleanup writes so fresh checkouts do not fail with ENOENT. Keep cleanup errors visible and reduce the exact regression allocation by the three removed LF lines. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): preserve isolated publication transport in CI Bind the fixture-owned PATH explicitly so clean CI startup cannot select a system GitHub CLI instead of the synthetic loopback transport. Preserve real requester, credential, restart, and physical Git CAS assertions. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): keep personal publisher credentials on the Gateway Use the normal worker execution identity for repository integration while retaining the selected publisher for Gateway API, ref and PR writes. Check live selection, repository reads and operation lifetime without borrowing a coding turn or changing the worker protocol. Preserve transient throttling recovery and document the execution-reader prerequisite. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: wait for private publication cleanup before draining Join native private publication work before acknowledging workspace drain while preserving concurrent editing. Fund the two success/cancellation regressions with exactly 126 LF; inherited 80-line debt remains separate. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: keep editing available while publication drains Reserve the publication settlement barrier under workspace serialization, then join it outside the editing queue. Exercise editing after drain admission and remove an inert prepared-store spy; reduce the exact allocation to 123 LF. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: recover publication with its original dispatch authority Carry the current publication reader through recorded worker recovery; preserve the chat reader only for callers without an explicit reader. Prove allowed and revoked recovery at the placement/admission boundary. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): bound recovery after checkpoint capture failures Include checkpoint capture in the existing publication recovery budget, while keeping editing admission separate from private integration and settlement. Preserve earlier failures when reservation contention skips an attempt. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): cancel publication worker recovery promptly Forward the existing publication operation signal through placement admission and offline-worker reconnect. Preserve the existing Gateway drain, deadline, current-authority checks and cleanup ownership. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(workers): follow unallocated timeout settlement Align the old lifetime oracle with #197875: a fresh attempt that never entered allocation becomes failed even after its provisioning transition committed. Preserve both real COMMIT barriers, the original timeout and no-allocation contract; independently assert persisted state and joined settlement. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> --------- Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]>
* fix(github): recover saved repository publications * fix(test): correct publication recovery test ownership Keep native publication integration in the database worker lane, preserve canonical registration order, and assert the extended requester capability without weakening exact RPC matching. Co-authored-by: galiniliev <[email protected]> * test(github): qualify publication authority before credential effects Exercise current requester roles, live placement reservation, and repository credential admission against a harmless loopback sink. Keep synthetic credential-provider evidence separate from live provider acceptance. Co-authored-by: galiniliev <[email protected]> * test(github): account for scoped publication regression lines Allocate exactly 141 net regression lines: 132 real-owner authority proof, eight Vitest ownership assertions, and one RPC requester matcher. The inherited 80-line base debt remains visible; this does not raise the shared scalar or conceal a failing ratchet. Co-authored-by: galiniliev <[email protected]> * fix(github): repair publication architecture ownership gates Extract the native workspace transfer operation into a leaf contract so merge transport no longer depends back on its client. Register repository reopen writes only under the existing repositoryMutation authority owner, with both admitted and bypass guard coverage. Co-authored-by: galiniliev <[email protected]> * test(github): use default publication registry runtime Co-authored-by: galiniliev <[email protected]> * test(github): compose native publication recovery proof Exercise real requester admission, receipt recovery, native Git and HTTP transport with a task-owned physical ref CAS oracle. Preserve request and checkpoint identity across a synthetic pre-effect 503 and coordinator reconstruction, with revoked authority, changed requester, moving placement and revoked custody controls. Reuse the existing synthetic credential fixture and allocate exactly 432 net new test lines. Provider responses, node enrollment and checkpoint input remain test-controlled; this does not claim live-provider or full Gateway restart acceptance. Existing full-ratchet debt remains unresolved. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): prove publication across Gateway process restart Exercise public repository sessions, authenticated requester admission, dispatched native worker writes, and saved checkpoint publication through a task-local GitHub transport. Restart the actual Gateway OS process while retaining native worker owners, then reopen the original request and verify one physical Git ref CAS. Reject a revoked original requester without additional transport or worker effects. External publisher/model responses are synthetic; actual profile, placement, credential admission, native Git, HTTP, process custody and durable receipts remain production-owned. Allocate exactly 929 new LF-counted test lines; preserve the inherited 80-line global debt and earlier coordinator-only evidence. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): create process proof diagnostics directory Address the scoped independent review finding: create the task-local diagnostics parent before cleanup writes so fresh checkouts do not fail with ENOENT. Keep cleanup errors visible and reduce the exact regression allocation by the three removed LF lines. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(github): preserve isolated publication transport in CI Bind the fixture-owned PATH explicitly so clean CI startup cannot select a system GitHub CLI instead of the synthetic loopback transport. Preserve real requester, credential, restart, and physical Git CAS assertions. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): keep personal publisher credentials on the Gateway Use the normal worker execution identity for repository integration while retaining the selected publisher for Gateway API, ref and PR writes. Check live selection, repository reads and operation lifetime without borrowing a coding turn or changing the worker protocol. Preserve transient throttling recovery and document the execution-reader prerequisite. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: wait for private publication cleanup before draining Join native private publication work before acknowledging workspace drain while preserving concurrent editing. Fund the two success/cancellation regressions with exactly 126 LF; inherited 80-line debt remains separate. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: keep editing available while publication drains Reserve the publication settlement barrier under workspace serialization, then join it outside the editing queue. Exercise editing after drain admission and remove an inert prepared-store spy; reduce the exact allocation to 123 LF. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix: recover publication with its original dispatch authority Carry the current publication reader through recorded worker recovery; preserve the chat reader only for callers without an explicit reader. Prove allowed and revoked recovery at the placement/admission boundary. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): bound recovery after checkpoint capture failures Include checkpoint capture in the existing publication recovery budget, while keeping editing admission separate from private integration and settlement. Preserve earlier failures when reservation contention skips an attempt. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * fix(github): cancel publication worker recovery promptly Forward the existing publication operation signal through placement admission and offline-worker reconnect. Preserve the existing Gateway drain, deadline, current-authority checks and cleanup ownership. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> * test(workers): follow unallocated timeout settlement Align the old lifetime oracle with openclaw#197875: a fresh attempt that never entered allocation becomes failed even after its provisioning transition committed. Preserve both real COMMIT barriers, the original timeout and no-allocation contract; independently assert persisted state and joined settlement. Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> --------- Co-authored-by: galiniliev <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]>
Carried to the pure candidate (stage 2) from the chain. Upstream's catalog-equivalence cases (openclaw#197875, new in this merge) pin the source hashes of upstream's own historical state projections. The pure candidate's state schema also carries the continuation tables, so all 10 projections hash differently: db:postgres:check failed 10 of 205 at 99016c4, and the received hashes equal the chain's pins exactly (the pure and chain state schemas match). The pins are this lineage's real history: bc7e568's own browser-to-deferred runtime (lazy + journal) hashes to dcde1d20, the pinned historical value, and the candidate's generated catalogs resolve all five bc7e568 layouts (raw schema and four runtime projections), catalog and fingerprint. A layout with one unshipped table resolves neither. The comment now names bc7e568 in place of the chain's 51ff02d. Refs openclaw#129388 (cherry picked from commit a377cc6) Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Fixes pending worker creation continuing with an outdated caller after access changes or a Gateway restart.
User Impact
Worker creation keeps its original caller through preparation, allocation, and initial bootstrap. Retrying the same key cannot replace that caller. Ready workers keep their existing maintenance behavior.
Shared state advances to schema 40. Older readers refuse the upgraded database. Pending legacy creation intents without recoverable caller evidence stop; uncertain allocations retain their cleanup identity. Recreate affected pending work after cleanup settles. Rollback requires the matching pre-upgrade backup and build.
Why This Change Was Made
Store the original caller on the existing allocation intent and restore it through the authentication owner. Confirmed refusals settle unallocated work or request exact cleanup. Temporarily unavailable identity reads leave recovery pending without allocating or destroying resources. Initial bootstrap stays bound to creation until first readiness.
The existing lifecycle owner still handles provisioning and cleanup; the continuation moves to one resume module. No separate authority store or cleanup implementation is added. Migration, recovery, and reader fencing form one complete repair. The 547-line test allocation covers the exact excess above the standard allowance (947 net test lines), for distinct admission, replay/restart, cleanup, transient-reader, migration, reader-fence, and build-swap compatibility contracts.
Historical SQLite catalogs remain resolvable across an in-place build swap, as required by #196800. An already-loaded updater may read the replacement JSON after activation. The generator now retains the immediate pre-provision-source schema and all four runtime variants, alongside the earlier historical inputs. All 112 base catalog layouts are preserved exactly after resolving their generated table indices. Five fixed-hash regression cases fail before regeneration and pass afterward.
The CI repair also restores the wrapper's runtime source closure, removes a type-import cycle without adding another schema owner, fixes canonical test routing, and updates PostgreSQL preparation expectations for schema 40.
Evidence
Validated source:
bfb4774af27d3514b7bcc55247f68daf614154dc, treec2e19f899186c894422056073e9442df9246e249. All 64,467 selected files match the validated snapshot before and after the final build. Build metadata identifies the preceding commit plus that dirty snapshot; its blobs map exactly to this final committed tree.2026.11.3→ candidate compiled Doctor: schema 22 → 40 passes, preserving four synthetic worker rows, preferences, and existing settings. Stable CLI initialized the database and settings; worker/preference rows were seeded offline. All original worker columns remain exact. Doctor adds only its existing missing-skill disables, run bookkeeping, and two migration markers. Candidate config and sessions commands work afterward. The installed stable Doctor then refuses schema 40 (it supports 22).Sanitized terminal and receipt evidence
Actual canonical-check output, with ANSI formatting and local paths removed:
Selected fields from the actual compiled-app receipt (identifiers and paths omitted):
{ "status": "passed", "manualStateInjection": false, "scope": "Isolated composition only; external synthetic worker never runs a node", "liveRemoval": { "state": "failed", "leaseId": null, "retrySourceUnchanged": true, "stateAfterRestart": "failed", "retryAfterRestartSourceUnchanged": true, "canonicalDeviceAbsent": true }, "offlineRemoval": { "state": "failed", "leaseId": null, "retrySourceUnchanged": true, "stateAfterRestart": "failed", "retryAfterRestartSourceUnchanged": true, "exitSignal": "SIGKILL", "discoveryAcceptedStatus": 201, "ordering": "Signed removal queued through actual Discovery while Gateway is off; Gateway applies canonical removal after startup. Any replay preparation stays effect-free and held until removal is observed." }, "controls": [ { "label": "before-removal", "allocated": true, "cleanupState": "destroyed", "normalRpcCleanup": true }, { "label": "after-crash-removal", "allocated": true, "cleanupState": "destroyed", "normalRpcCleanup": true } ] }Actual upgrade receipt:
{ "status": "passed", "installedStable": "2026.11.3", "stateSchemaBefore": 22, "stateSchemaAfter": 40, "workerRowsPreserved": 4, "preferencesExact": true, "existingConfigValuesPreserved": true, "doctorAddedConfig": [ "missing-skill disables", "wizard run metadata", "two migration completion markers" ], "originalWorkerColumnsExact": true, "pendingAndInitialSourceUnavailable": true, "uncertainLeaseAndReadyMaintenancePreserved": true, "sqliteIntegrity": "ok", "foreignKeyFailures": 0, "fixtureBoundary": "Stable CLI initialized config and SQLite; worker/preference rows seeded offline. Candidate compiled Doctor upgraded it." }The offline composition holds effect-free preparation until canonical removal is observed. It proves refusal after that removal, not that mailbox processing precedes every startup task. The external synthetic worker never provides a runnable node. All execution uses isolated synthetic services; this does not qualify real cloud allocation, deployed services, npm candidate packaging, or native macOS execution.
Final-head CI has completed: 166 jobs passed, 19 skipped, two failed. All branch-related repairs passed, including architecture guards, the previously failing compact-large jobs, and all four PostgreSQL lanes. Separate Swift and iOS Periphery workflows passed. No checks remain pending.
The only failing test is the inherited Codex Bun command-execution assertion. The original six-file shard reproduces identically on this head and original base
a3d5baaabd2ce88ace4b5d1c45a9577a61dbc08a(80 pass, one fail;node-app-server.runtime.test.ts:268, expected marker/exit 0, received empty stdout/exit 1). The final source was restored and reverified afterward. The second failed job is the aggregate CI gate. The subsequent automated policy workflow completed successfully; its dependency and sensitive-change checks passed, while its aggregate CI status correctly remains failed because the primary CI gate failed. This inherited failure remains a deferred CI blocker; no unrelated repair or rerun was performed. The first run's inherited workflow-size failure did not recur in the final run.Hosted review and CI closeout are complete. The PR remains open with auto-merge disabled. No merge is requested.