Skip to content

refactor(python): direct Monty integration, remove worker subprocess#203

Merged
chaliy merged 3 commits intomainfrom
claude/monty-direct-integration-fvu7g
Feb 12, 2026
Merged

refactor(python): direct Monty integration, remove worker subprocess#203
chaliy merged 3 commits intomainfrom
claude/monty-direct-integration-fvu7g

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 12, 2026

Summary

  • Remove bashkit-monty-worker crate (subprocess binary, IPC protocol, JSON wire types)
  • Monty now runs directly in-process via MontyRun::start() + OsCall resume loop
  • Remove PythonIsolation enum (Subprocess/InProcess/Auto modes) — only direct mode remains
  • Add monty as optional git dependency behind python feature flag (still not on crates.io)
  • Python remains optional and disabled by default (--features python)
  • Add 117 integration tests covering: execution, VFS bridging, resource limits, bash interop, error handling, security, edge cases
  • Update specs (006, 011) and docs to reflect direct integration architecture

Test plan

  • cargo build --features python — compiles
  • cargo build (without python) — still compiles (feature is optional)
  • cargo clippy --features python --all-targets -- -D warnings — clean
  • cargo test --features python --lib -- python — 38 unit tests pass
  • cargo test --features python --test python_integration_tests — 117 integration tests pass
  • cargo test --features python --test threat_model_tests — 114 tests pass (subprocess security module removed)
  • cargo test --features python --test spec_tests — 14 tests pass
  • cargo fmt --check — clean

…tion

Remove the bashkit-monty-worker crate and IPC subprocess architecture.
Monty now runs directly in the host process with resource limits enforced
by Monty's own runtime (memory, allocations, time, recursion).

Changes:
- Delete crates/bashkit-monty-worker/ (worker binary, IPC protocol)
- Remove PythonIsolation enum (no more Subprocess/InProcess/Auto modes)
- Simplify python.rs to direct Monty integration (~660 lines, was ~1468)
- Add monty as optional git dep behind `python` feature flag
- Add 117 integration tests covering execution, VFS bridging, resource
  limits, bash interop, error handling, security, and edge cases
- Update threat model docs and specs to reflect direct integration
- Remove python_subprocess_tests.rs (no longer applicable)
- Update threat_model_tests.rs (remove subprocess security module)

Python remains optional and disabled by default. Enable with:
  cargo build --features python

https://claude.ai/code/session_01MYaC4cZRkJiRzy81MsZ9tz
…odel

Update 006-threat-model.md and 011-python-builtin.md to reflect
direct Monty integration: remove PythonIsolation, worker binary,
IPC timeout/line limit, and subprocess isolation references.
TM-PY-023 through TM-PY-026 removed (subprocess-specific threats).

https://claude.ai/code/session_01MYaC4cZRkJiRzy81MsZ9tz
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51aed44ebe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

tracing = { workspace = true, optional = true }

# Embedded Python interpreter (optional)
monty = { git = "https://github.com/pydantic/monty", version = "0.0.4", optional = true }

Choose a reason for hiding this comment

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

P1 Badge Remove non-registry dependency from published crate

Adding monty as a git dependency here will block releases because cargo publish -p bashkit (run in .github/workflows/publish.yml line 42) rejects crates that depend on non-registry sources, even when that dependency is optional. This commit therefore makes the publish workflow fail for every release until monty comes from crates.io or is excluded from the published manifest.

Useful? React with 👍 / 👎.

tracing = { workspace = true, optional = true }

# Embedded Python interpreter (optional)
monty = { git = "https://github.com/pydantic/monty", version = "0.0.4", optional = true }

Choose a reason for hiding this comment

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

P2 Badge Pin Monty git source to a fixed revision

This dependency uses a git URL without rev/tag, so Cargo resolves whatever commit is at the default branch head; that makes --features python builds non-reproducible and can cause sudden breakages when upstream changes. Pinning to an explicit commit or tag would keep builds stable and make failures attributable to local changes.

Useful? React with 👍 / 👎.

Transitive dep from monty; minor version bump from already-vetted 1.0.20.

https://claude.ai/code/session_01MYaC4cZRkJiRzy81MsZ9tz
@chaliy chaliy merged commit 0cc2f14 into main Feb 12, 2026
9 checks passed
@chaliy chaliy deleted the claude/monty-direct-integration-fvu7g branch February 12, 2026 03:37
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