feat(sandbox): official Kit sandbox image + GHCR workflow#78
Conversation
Pre-baked Linux image for running the Kit coding agent inside a workdir.dev sandbox, so the dev-sandbox integration no longer installs the toolchain on every boot. - deploy/sandbox/Dockerfile: ubuntu:24.04 mirroring workdir's curated base apt layer, plus Go (go install github.com/mark3labs/kit/cmd/kit), the gh/glab/tea git-forge CLIs, git+openssh-client, the 127.0.0.1 localhost /etc/hosts entry Kit's OAuth listener needs, and /workspace. Deliberately omits workdir's guest-agent/init (the custom-image builder injects those). - .github/workflows/sandbox-image.yml: buildx -> GHCR (ghcr.io/mark3labs/ kit-sandbox) on master pushes touching deploy/sandbox/**, releases, and workflow_dispatch; tags latest/sha/semver. - deploy/sandbox/README.md: build, publish, and workdir POST /v1/images (source.type=oci) registration instructions. Versions pinned (overridable via build args): go 1.26.4, gh 2.95.0, glab 1.105.0, tea 0.14.1. Builds verified locally on linux/amd64.
|
Connected to Huly®: KIT-79 |
|
Warning Review limit reached
More reviews will be available in 40 minutes and 45 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds a sandbox image build-and-publish workflow, a Dockerfile for the image, and README instructions for building, publishing, and registering the image with workdir. ChangesSandbox image build, packaging, and docs
Sequence Diagram(s)sequenceDiagram
participant GitHubActions as GitHub Actions
participant SandboxWorkflow as sandbox-image workflow
participant BuildJob as build job
participant LoginAction as docker/login-action
participant MetadataAction as docker/metadata-action
participant BuildPushAction as docker/build-push-action
participant GHCR
GitHubActions->>SandboxWorkflow: trigger on master push, release publication, or workflow_dispatch
SandboxWorkflow->>BuildJob: start build job
BuildJob->>BuildJob: resolve KIT_VERSION from release tag, input, or latest
BuildJob->>LoginAction: log in with GITHUB_TOKEN
LoginAction->>GHCR: authenticate registry session
BuildJob->>MetadataAction: generate tags and labels
MetadataAction-->>BuildJob: tags and labels
BuildJob->>BuildPushAction: build deploy/sandbox/Dockerfile and push image
BuildPushAction->>GHCR: publish tagged image
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/sandbox-image.yml:
- Line 45: Pin the workflow’s action dependencies to immutable commit SHAs
instead of mutable version tags in the sandbox image publishing job. Update each
`uses` reference in the workflow, including `actions/checkout`,
`docker/setup-buildx-action`, `docker/login-action`, `docker/metadata-action`,
and `docker/build-push-action`, so they point to specific content SHAs and can’t
be retagged upstream.
- Around line 47-56: The “Resolve kit version” step is interpolating release and
input values directly inside the shell script, which can let untrusted content
reach the shell. Update the workflow step to pass github.event.release.tag_name
and inputs.kit_version through env variables instead of `${{ ... }}` in the
script, then in the run block read those env vars, validate the chosen version
string, and only then write it to GITHUB_OUTPUT.
- Around line 76-77: The sandbox image release tags generated by
docker/metadata-action are missing the required leading v prefix, so the current
semver patterns in the workflow produce 1.x.x tags instead of v1.x.x. Update the
tag generation entries in the sandbox-image workflow to preserve the contract,
either by using a v-prefixed pattern or by adding prefix=v for the semver tag
rules, and keep the existing release-tag behavior aligned with the documented
vX.Y.Z / vX.Y format.
In `@deploy/sandbox/Dockerfile`:
- Around line 58-61: The `kit` smoke check is being masked by `|| true`, so a
broken binary can still pass the image build; update the `RUN` step that
installs `kit` and invokes `kit --version` to fail the build on any non-zero
exit, and apply the same change to the other `kit` validation block referenced
in the review so both checks actually enforce runtime validity.
- Around line 47-81: The Dockerfile’s tool install steps for Go, gh, glab, and
tea download release artifacts and install them without verification. Add
integrity checks in the RUN blocks that fetch these assets, using the relevant
upstream checksum, signature, or digest verification flow before extracting or
copying them. Update the install sections for the Go bootstrap, gh, glab, and
tea steps so each artifact is validated before being placed on PATH.
In `@deploy/sandbox/README.md`:
- Around line 57-69: The OCI image registration example uses the mutable latest
tag, which makes the workdir definition non-reproducible. Update the example in
the README to use one of the immutable tags already produced by the workflow,
such as a semver tag or a sha-* tag, and keep the image_ref in the registration
snippet aligned with that stable tag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6a282e89-aae3-43dc-ab1d-0bd4b075d8cc
📒 Files selected for processing (3)
.github/workflows/sandbox-image.ymldeploy/sandbox/Dockerfiledeploy/sandbox/README.md
- Pin all workflow actions to immutable commit SHAs + persist-credentials: false on checkout (prevents upstream retag / credential persistence on a job with packages: write). - Resolve-kit-version step: move github context values into env: and validate the version before writing GITHUB_OUTPUT (avoids template-injection into a shell step with publish credentials). - metadata-action: add prefix=v to the semver tag patterns so release image tags are vX.Y.Z / vX.Y as documented (the action strips the v otherwise). - Dockerfile: verify Go, gh, glab, tea downloads against pinned SHA256 checksums; pin the image to linux/amd64 (checksums are arch-specific and workdir runs x86_64 Firecracker). - Dockerfile: drop '|| true' on the kit smoke checks so a broken kit binary fails the build instead of publishing green. Rebuilt locally: all checksums verify OK, kit version injects, smoke check passes.
|
@coderabbitai all five findings addressed in e0ce63b:
Verified locally: all four checksums report |
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
Use ghcr.io/mark3labs/kit-sandbox:v0.82.1 (an immutable release tag) instead of :latest in the POST /v1/images example, with a note to prefer vX.Y.Z or sha-<short> over latest, so the workdir image definition is reproducible.
|
@coderabbitai addressed the README reproducibility finding in 05c9413 — the |
|
Tip For best results, initiate chat on the files or code changes.
|
What
Adds an official, pre-baked Linux image for running the Kit coding agent inside a workdir.dev sandbox, plus a CI workflow that builds it and publishes to GHCR.
Today the dev-sandbox integration installs the whole toolchain (
apt-get,npm/go install,/etc/hostspatch, symlinks) on every sandbox boot. This image bakes all of that in once, so sandboxes created from it are ready immediately.Contents
deploy/sandbox/Dockerfile—ubuntu:24.04mirroring workdir's curated base apt layer, plus:/usr/local/go) and kit (go install github.com/mark3labs/kit/cmd/kit@<ver>, version ldflag injected)git+openssh-clientfor SSH clones127.0.0.1 localhost/etc/hostsentry Kit's OAuth listener needs/workspacesandbox-guest-agent/sandbox-init— workdir's custom-image builder injects the static-musl guest agent + init when it converts this OCI image to an ext4 rootfs..github/workflows/sandbox-image.yml— buildx → GHCR (ghcr.io/mark3labs/kit-sandbox) onmasterpushes touchingdeploy/sandbox/**, on published releases (rebuilt against the releasedkittag), and onworkflow_dispatch. Tags:latest,sha-<short>, branch,vX.Y.Z/vX.Y.deploy/sandbox/README.md— build, publish, and workdirPOST /v1/images(source.type=oci) registration instructions.Versions
Pinned, overridable via build args: go 1.26.4 (matches
go.mod), gh 2.95.0, glab 1.105.0, tea 0.14.1.How it's used
Once published, register the OCI image with workdir:
```bash
curl -X POST https://api.workdir.dev/v1/images
-H "Authorization: Bearer $WORKDIR_API_KEY"
-d '{"source":{"type":"oci","image_ref":"ghcr.io/mark3labs/kit-sandbox:latest"},"name":"custom/mark3labs/kit-sandbox"}'
```
then create sandboxes with
{"image":"custom/mark3labs/kit-sandbox", ...}.Testing
Built locally on
linux/amd64; the final layer smoke-checks every CLI:```
go version go1.26.4 linux/amd64
kit version v0.82.1
gh version 2.95.0
glab 1.105.0
Version: 0.14.1
```
Summary by CodeRabbit
New Features
Documentation