/branch (/fork) always fails with 'No conversation to branch' in background (daemon-backed thin-client) sessions
Bug
/branch (and its alias /fork) always fails with Failed to branch conversation: No conversation to branch when invoked against a background session (daemon-backed thin-client REPL — e.g., the bg/Agents view).
The session JSONL exists on disk under the expected project directory, so the conversation data is there — it just isn't reachable from /branch in thin-client mode.
Environment
- Claude Code 2.1.143
- macOS 26.4.1 (arm64)
Repro
- Start a background session (Agents View / bg job).
- In the thin-client view of that session, type
/branch(or/fork). - →
Failed to branch conversation: No conversation to branch
(Same /branch works fine from a normal local REPL session in the same project.)
Evidence the conversation is on disk
State of the bg session I tested:
~/.claude/jobs/<short>/state.json:
"sessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
"resumeSessionId": "923d0a88-3740-4f2c-beb8-76dc32051900",
"bridgeSessionId": "cse_01UWkiSRXQbWGRsn8o9wJefR",
"backend": "daemon",
"cwd": "/Users/me/projects/foo",
"originCwd": "/Users/me/projects/foo",
The corresponding jsonl is on disk and accumulating messages normally:
~/.claude/projects/-Users-me-projects-foo/923d0a88-3740-4f2c-beb8-76dc32051900.jsonl (25 lines, growing)
So this is not a missing-conversation issue — /branch is failing despite a perfectly valid session file at the expected location.
Observed behavior
- The failure is 100% reproducible in any bg/thin-client session, regardless of message count, regardless of project (tested across multiple repos).
- The same command in a normal foreground REPL on the same project succeeds.
- The
cwdof the bg session matches itsoriginCwd, so this is not theEnterWorktree-induced cwd-change case from #48254. /btw <question>followed by thef(fork) hotkey does work from the same bg session — suggesting the fork machinery itself isn't broken, only/branch's entry point isn't routed correctly for thin-client mode.
Related (not duplicates)
- #48254 — same error string, but root cause is cwd-change via
EnterWorktreeresolving the project dir to a different folder. Different mechanism; my session's cwd is stable and matchesoriginCwd, and the error reproduces without ever entering a worktree. - #45179 / #48110 — submodule/bare-repo worktree path-resolution issues for
/resume, not/branchin thin-client mode.
Suggested fix
Route /branch through the daemon when invoked from a thin-client REPL, the same way /btw's fork hotkey works in bg sessions today. Whatever predicate distinguishes thin-client/bg from local REPL for /btw should gate /branch's dispatch as well.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗