Skip to content

Fix shell environment inherited by Pi sessions - #21

Open
JnBrymn wants to merge 1 commit into
gregce:mainfrom
JnBrymn:fix/issue-20-shell-environment
Open

JnBrymn wants to merge 1 commit into
gregce:mainfrom
JnBrymn:fix/issue-20-shell-environment

Conversation

@JnBrymn

@JnBrymn JnBrymn commented Sep 14, 2026

Copy link
Copy Markdown

Closes #20.

Pi was started inside a Tortie-managed shell session whose environment did not reliably match a normal terminal. In particular, shell startup files exporting Pi provider keys could be skipped, leaving Pi with only cached/Codex models; Tortie also retained literal ~ components in the captured PATH.

This changes shell sessions to interactive login shells so the normal shell environment is loaded, expands ~ PATH entries during capture, and keeps restart handling compatible with existing -l sessions.

Not tested: Vitest is unavailable in this checkout. I do not know whether this fixes the issue.

gregce added a commit that referenced this pull request Sep 14, 2026
Issue 20: the session environment, researched

NOTHING WAS REPAIRED. This adds one document under docs/research/ and changes
no file under src/. No Electron was launched, PR #21 was read and never merged,
commented on or closed, and no variable's value appears anywhere in the document.

The report is two complaints with different answers.

The title's premise is false, and it is false in the direction of good news. A
session is already not a subprocess of Tortie. Measured on his own machine: a
pane's parent is the private tmux server and the server's parent is launchd,
with the Tortie that ran new-session nowhere in the ancestry. That is the
durability invariant working as designed, and it is why quitting Tortie does not
end his sessions. What he is actually feeling is the long-lived server's frozen
boot environment, which a Tortie restart does not refresh because a Tortie
restart does not restart the server. The live server's global environment holds
17 names, all launchd-shaped, and its PATH is 35 entries with no tilde and
nothing relative.

The second half is real, and it is Phase 33's problem statement word for word.
launch.envPassthrough shipped, works, resolves values per launch and writes none
of them to the manifest, and is set by no compiled agent row. So a provider key
exported in ~/.zshrc reaches no freshly created agent pane on any machine until
the person writes an agents.json, restates launch.argv and passes the confirm
gate. The mechanism exists and is inert everywhere.

The real finding is the third thing, and it is ours rather than his. When an
agent pane starts without the environment it needs, Tortie says nothing at all.
The env-unresolved notice is structurally unable to fire for him, because both
call sites are guarded on the row already naming variables; Settings draws
nothing when there is no config file, which hides the only sentence that names
agents.json; and agents.json appears in exactly one renderer string in the whole
app, inside that hidden block. Phase 33 built the mechanism and shipped no path
to it, so he got pi's own model error and silence from us.

PR #21: decline changes 1 and 2, adapt change 3 as its own entry. The login
shell flag is gated to agent === 'shell' at both call sites, so -il never
reaches pi; a shell pane is already interactive, measured; -i is a regression on
the nine harness zsh -l -c sites, 68 ms to 1714 ms with a banner prepended to
stdout; and four tests go red, one of them substantive, under which an existing
shell session silently comes back running a different command. Expanding ~
inside captured PATH entries is the one genuinely new thing in the diff and
nothing in the tree does it today, but it is unrelated to the reported symptom
and produces command-not-found rather than a model error.

Two drifts are reported and left alone: the probe deadline is 10 seconds while
the shipped guide, the Phase 33 backlog entry and a code comment all say 3, and
research 41 section 11 has three open items this document closes.

No phase is queued off this. That waits for his word.
gregce added a commit that referenced this pull request Sep 14, 2026
One running-log line, appended at the end, newest last. Records that issue 20
was researched to a document and that no source file moved: the title's premise
is false because a session's parent is already the private tmux server rather
than Tortie, the staleness is the server's frozen boot environment, the second
half is Phase 33's problem statement with the shipped mechanism set by no
compiled row, the real finding is that Tortie says nothing when a pane starts
without its environment, and PR #21 declines two changes and adapts the third.

No phase is queued off this. That waits for his word.
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.

Make each new session spawn not as a sub process but as a completely new process.

1 participant