0af8fb05bf
AIAgent.__init__ calls set_current_session_id(self.session_id), which mutated both the task-local ContextVar and the process-global os.environ. Because _build_child_agent wraps construction in delegated_child_context(), the ContextVar write is harmless (task-local), but the os.environ write clobbered the parent's HERMES_SESSION_ID for the rest of the process — leaking the child id into parent tools and subprocesses spawned after the child was built. Root cause of HermesPRDelegationSessionContext: parent 20260729_212118_5d797e dispatched child 20260730_160515_736ea1; later parent terminal inherited HERMES_SESSION_ID=the child. Fix: set_current_session_id() skips the process-global os.environ write when called from within a delegated_child_context(). The child's own tools and subprocesses still resolve their id through the ContextVar (task-local), while the parent's process-wide env keeps the parent's session identity. Root agents (CLI, gateway, cron) retain both paths. Adds 7 regression tests covering single child, concurrent children (8 parallel), parent-tool observation after construction, and root-agent session rotation backward compatibility. All pass; ruff clean.