[codex] Add Coder SSH-lease provider#271
Conversation
Add a direct Coder provider that leases workspaces through the local Coder CLI and exposes them as proxy-backed SSH leases for Crabbox commands. Keep Coder auth in the native CLI store while making doctor, run, ssh, stop, and cleanup work with conservative stop-first lifecycle defaults. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Require explicit Crabbox markers or legacy Crabbox labels before generic lease metadata is trusted, while keeping prefix-based ownership and legacy label resolution working. This prevents cleanup or resolve from acting on unrelated Coder workspaces after the provider branch is merged. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Check claim freshness before stopped-state cleanup so opted-in delete cleanup cannot remove still-claimed Coder workspaces. Add a regression test for stopped active claims to keep resolve-on-demand leases reusable. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Use the configured stop-vs-delete release policy for post-create rollback paths, but only after verifying the workspace exists when coder create itself fails. This keeps disposable Coder workspaces cleaned up while preserving the original create error for failures that never produced a workspace. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Hash overlong Coder workspace names before truncation and fall back to a lease-hash slug suffix when an existing workspace already occupies the derived name. This keeps long requested slugs stable enough for humans while avoiding deterministic create collisions. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Decide between coder list and coder list --all from the original request or stored claim reference before resolving and keep that same scope for post-start refreshes. This lets lease-id and slug based commands keep working when a claim points at an owner-qualified workspace. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Attach the proxy SSH target to ready status-only leases and preserve accumulated doctor checks when inventory listing fails. This keeps status JSON honest for ready workspaces and retains inventory diagnostics in failing doctor output. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Propagate Coder work-root defaults through normal config loading, stamp resolved Coder servers with that work root, and use unique slash-free SSH host aliases for owner-qualified workspaces while keeping the full ref in the proxy command. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Reuse persisted keep metadata from local claims when resolving, listing, and cleaning Coder workspaces so explicit keep requests survive later status and run flows without making ordinary claims immortal. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Persist Coder release intent in local claims, make workspace names lease-unique, and restrict cleanup to claimed workspaces so Crabbox does not mutate unrelated Coder environments. Also preserve owner-qualified workspace resolution, add safer acquisition rollback, isolate Coder known_hosts state, and include the delete-on-release flag in generated stop commands. Refs: openclaw#265
|
Codex review: needs real behavior proof before merge. Reviewed June 11, 2026, 9:01 PM ET / 01:01 UTC. Summary Reproducibility: yes. for the review defect: source inspection establishes that every post-create rollback invokes Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Route every post-create rollback through the configured or persisted release action, test default stop and opt-in deletion, then demonstrate doctor, warmup, run, SSH, and stop against an authenticated Coder workspace with redacted terminal output. Do we have a high-confidence way to reproduce the issue? Yes for the review defect: source inspection establishes that every post-create rollback invokes Is this the best way to solve the issue? No. The narrow maintainable solution is to reuse the existing configured release action during rollback rather than introduce an undocumented destructive exception. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b2356e0f5173. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Summary
Closes #265.
This PR adds the Coder provider as a direct Linux SSH-lease provider for Crabbox. It uses the Coder CLI for workspace lifecycle and SSH transport while keeping Crabbox responsible for sync, command execution, result collection, local claim tracking, and release behavior.
What changed
coderprovider implementation, registration, configuration, flags, docs, and provider list wiring.owner/workspaceinventory matches.coder ssh --stdioand isolate Coder SSHknown_hostsstate under Crabbox's Coder config directory.Validation
git diff --check origin/main...HEADgo test ./internal/providers/coder -count=1go test ./internal/providers/coder ./internal/providers/all ./internal/cligo test ./...autoreview --mode branch --base origin/main --engine codex --model gpt-5.5 --thinking medium --parallel-tests "go test ./..."The Codex autoreview pass reported no accepted/actionable findings.
Notes
Live Coder workspace smoke testing still requires an authenticated Coder deployment via
coder login <url>.