feat(processes): inject session PI_* env vars into started processes - #117
Merged
Merged
Conversation
aliou
marked this pull request as draft
September 30, 2026 09:57
378-kaiabot
Bot
force-pushed
the
feat/start-session-env
branch
2 times, most recently
from
October 2, 2026 20:14
193981d to
4226e8a
Compare
Threads an env parameter from executeStart through ProcessManager and ProcessRuntimeController into spawnCommand, built by buildSessionEnv from the extension context. Stale ambient PI_* values are stripped first, mirroring resolveSpawnContext in pi's bash tool.
378-kaiabot
Bot
force-pushed
the
feat/start-session-env
branch
from
October 2, 2026 20:29
4226e8a to
f417b7b
Compare
aliou
marked this pull request as ready for review
October 2, 2026 20:34
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.
Processes started via the
processtool'sstartaction previously inherited the bare parent environment, so child sessions lacked thePI_*identity variables pi exposes to its own bash tool. Any nested tooling relying onPI_SESSION_ID/PI_SESSION_FILE(e.g. session-file tracking inside a managed process) silently ran without them.buildSessionEnv(ctx)copiesprocess.env, strips stale ambientPI_*values, then setsPI_SESSION_ID,PI_SESSION_FILE,PI_PROVIDER,PI_MODEL,PI_REASONING_LEVELfrom the extension context — mirroringresolveSpawnContextin pi'sbash.ts.envparameter threads throughexecuteStart→ProcessManager.start→ProcessRuntimeController.start→spawnCommand(which already accepted env).Tests:
tools/start/index.test.tsverifies the injected variables reachmanager.start;session-env.test.tscovers stripping and conditional variables.