95a566b1e7
Follow-up for salvaged PR #69380. The snippet 'export -p | grep -vE ... > $tmp.$BASHPID || true' attaches the redirect to the grep pipeline segment, so $BASHPID expands inside grep's pipeline subshell — a DIFFERENT pid than the parent shell that expands the follow-up 'mv $tmp' operand. The dump landed in an orphaned temp file, mv failed silently (2>/dev/null), and the shared snapshot never updated again: exported env / venv activation stopped persisting between commands (tests/tools/test_local_shell_init.py TestSnapshotEndToEnd caught it). Wrap the pipeline in a brace group and attach the redirect to the group so the expansion happens in the current shell, matching mv's expansion. Also rename the shell-init probe var HERMES_SESSION_ENV_PROBE -> HERMES_STICKY_ENV_PROBE: it matched the HERMES_SESSION_ prefix the salvaged fix now intentionally strips from snapshots, and the snippet-shape test is updated to pin the brace-group contract.