claude-code - 💡(How to fix) Fix [Bug] Session identity broken for multi-agent worktree workflows: filtering, naming, and cross-worktree resume [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46853Fetched 2026-04-12 13:31:20
View on GitHub
Comments
1
Participants
2
Timeline
14
Reactions
0
Author
Timeline (top)
cross-referenced ×4labeled ×4mentioned ×3subscribed ×2

Error Message

[{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Output blocked by content filtering policy"},"request_id":"req_011CZwHyHAGs3JxBGJEgkNGQ"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:53430)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-11T03:43:27.528Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Output blocked by content filtering policy"}…

Root Cause

  1. Unfiltered session list: claude --resume shows ALL sessions for the entire repository (44 in my case) regardless of which worktree/branch the user is in. No filtering by current worktree.
  2. Garbage session names: Session names display random text from the session — not the agent name, not a user-assigned name. Examples: "Please dispatch captain on the git issues It feels like you are not using tools and skills appropriate", "Do a handoff", "resume". The @agent tag IS visible on some entries (proving the system knows the agent name), but the primary display label is garbage text.
  3. Claude Code randomly overrides user-assigned session names: Even when a session name is explicitly assigned by the user, Claude Code silently replaces it with auto-generated text at some later point. This is not "bad defaults" — it's the system actively overriding user intent. You assign a name, you see it confirmed, and later the name is something else. This makes the naming system untrustworthy.
  4. Cross-worktree resume fails silently: Sessions from other worktrees are shown in the list, but selecting one fails because the session was started in a different worktree with different branch state. The UI shows an affordance that always fails.
  5. Remote-control mirrors the same broken list: The Claude Desktop Code tab's session picker shows the same unfiltered, badly-named session list. A principal managing a fleet of agents sees every agent's sessions mixed together with meaningless names.

Fix Action

Fix / Workaround

  1. Unfiltered session list: claude --resume shows ALL sessions for the entire repository (44 in my case) regardless of which worktree/branch the user is in. No filtering by current worktree.
  2. Garbage session names: Session names display random text from the session — not the agent name, not a user-assigned name. Examples: "Please dispatch captain on the git issues It feels like you are not using tools and skills appropriate", "Do a handoff", "resume". The @agent tag IS visible on some entries (proving the system knows the agent name), but the primary display label is garbage text.
  3. Claude Code randomly overrides user-assigned session names: Even when a session name is explicitly assigned by the user, Claude Code silently replaces it with auto-generated text at some later point. This is not "bad defaults" — it's the system actively overriding user intent. You assign a name, you see it confirmed, and later the name is something else. This makes the naming system untrustworthy.
  4. Cross-worktree resume fails silently: Sessions from other worktrees are shown in the list, but selecting one fails because the session was started in a different worktree with different branch state. The UI shows an affordance that always fails.
  5. Remote-control mirrors the same broken list: The Claude Desktop Code tab's session picker shows the same unfiltered, badly-named session list. A principal managing a fleet of agents sees every agent's sessions mixed together with meaningless names.

Code Example

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Output blocked by content filtering policy\"},\"request_id\":\"req_011CZwHyHAGs3JxBGJEgkNGQ\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:53430)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-11T03:43:27.528Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Output blocked by content filtering policy\"}
RAW_BUFFERClick to expand / collapse

Bug Description Session identity is broken for multi-agent worktree workflows (naming, filtering, resume, remote-control)

Problem

Four interconnected session-identity issues that compound into a broken experience when running multiple agents in separate git worktrees:

  1. Unfiltered session list: claude --resume shows ALL sessions for the entire repository (44 in my case) regardless of which worktree/branch the user is in. No filtering by current worktree.
  2. Garbage session names: Session names display random text from the session — not the agent name, not a user-assigned name. Examples: "Please dispatch captain on the git issues It feels like you are not using tools and skills appropriate", "Do a handoff", "resume". The @agent tag IS visible on some entries (proving the system knows the agent name), but the primary display label is garbage text.
  3. Claude Code randomly overrides user-assigned session names: Even when a session name is explicitly assigned by the user, Claude Code silently replaces it with auto-generated text at some later point. This is not "bad defaults" — it's the system actively overriding user intent. You assign a name, you see it confirmed, and later the name is something else. This makes the naming system untrustworthy.
  4. Cross-worktree resume fails silently: Sessions from other worktrees are shown in the list, but selecting one fails because the session was started in a different worktree with different branch state. The UI shows an affordance that always fails.
  5. Remote-control mirrors the same broken list: The Claude Desktop Code tab's session picker shows the same unfiltered, badly-named session list. A principal managing a fleet of agents sees every agent's sessions mixed together with meaningless names.

Steps to reproduce

  1. Create a git repo with multiple worktrees: git worktree add .worktrees/devex -b devex
  2. Start sessions in different worktrees with different agent names: cd .worktrees/devex && claude --agent devex
  3. Optionally: assign a custom session name
  4. Exit the session
  5. Run claude --resume from the devex worktree
  6. Observe: sessions from all worktrees visible, names are garbage, any custom name may have been overridden
  7. Select a session from a different worktree → fails

Expected behavior

  1. Filter by worktree by default — claude --resume in the devex worktree shows only devex sessions. Ctrl+A or a toggle to show all.
  2. Use agent name as session display name — sessions started with --agent devex display "devex" as the primary label, not random session text.
  3. Never override user-assigned session names — if the user names a session, that name persists for the lifetime of the session. Claude Code may suggest a name for unnamed sessions, but must never silently replace a user-assigned name.
  4. Prevent or warn on cross-worktree resume — don't show sessions the user can select but cannot resume.
  5. Fix remote-control session picker — apply the same filtering and naming to the Claude Desktop Code tab.

Why this matters

Multi-agent development with worktrees is a growing pattern (Claude Code's own --agent flag and EnterWorktree tool encourage it). The current session management UX assumes a single-session, single-directory workflow. When scaled to 5-8 concurrent agents on the same repo, the resume/remote-control experience breaks down completely. The principal managing a fleet of agents needs clean, agent-named, worktree-filtered navigation — not a raw dump of every session ever started.

Reporter

Related

  • --agent/--name env var feedback (separate filing) — the agent name exists internally but isn't surfaced
  • Filed as part of the 2026-04-11/12 feedback batch

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.101
  • Feedback ID: ce60ba6d-01b6-4126-ac04-c94b1e74cd67

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Output blocked by content filtering policy\"},\"request_id\":\"req_011CZwHyHAGs3JxBGJEgkNGQ\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:53430)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-11T03:43:27.528Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Output blocked by content filtering policy\"}

Note: Content was truncated.

extent analysis

TL;DR

Filtering sessions by worktree and using agent names as session display names may resolve the broken session identity experience in multi-agent worktree workflows.

Guidance

  • Verify that the --agent flag is correctly set for each session to ensure agent names are used as session display names.
  • Check if the claude --resume command can be modified to filter sessions by worktree by default, and consider adding a toggle to show all sessions.
  • Investigate the possibility of preventing or warning on cross-worktree resume to avoid silent failures.
  • Review the remote-control session picker to ensure it applies the same filtering and naming as the command-line interface.

Example

No specific code snippet is provided due to the lack of explicit code references in the issue.

Notes

The provided information suggests that the issue is related to the session management UX in multi-agent worktree workflows. However, the truncated content may limit the accuracy of the analysis.

Recommendation

Apply a workaround by using the --agent flag to set unique agent names for each session and manually filtering sessions by worktree. This may help mitigate the broken session identity experience until a more comprehensive solution is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING