Skip to content

Tell a hotfix seat's ssh session where the interpreters live - #175

Merged
gilesknap merged 1 commit into
mainfrom
claude/uv-interpreter-store-in-the-session
Aug 22, 2026
Merged

gilesknap merged 1 commit into
mainfrom
claude/uv-interpreter-store-in-the-session

Conversation

@gilesknap

Copy link
Copy Markdown
Member

Partial fix for #160 — the half that fails silently. Not merged; opened for review only.

The question this answers

What does uv sync do in a VS Code shell? Measured on p47-beamline from a seat mounting the claim and running as the target's uid, in the environment podbench's ssh transport actually creates:

what you type result
uv sync, .venv present ✅ home unchanged, on the claim
uv add six ✅ home unchanged, on the claim
.venv removed, then uv sync ❌ home = /tmp/.local/share/uv/python/cpython-3.11.13-…

uv consults UV_PYTHON_INSTALL_DIR only when it has to choose an interpreter. With a venv present it reuses the one pyvenv.cfg names — and since 0.6.0 that one is on the claim, resolving to the same bytes in both namespaces. That is why the common case is genuinely fine.

When it does choose, it writes a seat-local path the target cannot see. No error, and the shebang still reads #!/podbench/app/.venv/bin/python, so it looks right. The fix reverts at the next relaunch and nothing says so.

A VS Code shell is an ssh session, and sshd inherits none of the image's ENV — only SESSION_ENV_NAMES survives, and UV_PYTHON_INSTALL_DIR is not in it. So it arrives unset, and uv falls back to $HOME/.local/share/uv/python inside the seat.

The fix

session_env() gains one computed entry, and ensure_sshd_config supplies it.

Computed, not forwarded, and that distinction is the point: podbench's image and every python-copier-template target set UV_PYTHON_INSTALL_DIR=/python, so carrying it by name would point a session working on the target's project at the seat's interpreter store — the bleed #160 describes, not the fix. There is a test asserting it is never in SESSION_ENV_NAMES.

Probed, not assumed: an ordinary attach seat has no claim, and naming a path that does not exist would break uv there for no reason. hotfix_interpreter_store() returns None unless the claim's interpreter directory is actually present.

Verified

Same failing case, with the session env this now writes:

home now: home = /podbench/app/.python/cpython-3.11.13-linux-x86_64-gnu/bin
resolves: /podbench/app/.python/cpython-3.11.13-linux-x86_64-gnu/bin/python3.11
on the claim? YES

and the target then runs what the seat built — FastCS: 0.10.1.

What this does not do

#160 also asks for UV_PYTHON_INSTALL_DIR in the application container's chart env. I have left that out deliberately and #160 stays open for it: podbench's own rebuild already passes --python explicitly, so the target is covered for podbench-driven syncs, and overriding the variable in the application container would point uv at an empty claim during image start-up — a plausible regression I have not measured. Worth doing as its own change with its own evidence.

just check green: 1564 passed, pyright strict clean. Test pod and seat deleted.

A VS Code shell is an ssh session, and sshd inherits none of the image's ENV -
only the names in SESSION_ENV_NAMES survive. UV_PYTHON_INSTALL_DIR is not one of
them, so it arrives unset and uv falls back to $HOME/.local/share/uv/python,
inside the seat.

Measured on p47-beamline, 2026-08-22, from a seat mounting the claim and running
as the target's uid:

  uv sync, venv present  ->  home unchanged, on the claim   (fine)
  uv add six             ->  home unchanged, on the claim   (fine)
  .venv removed, uv sync ->  home = /tmp/.local/share/uv/python/cpython-3.11.13...

The last one is the case #160 calls silent. uv only consults
UV_PYTHON_INSTALL_DIR when it has to *choose* an interpreter; with a venv
already present it reuses the one pyvenv.cfg names, and that one is on the
claim, which is why the common case looks fine. When it does choose, it writes
a path the target cannot see - with no error, and a shebang that still reads
#!/podbench/app/.venv/bin/python. The fix reverts at the next relaunch and
nothing says so.

The value is computed, not forwarded. Both podbench's image and every
python-copier-template target set UV_PYTHON_INSTALL_DIR=/python, so carrying it
by name would point a session working on the target's project at the *seat's*
interpreter store - which is the bleed rather than the fix. It is also probed
rather than assumed: an ordinary attach seat has no claim, and naming a path
that does not exist would break uv there for no reason.

Verified against the same failing case: with the session env this now writes,
the rebuilt venv names /podbench/app/.python and the target runs it.

Refs #160.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Kt5d2r5cnhr2iXEkddtaEz
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b565777c-412e-4bc6-bbb5-a815a8a7aa19

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gilesknap
gilesknap merged commit e4b1fdb into main Aug 22, 2026
30 checks passed
@gilesknap
gilesknap deleted the claude/uv-interpreter-store-in-the-session branch August 22, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant