Repository navigation
fix(runners): preserve node workspaces across restarts - #123889
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 7:56 PM ET / 23:56 UTC. ClawSweeper reviewWhat this changesThis PR replaces node-local workspace cleanup heuristics with Gateway-published retention snapshots so durable node workspaces survive restarts and obsolete artifacts are removed. Merge readiness⛔ Blocked by patch quality or review findings - 8 items remain Keep open: the Gateway-authoritative ownership model is the right repair boundary, but two P1 upgrade and freshness gaps can still delete a durable node workspace. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway owns durable worker placements, while paired node hosts store the resulting session workspaces. The new coordinator sends ownership snapshots over the private node-worker command channel, and the node uses them with live local operations to decide what may be deleted. flowchart LR
A[Durable placements] --> B[Gateway retention coordinator]
C[Node inventory or reconnect] --> B
B --> D[Private retain command]
D --> E[Node-host workspace runtime]
F[Active launches and transfers] --> E
E --> G[Retained session workspaces]
E --> H[Bounded artifact cleanup]
Decision needed
Why: The repository policy requires owner confirmation for protocol-version changes, and the current v1 declaration cannot distinguish a node that implements the new destructive-cleanup authority from one that does not. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +660, Tests +501, Docs +3. Total +1164 across 23 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Version or otherwise explicitly gate node retention support, rebuild retention state before every bounded continuation, and prove an older node plus an intervening durable-placement update cannot delete an owned workspace. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: seed more than one cleanup pass, make a placement durable after the first hasMore response, finish its local operation, and observe the stale replay retain set delete it; a new-Gateway/old-node-host pair independently reproduces the compatibility path. Is this the best way to solve the issue? No: Gateway-owned retention is the right boundary, but this implementation must distinguish old node hosts and must not replay an obsolete full snapshot after retention state changes. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b5f62303867c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready on exact head Maintainer decision: node workspace deletion must require a full reconnect-scoped Gateway snapshot. Missing, stale, malformed, or failed publication retains bytes; it never authorizes the old latest-generation fallback. The existing private supervisor dialect is still unreleased, so adding the bounded retain command does not require a public protocol-version change. Proof completed:
Production is +966/-306 (net +660); tests +579/-78 (net +501); docs net +3. This is justified capability growth for deterministic Gateway authority, a closed private contract, node-local race fencing, and authoritative generation/artifact/manifest collection. The prior 53-line heuristic owner is deleted, and there is no configuration, durable sidecar, public Gateway method, or SQLite schema-version change. |
|
Merged via squash.
|
* fix(runners): retain node workspaces from gateway state * docs(plan): record authoritative node retention
What Problem This Solves
Fixes an issue where a restarted node host could delete an older workspace generation that the Gateway still durably owned, while the final generation of a retired session and its transfer artifacts could remain forever. The previous cleanup inferred ownership from the numerically latest local directory plus active launch receipts, which did not represent idle durable placements.
Why This Change Was Made
The Gateway now publishes a full reconnect-scoped retain snapshot through the existing private node-worker command dialect. The node accepts bounded replacement snapshots, unions them with nonterminal launch receipts and every in-flight workspace operation, and only then removes unretained generations, transfer staging and rollback siblings, unreachable manifests, and empty workspace parents in bounded passes. The old startup/latest-generation heuristic is deleted. This AI-assisted change adds no public Gateway method, public protocol-version bump, configuration, durable sidecar, or SQLite schema-version change.
Production delta is +966/-306 (net +660); tests are +579/-78 (net +501), with a net +3 docs update. The production growth is the missing ownership capability: deterministic Gateway publication, a closed private contract, node-local race fencing, and authoritative filesystem collection. The old 53-line heuristic owner is removed rather than retained as a fallback.
User Impact
Paired devices can keep idle session workspaces safely across node and Gateway restarts, while sessions and environments that are no longer owned stop leaking disk. A missing or failed snapshot only over-retains; it never authorizes fallback deletion.
Evidence
does not delete workspaces before the first Gateway snapshotfailed against the previous production implementation because supervisor startup removed the older durable workspace.pnpm buildpassed locally after the selected Testbox backend was unavailable because its client executable was missing.