Skip to content

feat: add Ascii Box remote execution environment - #1604

Open
zozo123 wants to merge 7 commits into
stacklok:mainfrom
zozo123:feat/box-execution-environment-v2
Open

zozo123 wants to merge 7 commits into
stacklok:mainfrom
zozo123:feat/box-execution-environment-v2

Conversation

@zozo123

@zozo123 zozo123 commented Sep 15, 2026

Copy link
Copy Markdown

Summary

Adds an Ascii Box-backed Mecatl execution-environment / placement-provider adapter directly on main.

What it provides

  • server.PlacementProvider + exact PlacementReattacher backed by the Box API
  • durable EnvironmentRef{Kind: "box", ID: <box-id>, Revision: "box-api-v1"}
  • Box filesystem adapter implementing Mecatl's versioned Workspace contract
  • Shell CommandRunner bound to the same Box workspace namespace
  • POSIX-like namespace operations (ReadDir, Remove, Rename, CopyFile)
  • create / readiness / stop / resume lifecycle handling
  • noEnv: true by default so account/model/GitHub/SSH secrets are not injected into agent sandboxes
  • bounded API responses, path confinement, safe shell quoting, HTTPS-only API endpoint configuration
  • offline httptest coverage for creation, exact reattachment, version conflicts, grep, path escape, auth/error handling
  • opt-in real API smoke test behind box_live

The API key is host-side configuration only and is never placed in EnvironmentRef, the Box environment, tests, or repository state.

Live verification

The live contract test is opt-in and excluded from normal CI:

BOX_API_KEY=... go test -tags=box_live ./internal/adapter/boxenv -run TestLiveBoxEnvironment -v

It exercises create, file read/write, Shell/workspace namespace agreement, exact reattachment, and cleanup.

Scope

This PR intentionally keeps Box isolated in internal/adapter/boxenv; it does not add a parallel sandbox abstraction or leak Box concepts into engine/. Operator-facing execution-placement selection can be wired separately once the provider-registration surface is finalized.

zozo123 commented Sep 15, 2026

Copy link
Copy Markdown
Author

CI note: all pull-request workflows (CI, Deslop, e2e-live, perf) are currently action_required before any jobs are created. This is GitHub's fork-contributor workflow-approval gate, not a test failure. A Stacklok maintainer needs to click Approve and run workflows on this PR; no repository secrets are requested by the PR CI path.

zozo123 commented Sep 15, 2026

Copy link
Copy Markdown
Author

One more status note: the remaining red Vercel check is also a permission gate (Authorization required to deploy for the Stacklok Vercel team), not a build/deploy error from this change. So the PR currently needs maintainer approval for GitHub Actions and Vercel before any real CI result can go green/red.

@zozo123

zozo123 commented Sep 15, 2026

Copy link
Copy Markdown
Author

E2E evidence (tested with gh)

Tested PR revision 0dab52aa2e2b67c5baa18c75dd2b7372094c9152 locally on macOS arm64:

  • go test ./internal/adapter/boxenv
  • go test -tags=box_live ./internal/adapter/boxenv -run TestLiveBoxEnvironment -count=1 -v
    • Create flow reaches the live Box, but CreateFile fails because the file-read probe receives HTTP 400 box_direct_failed: ENOENT for a missing file. The adapter currently only normalizes HTTP 404 to fs.ErrNotExist.

I reproduced a minimal local fix that normalizes the Box API's ENOENT response to fs.ErrNotExist; with that fix applied, the same live contract test passes in 5.4s and exercises create, file read/write, Shell/workspace namespace agreement, exact reattachment, and cleanup. The fix is not pushed because this checkout does not have permission to push to stacklok/mecatl (GitHub returned HTTP 403).

@zozo123

zozo123 commented Sep 15, 2026

Copy link
Copy Markdown
Author

Follow-up: local compatibility fix verified

The live failure is reproducible and isolated to missing-file semantics: Box returns HTTP 400 with box_direct_failed / ENOENT, not HTTP 404. I implemented and verified a local fix that treats both forms as fs.ErrNotExist (including the CopyFile probe path).

Verification with the fix applied:

go test ./internal/adapter/boxenv
ok   github.com/stacklok/mecatl/internal/adapter/boxenv

go test -tags=box_live ./internal/adapter/boxenv -run TestLiveBoxEnvironment -count=1 -v
--- PASS: TestLiveBoxEnvironment (4.35s)
PASS

The fix is committed locally as f57633b1d; pushing is blocked because the authenticated GitHub account has no write permission to stacklok/mecatl (HTTP 403).

@zozo123

zozo123 commented Sep 15, 2026

Copy link
Copy Markdown
Author

Pushed the verified fix to the PR head branch (f57633b1d). The live Box contract test now passes end-to-end, including create, file read/write, Shell/workspace namespace agreement, exact reattachment, and cleanup. The remaining Vercel check is an external authorization-required deployment failure, unrelated to the Go tests.

@jhrozek

jhrozek commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

hey @zozo123 you opened 3 PRs with essentially the same feature but they don't appear to be the same, which one of them is the current one?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants