The pane name that vanished on reattach — why tmux -e is a trap for identity
Agents in restored panes couldn't state their own session name even though the badge showed it. The cause was a CREATE-only env channel; the fix binds identity to a stable pane id read from a per-spawn file.
The symptom
Fresh build from main. The founder asks his Codex and Claude panes: "너 세션명 뭐니?" (what's your session name?). The pane badge says nova-mole-4900. But Codex runs echo $DALKKAK_SESSION_NAME and gets nothing; Claude answers "unknown". The UI knows the name; the agent inside the pane doesn't.
The cause — and the tell
The name reached panes one way: tmux new-session -A -D -e DALKKAK_SESSION_NAME=.... tmux's -e sets the environment only when a session is created. But Talkak runs a persistent -L dalkkak tmux server so panes survive app restarts — and new-session -A reattaches an existing session without re-applying -e. Those panes were created before the change, so reattaching them never delivered the new variable.
The tell was that DALKKAK_PANE_ID did work (Claude's wrapper fired, which is guarded on it). Same -e line — but DALKKAK_PANE_ID was added to it long ago, so old sessions already carried it. One var present, its sibling on the very same line absent: that's the fingerprint of an env added after the session was born.
This is the nastiest shape of bug: it doesn't fail loudly, it fails half-configured. The badge works, one env works, one doesn't. It looks like a typo, not an architecture problem.
The fix
Stop injecting identity through a create-only channel.
pty::spawnnow writes~/Library/Application Support/DalkkakAI/sessions/<pane_id>= the name on every spawn.- The Claude wrapper and the Codex
~/.codex/AGENTS.mdblock read the name from that file via the stable$DALKKAK_PANE_ID(the env stays only as a fallback). - And
ensure_codex_agentsnow replaces its marked block instead of skip-if-present — otherwise existing users keep the old instruction forever and never get the file-read one.
The pane id is stable and reliably present; the file is rewritten every spawn; so the name is correct whether the session is brand new or reattached from last week.
Verified — including in the real app
Code: cargo check 0, inline tests 5/5, and a wrapper dry-run that reads the name from the file with no DALKKAK_SESSION_NAME set (file → the name; file missing → env fallback; both gone → "unknown").
Then the proof that actually mattered: the founder's Codex pane ran cat "$HOME/Library/Application Support/DalkkakAI/sessions/$DALKKAK_PANE_ID" and answered nova-mole-4900 — matching its badge. The mechanism I could only dry-run, his machine confirmed end to end.
The lesson
An identity injected through a create-only channel — a tmux -e, a one-shot env, a first-run write — silently rots on any long-lived or reattached session. Bind identity to a stable key (the pane id), read from a source that is rewritten every spawn (a file), not to a value that only lands once. And idempotent installers must replace, not skip: skip-if-present is how existing users get stranded on stale instructions across updates.