Skip to content

fix(admin): fall back from broken venv pip - #995

Merged
olegbrok merged 1 commit into
mainfrom
agent/admin-venv-pip-probe
Aug 4, 2026
Merged

fix(admin): fall back from broken venv pip#995
olegbrok merged 1 commit into
mainfrom
agent/admin-venv-pip-probe

Conversation

@bradbrok

@bradbrok bradbrok commented Aug 4, 2026

Copy link
Copy Markdown
Owner

What changed

  • probe an existing project venv through .venv/bin/python -m pip --version before selecting it for dependency rebuilds
  • treat any probe failure as a vestigial venv, log the failure and fallback interpreter loudly, and install through the running daemon's sys.executable
  • keep a functional project venv preferred, with both the probe and install using its own Python/pip module
  • invoke the existing host-local owner-notification path exactly once whenever the dependency rebuild leaves deps_error set

Why / root cause

Internal fleet task 508 traced the Mini's repeated deploy-time dependency failure to a vestigial .venv. Its .venv/bin/pip file still exists, but the associated interpreter no longer has the pip module. The update path trusted file existence as proof of functionality, selected that broken environment on every deploy, then degraded to a response field and one daemon log line.

The designed system-Python fallback was never reached even though the Mini daemon's Homebrew Python could perform the install.

Impact

Vestigial venvs no longer block dependency delivery: updates fall back to the interpreter that is actually running the daemon. Healthy project venvs remain preferred. If either dependency-install branch still fails, the owner receives a host-local alert so code cannot silently land without required packages.

Checks

  • requested probe/fallback/preference/alert regressions: 3 passed
  • uv run pytest -q tests/test_admin_update.py: 41 passed
  • focused existing host-local owner-notifier tests: 3 passed
  • broader tests/test_api.py: 402 passed; one unrelated host-configured tmux-dream failure, whose exact selector passed with its intended SDK transport
  • uv run ruff check .: passed
  • uv lock --check: passed
  • targeted compileall: passed
  • git diff --check: passed

🤖 Opened by Murzik

@olegbrok
olegbrok marked this pull request as ready for review August 4, 2026 13:54

@olegbrok olegbrok left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed + verified: probe-before-prefer is fail-closed (FileNotFoundError on a missing venv python also falls back loudly), the system branch is untouched, owner alert fires exactly once post-update with try/except armor. Ran test_admin_update.py locally in a fresh worktree (41 pass); CI green on final SHA 37bb694 across py3.11/3.12/3.13 full suites — the test_api.py env-bleed flag was confirmed environmental.

🤖 Reviewed by Barsik (murzik authored)

@olegbrok
olegbrok merged commit 01e577d into main Aug 4, 2026
11 checks passed
@olegbrok
olegbrok deleted the agent/admin-venv-pip-probe branch August 4, 2026 13:54
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.

2 participants