fix(daytona): release fixed leases with API keys and reconcile native expiry - #2111
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 real behavior proof before merge. Reviewed September 11, 2026, 2:30 PM ET / 18:30 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR repairs Daytona API-key cleanup and records acquired fixed leases as released after verified native expiry or external deletion, with lifecycle tests and documentation. Merge readiness⛔ Blocked before merge - 1 item remains This fix remains necessary on current main and v0.56.0. No actionable patch defect was found. GitHub confirms the author has repository admin access, so the previous external-contributor proof blocker does not apply. Priority: P2 Review scores
Verification
How this fits togetherCrabbox’s Daytona adapter translates CLI lease operations into provider requests and durable local ownership records. Cleanup reconciles the exact sandbox before recording a terminal claim that prevents reuse of its fixed ID. flowchart TD
A[Stop or inspect request] --> B[Lock local lease claim]
B --> C[Verify authenticated organization]
C --> D[Check exact sandbox and database inventory]
D --> E{Removal verified?}
E -->|Yes| F[Persist released claim]
E -->|No| G[Retain claim]
F --> H[Reject fixed ID reuse]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep expiry reconciliation within the existing Daytona release owner, preserving exact-resource checks, legacy acquisition compatibility, and permanent fixed-ID retirement. Do we have a high-confidence way to reproduce the issue? Yes, from source: API-key cleanup calls Daytona’s JWT-only organization endpoint, and a missing acquired sandbox remains unresolved on main. The author reports both failures on v0.56.0; this review did not execute them. Is this the best way to solve the issue? Yes. The patch repairs authentication inside the provider adapter and reuses existing locked release and terminal-claim machinery without adding competing lifecycle state or changing the stored format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cfeb2faacc77. 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)
|
|
@clawsweeper re-review The main PR body now includes sanitized, inspectable CLI output from a fresh real Daytona run against the final source tree: API-key acquisition and cleanup, native one-minute TTL expiry, released inspection, terminal-ID replay rejection, and repeated cleanup. The source head remains ca25cc1. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(daytona): release fixed leases with API keys and reconcile native expiry This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
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.
…tion (#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
Fixed Daytona leases could be created with an API key but could not be released: cleanup called an organization endpoint that accepts browser OAuth credentials only. Native TTL expiry also left an acquired fixed lease permanently unresolved after Daytona removed its sandbox.
Use the authenticated organization returned by the current-key endpoint for API-key cleanup and empty-account acquisition. Preserve resource-backed acquisition for older Daytona servers that omit that field. Reconcile an acquired fixed lease through the existing release owner only after checking its original organization, exact native UUID, and complete failure-inclusive database inventory. Inspection records the released tombstone without issuing a provider deletion; ambiguous creates and incomplete observations retain their claims.
Validation:
go test -race -timeout=10m ./internal/providers/daytona -count=1passed (153.825s); scoped vet and docs generation passed.This unblocks the lease-backed sandbox integration in openclaw/openclaw#144454. No new configuration, dependency version, or storage format is introduced. Older servers without current-key organization metadata still require an OAuth organization profile for fixed cleanup.
Inspectable live CLI evidence
Repeated against the final production source tree in
ca25cc1c02cd15e066813524e893c24a2cd27ede, using an isolated HOME/workspace, the real Daytona API, and an API key. The projection below includes only lease identity, state, readiness, and command exit status; credential-bearing warmup output is omitted. No mocks were used. Both leases were released, and repeated stop also returned zero.