fix: reserve /home/work to prevent duplicate container mount points#12969
fix: reserve /home/work to prevent duplicate container mount points#12969hoyajigi wants to merge 3 commits into
Conversation
Mounting a vfolder with its alias set to exactly /home/work passed all
three alias validation paths (registry.create_session, sokovan
validate_session_spec, and MountNameValidationRule) because
RESERVED_VFOLDERS only contains /home and the alias checks only strip
the "/home/work/" prefix with a trailing slash. The agent always
bind-mounts the scratch directory at /home/work, so such a session
reaches the agent and fails at container creation with:
DockerError(400, "Duplicate mount point: /home/work")
Add /home/work to RESERVED_VFOLDERS so every validation path rejects it
up front with an InvalidAPIParameters error instead.
There was a problem hiding this comment.
Pull request overview
Prevents vfolder aliases from colliding with the agent’s intrinsic /home/work scratch mount.
Changes:
- Reserves
/home/workin manager validation. - Adds regression coverage and a changelog entry.
- Sokovan’s separate common reservation list remains unmodified.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ai/backend/manager/defs.py |
Adds /home/work to reserved paths. |
tests/unit/manager/api/test_utils.py |
Tests exact-path rejection. |
changes/12969.fix.md |
Documents the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # The agent always bind-mounts the scratch directory at /home/work, | ||
| # so mounting a vfolder exactly there makes dockerd reject the container | ||
| # with "Duplicate mount point: /home/work". | ||
| "/home/work", |
The list was duplicated in ai.backend.common.defs and ai.backend.manager.defs, and sokovan validate_session_spec() reads the common copy, so patching only the manager copy left that path open. Remove the manager copy and make verify_vfolder_name use common.defs so there is a single source of truth.
|
Good catch — |
seedspirit
left a comment
There was a problem hiding this comment.
It doesn't seem to be a big problem, but could @HyeockJinKim take a look at it?
Summary
/home/workpasses every alias validation path (registry.create_session, sokovanvalidate_session_spec, andMountNameValidationRule): the checks only strip the/home/work/prefix (with trailing slash), andRESERVED_VFOLDERScontains/homebut not/home/work./home/work(agent/docker/agent.py), so such a session passes scheduling and then fails at container creation on the agent withDockerError(400, "Duplicate mount point: /home/work")— observed in production on 26.4.3./home/worktoRESERVED_VFOLDERSso every validation path rejects the alias up front withInvalidAPIParameters.RESERVED_VFOLDERS/RESERVED_VFOLDER_PATTERNSwere duplicated betweenai.backend.common.defs(used by sokovan) andai.backend.manager.defs(used byverify_vfolder_name); consolidated ontocommon.defsas the single source of truth and removed the manager copy.Test plan
pants fmt/fix/lint --changed-since=origin/mainall passtest_vfolder_name_validatorunit test:verify_vfolder_name("/home/work")must be rejected while/home/work/<name>aliases and a folder literally namedhome/workstay allowed (CI)mount_mapalias/home/work→ expectInvalidAPIParametersat session creation instead offailed-to-createat the agent