`/resume` picker permanently hides sessions tainted with `sessionKind: "bg"` after FleetView + `/compact` fork
Summary
/resume picker permanently hides any session whose JSONL contains entries with sessionKind:"bg". Once a session is "tainted" with this marker, no /rename or graceful exit recovers picker visibility. The only workaround is claude --resume <sessionId> directly with the UUID.
Reproducer
- Open the agent view (FleetView). This spawns one or more
kind:"bg"peek processes — each writes a sidecar to~/.claude/sessions/<pid>.jsonwith"kind":"bg"and attaches to an existing session (e.g., session A). - Inside that bg process, trigger a
/compact(manual or auto). This creates a forked session B whose first JSONL entry istype:"system", subtype:"compact_boundary"with"sessionKind":"bg"baked in, and every subsequent entry written by that bg process also carries"sessionKind":"bg". - Exit the bg process, optionally rename session B via
/rename, then/exitit gracefully. - From a fresh terminal, run
claude --resume. Session B is absent from the picker, no matter what custom title was set.
The taint propagates through further forks: forking session B (e.g., via another /compact) into session C also inherits "sessionKind":"bg" → C is also hidden.
Evidence (verified on 2.1.142, macOS)
In our case:
- Session
3dc4caa7-...was opened by FleetView withkind:"bg"(sidecar PID 41775 confirmed). /compactinside that bg session created63048f89-.... Its compact_boundary entry shows:
``json`
{
"type": "system",
"subtype": "compact_boundary",
"sessionKind": "bg",
"forkedFrom": {"sessionId": "3dc4caa7-..."}
}
"sessionKind":"bg"`.
1831 out of 2848 JSONL entries carried
- A second fork created
70b18b86-...— same inheritance pattern, 4 of 737 entries tainted. - Both sessions were invisible in the
/resumepicker; both became visible immediately after stripping"sessionKind":"bg"from every JSONL entry (verified withsed -i '' 's/,"sessionKind":"bg"//g').
Expected behavior
A session created by /compact while attached to an interactive terminal (even if the underlying process happens to be kind:"bg" for FleetView display reasons) should be treated as a regular user session. sessionKind should reflect the current process's role, not be inherited as persistent JSONL metadata.
Suggested fixes (any one would resolve)
- Don't propagate
sessionKindto forked sessions. Always start a new session fresh; let its own runtime determine its kind. - Use the sidecar (
~/.claude/sessions/<pid>.json) as the source of truth forkind, not historical JSONL entries. The picker should look up the current attached process kind (if any), not historical tagging. - Stop writing
sessionKindinto every JSONL entry. If audit-trail of process kind is needed, write it once per session-attach event, not on every assistant/tool/user entry.
Why this is a high-impact bug
- FleetView/agent view is a featured workflow. Any user who runs
/compactwhile agent view is open is at risk of "losing" the resulting session from/resume— they can only recover it by knowing the UUID. /renamebecomes silently no-op for these sessions, which is a major UX regression. Users report "I named the session and now it's gone" without realizing the picker filter is the cause.- The taint propagates through fork chains, so one mistake compounds across multiple session generations.
Workaround for affected users
# Find affected sessions
grep -l '"sessionKind":"bg"' ~/.claude/projects/*/<sid>.jsonl
# Backup + strip (macOS sed)
cp <file>.jsonl <file>.jsonl.bak
sed -i '' 's/,"sessionKind":"bg"//g' <file>.jsonl
After stripping, the session appears in /resume immediately on next picker invocation — no restart needed.
Environment
- Claude Code version: 2.1.142
- OS: macOS (Darwin 25.4.0)
- Shell: zsh
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗