mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #66] [MERGED] fix(template): create WORKDIR directories during template builds #151
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#151
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/66
Author: @nblintao
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/31/2026
Merged by: @huajq
Base:
main← Head:fix/workdir-step-mkdir📝 Commits (4)
a18938ffix(template): create WORKDIR directories during template builds7032ec1fix(template): resolve relative WORKDIR against the current workdir90b36e9fix(template): normalize WORKDIR lexically and create it without a shellbabc0b3fix(template): create WORKDIR via envd filesystem instead of exec'ing mkdir📊 Changes
5 files changed (+273 additions, -7 deletions)
View changed files
📝
docs/src/concepts/templates.md(+1 -1)📝
src/sandbox/backend.rs(+18 -0)📝
src/sandbox/envd.rs(+16 -4)📝
src/sandbox/process.rs(+21 -0)📝
src/template/step_executor.rs(+217 -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. While running existing Dockerfile-defined task suites (Harbor tasks) against an AgentENV server via the stock e2b Python SDK, template builds succeeded but every sandbox failed on first command with:
Problem
Docker's
WORKDIRcreates the directory when it does not exist (Dockerfile reference), but the template step executor only records the path as build-context metadata (src/template/step_executor.rs,TemplateBuildStepKind::Workdir). Any Dockerfile whoseWORKDIRpoints at a directory not already present in the base image produces a template whose workdir is missing.Both Dockerfile front-ends are affected:
Template().from_dockerfile(...), which mapsWORKDIRto a workdir step — and additionally injects a defaultWORKDIR /home/userwhen the Dockerfile sets none, a directory that rarely exists in arbitrary OCI images;aenv build, which maps the instruction the same way.Minimal repro (e2b SDK against an AgentENV server):
Fix
Run
mkdir -pinside the build sandbox when executing a workdir step, with the previous workdir as the cwd so relativeWORKDIRpaths resolve the way Docker resolves them. A failed mkdir fails the build, labelled with theWORKDIRstep. Doc table updated accordingly.Validation
cargo test --lib template— 34 passed (new: mkdir command shape, relative-path cwd resolution, failure labelling;workdir_step_updates_workdirmoved to a recording sandbox since the step now executes a command).aenv-serverwith this fix and re-ran a previously failing Harbor task (FROM ubuntu:24.04+WORKDIR /app, unmodified) throughharbor run -e e2bagainst the patched server: the previously failing trial now passes end-to-end (verifier reward 1.0). Validated together with #67 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.