Skip to content

claude pane resume fails ("No conversation found") — nested headless claude clobbers the pane's session id #511

@MarianMatys

Description

@MarianMatys

Is this a reproducible bug?

  • I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.

Current behavior

On restart, herdr fails to resume claude panes with No conversation found with session ID: <uuid>. herdr-agent-state.sh (integration v5) reports
pane.report_agent_session keyed only by the HERDR_PANE_ID env var, storing just
the id. Any process inheriting that env can claim the pane — including a nested
claude run in a different cwd. The official remember plugin triggers it: it runs
claude -p with cwd=$TMPDIR and inherited env, so its SessionStart hook reports
the throwaway session id (written under ~/.claude/projects/-tmp/) and overwrites
the pane's real id. On restore, claude --resume <id> is cwd-scoped (searches only
~/.claude/projects/<encoded-pane-cwd>/), so the -tmp session is never found.

Expected behavior

A nested/sandboxed claude run must not overwrite a pane's interactive session, and aka stored session must resume (or degrade to a clean start) instead of erroring.

Proposed fix

  1. Resume by the session's real path, not the pane cwd. The hook already has
    transcript_path; the CLI already accepts report-agent --agent-session-path.
    Persist it and cd there (or resume by path) on restore — fixes it even for -tmp.
  2. Authority by PID/foreground, not just HERDR_PANE_ID — only accept reports
    from the pane's tracked foreground process, so a sibling nested run can't clobber it.
  3. Graceful fallback — if the stored session file is missing on restore, start
    clean instead of erroring.

Reproduction

  1. In a herdr claude pane, start interactive claude in a repo, send a message.
  2. From inside that pane, run a nested headless claude in another cwd:
    ( cd /tmp && env CLAUDECODE= claude -p hi --max-turns 1 )
    (or just let the remember plugin run its consolidation)
  3. herdr pane get <pane_id> → agent_session.value now points to a session that
    find ~/.claude/projects -name '.jsonl' resolves under projects/-tmp/.
  4. Restart herdr → pane fails with No conversation found with session ID.

Impact

Loss of claude session continuity on restart — the headline feature. Silent: the
clobber happens in the background, user only sees it after a restart. Affects every
pane whenever a nested/headless claude runs (the bundled remember plugin alone is
enough). codex unaffected (its resume is global, not cwd-scoped).

Environment

herdr 0.6.8, claude integration v5, Linux/WSL2, Claude Code (recent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions