[codex] Add Crownest provider#681
Conversation
|
Codex review: needs changes before merge. Reviewed July 2, 2026, 2:00 PM ET / 18:00 UTC. Summary Reproducibility: yes. for the review findings by source inspection: client.go still probes /v1/sandboxes?limit=1, and backend.go publishes a claim before acquiring the operation lock. I did not run live Crownest credentials in this read-only review. Review metrics: 2 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:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the Crownest implementation behind the provider adapter, but fix the doctor permission boundary and claim/operation-lock ordering before final maintainer provider acceptance. Do we have a high-confidence way to reproduce the issue? Yes for the review findings by source inspection: client.go still probes /v1/sandboxes?limit=1, and backend.go publishes a claim before acquiring the operation lock. I did not run live Crownest credentials in this read-only review. Is this the best way to solve the issue? No; the provider shape is close, but the current implementation needs the doctor probe and claim/lock ordering fixed before it is the narrow maintainable solution. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c0363ba1ba3b. Label changesLabel changes:
Label justifications:
Evidence reviewedAcceptance criteria:
What 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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f2a8bfbb3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| *shouldStop = false | ||
| cleanupCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), cleanupTimeout) | ||
| defer cancel() | ||
| if err := api.DeleteSandbox(cleanupCtx, sandboxID); err != nil && !isNotFound(err) { |
There was a problem hiding this comment.
Avoid deleting one-shot Workspace Run sandboxes
For normal crabbox run --provider crownest without --keep, the Workspace Run is created with keepSandbox=false, so Crownest owns cleanup; the public Workspace Runs docs describe the run lifecycle as requiring workspace_run:create/read/cancel and keepSandbox as the cleanup control. This unconditional DeleteSandbox makes an otherwise successful run fail during cleanup for least-privilege keys that can run Workspace Runs but cannot delete sandboxes (403 is not treated like 404), flipping the local exit code to 1 after the remote command succeeded.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e418223. One-shot Crownest Workspace Runs now respect keepSandbox=false: Crabbox removes the local claim but does not call DeleteSandbox, so least-privilege Workspace Run keys do not fail after a successful remote command. Retained paths still delete when Crabbox explicitly requested retention and then needs to clean up.
Validation: go test ./internal/providers/crownest ./internal/cli, go vet ./..., go build -trimpath -o bin/crabbox ./cmd/crabbox, live scripts/live-crownest-smoke.sh, and autoreview clean.
3f2a8bf to
e418223
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 185162630e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func (c *httpClient) BaseURL() string { return c.baseURL } | ||
|
|
||
| func (c *httpClient) Probe(ctx context.Context) error { | ||
| return c.doJSON(ctx, http.MethodGet, "/v1/sandboxes?limit=1", nil, nil, "") |
There was a problem hiding this comment.
Probe the Workspace Run surface in doctor
For a least-privilege Crownest key that has only the documented Workspace Run lifecycle scopes (workspace_run:create/read/cancel), normal one-shot crabbox run --provider crownest can succeed, but this doctor probe hits the sandbox-list endpoint and fails with 403 before exercising the delegated-run surface. That makes crabbox doctor --provider crownest incorrectly report auth/API failure for valid run-only credentials; probe a Workspace Run read endpoint instead, or make sandbox-list denial non-fatal for doctor.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed1e87e9be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if err := b.claimAcquiredSandbox(ctx, api, req, leaseID, sandboxID, slug, &leaseID, &slug); err != nil { | ||
| return RunResult{}, err | ||
| } | ||
| if err := lockAcquiredLease(); err != nil { |
There was a problem hiding this comment.
Acquire the operation lock before publishing new claims
For newly created Crownest runs, claimAcquiredSandbox writes the local claim and prints the slug before this process holds the per-lease operation lock. In the window before lockAcquiredLease succeeds, another crabbox stop --provider crownest <slug> process can resolve the just-published claim, acquire the lock first, delete the sandbox, and remove the claim while this run is still uploading/finalizing/starting, causing the active run to fail or race against a deleted sandbox. Hold the operation lock before making the claim visible (the same pattern matters when the sandbox ID is first reported after start).
Useful? React with 👍 / 👎.
Summary
Why / impact
This lets Crabbox run workloads on Crownest while keeping the core provider-neutral and avoiding secret persistence or secret forwarding. The provider treats the Crownest API key as runtime-only configuration, does not pass it on the command line, rejects unsupported delegated-run surfaces, and documents the current environment-forwarding limitation.
Review comment addressed
worker/package-lock.jsondrift from the branch.--crownest-url,--crownest-project-id,--crownest-template) so custom-scoped retained sandboxes can be stopped from the printed command.keepSandbox=false, Crabbox removes only the local claim and does not callDeleteSandbox; retained sandboxes still use explicit delete when Crabbox requested retention and later cleans up.Repo guidance checked
AGENTS.md: provider-neutral core, no generated outputs edited by hand, verification commands included in the PR, and no provider/broker tokens in code/docs.SECURITY.md: no live credentials or private infrastructure details are published here..github/: no pull request template is present; CI target is the repository default branch,main.Validation
go test ./internal/providers/crownest ./internal/cliPassed.
go test -race ./...Passed on the final current-main merge.
go vet ./...Passed.
90.1% after focused Crownest config-path tests; threshold is 90.0%.
go build -trimpath -o bin/crabbox ./cmd/crabboxPassed. macOS linker emitted only:
ld: warning: ignoring duplicate libraries: '-lobjc'.scripts/check-docs.shPassed: checked 51 command docs, provider matrix with 69 providers, 202 markdown files, and built
dist/docs-site.node --test scripts/live-crownest-smoke.test.jsPassed: 1 test.
Passed: 752 tests and Wrangler dry-run build.
git diff --exit-code origin/main -- worker/package-lock.jsonPassed: worker lockfile is no longer part of this PR.
Two actionable findings fixed; final review clean with no accepted/actionable findings.
Live Crownest evidence
Using a Crownest API key from the shell environment only, I ran
bin/crabbox doctor --provider crownestand a real remote workload against a temporary repo containing six files. The remote command ran Node tests, analyzed a CSV dataset, wrote a summary artifact, and verified the aggregate output.Key output:
I also ran the live smoke script with
CRABBOX_BIN=bin/crabbox scripts/live-crownest-smoke.sh. It exercised doctor, one-shot run, keep, status, reuse, and stop:Config / secrets
CRABBOX_CROWNEST_API_KEYorCROWNEST_API_KEYto be supplied at runtime.