feat(isolation): typed itmux subprocess client (Plan 1b Task 3)#238
Closed
NeuralEmpowerment wants to merge 2 commits into
Closed
feat(isolation): typed itmux subprocess client (Plan 1b Task 3)#238NeuralEmpowerment wants to merge 2 commits into
NeuralEmpowerment wants to merge 2 commits into
Conversation
Add ItmuxClient, a typed Python wrapper around the itmux Rust binary subprocess (start/send/await/capture/exec/stop), with Pydantic v2 models (frozen, extra=forbid) parsed from itmux's JSON stdout. The subprocess runner is injectable so tests exercise argv construction and JSON parsing without a real itmux binary or Docker daemon.
…env, not a flag itmux has no --claude-plugin-dirs CLI flag; it reads the colon-separated ITMUX_CLAUDE_PLUGIN_DIRS env var. The speculative flag was a silent no-op that would break skill injection. Wire claude_plugin_dirs through the subprocess environment instead, and extend the injectable ItmuxRunner protocol with a per-call env kwarg (merged over os.environ by the real runner). Only start sets the var; other subcommands pass env=None.
There was a problem hiding this comment.
Pull request overview
Adds a typed Python subprocess client for the Rust itmux workspace driver binary inside agentic_isolation, including strict JSON parsing via Pydantic models and a fakeable runner for deterministic unit testing.
Changes:
- Introduces
agentic_isolation.itmux_client.ItmuxClientwith typed methods forstart/send/await_ready/capture/exec/stopplus binary resolution logic. - Adds Pydantic models (
StartReport,AwaitResult,ExecResult) with strict validation (extra="forbid") to avoid untyped dict plumbing. - Adds unit tests using an injectable fake runner and updates packaging/lockfiles to include
pydantic.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/python/agentic_isolation/agentic_isolation/itmux_client.py | New typed subprocess client + Pydantic models + binary resolution/failure typing. |
| lib/python/agentic_isolation/tests/test_itmux_client.py | New unit tests validating argv/env construction, exit-code semantics, and model strictness. |
| lib/python/agentic_isolation/pyproject.toml | Adds pydantic as a runtime dependency. |
| lib/python/agentic_isolation/uv.lock | Locks pydantic + transitive deps for the isolation package environment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+25
| dependencies = [ | ||
| "pydantic==2.13.4", | ||
| ] |
Comment on lines
+244
to
+248
| agents: list[str], | ||
| startup_timeout_s: float, | ||
| strict_startup: bool, | ||
| claude_plugin_dirs: list[str] | None = None, | ||
| ) -> StartReport: |
Comment on lines
+259
to
+261
| assert argv[argv.index("--timeout") + 1] == "60.0" | ||
|
|
||
| def test_exit_code_2_is_not_ready_not_an_error(self) -> None: |
Contributor
Author
|
Superseded by the consolidated Plan 1b contract PR (feat/workspace-run) - all 4 contract tasks in one coherent reviewable unit. This work is included there. |
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.
Plan 1b Task 3. Typed Python client that shells out to the
itmuxRust binary -ItmuxClient(start/send/await_ready/capture/exec/stop) with an injectable runner (fake-tested, no real binary/docker needed),StartReport/AwaitResult/ExecResultPydantic models, and binary resolution ($AGENTIC_ITMUX_BIN-> repo release path -> PATH).Parity catches from reading main.rs/result.rs:
awaitstripspane+ exits code 2 when legitimately not-ready (treated as valid, not error);execforwards inner exit code (never raises on non-zero); plugin dirs passed viaITMUX_CLAUDE_PLUGIN_DIRSenv (itmux has no flag). 22 tests; mypy strict + ruff clean.Merge note: shares the
pydantic==2.13.4addition with Plan 1b Task 1 (#PR); merge Task 1 first, then this one's pyproject/uv.lock resolves trivially. Tracks okrs-51p.3 / okrs-o78.