Repository navigation
feat: make persistent Python the default agent path - #3
Merged
Merged
Conversation
Python is a first-class execution environment here, not a sandbox. The old filter removed a hand-maintained list of provider variables plus any name ending in API_KEY, SECRET, or TOKEN. That broke legitimate project code while providing no meaningful isolation to an LLM that already has arbitrary execution as the user running pi. Pass the host environment through unchanged and document the actual security model: enabling the tool delegates the user's authority to the model, and any restriction has to live at an OS boundary outside the process. Pin the behavior with an end-to-end assertion that a custom host variable is visible in the selected interpreter.
The old prompt guidance limited the tool to "non-trivial" data work and named a few narrow domains. That gave models an easy reason to fall back to `python -c`, heredocs, and temporary scripts for short or unrelated Python, throwing away the persistent namespace this extension exists to provide. Make this the preferred path for all inline Python, including one-offs, and spell out the legitimate exceptions: existing scripts and CLIs, fresh-process behavior, and work where shell semantics are material. Tell the model to reuse live kernel state after ordinary exceptions and cooperative timeouts instead of reconstructing it in another process.
Replace the four-job Linux-only matrix with the full cross product of Python 3.9 through 3.14, Node's supported 22/24/26 lines (plus the exact 22.19 floor), Bun 1.3/1.4, and Linux/macOS/Windows: 108 jobs. Use an x64 macOS label because the arm64 image has no Python 3.9 build, and cap every leg at five minutes so a broken signal implementation cannot wedge CI. Add a stable `CI gate` job for branch protection; it turns red unless the entire dynamic matrix succeeds. Teach the test harness to select `python.exe` on Windows or honor an explicit interpreter, and expose a Bun test script. Synchronize the lockfile root metadata while touching the runtime declarations. Update the contributor guide to describe the real matrix, gate, squash commit convention, and pre-1.0 release-please policy. Features are patch bumps with our config; hidden commit types do not release on their own.
Lead with what the package is, how its persistent process behaves, and where that persistence ends instead of opening with the history of an old checkpoint implementation. Put installation and the execution-risk warning above the fold, consolidate duplicated tool/install/reference material, and move protocol internals and checkpoint archaeology behind the user-facing behavior. Describe the security model without pretending users review each cell or listing every thing arbitrary model-driven code can do: enabling the tool delegates the authority of the user running pi, full stop. Align npm metadata and discovery keywords with the IPython-style positioning.
Node cannot deliver a catchable SIGINT to a Windows child process:
kill("SIGINT") terminates Python outright, and the exit event previously
rejected the request as an unexpected kernel death. Treat that platform
limitation as an immediate hard kill instead, preserving partial output
and returning the normal killed=true result before transparently
respawning on the next call.
Keep the namespace-preserving SIGINT assertions on POSIX and add a Windows
branch that pins the hard-kill contract. Document the difference in the
tool schema and README rather than promising cooperative interruption on
a platform that cannot provide it.
The first exhaustive matrix proved its point but exposed 108 individual checks. Keep all 108 runtime combinations while presenting only 18 jobs: one per JS runtime and OS, with Python 3.9 through 3.14 executed as sequential composite-action steps inside it. Continue after an individual Python failure, then aggregate all six outcomes so every version still runs and any failure still turns the job red. Add a tiny Node launcher because Node 26 removed --experimental-transform-types after making transformation the default, while Node 22/24 still need the flag for parameter properties. The stable CI gate continues to summarize the entire matrix for branch protection.
Node 26 removed --experimental-transform-types and its built-in loader now only strips erasable syntax. The sole construct requiring transformation was PythonKernel's parameter property; expand it to an ordinary field and assignment so Node 22 through 26 can all execute the test directly with no version-switching launcher.
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.
Summary
pythontool instead ofpython -c, heredocs, and temporary scriptsCommit structure
fix: inherit the host environment unchangedfeat: prefer persistent Python over bash one-offsci: test every supported runtime across hosted operating systemsdocs: present pi-python as an IPython-style agent sessionfix: make Windows timeout behavior explicitci: collapse Python permutations into runtime jobsfix: use erasable TypeScript syntax on Node 26CI coverage
The matrix covers 108 combinations while exposing only 18 runtime/OS checks:
Python versions run sequentially inside each runtime/OS job.
CI gateis the stable branch-protection context and succeeds only when all 108 combinations pass.Validation
npm ci --ignore-scriptsnpm run checknpm test— 29/29npm run test:bun— 29/29