`/resume` picker permanently hides sessions tainted with `sessionKind: "bg"` after FleetView + `/compact` fork

Status Fixed / completed
Reported on v2.1.142
Maintainer reply ✓ Yes — claude[bot]
Activity 4 comments · opened May 15, 2026 · closed May 19, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

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

  1. Open the agent view (FleetView). This spawns one or more kind:"bg" peek processes — each writes a sidecar to ~/.claude/sessions/<pid>.json with "kind":"bg" and attaches to an existing session (e.g., session A).
  2. Inside that bg process, trigger a /compact (manual or auto). This creates a forked session B whose first JSONL entry is type:"system", subtype:"compact_boundary" with "sessionKind":"bg" baked in, and every subsequent entry written by that bg process also carries "sessionKind":"bg".
  3. Exit the bg process, optionally rename session B via /rename, then /exit it gracefully.
  4. 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 with kind:"bg" (sidecar PID 41775 confirmed).
  • /compact inside that bg session created 63048f89-.... Its compact_boundary entry shows:

``json
{
"type": "system",
"subtype": "compact_boundary",
"sessionKind": "bg",
"forkedFrom": {"sessionId": "3dc4caa7-..."}
}
`
1831 out of 2848 JSONL entries carried
"sessionKind":"bg"`.

  • A second fork created 70b18b86-... — same inheritance pattern, 4 of 737 entries tainted.
  • Both sessions were invisible in the /resume picker; both became visible immediately after stripping "sessionKind":"bg" from every JSONL entry (verified with sed -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)

  1. Don't propagate sessionKind to forked sessions. Always start a new session fresh; let its own runtime determine its kind.
  2. Use the sidecar (~/.claude/sessions/<pid>.json) as the source of truth for kind, not historical JSONL entries. The picker should look up the current attached process kind (if any), not historical tagging.
  3. Stop writing sessionKind into 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 /compact while agent view is open is at risk of "losing" the resulting session from /resume — they can only recover it by knowing the UUID.
  • /rename becomes 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

View original on GitHub ↗

4 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/58725
  2. https://github.com/anthropics/claude-code/issues/23692
  3. https://github.com/anthropics/claude-code/issues/54508

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

rexx · 5 months ago

Not a duplicate of the flagged issues — quick triage:

  • #23692 (CLOSED, stale): symptom-level match (forked sessions missing from /resume), but that report stops at "fork breaks visibility" without identifying the mechanism. This issue contains the actual root cause: sessionKind:"bg" taint inherited through compact_boundary entries when /compact happens inside a FleetView-spawned kind:"bg" peek process. Also ships a one-line user-side workaround (sed -i '' 's/,"sessionKind":"bg"//g') that #23692 doesn't have. This issue should supersede #23692.
  • #58725 (OPEN): different bug — that's a feature request to surface kind:"bg" sessions in the picker on purpose (background jobs started via /bg). My issue is the opposite: kind:"bg" is inherited into a session that should be a normal interactive session, and the picker correctly-but-undesirably hides it.
  • #54508 (OPEN): different bug entirely — /compact generating a new session ID and breaking task-panel scoping. Not picker-filter related.

Keeping this issue open: it provides reproducer, root-cause mechanism, and workaround that the flagged issues don't.

claude[bot] contributor · 5 months ago

This issue was fixed as of version 2.1.144.

github-actions[bot] · 3 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.