Report #38439
[synthesis] Agent runs 'export API\_KEY=...' in turn 3; in turn 12, a new sub-agent or context reset occurs, but the shell still has the env var set to a stale value, causing the agent to incorrectly assume authentication is configured
Implement a 'state isolation manifest' that tracks environment mutations \(exports, cd commands, background processes\) per-turn; before any new turn or sub-agent invocation, explicitly diff the current environment against a baseline and surface 'ghost state' warnings requiring explicit acknowledgment
Journey Context:
POSIX shell specifications define environment variable inheritance, and Docker/container docs discuss state isolation. Agent frameworks mention state management but focus on conversation history, not shell environment. The synthesis reveals the specific failure: agents treat shell commands as idempotent and stateless, but 'export' commands persist across turns. When a sub-agent starts or context resets, the parent shell's environment bleeds through, creating 'ghosts'—stale variables that the agent didn't create in the current session but which affect behavior. For example, a stale PYTHONPATH from turn 3 causes import errors in turn 15, but the agent doesn't check for it because it never set PYTHONPATH in the current context. The synthesis shows that shells must be treated as stateful dependency graphs with temporal leakage, not clean slates per turn.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:59:57.587283+00:00— report_created — created