mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #67] [MERGED] fix(template): provision a missing default user at the end of a build #152
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/67
Author: @nblintao
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/31/2026
Merged by: @LSX-s-Software
Base:
main← Head:fix/provision-default-user📝 Commits (6)
5d0deaefix(template): provision a missing default user at the end of a buildb34d9fdfix(template): provision the default user via /bin/sh9ee24cdfix(template): validate the account name and propagate executor errors0a0245afix(template): provision the default user's named group as wellb5a01dffix(template): bound the default-user provisioning command with a timeouta5a627ffix(template): only downgrade provisioning failure when the image lacks tooling📊 Changes
2 files changed (+371 additions, -3 deletions)
View changed files
📝
docs/src/concepts/templates.md(+1 -1)📝
src/template/runner.rs(+370 -2)📄 Description
Background
We work on miles, an RL training framework, and are integrating AgentENV as a sandbox backend for agentic RL environments through its E2B-compatible API. Running Dockerfile-defined task suites (Harbor tasks) against an AgentENV server via the stock e2b Python SDK, sandboxes came up but every SDK filesystem call failed with:
Problem
envd resolves SDK operations against the template's default user. E2B Cloud guarantees that account exists through its base images, and the e2b SDK bakes the convention in:
from_dockerfileinjectsUSER userwhenever a Dockerfile does not set one (dockerfile_parser.py, "Set the user and workdir to the E2B defaults"). Templates built from arbitrary OCI images do not ship that account —ubuntu:24.04has nouser— so the injected default breaks every envd operation that resolves it at runtime.The chain on the AgentENV side: the template's user metadata lands in
config.common.default_user(src/sandbox/firecracker/factory.rs) and is handed to envd at init; envd then rejects operations because the account does not exist in the guest (e2b-dev/infra,packages/envd/internal/permissions/authenticate.go).Fix
Provision the missing account inside the build sandbox after the build steps finish:
covering GNU and BusyBox userlands. Deliberate scoping:
USERvalues are left alone — Docker allows a UID with no passwd entry.user:groupforms target the account before the colon.useradd/adduserbuilt fine before this provisioning existed; only envd calls that resolve the default user will fail, exactly as today.Alternatives considered: patching envd to fall back to root when the default user is missing (touches the vendored
e2b-dev/infrabuild viatools-image/, and loosens envd's contract for every deployment), or validating at build submission (breaks previously-working builds). Creating the account aligns AgentENV templates with what E2B-compatible clients already assume; happy to rework toward another layer if you prefer.Validation
cargo test --lib template— 35 passed (new: provisioning skips absent/root/numeric users, creates missing named users, targets the account before the colon, and a failed creation warns without failing the build).aenv-serverwith this fix and re-ran a previously failing Harbor task (FROM ubuntu:24.04, noUSERinstruction, SDK filesystem uploads/downloads) throughharbor run -e e2bagainst the patched server: the previously failing trial now passes end-to-end (verifier reward 1.0). Validated together with #66 on the same rebuilt server; each fix addresses an independent failure the task hits in sequence.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.