feat: add experimental Crabbox environment adapter#1745
Conversation
Co-authored-by: Cursor <[email protected]>
|
@zozo123 is attempting to deploy a commit to the Harbor Framework Team on Vercel. A member of the Team first needs to authorize it. |
|
Enjoy a better diff viewing experience by clicking one of these URLs: |
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
|
Cross-repo stack note:
Related PRs:
CI note: the previous Ubuntu failure was in unrelated |
|
Tracking issue for productionizing provider-generic Crabbox environment support: #1748 |
|
CI rerun status: all checks are now green after the no-op retrigger commit. The earlier Ubuntu failure appears to have been transient/unrelated to this adapter change. |
|
Enjoy a better diff viewing experience by clicking one of these URLs: Generated by Claude Code |
|
Status refresh after the cross-repo dependency landed:
|
|
Status refresh: merged latest |
|
Latest status after merging current |
|
Status refresh: merged latest |
|
Latest status: updated with current |
|
New context worth surfacing, plus a direct question on direction (rather than another status refresh). Demand signal from Hugging Face. @adithya-s-k (maintainer of huggingface/Repo2RLEnv, which emits Harbor-format tasks) reviewed a downstream crabbox runner I proposed there, declined it as out-of-scope for a synthesis-only repo, and explicitly redirected crabbox support to Harbor:
Full thread: huggingface/Repo2RLEnv#53. An honest fit re-assessment. Since this spike opened I've looked harder at Harbor's own pattern: provider environments land natively in The known gap for anything beyond a spike is benchmark-grade isolation: this adapter executes on the lease host directly instead of building the task's The question — which direction is worth investing in?
Any of those is a fine answer — I'd just rather put the work where you actually want it. cc @alexgshaw (you merged the comparable provider-env PRs). |
|
Pushed hardening commit Key changes: provider-generic lease parsing (including timing JSON on stderr), startup rollback for newly acquired leases, ownership-aware/retryable stop behavior, correct one-argument SSH command quoting, Harbor default-user support, validation for env/template/SSH inputs, bounded subprocess cleanup, deterministic tar uploads, and 13 focused unit tests. Local validation passed: Ruff format/check, ty, import smoke test, and The PR description now states the decision boundary explicitly: merge this as a narrow host-level import-path example, or close it rather than silently growing it into Docker/Compose parity. |
|
Branch update complete:
The decision boundary remains explicit: merge this as a narrow, tested import-path example, or close it rather than expanding this PR into Docker/Compose parity. |
Summary
CrabboxEnvironmentexample loaded through Harbor'senvironment.import_pathhook.crabbox inspect --jsonand provider-managed aliases through a constrainedssh_host_template.Why this shape
Harbor keeps ownership of tasks, agents, trials, verification, and results. Crabbox keeps ownership of provider credentials, lease acquisition, lease identity, and cleanup. The adapter is the narrow bridge between Harbor's
BaseEnvironmentoperations and an SSH-reachable Crabbox lease.This stays behind
environment.import_path; it does not add a built-in environment enum or a Crabbox dependency to Harbor core.Hardening included
leased <id>stdout line.start().id; preserve state when stop fails so cleanup can be retried.sudo -n -uexecution.Provider model
sshHost,sshUser,sshPort, andsshKeywork directly.ssh_host_template; Islo remains the first documented example.Scope and non-goals
This is a Linux, host-level prototype. It does not build the task
Dockerfile, reproduce Docker Compose isolation, translate Harbor resource fields, or advertise network-policy support. Those limitations are documented rather than hidden.Dependencies
Merge or close decision
Merge this as an explicit import-path example if Harbor accepts a documented host-level environment prototype with narrow capabilities and tests.
Close it instead of expanding this PR if Harbor requires every environment example to provide Dockerfile builds, Compose parity, or built-in provider support. Those requirements call for a different
CrabboxRemoteDockerEnvironmentdesign or a first-class Crabbox exec/transfer protocol.Test plan
uv run ruff format --check examples/crabbox_environment tests/unit/environments/test_crabbox_environment.pyuv run ruff check examples/crabbox_environment tests/unit/environments/test_crabbox_environment.pyuv run ty check examples/crabbox_environment/harbor_crabbox/environment.pyuv run pytest tests/unit/environments/test_crabbox_environment.pyPYTHONPATH=examples/crabbox_environment uv run python -c "from harbor_crabbox.environment import CrabboxEnvironment; print(CrabboxEnvironment.type())"Local validation for the hardening commit: 13 tests passed, with Ruff, ty, and import validation passing.