lablup / lablup/backend.ai

fix: mount-list dedup (BA-650 / #3593) regressed in SessionSpec refactor — KernelRow.mounts no longer deduped at enqueue

Open Beginner friendly
#12,348 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Summary

The mount-list deduplication added in #3593 (BA-650) was partially lost during the sokovan session-lifecycle / `SessionSpec` refactor (#11250). The **write/enqueue** path no longer deduplicates `mounts` before persisting it to `KernelRow`.

## Background

#3593 deduped the compute-session mount list in **two** places, both via a set-comprehension `[*{mount.name for mount in ...}]`:

1. **Read path** — `models/session.py :: parse_row` (GraphQL session resolver)
2. **Write path** — `registry.py :: enqueue_session` (persisted `KernelRow.mounts`)

## Current state (`main`, after #11250)

**Read path — still correct, even strengthened.** Now at `src/ai/backend/manager/api/gql_legacy/session.py:1103`:

```python
"mounts": [*{mount.name for mount in vfolder_mounts}],
"vfolder_mounts": [*{vf.vfid.folder_id for vf in vfolder_mounts}], # newly deduped too
```

**Write path — regressed.** The `enqueue_session` payload was refactored into `SessionRowCreator.build_row`, and the set-dedup was dropped. `src/ai/backend/manager/repositories/scheduler/creators.py:110`:

```python
resolved_mounts = list(self.kernel_spec.vfolder_mounts)
...
mounts=[mount.name for mount in resolved_mounts], # ← no dedup (was [*{...}])
```

## Impact

- The persisted `KernelRow.mounts` column can again contain duplicate folder names — the exact condition #3593 fixed.
- **User-facing GraphQL responses are NOT affected**: `parse_row` re-derives `mounts` from `vfolder_mounts` with dedup at read time, so `compute_session` / `compute_session_list` still return unique values.
- Any consumer that reads the stored `mounts` column **without** going through `parse_row` would observe the duplicates.

## Suggested fix

Restore the set-comprehension at the write site to match #3593:

```python
mounts=[*{mount.name for mount in resolved_mounts}],
```

The legacy `registry.py` enqueue path (`registry.py:1075`, `mounts=mount_entries` built by `_mount_entries_from_creation_config`) should be checked for the same gap while at it.

## References

- Original fix: #3593 (BA-650)
- Regressing refactor: #11250 (`8321c79aa`, `creators.py:110`)

Contributor guide

Open the contributing guide

Research direction

Read `src/ai/backend/manager/repositories/scheduler/creators.py` at `SessionRowCreator.build_row`, especially the `resolved_mounts` assignment and `KernelRow.mounts` construction. Compare it with the original deduplication in #3593, then check the legacy `registry.py:1075` enqueue path for the same gap. Done means persisted mounts are deduplicated in both write paths; user-facing GraphQL behavior is already described as unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
79/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.