Skip to content

fix(sandbox): align E2B sandbox with current gitmachine API#61

Open
Nivesh353 wants to merge 1 commit into
open-gitagent:mainfrom
Nivesh353:fix/sandbox-e2b-machine-construction
Open

fix(sandbox): align E2B sandbox with current gitmachine API#61
Nivesh353 wants to merge 1 commit into
open-gitagent:mainfrom
Nivesh353:fix/sandbox-e2b-machine-construction

Conversation

@Nivesh353

Copy link
Copy Markdown
Contributor

sandbox.ts was written against an outdated gitmachine API. It passed
provider: "e2b" to GitMachine, but the current gitmachine splits VM
creation (E2BMachine) from git lifecycle (GitMachine) — GitMachine
expects a ready-built machine instance. With none passed, this.machine
was undefined and start() threw. The feature couldn't run at all,
regardless of a valid E2B key.

Fix

Construct the E2BMachine first, then hand it to GitMachine (the pattern
gitmachine's README documents). Four corrections:

  1. Build E2BMachine({ apiKey, template, timeout, envs }) and pass it as machine
  2. GitMachine uses env (singular); E2BMachine uses envs (plural)
  3. Add an explicit E2B_API_KEY check with a helpful error
  4. Fix repoPath to gitmachine's fixed /home/user/repo; return the built
    machine (was gitMachine.machine, which is private → undefined)

Scope: a single file, src/sandbox.ts (+22 / −8).

Verification

  • gitmachine standalone — confirmed working (boots a VM, clones a repo,
    runs commands in isolation).
  • gitagent --sandbox end-to-end — VM boots → repo clones → the agent's
    cli tool runs inside the sandbox:

sandbox.ts passed `provider: "e2b"` to GitMachine, but current gitmachine
expects a pre-built `machine` — so it was undefined and start() crashed.
Now construct E2BMachine first and pass it in (+ env/envs key fix, E2B_API_KEY
check, fixed /home/user/repo path). Verified end-to-end: --sandbox boots the
VM and runs tools inside it.
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.

1 participant