Skip to content

feat(crabbox): add a lease-backed sandbox backend for tool-call isolation - #144454

Merged
steipete merged 8 commits into
mainfrom
steipete/crabbox-sandbox-backend
Sep 11, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/crabbox-sandbox-backend

Conversation

@steipete

@steipete steipete commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw users can select Crabbox for cloud-hosted tool-call sandboxes. A sandbox must keep the same remote workspace across concurrent creation and session reuse, survive interrupted provisioning, and remain manageable after a restart. Provider execution and cleanup must also respect repository ownership when an operator transfers a lease.

Why This Change Was Made

The Crabbox plugin implements the existing sandbox backend contract. Core reserves a durable runtime ID before provider allocation, serializes lifecycle changes, and retains uncertain or failed operations for recovery. Shared reservations always replay from the original provider workspace while each caller keeps its own workspace context.

Static SSH and Crabbox now share one remote-shell workspace, skills, execution-staging, and filesystem implementation. Initial uploads publish the complete primary/agent workspace atomically; partial transfers cannot be mistaken for completed workspaces, and concurrent publishers preserve the winning workspace and its later edits. Crabbox supplies a local exec command for each operation, retaining provider claim authority through execution and transport cleanup. OpenClaw never caches or executes raw provider SSH credentials. Management uses repository-scoped stop. Core independently fences retired runtime generations through actual process admission.

User Impact

Set agents.defaults.sandbox.backend to crabbox and enable/configure the bundled Crabbox plugin. Remote edits survive lease reuse and registry/plugin reopen; recreate releases the old generation and creates a new one. Unsupported command/provider capabilities fail before allocation.

The initial supported route is direct Daytona. This requires a Crabbox build containing claim-owned exec, offline exec --check, and stop --current-repo; the released 0.56.0 binary does not provide the complete contract. The prerequisite cleanup/TTL fix landed in openclaw/crabbox#2111. The command-ownership follow-up is merged in openclaw/crabbox#2119 (5c3aec438fa8368263b3465d0376003ff00402b4).

Evidence

The final bootstrap uses the existing native no-replace rename helper, preserving even an emptied winner. Its exact-stage cleanup restores owner directory permissions without following symlinks. The seven-case product Python proof passed on real non-root Daytona Linux (UID 1001) and macOS (UID 501), covering empty winners, readonly cleanup, symlink preservation, unsupported primitives, and uploaded modes. New SSH workspaces require native atomic directory publication; existing workspaces remain adopted without reseeding.

  • Real Daytona registered-plugin test passed in 207.980 seconds: failed pre-submission recovery, concurrent creation, a shared caller from another repository, actual exec runtime, remote file operations, access after the configured 60-second token lifetime, registry/plugin reopen, recreate, and complete cleanup.
  • A deliberate transfer between two synthetic repositories occurred after execution preparation and before actual spawn. The old repository's prepared command, file access, and scoped cleanup were rejected; its registry record remained recoverable. The new owner executed successfully and released the lease, after which the old registry entry could be removed.
  • The exact final e23770c candidate with the merged Daytona-only Crabbox command contract passed in 136.474 seconds, including the same ownership-transfer checks and full cleanup.
  • Real filesystem regressions fail on incomplete initial uploads before the fix and pass for primary/agent retry, concurrent publication preserving user edits, and existing SSH workspace adoption. Normal failures clean only their own staging directory; abrupt process loss can leave an unreferenced named stage on static SSH, documented for manual recovery. Crabbox lease deletion removes such artifacts.
  • Regression coverage includes reservation replay from the original workspace, terminal-ID retirement, delayed execution after core removal, and upload admission after revocation. The final focused suite passed 190 tests across 13 files, covering core, plugin, SSH, remote-shell, and process-runtime behavior.
  • The final cleanup-token correction uses private owner-held records, rejects foreign/duplicate finalization, and removes the inherited assertion. Its 95 focused tests, lint, actual assertion ratchet, and fresh independent P0–P2 review pass.
  • Final independent review of the complete candidate is clean at P0–P2. Selected local verification covers types, lint, formatting, SDK/import boundaries, documentation, and dead-code checks; exact-head GitHub CI passed.

Live coverage is Daytona on Linux from macOS. The test reopens the real registry and plugin lifecycle; it does not claim a full Gateway process restart. This PR does not publish Crabbox or change a live operator Gateway.

…tion

Register `agents.defaults.sandbox.backend: "crabbox"` from the existing
Crabbox plugin when `plugins.entries.crabbox.config.sandbox` is present.
The Gateway, agent loop, channels, and model credentials stay on the host;
exec, file tools, and media reads run on a box that Crabbox leases for the
sandbox scope under a fixed, scope-derived lease ID, so restarts and
sibling sessions adopt the same lease instead of allocating another.

The endpoint comes from `crabbox ssh --show-secret`; token-based providers
such as Daytona rotate the SSH user, so the inner SSH backend handle is
rebuilt once the endpoint is older than ten minutes. Everything below the
endpoint reuses the built-in SSH backend and the shared remote-shell
filesystem bridge. Recreate and prune stop the lease.

Crabbox remains the only provider owner: no per-provider plugin, no new
dependency. Not supported: the sandboxed browser and sandbox.docker.binds.
…keys

Fixed Crabbox lease IDs are single-use: a stopped lease leaves a terminal
tombstone, so deriving the ID from the sandbox scope broke `openclaw
sandbox recreate`. Each runtime generation now mints its own ID and the
sandbox registry carries it, so restarts adopt the live lease and recreate
provisions under a fresh one.

Crabbox connects with its own SSH client, so its per-lease known_hosts may
not hold the OpenSSH entry yet. Record the host key on first contact and
run the SSH backend with strict checking against that file instead of
disabling verification, so a later impostor cannot receive the token
carried in the SSH user.
Crabbox reports a stopped fixed lease as "has no active create attempt; it
cannot allocate a replacement". Recognize that wording so recreate mints a
fresh lease instead of failing; unknown inspection outcomes still propagate.
@steipete
steipete requested a review from a team as a code owner September 10, 2026 22:37
@clawsweeper

clawsweeper Bot commented Sep 10, 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 docs Improvements or additions to documentation gateway Gateway runtime docker Docker and sandbox tooling extensions: crabbox size: XL maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 11, 2026, 6:04 PM ET / 22:04 UTC (Revision 7).

ClawSweeper review

What this changes

Adds Crabbox-hosted tool sandboxes with durable lease recovery and shares remote workspace initialization, execution, and file operations with the SSH backend.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains useful, maintainer-sponsored work absent from current main. The earlier lifecycle and ownership findings are resolved, and the required Crabbox dependency is now merged; no new blocking code defect was established.

Priority: P2
Reviewed head: e23770c3ff0479c0233cf6c73f3c54621c82c178

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The revised implementation and reported authority-transfer proof are solid; deployment compatibility evidence remains the material readiness gap.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.
Evidence reviewed 13 items Capability remains absent from main: The pinned main Crabbox entry registers cloud workers but no sandbox backend; the PR introduces the sandbox registration at lines 75–97.
Latest release comparison: The v2026.9.4 Crabbox entry likewise provides cloud workers without this sandbox registration. No same-repository replacement fixing PR was established; the supplied Telegram-related item is unrelated.
Durable lifecycle and previous findings: Reservation precedes allocation, retains the original workspace, serializes provider lifecycle operations, and records removal before waiting. Unknown failures retain their generation; only an exact released lease permits replacement.
Findings None None.
Security None None.

How this fits together

OpenClaw’s sandbox layer sends agent commands and file operations to isolated environments while the Gateway and agent loop remain local. The registry owns runtime generations; the Crabbox plugin delegates provider access and repository authorization to the Crabbox CLI.

flowchart TD
  A[Agent commands and file operations] --> B[Sandbox registry]
  B --> C[Reserve or reuse runtime]
  C --> D[Shared remote workspace layer]
  D --> E[Crabbox repository authorization]
  E --> F[Daytona sandbox]
  F --> G[Command output and file results]
  B --> H[Recreate and recover cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - Existing SSH setups without native no-replace directory rename can reuse existing workspaces but will fail when creating or recreating one.
  • Resolve merge risk (P1) - Published-updater upgrade and disable/reconcile/rollback execution remain unproven; older binaries can read the database without understanding pending lease recovery.
  • Resolve merge risk (P1) - The new opt-in backend currently requires a supporting Crabbox build beyond published v0.56.0; unsupported binaries are rejected before allocation.
  • Complete next step (P2) - Record published-updater × candidate upgrade and disable/reconcile/rollback results preserving existing runtimes and pending lease records.
Agent review details

Security

None.

PR surface

Source +994, Tests +1635, Docs +176, Generated 0, Other -2. Total +2803 across 47 files.

View PR surface stats
Area Files Added Removed Net
Source 22 2258 1264 +994
Tests 12 1695 60 +1635
Docs 9 199 23 +176
Config 0 0 0 0
Generated 2 3 3 0
Other 2 0 2 -2
Total 47 4155 1352 +2803

Review metrics

Metric Value Why it matters
New plugin configuration 5 optional fields in 1 sandbox block Provider, class, TTL, idle timeout, and binary selection configure the opt-in backend without changing the default backend.
Persistent lifecycle contract 2 payload fields; 4 runtime states; no new table or schema version The existing registry gains durable recovery semantics despite retaining its physical schema.

Merge-risk options

Maintainer options:

  1. Complete the upgrade evidence (recommended)
    Record a published-updater upgrade and safe rollback with existing SSH runtimes and pending Crabbox reservations, including the documented unsupported-filesystem outcome.

Technical review

Best possible solution:

Keep the shared registry and remote-shell owners, with verified published-version upgrade and disable/reconcile-before-rollback behavior that preserves existing runtimes and uncertain leases.

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

Not applicable to the feature request. Earlier lifecycle defects have targeted regression coverage and reported Daytona verification; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes: the existing plugin, registry, and shared remote-shell boundaries are appropriate, and the recorded maintainer rewrite establishes the intended SSH tradeoff. Upgrade and rollback validation remains necessary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded, opt-in sandbox improvement with useful lifecycle repairs and no demonstrated urgent production incident.
  • merge-risk: 🚨 compatibility: Shared SSH initialization gains a platform requirement, and durable reservations require safe upgrade and rollback handling beyond ordinary CI.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.
  • proof: sufficient: Contributor real behavior proof is sufficient. Reported real Daytona execution through the registered plugin, exec runtime, filesystem bridge, and management owner demonstrates recovery and rejects old-owner effects after repository transfer while allowing the current owner. Registry/plugin reopen is demonstrated; a full Gateway restart and published-version upgrade are not claimed.

Evidence

What I checked:

  • Capability remains absent from main: The pinned main Crabbox entry registers cloud workers but no sandbox backend; the PR introduces the sandbox registration at lines 75–97. (extensions/crabbox/index.ts:75, f3f3d6b1ed68)
  • Latest release comparison: The v2026.9.4 Crabbox entry likewise provides cloud workers without this sandbox registration. No same-repository replacement fixing PR was established; the supplied Telegram-related item is unrelated. (extensions/crabbox/index.ts, 3a9d69db306c)
  • Durable lifecycle and previous findings: Reservation precedes allocation, retains the original workspace, serializes provider lifecycle operations, and records removal before waiting. Unknown failures retain their generation; only an exact released lease permits replacement. (src/agents/sandbox/registry.ts:365, e23770c3ff04)
  • Dependency boundary and execution authority: The adapter directly executes Crabbox capability checks, fixed-ID warmup, claim-owned exec, and repository-scoped stop. This establishes the Crabbox dependency inspection requirement; no Codex runtime contract is involved. (extensions/crabbox/src/crabbox-sandbox-backend.ts:175, e23770c3ff04)
  • Required dependency is merged: GitHub confirms feat: retain repository ownership during remote command execution crabbox#2119 merged as 5c3aec438fa8368263b3465d0376003ff00402b4. This resolves the previous review’s unmerged-dependency blocker. (5c3aec438fa8)
  • Final execution admission: The merged exec command checks repository ownership under a retained claim fence before resolving provider access and launching SSH; transport cleanup remains inside that fence. Daytona restricts this route to acquired fixed-ID leases, and scoped release checks the repository under its exclusive durable claim lock. (internal/cli/exec.go:94, 5c3aec438fa8)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record published-updater upgrade and disable/reconcile/rollback evidence that preserves existing runtimes and pending lease records.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-10T22:43:55.404Z sha 0a852dd :: needs real behavior proof before merge. :: [P1] [P1] Resume nonterminal leases instead of replacing their workspace | [P2] [P2] Serialize allocation for callers sharing a sandbox scope | [P2] [P2] Retain the lease ID when provisioning fails before registration | [P2] [P2] Honor the configured SSH token lifetime
  • reviewed 2026-09-11T18:46:16.700Z sha 287cf29 :: needs real behavior proof before merge. :: [P1] [P1] Fence prepared SSH execution against repository transfer | [P2] [P2] Replay shared reservations from their original workspace
  • reviewed 2026-09-11T18:58:36.810Z sha 287cf29 :: needs real behavior proof before merge. :: [P1] [P1] Fence prepared SSH execution against repository transfer | [P2] [P2] Replay shared reservations from their original workspace
  • reviewed 2026-09-11T19:18:01.174Z sha fcb92e7 :: needs real behavior proof before merge. :: [P1] [P1] Fence prepared SSH execution against repository transfer | [P2] [P2] Replay shared reservations from their original workspace
  • reviewed 2026-09-11T19:31:27.487Z sha 10418ef :: needs real behavior proof before merge. :: [P1] [P1] Fence prepared SSH execution against repository transfer | [P2] [P2] Replay shared reservations from their original workspace
  • reviewed 2026-09-11T21:44:09.255Z sha edf1107 :: blocked before merge. :: none

@steipete steipete self-assigned this Sep 11, 2026
@steipete

steipete commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed head 0a852dd8bd223179ee4ea1fb523d581748cfb4fc. This needs repair before landing. The plugin boundary and reuse of the existing SSH/filesystem backend are appropriate, but the current adapter does not preserve the promised workspace lifecycle.

  1. P1 — Resume retained workspaces. selectLease skips every non-ready lease at crabbox-sandbox-backend.ts:226–229. The dependency's fixed warmup explicitly resumes native stopped/archived machines. Those states differ from a Crabbox-released lease ID. Skipping them allocates another remote-canonical workspace and strands edits on the existing machine. Preserve the ID and let Crabbox replay it; replace only after a confirmed terminal/released outcome.
  2. P2 — Select and publish one runtime per scope. At crabbox-sandbox-backend.ts:232–234, simultaneous first use can mint different IDs from the same empty registry snapshot. The context owner reads IDs before awaiting the factory and publishes only afterward (src/agents/sandbox/context.ts:291–320). Registry uniqueness is by runtime name, so both leases can be registered for one scope.
  3. P2 — Preserve uncertain provisioning for recovery. Warmup and its subsequent inspect run before the factory's cleanup block (crabbox-sandbox-backend.ts:354–364). A timeout after creation leaves an unregistered ID, and the next attempt creates a replacement. Cleanup failures are also discarded. Crabbox deliberately persists uncertain fixed-create attempts for replay under the same ID. A broad match on nested text such as “not found” is not proof that the original allocation is terminal.
  4. P2 — Respect the credential owner's lifetime. The ten-minute endpoint cache (crabbox-sandbox-backend.ts:46, 370–377) assumes a default token lifetime. Daytona supports shorter configured lifetimes, and its current SSH command output does not expose authoritative expiry metadata. Obtain current access through Crabbox for the operation rather than treating that default as an expiry contract.

The retained SSH handle also bypasses renewed repository admission during its cache window. Inspection reports native readiness, not current repository authorization. Preserve Crabbox's admission at remote I/O; the existing positive live proof does not establish this boundary. No live revocation or cross-repository probe was performed for this review.

Dependency evidence was inspected at the merged Crabbox change #1700, commit 376ca43032c1bbbc9f879f9394b9789688a35f58: fixed replay and resume, released versus native status, SSH admission, and configurable SSH lifetime.

The exact-head openclaw/ci-gate is successful (run). That evidence does not cover these lifecycle failures. The existing tests explicitly expect new IDs for repeated unregistered calls, omit concurrent first use and post-create failure recovery, and swallow execution errors in the endpoint-refresh cases. The PR's earlier live proof remains useful for basic provisioning and remote file I/O, but it is not a fresh execution result from this review.

Accepted storage decision

Extend the existing sandbox registry owner to reserve one runtime generation for a backend/scope before provider provisioning, retain that ID through uncertain failures and restart, and publish readiness only for the still-current generation. Crabbox remains the sole provider/claim owner; the plugin consumes the generic registry lifecycle rather than adding a separate state store. Use the existing SQLite table and synchronous transaction owner; do not hold a transaction across provider calls. Coordinate create, retry, recreate, and prune so deletion cannot race a pending generation into publication.

The retained reservation is canonical recovery state, not a cache. Keep it visible to recovery and cleanup until the matching provider release is confirmed. The maintainer accepted this design on 2026-09-11 and explicitly directed implementation, improvement, live testing, and landing in the review task. This records acceptance for the material persistence/publication change under the storage review checkpoint.

A process-local map would not survive a Gateway restart. Deterministic single-use IDs alone cannot handle repeated recreation without retaining generation state or walking accumulated tombstones. The registry already owns runtime identity and cleanup, making it the appropriate place for this invariant.

Keep the change bounded to reservation/recovery for this backend and its generic host contract, with no new configuration, dedicated database, retention policy, or data migration. Preserve existing registered runtimes during adoption. Before rollback, disable the new backend and reconcile its recorded pending leases; do not erase uncertain recovery records. Validation must cover concurrent first use, failure after provider creation followed by restart, resume with remote edits preserved, recreation/pruning during provisioning, and successful use with a shortened credential lifetime. Normal review and exact-head CI remain required before merge.

Maintainer rewrite status — 2026-09-11

The findings above are resolved in pushed head edf11073c92c3a94658d1f06e4b59d34fe6051e4. The accepted registry design remains unchanged: reserve before allocation, retain uncertain operations, preserve the original provider workspace, and fence recreation/pruning against late publication.

Crabbox now owns every remote command and cleanup admission through exec and stop --current-repo; the adapter no longer retains raw SSH credentials. Static SSH and Crabbox share one remote-shell workspace/skills/filesystem owner. Initial uploads publish atomically with the existing native no-replace primitive, and exact-stage cleanup handles read-only directories without following symlinks or altering the winning workspace.

All 190 selected tests pass, together with the chosen types, lint, SDK/import-boundary, documentation and dead-code checks. The complete candidate passed fresh independent P0–P2 review. The final registered-backend Daytona run passed in 143.256 seconds, including pending recovery, shared reuse from another workspace, real exec/file operations, reopen, recreate, prepared execution denied after repository transfer, old-owner cleanup denial, current-owner execution/release, and terminal registry cleanup. All test leases were released. Earlier proof also exercised access beyond the configured SSH token lifetime. Seven exact-product filesystem edge cases passed on non-root macOS (UID 501) and real Daytona Linux (UID 1001).

The upstream API-key cleanup/native-expiry repair is merged in openclaw/crabbox#2111 (2ead1eee957459ba14f785e30ec301be887bac47). The required command-ownership contract is in openclaw/crabbox#2119; its current head has clean review and passing live proof, with final CI still running. Its provider-specific exec admission accepts only acquired fixed-ID Daytona leases, whose release path honors the execution fence.

OpenClaw exact-head CI and the native maintainer landing gates remain pending. This update records completed implementation/review/live proof, not a merge or a Crabbox release.

Reserve runtime generations before provisioning, preserve one SSH workspace owner across credential refreshes, and retain runtime authority through deferred execution and upload admission. Keep failed provisioning and cleanup recoverable under the original lease identity and workspace.
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 11, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Sep 11, 2026
@steipete steipete closed this Sep 11, 2026
@steipete steipete reopened this Sep 11, 2026
Preserve current main changes and regenerate configuration documentation metadata from the combined schema. Sandbox lifecycle, SSH, and exec behavior remains as reviewed; focused integration checks and real Daytona proof pass.
Route Crabbox execution and cleanup through its current repository claim
instead of retained SSH credentials. Replay shared reservations from their
original provider workspace while preserving each caller's workspace context.

Share remote workspace, skills, filesystem, and execution staging between
static SSH and provider command transports. Publish initial workspaces with
native no-replace rename and clean read-only staging directories safely.

Validation: 190 focused tests; selected types, lint, SDK and docs checks;
registered Daytona live flow including ownership transfer and cleanup;
non-root Linux/macOS bootstrap edge proof; independent P2 review clean.

Requires the Crabbox command-ownership contract in
openclaw/crabbox#2119, following the cleanup and TTL
repair in openclaw/crabbox#2111.
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer assessment for head e23770c3ff0479c0233cf6c73f3c54621c82c178: the current review reports no code/security findings and sufficient live proof. The exact-head CI run is green: https://github.com/openclaw/openclaw/actions/runs/34651306176.

I am accepting the documented compatibility tradeoffs for this requested landing:

  • New SSH workspace initialization requires a native no-replace directory operation. This prevents a concurrent initializer from overwriting even an emptied canonical workspace. The exact product helpers passed on non-root Linux and macOS; unsupported capability fails without publishing, and existing unmarked workspaces are adopted without reseeding. This prerequisite is explicit in the SSH and backend documentation.
  • Crabbox is opt-in and requires the command contract merged in feat: retain repository ownership during remote command execution crabbox#2119. Published v0.56.0 lacks it and is rejected by an offline check before allocation. This does not change the default backend or claim that a new Crabbox release was published.
  • The accepted storage decision uses the existing table and preserves uncertain leases. Real management proof covers pending recovery, preserved cleanup failure, successful reconciliation, registry/plugin reopen, and terminal cleanup; all synthetic leases were released. A full published-updater upgrade and disable/reconcile/rollback campaign was not run and is not claimed. That broader release-validation evidence is deferred, rather than inventing an additional merge gate without a demonstrated defect. The recorded rollback contract remains: disable the backend and reconcile its leases before downgrading; never erase pending recovery records.

The completed proof is proportional to this opt-in backend and its shared owner changes: 190 focused tests, 95 tests for the final cleanup-owner correction, selected type/lint/SDK/docs/dead-code gates, independent P0–P2 reviews, exact-head CI, and the final registered-backend Daytona run (136.474 seconds). Proceeding through the repository's native prepare/merge gates under the requested maintainer scope.

@steipete
steipete merged commit 8a32b5a into main Sep 11, 2026
201 checks passed
@steipete
steipete deleted the steipete/crabbox-sandbox-backend branch September 11, 2026 22:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…tion (openclaw#144454)

* feat(crabbox): add a lease-backed sandbox backend for tool-call isolation

Register `agents.defaults.sandbox.backend: "crabbox"` from the existing
Crabbox plugin when `plugins.entries.crabbox.config.sandbox` is present.
The Gateway, agent loop, channels, and model credentials stay on the host;
exec, file tools, and media reads run on a box that Crabbox leases for the
sandbox scope under a fixed, scope-derived lease ID, so restarts and
sibling sessions adopt the same lease instead of allocating another.

The endpoint comes from `crabbox ssh --show-secret`; token-based providers
such as Daytona rotate the SSH user, so the inner SSH backend handle is
rebuilt once the endpoint is older than ten minutes. Everything below the
endpoint reuses the built-in SSH backend and the shared remote-shell
filesystem bridge. Recreate and prune stop the lease.

Crabbox remains the only provider owner: no per-provider plugin, no new
dependency. Not supported: the sandboxed browser and sandbox.docker.binds.

* fix(crabbox): rotate sandbox lease identity and verify recorded host keys

Fixed Crabbox lease IDs are single-use: a stopped lease leaves a terminal
tombstone, so deriving the ID from the sandbox scope broke `openclaw
sandbox recreate`. Each runtime generation now mints its own ID and the
sandbox registry carries it, so restarts adopt the live lease and recreate
provisions under a fresh one.

Crabbox connects with its own SSH client, so its per-lease known_hosts may
not hold the OpenSSH entry yet. Record the host key on first contact and
run the SSH backend with strict checking against that file instead of
disabling verification, so a later impostor cannot receive the token
carried in the SSH user.

* fix(crabbox): treat terminal fixed leases as replaceable during adoption

Crabbox reports a stopped fixed lease as "has no active create attempt; it
cannot allocate a replacement". Recognize that wording so recreate mints a
fresh lease instead of failing; unknown inspection outcomes still propagate.

* fix(crabbox): make sandbox lease lifecycle durable

Reserve runtime generations before provisioning, preserve one SSH workspace owner across credential refreshes, and retain runtime authority through deferred execution and upload admission. Keep failed provisioning and cleanup recoverable under the original lease identity and workspace.

* fix(ci): clean sandbox exports and update merge fixtures

* fix(sandbox): retain provider ownership through remote operations

Route Crabbox execution and cleanup through its current repository claim
instead of retained SSH credentials. Replay shared reservations from their
original provider workspace while preserving each caller's workspace context.

Share remote workspace, skills, filesystem, and execution staging between
static SSH and provider command transports. Publish initial workspaces with
native no-replace rename and clean read-only staging directories safely.

Validation: 190 focused tests; selected types, lint, SDK and docs checks;
registered Daytona live flow including ownership transfer and cleanup;
non-root Linux/macOS bootstrap edge proof; independent P2 review clean.

Requires the Crabbox command-ownership contract in
openclaw/crabbox#2119, following the cleanup and TTL
repair in openclaw/crabbox#2111.

* fix(sandbox): retain ownership of prepared execution cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: crabbox gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant