Repository navigation
feat: recover abandoned Crabbox source staging - #152006
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 18, 2026, 5:00 PM ET / 21:00 UTC (Revision 2). ClawSweeper reviewWhat this changesAdds commands and conservative automatic cleanup for abandoned Crabbox source copies, with checks that source, diagnostics, and lease ownership remain safe. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful work absent from current main. Both previous findings are resolved, and the reviewed recovery path has no remaining concrete blocking defect. The member-authored, protected PR should remain open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherThe Crabbox wrapper prepares local source copies for remote validation and preserves diagnostic outputs afterward. Recovery handles copies left behind when the original wrapper disappears, deleting them only after checking ownership and independently retained contents. flowchart TD
A[Local source checkout] --> B[Temporary source copy]
B --> C[Ownership and source receipts]
C --> D[Abandoned copy discovery]
D --> E[Verify settlement and native claims]
E --> F[Verify retained source and diagnostics]
F --> G[Remove unchanged copy]
E --> H[Keep protected copy]
F --> H
Before merge
Agent review detailsSecurityNone. PR surfaceTests +1500, Other +2912. Total +4412 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep recovery with the staging owner, preserving uncertain copies and requiring independent source and diagnostic preservation before deletion. Do we have a high-confidence way to reproduce the issue? Not applicable as a new-capability review. Abrupt producer loss is exercised by the supplied recovery fixtures and reported native runs; no runtime reproduction was executed here. Is this the best way to solve the issue? Yes. Extending the existing staging owner and withholding recovery when preservation cannot be established is a coherent approach; both earlier compatibility defects are repaired. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d9cb5f84d00e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Added: local inspection and recovery of abandoned Crabbox source capsules with verified ownership and retained source. |
…49075-c1-control-repair * commit 'dc5b321b5f89f9cf0e704ee202ea3059fb1ce63d': (79 commits) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) refactor(health): skip unused verbose account projection (#152108) fix: restore dashboard test limits and SQLite test compilation (#152089) test(qa-lab): stabilize timeout recovery delivery proof (#152100) fix: probe SQLite when Node denies worker threads (#152075) perf(gateway): keep GitHub co-author trailer scans linear (#152115) fix(media): report CLI models with missing command or args (#151969) refactor: remove retired runtime code and duplicate helpers (#151973) perf(plugins): combine runtime and tool call scopes (#152101) test(memory): seed restart fixtures with the Gateway stopped (#152038) ...
…n-20260918-v4 * origin/main: (81 commits) fix: retire failed setup plugins without replaying facade initialization (#152026) fix(test): select Node for built runtime recovery fixtures (#152162) refactor(auth): reuse privately assembled choice groups (#152166) fix: preserve chat media delivery and session boundaries (#152079) fix: keep stale Stop messages from canceling replacement sessions (#152116) improve(plugins): reduce mutable argument handling overhead (#152154) fix(scripts): prevent host tooling drift from blocking PR workflows (#152078) improve: reduce model capability preparation work (#152128) fix: stop marking delivered scheduled reports as failed (#152165) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) ...
Add local inspection and recovery of abandoned Crabbox source capsules after verifying writer settlement, native claims, retained source, and diagnostics.
What Problem This Solves
An abrupt wrapper exit can leave a frozen Crabbox source copy behind even when the remote lease has ended. Neither an old directory nor a missing PID proves that deleting the copy is safe: it may retain unique source, an unsettled writer, a live claim, or diagnostics that were never preserved.
This adds inspection and recovery at the wrapper that owns source staging. It follows the normal-cancellation repair in #151862 and handles remnants that survive beyond the original process's cleanup opportunity.
User Impact
node scripts/crabbox-wrapper.mjs staging inspectreports recognized copies and the reason each remains protected.staging recover <id>can remove a prepared or positively settled capsule after proving that its selected source remains available through an independent named Git ref and its diagnostics are preserved. An explicit--witness-repo <path> --witness-ref <full-ref>can identify an existing retained source. Successful ordinary source-transfer commands also attempt one eligible older copy after completing their own cleanup.Recovery is local and reads the original native claim namespace. It neither provisions nor stops machines, rewrites claims, nor creates permanent source backups. Normal execution and cleanup still work with ignored or unignored repository-local staging roots; these locations receive no new recovery metadata and their abandoned copies remain protected. This feature does not add general restrictions on source selection or extra mounts.
Recovery requires a known, unchanged boot and PID namespace. Copies from an earlier boot, unknown or older receipt formats, full Git worktrees, uncertified preparation callbacks, unsettled consumers, active claims, and unique or changed source remain protected. Inspection explains these limits instead of inferring safety from age or a stale PID.
Why This Change Was Made
Eligible producers write a private receipt beside the disposable payload, seal an immutable source manifest, persist admission before starting a consumer, and record settlement through the existing process finalizer. Optional registration is withheld when the staging location overlaps the supplied source or effective Git workspace. Preparation that may invoke Git callbacks keeps a permanent writer hold without disabling those callbacks or changing ordinary command execution. Installed filters with no applicable path attributes do not withhold recovery.
Recovery acquires exclusive ownership and checks the producer, native claims, independent Git witness, remaining payload, and preserved artifacts. The witness validates retained-ref ancestry, commit/tree connectivity, selected raw blobs, modes, and deletions. Artifact preservation uses content-addressed evidence without replacing the original source manifest. Interrupted removal can resume only from recorded intent; unknown files, changed identities, incomplete metadata, and unjoined recovery readers remain protected.
Discovery reads bounded headers rather than hashing payloads or querying providers. Its non-authoritative paging hint allows later candidates to progress even when an earlier copy cannot be recovered. Unsupported filesystem durability disables orphan recovery while preserving normal staging and cleanup, and metadata reads reject non-regular files without blocking on a FIFO.
Evidence
The retained Linux environment passed 344 existing wrapper/capsule cases with one platform skip, plus 16 recovery cases, 17 claim cases, and seven staging-location cases. The final constructor replay retained the earlier unaffected results and reran the changed recovery behavior. These exercise the actual producer and public wrapper, abrupt owner loss, admission and settlement, dirty source and an explicit retained witness, preserved diagnostics, interrupted removal, replacement and corruption, concurrent recovery, bounded discovery, and protected worktree registrations. Two actual native-CLI cases also verified ignored and unignored repository-local staging without new recovery metadata or source/index changes.
The actual native
sync-planandclaims list --jsonpath recovered an outside-repository copy, refused a synthetic live claim without rewriting it, recovered after the fixture owner removed that claim, and refused a substituted claim namespace. On head1081333c3cac8a1d51354f4b3005daf7fda9984c, an installed-Mac-runtime fixture created a version-2 receipt, killed the producer after preparation, and recovered through the public launcher in 615 ms, preserving source, HEAD, index, all observed native claims, and the installed binary. That Mac runtime used its existing@openclaw/fs-safe0.8.5; the Linux proof used the checkout's locked dependencies. The Mac fixture was removed after readback.Discovery measured 64 headers and 28,608 header bytes in 9.3 ms with no payload hashing. The affected format, lint, type graphs, compiler boundary, dependency-export check, and repository ratchets passed remotely. The actual native callback replay confirms that configured helpers still execute normally, their staging stays held after configuration removal, and a fresh ordinary capsule recovers. Regression cases also cover inactive versus active filters, deleted-file probes, ambiguous filter names, and a writer hold that survives later cleanup failures. Independent source review has no outstanding findings, and the bounded Autoreview pass over the complete patch found no P0 defects. The CI run for this head tracks hosted validation separately.