Skip to content

fix(crabbox): reuse source mirrors after canceled preparation - #206267

Merged
vincentkoc merged 1 commit into
mainfrom
fix/crabbox-prepared-staging-preserve-20261127
Nov 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/crabbox-prepared-staging-preserve-20261127

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Canceling a Crabbox run after source preparation finishes but before provider admission can strand its reusable source mirror. Cleanup records preserved artifacts and changes the lifecycle phase to preserved, even though the mirror has never had a consumer. The next run then rejects the mirror's otherwise complete idle handoff and must prepare another copy.

User Impact

Interrupted remote-check preparation can leave a completed, unused mirror available for the next run. Active or incomplete staging remains protected. This changes developer tooling only; no configuration, migration, or historical-receipt rewrite is required.

Why This Change Was Made

Artifact preservation now changes the phase only after admitted consumers have settled. Earlier phases retain their existing state while recording the same artifact manifest and durability result. The idle-admission rules remain unchanged.

The regression coverage extends existing fixtures for prepared and settled mirror reuse, incomplete/admitted preservation, and cancellation queued during synchronous preparation before the first admission checkpoint. Production delta is +2 comment lines; test delta is +42 lines. The simplification pass retained the single producer-side condition and reused the existing fixtures.

Evidence

  • Original-order failure observed during validation for fix(ui): keep chat responsive while tool renderers load #201971: cancellation was queued during source copying, preparation completed, and no provider was admitted. Cleanup retained a receipt with users=none and state=preserved; the native idle-mirror check rejected that combination. This PR does not alter that retained receipt.
  • Independent source and test reviews found no actionable issue. The normal commit hook formatted the three changed files and completed successfully; its only change to the reviewed patch was a multiline test-call closing delimiter. git diff --check and signature verification passed.
  • Exact-head hosted runtime proof passed the four focused families: staging 42, staging-fsync 5, staging-location 4, and wrapper 324 passed / 1 skipped. Matching scripts/test types, formatting, and lint passed. The original direct-head run still records five unrelated inherited unused-export failures; this is not relabeled a green run.
  • The normal pull-request CI run is now successful, with no failed jobs. Preflight actually checked out merge 1ceb6f948591b53322c0aba713376646d8324459 (tree d9a9257d0fad0f5e3d36f26d524b9dcc81f6340d), whose ordered parents are base 7642a7fa697517f612e8d9de2a975ddb1c16b459 and reviewed head 0f4427a025562b735280cde14fa6722a59109cdb.
  • Committed-range autoreview reported zero findings for that head. Its automated sandbox review was limited to the supplied diff; separate direct reviews covered the complete staging/wrapper owners, callers, dependency contracts, and regression fixtures.

Review follow-up: receipt compatibility and cancellation

This addresses the same-head review's compatibility and behavior-proof requests.

  • Released contract: the current stable v2026.11.10 resolves to 6ea542fd97e2876aa4c871ccc494ed5419a03c5c. Its complete staging owner and wrapper are byte-identical to this PR's base and the source used for the observed cancellation failure. The release's staging artifact, claim, directory-identity, location, process-provenance, user, and witness owners also match the PR base. Relevant dependency pins remain Zod 4.6.7, TSX 4.23.15, and Vitest 5.0.5, with the same supported Node range. The existing source-capsule optimization differs from the release, so this is not a claim that the entire checkout equals the release.
  • Stored data: receipt version remains 2. The strict schema, bounded reader, directory/owner identity checks, durability/artifact verification, and idle-admission predicate are unchanged. New unused completed mirrors retain the already-supported users=none,state=prepared combination; settled consumers still produce users=settled,state=preserved. Existing receipts remain readable under the same rules. Previously stranded none/preserved receipts are not promoted, migrated, or automatically removed by this fix.
  • Original-order runtime proof: the wrapper regression uses the actual source-local shim and compiled wrapper, queues SIGTERM while synchronous preparation completes, then checks exit 143, joined owners, no provider run/claim, preserved source, and a durable idle none/prepared receipt. The staging handoff regression then exercises preservation and subsequent acquisition, verifies reuse of the same source inode, verifies preserved output bytes, and checks final native disposal. Prepared and settled variants both pass; incomplete/admitted/unknown-writer guards remain covered.
  • Proof limits: the original failure was observed with the real wrapper and Crabbox 0.83.2 before provider admission. The repaired cancellation and reuse paths above are hosted runtime regression fixtures, including a controlled Crabbox 0.83.2 protocol fixture; they are not a claimed live provider run or a replay of an installed release. This producer-only change requires neither a provider allocation nor alteration of retained historical staging to verify the lifecycle transition.

@vincentkoc vincentkoc self-assigned this Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Nov 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Preserve preparation state when recording artifacts before consumer settlement so completed, unused source mirrors remain reusable.

Example: A Blacksmith preparation completes, then SIGTERM arrives before provider admission.

  • Before: Cleanup records users=none and state=preserved, preventing the next invocation from reusing the mirror.
  • After: Cleanup retains state=prepared, allowing the existing idle handoff to make the mirror reusable.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-consistent, but required runtime and persisted-state compatibility evidence are absent and CI is not green.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Canceling completed preparation can strand a reusable mirror and force subsequent remote checks to prepare another source copy.
Reason: This restores the existing reuse contract with one production condition, and the maintainer-authored PR establishes direction.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR addresses a source-confirmed mirror-reuse bug still present on main; no introduced correctness defect was found.

Reviewed head: 0f4427a025562b735280cde14fa6722a59109cdb

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted shipped-wrapper output showing cancellation after preparation, no provider admission, successful subsequent reuse, and compatibility with latest-stable receipts; base-red/head-green regression execution is also not shown.
Agent review details

How this fits together

The Crabbox wrapper prepares local source capsules, records consumer and artifact lifecycle facts, and hands eligible source mirrors back to subsequent remote-check invocations.

flowchart TD
A[Crabbox wrapper invocation] --> B[Source capsule preparation]
B --> C[Staging receipt owner]
C --> D[Provider admission]
D --> E[Consumer settlement]
C --> F[Artifact preservation]
E --> F
F --> G[Idle mirror handoff]
G --> B
Loading

Technical review

Best possible solution:

Keep the single producer-side condition and the existing idle-mirror admission and recovery owners.

Do we have a high-confidence way to reproduce the issue?

Source establishes the failure: pre-admission cleanup changes prepared to preserved while users remain none, causing idleMirror to reject reuse; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The condition repairs the incorrect lifecycle fact at its producer without weakening reuse checks, adding state, or rewriting historical receipts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 71b9c69723d0.

Provenance checked

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ae25401 adds scripts/crabbox-staging.mts:686 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ae2540187988; files: scripts/crabbox-staging.mts)
  • Shakker: Raw commit d5b46df adds scripts/crabbox-staging.mts:510 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5b46dfea58a; files: scripts/crabbox-staging.mts)
  • Vincent Koc: Raw commit 28f8cab adds test/scripts/crabbox-wrapper.test.ts:14 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 28f8cab70da1; files: test/scripts/crabbox-wrapper.test.ts)

PR surface

Tests +42, Other +2. Total +44 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 52 10 +42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 1 +2
Total 3 55 11 +44

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 26, 2026, 8:08 PM ET / November 27, 2026, 01:08 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 27, 2026 01:16
@vincentkoc
vincentkoc merged commit ce4bf4c into main Nov 27, 2026
241 of 243 checks passed
@vincentkoc
vincentkoc deleted the fix/crabbox-prepared-staging-preserve-20261127 branch November 27, 2026 02:34
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit '7df6cb759f9e604921536a700e2f527c5516e7de': (185 commits)
  docs: clarify what telemetry OpenClaw sends and how to opt out
  refactor(ui): remove retired stream-follow test seams (#206316)
  fix: distinguish missing command results from unknown outcomes (#206313)
  fix(build): reuse stamps after identical pnpm installs (#206282)
  chore(ci): inventory Gateway model catalog worker lifecycles (#206251)
  fix: keep failed image inspections inside chat activity (#206283)
  fix: clarify sent-message labels and chat activity icons (#206048)
  fix(cron): use the service's free memory for extra automation runs (#206322)
  test(android): reuse the shared TLS fixture (#206280)
  fix(ui): restore New Session recovery during startup (#206319)
  test(macos): align new Gateway URL expectations (#206281)
  feat: let doctor --fix tell when its startup repairs have nothing to do (#206246)
  fix(android): pause idle gateway discovery without blocking consumers (#196209)
  fix(ci): prepare the Android SDK for scheduled CodeQL scans (#203843)
  fix(memory): read delegated cgroup pressure from the mapped leaf (#206308)
  improve(config): reuse plugin metadata during auto-enable (#206289)
  improve: copy only the selected model for agent completions (#206287)
  fix(pr): refresh tooling before preparing reviewed incoming PRs (#206236)
  fix: keep Gateway ready while plugins drain after updates (#206299)
  fix(crabbox): keep unused prepared mirrors reusable (#206267)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant