Skip to content

feat(provider): add Sealos Devbox SSH-lease provider#682

Open
coygeek wants to merge 28 commits into
openclaw:mainfrom
coygeek:feat/sealos-devbox-provider
Open

feat(provider): add Sealos Devbox SSH-lease provider#682
coygeek wants to merge 28 commits into
openclaw:mainfrom
coygeek:feat/sealos-devbox-provider

Conversation

@coygeek

@coygeek coygeek commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #365

Summary

Adds sealos-devbox as a Crabbox Linux SSH-lease provider backed by Sealos DevBox lifecycle resources.

This PR includes:

  • provider registration, config/env/flag handling, and metadata matrix entries
  • read-only doctor checks for kubectl, namespace, CRD version, RBAC, image/template source, and route configuration
  • CRD lifecycle create/resolve/status/release/cleanup paths with Crabbox ownership labels and stale-claim handling
  • Sealos Secret/key parsing, local key persistence controls, SSH target construction, and readiness/status behavior
  • guarded live-smoke wiring and provider documentation
  • regression coverage for rollback, retained reuse, read-only resolve, release cleanup, CRD version validation, RBAC checks, and SSH NodePort selection

Verification

Local verification passed with:

gofmt -w $(git ls-files '*.go')
go test ./...
go vet ./...
go build -trimpath -o bin/crabbox ./cmd/crabbox
node scripts/generate-provider-matrix.mjs
node scripts/build-docs-site.mjs
bash scripts/check-docs.sh
bash -n scripts/live-smoke.sh
node --test scripts/live-smoke.test.js
git diff --check

Observed pass signals:

  • go test ./... passed
  • go vet ./... passed
  • provider matrix generated with 68 providers
  • command docs check passed for 51 command docs
  • markdown link/docs check passed for 201 markdown files
  • node --test scripts/live-smoke.test.js passed with 51 pass, 0 fail

Structured review was run with Codex:

.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --engine codex

Result: autoreview clean: no accepted/actionable findings reported.

Config And Secret Notes

  • Sealos credentials stay out of repository config; the provider uses local kubeconfig/context or configured kubeconfig paths.
  • DevBox private key material is redacted from output and persisted only under Crabbox local lease state when needed for SSH reuse.
  • Untrusted repo config is prevented from redirecting Sealos workload fields while preserving explicit release policy.
  • Live Sealos cluster/RBAC/SSHGate success is not claimed by this PR; the live-smoke path remains opt-in and classifies missing local Kubernetes tooling or credentials as environment blocked before mutation.

coygeek and others added 24 commits June 24, 2026 15:12
Register the sealos-devbox provider with typed config, flags, env/YAML loading, metadata, and a read-only doctor so the provider can be discovered and prerequisite-checked before mutating lifecycle work lands.

Record the automation surface as crd_first based on Sealos CRD and SSHGate evidence while keeping lifecycle operations as explicit deferred stubs for later plans.
Implement the CRD-first Sealos DevBox lifecycle foundation behind the sealos-devbox adapter. This adds structured Devbox manifest rendering, fakeable kubectl helpers, scoped claims, status normalization, and Secret key persistence without exposing key material.

The lifecycle stops at a prepared DevBox resource so later SSH/release/cleanup plans can add route construction, readiness, retained release, and cleanup behavior on top of a validated provider-local identity model.
Implement Sealos DevBox SSH target construction, readiness handoff, release behavior, and bounded cleanup behind the provider adapter.\n\nPublic-key SSHGate remains the default route, NodePort stays an explicit fallback, and cleanup/release paths validate identity before mutating resources.
Document the Sealos DevBox provider lifecycle, selection metadata, and live-smoke prerequisites.

Add a guarded Sealos branch to the shared live-smoke harness so missing Kubernetes and route prerequisites classify as environment_blocked before mutation.
Roll back non-kept Sealos DevBox resources when post-create bootstrap fails, and make doctor report blocked when no image or templateID can create a DevBox.

Keep untrusted config from redirecting Sealos cluster workload fields while preserving explicit delete-on-release policy.
Ensure sealos-devbox status --wait does not report ready until the SSH route is usable, matching the SSH lease readiness contract.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Only clear sealos-devbox local claim and SSH key state after a Kubernetes API NotFound confirms the DevBox is absent. Local kubectl execution failures now return to the caller so a missing binary or broken context cannot orphan a running DevBox.
Split Sealos DevBox validation so doctor can construct a read-only backend with incomplete route settings while lifecycle backend configuration still requires a usable SSHGate or NodePort route.
Call the acquire callback after the Sealos DevBox identity and SSH route are known but before local claim and key state are written, so controller-backed cleanup can track or reject the raw provider resource safely.
Require explicit yes output from kubectl auth can-i checks and force cleanup when controller identity acknowledgement rejects a newly acquired Sealos DevBox, even for kept acquisitions.
Allow Sealos DevBox release-only resolution to return the Kubernetes identity without requiring an SSH route, so stop/delete can proceed for NodePort DevBoxes whose status lacks an SSH endpoint.
Avoid Secret/key persistence during Sealos read-only resolution and reject scoped local claims whose live DevBox no longer matches the active provider scope.
Require a concrete Sealos DevBox image for CR creation and doctor readiness, while leaving templateID as optional metadata. Also decode Kubernetes-style lastContainerStatus objects so list/status reads handle real DevBox status payloads.
Resume paused Sealos DevBox leases before mutable SSH reuse paths fetch key material and wait for SSH. This preserves the default pause-on-release lifecycle while allowing later run and ssh commands to reuse retained leases.
Delay mutable SSH target construction until after a paused Sealos DevBox is resumed. This lets retained NodePort leases refresh their live route before Crabbox validates the SSH endpoint.
Reject Crabbox-labelled Sealos DevBoxes that lack the current provider_scope annotation. This keeps resolve, status, and release aligned with cleanup's exact scope boundary.
Check Kubernetes patch RBAC during doctor and refresh DevBox status while waiting for late-published SSH Secret names. This keeps Sealos preflight and acquisition aligned with the actual lifecycle operations.
Prefer explicit SSH NodePort fields or SSH-labelled port entries before falling back to generic numeric ports. This prevents Sealos NodePort routing from selecting preview or HTTP ports when multiple services are reported.
Allow release-only resolution to return a scoped local claim when Kubernetes confirms the Sealos DevBox is absent. This lets delete-on-release stop paths reach the existing stale claim and key cleanup branch.
Require doctor to confirm the DevBox CRD serves v1alpha2, and require NodePort SSH routing to come from SSH-specific status fields or port metadata instead of arbitrary exposed ports.
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 2:22 AM ET / 06:22 UTC.

Summary
The PR adds a built-in sealos-devbox Linux SSH-lease provider with config/env/flags, Kubernetes CRD lifecycle, SSH routing, Secret-backed key handling, cleanup, docs, tests, provider metadata, and live-smoke wiring.

Reproducibility: not applicable. for the feature request itself; this is a new provider, not a broken existing behavior. For live behavior, no: the PR includes offline checks but no real Sealos run proving the provider path.

Review metrics: 2 noteworthy metrics.

  • Diff Size: 33 files, +4,799/-12. The PR adds a broad provider, config, docs, tests, generated metadata, and live-smoke surface that needs maintainer attention before merge.
  • Real Sealos Proof: 0 live proof artifacts attached. The PR body reports offline validation but explicitly does not claim live Sealos cluster/RBAC/SSHGate success.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #365
Summary: This PR is the implementation candidate for the open Sealos DevBox provider request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output, logs, or a linked artifact from a real Sealos doctor/warmup/run/status/stop or cleanup flow.
  • [P1] Get maintainer approval or an explicit waiver for the CRD, Secret, SSHGate, and retained-release contract before merge.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix real Sealos proof is attached; add redacted terminal output, logs, a recording, or a linked artifact, then update the PR body so ClawSweeper re-reviews automatically or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] No real Sealos DevBox proof is attached; offline tests do not prove CRD, RBAC, Secret, SSHGate/NodePort, sync, run, release, or cleanup behavior against an actual Sealos setup.
  • [P1] The linked provider issue remains open for product/security review, so maintainers still need to bless the CRD, Secret, SSHGate, and retained-release contract or explicitly waive that gate.
  • [P1] The provider reads Kubernetes Secret private-key material and writes local SSH keys, so merge should wait for real proof or a maintainer-owned first-landing decision.

Maintainer options:

  1. Require live provider proof and approval (recommended)
    Ask for redacted terminal output, logs, or a linked artifact covering doctor, warmup, status wait, run, and stop or cleanup against a real Sealos environment, plus maintainer approval of the provider contract.
  2. Waive proof for first landing
    Maintainers may explicitly accept the new provider behind documented environment-blocked smoke behavior if they are comfortable owning follow-up real-cluster validation.
  3. Pause the provider direction
    If the CRD/Secret/SSHGate contract is not ready to bless, keep this PR paired with the open provider issue until the supported automation surface is confirmed.

Next step before merge

  • [P1] Human review is needed because automation cannot provide the contributor's real Sealos proof or approve the product/security contract for this new provider.

Security
Cleared: No concrete security defect was found in the inspected head; the provider uses local kubeconfig context, redacts kubectl errors, stores Sealos SSH private keys with 0600 permissions, and no longer writes raw scope metadata remotely.

Review details

Best possible solution:

Land the provider only after maintainers approve the Sealos provider contract and the contributor adds redacted live Sealos proof, or after maintainers explicitly waive that proof for a first landing.

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

Not applicable for the feature request itself; this is a new provider, not a broken existing behavior. For live behavior, no: the PR includes offline checks but no real Sealos run proving the provider path.

Is this the best way to solve the issue?

Unclear pending maintainer approval and proof. The SSH-lease adapter is plausible and the raw remote-scope annotation exposure is addressed, but the provider should not merge without real Sealos proof or an explicit maintainer waiver.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0ec69d642764.

Label changes

Label justifications:

  • P2: This is a substantial new provider improvement with bounded scope, not an urgent regression.
  • merge-risk: 🚨 auth-provider: The PR adds kubeconfig-based provider routing and reads Sealos DevBox Secret material for SSH authentication.
  • merge-risk: 🚨 security-boundary: The PR touches Kubernetes Secret handling, remote DevBox metadata, and cleanup/release identity boundaries.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix real Sealos proof is attached; add redacted terminal output, logs, a recording, or a linked artifact, then update the PR body so ClawSweeper re-reviews automatically or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • Repository policy read and applied: AGENTS.md was read fully; its provider-neutral boundary, generic positioning, testing, and credential-handling guidance are directly relevant to this provider review. (AGENTS.md:1, 0ec69d642764)
  • Current main lacks this provider: Searching current main found no Sealos provider names, CRD terms, docs, or live-smoke support, so the PR is not obsolete on main. (0ec69d642764)
  • PR scope and proof state: The PR changes 33 files with +4,799/-12 and the body says live Sealos cluster/RBAC/SSHGate success is not claimed; comments only request re-review and do not attach live proof. (e78ad4ed5214)
  • Provider registration source: The PR registers sealos-devbox as a Linux SSH-lease provider with sealos and sealos-dev aliases and no coordinator routing. (internal/providers/sealosdevbox/provider.go:31, e78ad4ed5214)
  • Security-sensitive key path inspected: The provider reads Sealos DevBox Secret key fields and writes the private key to the existing per-lease local key path with 0600 permissions. (internal/providers/sealosdevbox/secrets.go:61, e78ad4ed5214)
  • Remote scope metadata inspected: The latest head stores hashed provider-scope identifiers in DevBox labels/annotations rather than writing raw kubeconfig/context/route fields to remote metadata. (internal/providers/sealosdevbox/devbox.go:130, e78ad4ed5214)

Likely related people:

  • coygeek: Current-main history shows substantial Coder SSH-lease provider, provider registry, config, and SSH/provider lifecycle work in the same architectural area, beyond this PR. (role: recent provider-area contributor; confidence: high; commits: 1b5e52ddaf66, 4b5849d2036d, 89019eb7c50f; files: internal/providers/coder, internal/providers/all/all.go, internal/cli/config.go)
  • Vincent Koc: Recent main history includes live-smoke and Coder lifecycle changes in the provider validation and cleanup area touched by this PR. (role: recent adjacent contributor; confidence: medium; commits: 0ec69d642764, b3dfa1ab3140, e3e14ef0588f; files: scripts/live-smoke.sh, internal/providers/coder)
  • Peter Steinberger: Recent main history added another provider and touched shared provider/config/docs surfaces relevant to reviewing a new built-in provider. (role: adjacent provider contributor; confidence: medium; commits: 0301236b2752; files: internal/providers/all/all.go, internal/cli/config.go, docs/providers/README.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jun 25, 2026
coygeek added 2 commits June 24, 2026 21:48
Drop unused Sealos helper functions left behind after the CRD lifecycle implementation so the CI deadcode gate passes.
Register the requested sealos and sealos-dev aliases for the Sealos DevBox provider and update registration coverage plus generated provider docs.
@coygeek

coygeek commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Wait for the expected terminal failure message as well as status in the pre-acquire cleanup test so the race-enabled CI run cannot observe an intermediate terminal record.
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 25, 2026
Store only non-sensitive Sealos provider-scope fingerprints on remote DevBox metadata and stop writing raw route fields to annotations.

Release patches now remove legacy raw scope and route annotations while preserving local claim scope matching for existing DevBoxes.
@coygeek

coygeek commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Sealos Devbox SSH-lease provider

1 participant