[BUG] Sessions started with TeamCreate (e.g. custom skills) permanently hidden from --resume
Bug Description
Sessions that use TeamCreate (e.g., a custom skill that spawns a team of review agents) have two resume visibility bugs:
- The main session becomes permanently invisible to
--resumeand/resume, even after the team is deleted withTeamDelete - Subagent sessions leak into the resume picker as visible entries that users should never see
Environment
- Claude Code version: 2.1.81
- OS: Fedora Linux 42 (kernel 6.19.6)
- Shell: zsh
Root Cause (from reverse-engineering v2.1.81 binary)
Bug 1: teamName persists on every message, blocking resume
teamName is written to every JSONL record during the team phase, not just the init record:
line 1: (init — no teamName)
line 12: teamName=audit type=user
line 13: teamName=audit type=assistant
...
line 152: teamName=audit type=assistant
The resume picker filters on this:
// Decompiled from v2.1.81 binary
if (L.teamName) {
return v(`Session ${H.sessionId} filtered from /resume: teamName=${L.teamName}`), null;
}
TeamDelete removes the team directory but does NOT clear teamName from the session JSONL, making the session permanently invisible.
Bug 2: Subprocess teammates lack isSidechain flag
When teammateMode is subprocess, team agents are spawned as independent sessions with their own JSONL files at the project root. These have agentName set (e.g., "bug-reviewer", "validator-legal") but isSidechain: false.
The resume picker only filters on isSidechain and teamName — not agentName. So once bug 1 is fixed (teamName cleared), all subagent sessions become visible in the resume list, cluttering it with internal agent sessions.
Reproduction
# 1. Start claude and invoke a skill that calls TeamCreate
claude
> /my-skill # e.g. a custom skill that creates a team of parallel review agents
# 2. Skill completes, team is deleted, exit claude
# 3. Try to resume
claude --resume # main session not listed
claude --resume <id> # also fails
# 4. Verify: teamName on every message in the session
python3 -c "
import json
with open('<session>.jsonl') as f:
for i, line in enumerate(f):
d = json.loads(line)
if d.get('teamName'):
print(f'line {i}: teamName={d[\"teamName\"]}')
if i > 5: break
"
Impact
- Main sessions using
TeamCreatebecome permanently unresumable TeamDeletecleans up the team directory but does NOT clearteamNamefrom the session- Subprocess teammate sessions pollute the resume picker (no
isSidechainflag) - Affects anyone building custom skills/workflows that use agent teams
Suggested Fix
- For bug 1: Change the resume filter to only exclude sessions where the team is still active (check if
~/.claude/teams/{teamName}/exists), rather than unconditionally filtering onteamNamepresence. Alternatively, haveTeamDeletestripteamNamefrom all records in the session JSONL.
- For bug 2: Set
isSidechain: trueautomatically when creating subprocess teammate sessions, or addagentNameto the resume picker's filter list.
Related Issues
- #26123 —
/resumebroken since v2.1.31 (identified similar picker filtering bugs)
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗