Skip to content

fix: reserve /home/work to prevent duplicate container mount points#12969

Open
hoyajigi wants to merge 3 commits into
mainfrom
fix/reserve-home-work-mount-alias
Open

fix: reserve /home/work to prevent duplicate container mount points#12969
hoyajigi wants to merge 3 commits into
mainfrom
fix/reserve-home-work-mount-alias

Conversation

@hoyajigi

@hoyajigi hoyajigi commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Setting a vfolder mount alias to exactly /home/work passes every alias validation path (registry.create_session, sokovan validate_session_spec, and MountNameValidationRule): the checks only strip the /home/work/ prefix (with trailing slash), and RESERVED_VFOLDERS contains /home but not /home/work.
  • The agent always bind-mounts the scratch directory at /home/work (agent/docker/agent.py), so such a session passes scheduling and then fails at container creation on the agent with DockerError(400, "Duplicate mount point: /home/work") — observed in production on 26.4.3.
  • Add /home/work to RESERVED_VFOLDERS so every validation path rejects the alias up front with InvalidAPIParameters.
  • RESERVED_VFOLDERS/RESERVED_VFOLDER_PATTERNS were duplicated between ai.backend.common.defs (used by sokovan) and ai.backend.manager.defs (used by verify_vfolder_name); consolidated onto common.defs as the single source of truth and removed the manager copy.

Test plan

  • pants fmt/fix/lint --changed-since=origin/main all pass
  • Extended test_vfolder_name_validator unit test: verify_vfolder_name("/home/work") must be rejected while /home/work/<name> aliases and a folder literally named home/work stay allowed (CI)
  • Manual: create a session with mount_map alias /home/work → expect InvalidAPIParameters at session creation instead of failed-to-create at the agent

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.
Copilot AI review requested due to automatic review settings July 20, 2026 04:29
@hoyajigi
hoyajigi requested a review from a team as a code owner July 20, 2026 04:29
@github-actions github-actions Bot added the size:XS ~10 LoC label Jul 20, 2026
@github-actions github-actions Bot added the comp:manager Related to Manager component label Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents vfolder aliases from colliding with the agent’s intrinsic /home/work scratch mount.

Changes:

  • Reserves /home/work in 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.

Comment thread src/ai/backend/manager/defs.py Outdated
# 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.
@hoyajigi

Copy link
Copy Markdown
Member Author

Good catch — sokovan.validate_session_spec() indeed reads RESERVED_VFOLDERS from ai.backend.common.defs, which is a duplicate of the list in ai.backend.manager.defs. Fixed in 6b6fd83 by consolidating onto the common definition: the reservation is now in common/defs/__init__.py, the manager.defs copy is removed, and verify_vfolder_name imports from common.defs, so all validation paths share a single source of truth.

@github-actions github-actions Bot added size:M 30~100 LoC comp:common Related to Common component and removed size:XS ~10 LoC labels Jul 20, 2026

@seedspirit seedspirit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to be a big problem, but could @HyeockJinKim take a look at it?

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

Labels

comp:common Related to Common component comp:manager Related to Manager component size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants