Skip to content

feat(processes): inject session PI_* env vars into started processes - #117

Merged
378-kaiabot[bot] merged 1 commit into
mainfrom
feat/start-session-env
Oct 2, 2026
Merged

378-kaiabot[bot] merged 1 commit into
mainfrom
feat/start-session-env

Conversation

@aliou

@aliou aliou commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Processes started via the process tool's start action previously inherited the bare parent environment, so child sessions lacked the PI_* identity variables pi exposes to its own bash tool. Any nested tooling relying on PI_SESSION_ID / PI_SESSION_FILE (e.g. session-file tracking inside a managed process) silently ran without them.

  • buildSessionEnv(ctx) copies process.env, strips stale ambient PI_* values, then sets PI_SESSION_ID, PI_SESSION_FILE, PI_PROVIDER, PI_MODEL, PI_REASONING_LEVEL from the extension context — mirroring resolveSpawnContext in pi's bash.ts.
  • An optional env parameter threads through executeStart → ProcessManager.start → ProcessRuntimeController.start → spawnCommand (which already accepted env).

Tests: tools/start/index.test.ts verifies the injected variables reach manager.start; session-env.test.ts covers stripping and conditional variables.

@aliou
aliou marked this pull request as draft September 30, 2026 09:57
@378-kaiabot
378-kaiabot Bot force-pushed the feat/start-session-env branch 2 times, most recently from 193981d to 4226e8a Compare October 2, 2026 20:14
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
378-kaiabot Bot force-pushed the feat/start-session-env branch from 4226e8a to f417b7b Compare October 2, 2026 20:29
@aliou
aliou marked this pull request as ready for review October 2, 2026 20:34
@378-kaiabot
378-kaiabot Bot merged commit 9efa0c8 into main Oct 2, 2026
2 checks passed
@378-kaiabot
378-kaiabot Bot deleted the feat/start-session-env branch October 2, 2026 20:34
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