Skip to content

fix(admin): rebuild deps for system-python (rebase of #323 + integration tests) - #392

Merged
olegbrok merged 2 commits into
betafrom
fix/admin-force-deps-rebase
May 6, 2026
Merged

fix(admin): rebuild deps for system-python (rebase of #323 + integration tests)#392
olegbrok merged 2 commits into
betafrom
fix/admin-force-deps-rebase

Conversation

@olegbrok

@olegbrok olegbrok commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rebases #323 (sat OPEN since 2026-04-25, conflicting after main's api.py refactor stack #362-#372) onto current beta and adds integration tests covering the interaction with the recently-landed `force=true` flag from #390.

This supersedes #323 — same intent, conflict-resolved against beta + extra coverage.

What's in the box

From #323 (Brad's original, now `c51b578` after conflict resolution):

  • `/admin/update` accepts `force_deps: bool = False`. When true, reinstall deps even when git HEAD didn't move.
  • pip-install path now falls back to `sys.executable -m pip install --break-system-packages` when no `.venv/bin/pip` is present (PEP 668 / Homebrew / Debian).
  • Trigger detection widened: pyproject.toml OR uv.lock changes both qualify.
  • New `deps_error` surfaced in response so silent failures stop being silent.
  • `update_and_restart` MCP tool grows a `force_deps=False` param.

New integration tests (`65004ce`):

Why this matters

`force` (PR #390) and `force_deps` (this PR) are orthogonal escape hatches:

  • `force`: git-level — discard tracked-file mods before pull
  • `force_deps`: env-level — reinstall when installed packages drift from pinned

Both useful. Combined: `update_and_restart(force=True, force_deps=True)` is the nuclear-recovery option for any deploy that's stuck.

Test plan

Suggested follow-up

Close #323 as superseded once this lands.

🤖 Opened by Barsik

Oleg and others added 2 commits May 5, 2026 20:04
…scape hatch

The admin_update endpoint only ran `pip install` if `.venv/bin/pip` existed,
which silently skipped dependency rebuilds on system-python deployments
(Homebrew/Debian). Result: pyproject pin bumps merged to main but the live
daemon kept running stale package versions.

Fix:
- Fall back to `sys.executable -m pip install --break-system-packages` when
  no in-tree venv is present (PEP 668 externally-managed envs).
- Trigger rebuild when pyproject.toml or uv.lock changed in the pulled
  diff, OR when the new `force_deps=true` query param is set.
- Surface `deps_error` in the response so silent failures stop being silent.
- Wire `force_deps` through the `update_and_restart` MCP tool.

Tests: added 3 cases covering force_deps URL wiring, branch+force_deps
combo, and deps_error surfacing. All 172 pinky_self tool tests pass.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Adds 4 tests in TestAdminUpdateForceDepsIntegration verifying:
- force_deps=True triggers pip install on a clean (no-op) pull
- force=True + force_deps=True combine correctly (reset + reinstall)
- default behavior skips pip when pyproject.toml is unchanged
- pip install failures surface as deps_error in the response

Mirrors the matching MCP-tool-level coverage in test_pinky_self_tools.py.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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