Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/11610.enhance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Session creation now honors `MountOption.mount_destination` from `mount_options[uuid]` (as a fallback after `mount_id_map`), so both session and inference service paths accept the same `MountOption` shape. Previously the field was silently ignored on the session path, forcing callers to use `mount_map` / `mount_id_map` for destinations.
11 changes: 10 additions & 1 deletion src/ai/backend/manager/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,16 @@ def _mount_entries_from_creation_config(
perm = None
raw_subpath = opts.get("subpath")
subpath_value = str(raw_subpath) if raw_subpath is not None else None
dst_path = mount_id_map.get(vfolder_uuid) or mount_id_map.get(raw_id)
# Destination may come from either the explicit ``mount_id_map``
# (preferred — atomic to the destination concept) or, as a
# fallback, the per-vfolder ``mount_options[uuid].mount_destination``
# so callers can express both option and destination in a single
# dict — matching the inference service creation surface.
dst_path = (
mount_id_map.get(vfolder_uuid)
or mount_id_map.get(raw_id)
or opts.get("mount_destination")
)
entries.append(
MountInfoEntry(
vfolder_id=VFolderUUID(vfolder_uuid),
Expand Down
49 changes: 49 additions & 0 deletions tests/unit/manager/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,52 @@ async def _hang(cache_id: str) -> AsyncIterator[AbstractEvent]:
await mock_registry_obj._wait_for_session_running(
session_id, mock_propagator, max_wait=0
)


class TestMountEntriesFromCreationConfig:
"""Session creation honors ``mount_destination`` from both ``mount_id_map``
(preferred) and ``mount_options[uuid].mount_destination`` (fallback), so the
same ``MountOption`` shape that inference service creation accepts also
works for sessions.
"""

def test_mount_id_map_supplies_destination(self) -> None:
vfid = uuid.uuid4()
creation_config = {
"mount_ids": [vfid],
"mount_id_map": {vfid: "/data/dst"},
"mount_options": {vfid: {"permission": "ro"}},
}

entries = AgentRegistry._mount_entries_from_creation_config(creation_config)

assert len(entries) == 1
assert entries[0].mount_destination == "/data/dst"

def test_mount_options_mount_destination_fallback(self) -> None:
vfid = uuid.uuid4()
creation_config = {
"mount_ids": [vfid],
"mount_id_map": {},
"mount_options": {
vfid: {"mount_destination": "/data/from-options", "permission": "ro"},
},
}

entries = AgentRegistry._mount_entries_from_creation_config(creation_config)

assert len(entries) == 1
assert entries[0].mount_destination == "/data/from-options"

def test_mount_id_map_takes_precedence_over_mount_options(self) -> None:
vfid = uuid.uuid4()
creation_config = {
"mount_ids": [vfid],
"mount_id_map": {vfid: "/data/winner"},
"mount_options": {vfid: {"mount_destination": "/data/loser"}},
}

entries = AgentRegistry._mount_entries_from_creation_config(creation_config)

assert len(entries) == 1
assert entries[0].mount_destination == "/data/winner"
Loading