You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PTYs spawned without a session inherit the outer AGENT_TTY_SESSION_ID (doctor probe) #177
Since #166, resolvePtyEnv (src/pty/createPty.ts) sets AGENT_TTY_ACTIVE=true for every PTY and sets AGENT_TTY_SESSION_ID only when a sessionId is passed. When no sessionId is passed, an AGENT_TTY_SESSION_ID inherited from the parent environment goes through unchanged.
The only caller without a sessionId is the doctor PTY-spawn probe (src/cli/commands/doctor.ts, deps.createPty({...}) around line 472). So when doctor runs inside an agent-tty session, its throwaway probe process gets:
AGENT_TTY_ACTIVE=true, although it is not a managed session, and
the outer session's AGENT_TTY_SESSION_ID.
The impact is low because the probe is short-lived. But the environment contract documented in docs/USAGE.md ("a session reports its own ID") doesn't hold for PTYs without a session.
Expected
A PTY spawned without a sessionId must not claim a session. It should drop inherited AGENT_TTY_SESSION_ID and AGENT_TTY_ACTIVE rather than passing the outer values through. Explicit --env/caller env values should still win, matching the existing precedence.
Acceptance
resolvePtyEnv with no sessionId removes inherited AGENT_TTY_SESSION_ID and does not set AGENT_TTY_ACTIVE=true, or a clearly argued alternative (for example, making sessionId required and giving doctor an explicit opt-out).
Unit tests cover: inherited values stripped when there is no session id, caller env still wins, and existing session behavior is unchanged.
The resolvePtyEnv doc comment and docs/USAGE.md match the behavior.
Activity