Skip to content

fix: auto-bootstrap Python engine before starting bridge#25

Merged
anandgupta42 merged 2 commits intomainfrom
fix/bridge-ensure-engine
Mar 3, 2026
Merged

fix: auto-bootstrap Python engine before starting bridge#25
anandgupta42 merged 2 commits intomainfrom
fix/bridge-ensure-engine

Conversation

@anandgupta42
Copy link
Contributor

Summary

  • Call ensureEngine() in Bridge.start() before spawning the Python subprocess, so the managed venv with altimate-engine is created automatically on first run
  • Add enginePythonPath() as step 4 in resolvePython() so the managed venv's Python is used after bootstrapping
  • Fixes ModuleNotFoundError: No module named 'altimate_engine' that occurs when no local .venv exists and system python3 doesn't have the engine installed

Test plan

  • Run CLI locally without any .venv present — should auto-download uv, create venv, install engine, and start the bridge successfully
  • Run CLI with ALTIMATE_CLI_PYTHON env var set — should still use the explicit path
  • Run CLI in the monorepo dev environment with packages/altimate-engine/.venv — should use the local dev venv (step 2) without triggering ensureEngine download

🤖 Generated with Claude Code

anandgupta42 and others added 2 commits March 3, 2026 10:31
Bridge.start() now calls ensureEngine() to download uv, create an
isolated venv, and install altimate-engine before spawning the Python
subprocess. resolvePython() also checks the managed venv path so
the correct interpreter is used after bootstrapping.

Previously, resolvePython() would fall through to system python3
which doesn't have altimate_engine installed, causing
ModuleNotFoundError on first run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Export resolvePython() from client.ts for direct unit testing
- Test that ALTIMATE_CLI_PYTHON env var takes highest priority
- Test that managed engine venv is used when present on disk
- Test fallback to python3 when no venvs exist
- Test that ensureEngine() is called before bridge spawn
- Mock only bridge/engine module to avoid leaking into other tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anandgupta42 anandgupta42 merged commit 01a453c into main Mar 3, 2026
6 of 8 checks passed
@anandgupta42 anandgupta42 deleted the fix/bridge-ensure-engine branch March 3, 2026 19:03
anandgupta42 added a commit that referenced this pull request Mar 17, 2026
* fix: auto-bootstrap Python engine before starting bridge

Bridge.start() now calls ensureEngine() to download uv, create an
isolated venv, and install altimate-engine before spawning the Python
subprocess. resolvePython() also checks the managed venv path so
the correct interpreter is used after bootstrapping.

Previously, resolvePython() would fall through to system python3
which doesn't have altimate_engine installed, causing
ModuleNotFoundError on first run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add bridge client tests for ensureEngine and resolvePython

- Export resolvePython() from client.ts for direct unit testing
- Test that ALTIMATE_CLI_PYTHON env var takes highest priority
- Test that managed engine venv is used when present on disk
- Test fallback to python3 when no venvs exist
- Test that ensureEngine() is called before bridge spawn
- Mock only bridge/engine module to avoid leaking into other tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
anandgupta42 added a commit that referenced this pull request Mar 17, 2026
* fix: auto-bootstrap Python engine before starting bridge

Bridge.start() now calls ensureEngine() to download uv, create an
isolated venv, and install altimate-engine before spawning the Python
subprocess. resolvePython() also checks the managed venv path so
the correct interpreter is used after bootstrapping.

Previously, resolvePython() would fall through to system python3
which doesn't have altimate_engine installed, causing
ModuleNotFoundError on first run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add bridge client tests for ensureEngine and resolvePython

- Export resolvePython() from client.ts for direct unit testing
- Test that ALTIMATE_CLI_PYTHON env var takes highest priority
- Test that managed engine venv is used when present on disk
- Test fallback to python3 when no venvs exist
- Test that ensureEngine() is called before bridge spawn
- Mock only bridge/engine module to avoid leaking into other tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <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