[AAASM-1218] ✨ (_install): Add ensure_runtime() install-time runtime fallback#56
Merged
Chisanan232 merged 6 commits intoMay 23, 2026
Merged
Conversation
6 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…, INSTALL_HINT Establishes the install-time presence-check module. Module-level constants only; ensure_runtime() lands in the next commit. WHEEL_BUNDLED_BIN points to agent_assembly/bin/aasm — the same path runtime.py already searches, so both modules observe the same wheel artifact without inter-module coordination. INSTALL_HINT lists all install channels (pip [runtime] extra, Homebrew tap, curl installer) so users hitting the missing-binary case get copy-paste recovery commands. AAASM-1218
Three-branch resolution: 1. shutil.which(BINARY_NAME) — fastest, covers Homebrew tap, cargo install, and any binary on the user's PATH. 2. WHEEL_BUNDLED_BIN file+executable check — covers the platform-wheel install (`pip install agent-assembly[runtime]`). 3. Raise RuntimeError(INSTALL_HINT) — fail fast with copy-paste recovery commands. Distinct from runtime.py's find_aasm_binary() in that this is a synchronous presence check returning the Path (or raising), not a lifecycle helper that spawns the sidecar. Suitable for use at SDK import time or early in long-running scripts. AAASM-1218
Pytest fixture that scrubs the host environment so ensure_runtime() tests are deterministic: * PATH is emptied — shutil.which() finds no system binary. * WHEEL_BUNDLED_BIN is patched to a tmp_path location — tests can create or skip the file to exercise each branch. Yields the fake-binary path so tests can populate it on demand. AAASM-1218
Verifies the fast-path: a stub executable on PATH wins, regardless of whether the wheel-bundled path is present. Uses tmp_path to construct an isolated PATH so the test doesn't depend on the host's real `aasm` install state. AAASM-1218
Verifies the second-branch fallback: with PATH scrubbed by isolate_runtime, ensure_runtime() resolves to WHEEL_BUNDLED_BIN when the file is present and executable. This exercises the `pip install agent-assembly[runtime]` installation path. AAASM-1218
Verifies the unhappy-path branch: with neither a PATH match nor a wheel-bundled binary, ensure_runtime() raises RuntimeError and the exception text contains the full INSTALL_HINT (pip [runtime], Homebrew tap, curl installer) — so a user hitting this in production gets actionable copy-paste recovery commands. AAASM-1218
261616b to
3d6c20d
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Adds
agent_assembly/_install.py— a lean, synchronous presence-check module for theaasmsidecar binary, intended for use at SDK import time or early in long-running scripts. Fails fast with a clear install hint when the binary is unavailable, before the user discovers it via a subtle subprocess failure deep in the SDK call.Resolution order
shutil.which("aasm")— Homebrew tap,cargo install,curlinstaller default.agent_assembly/bin/aasm— bundled by the[runtime]platform wheel (AAASM-1215).RuntimeError(INSTALL_HINT)— copy-paste install commands for all channels.Why a new module instead of reusing
runtime.pyagent_assembly.runtime.find_aasm_binary()and friends manage the full lifecycle (port probe + subprocess spawn)._install.ensure_runtime()is purely presence-check + path-return — usable from contexts that can't yet (or don't want to) bring up the sidecar. Both modules observe the sameagent_assembly/bin/aasmwheel-bundled location, so no coordination is needed.This PR is independent of AAASM-1215/1216/1217 —
_install.pyworks against existing master.Type of Change
Breaking Changes
Net-new module. No existing API changed.
Related Issues
Testing
test/unit/test_install.pycovers all three resolution branches:test_ensure_runtime_returns_path_match_first— PATH binary winstest_ensure_runtime_falls_back_to_wheel_bundled— WHEEL_BUNDLED_BIN used when PATH emptytest_ensure_runtime_raises_with_install_hint— RuntimeError carries INSTALL_HINTLocal full-suite run:
380 passed, 11 skipped(skips are pre-existing env-conditional tests).Checklist
Commits