anthropics / anthropics/claude-code

VS Code extension: a single prompt submission was dispatched into 3 separate sessions (duplicated token usage)

Open
#94,569 0 comments 0 reactions 0 assignees View on GitHub
area:cost area:ide bug platform:vscode platform:windows
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

**Environment**
- Claude Code VS Code extension (`entrypoint: "claude-vscode"`)
- Windows 11

**What happened**

A single message I sent from the VS Code extension was processed as three independent sessions running in parallel, each executing the full task from scratch. All three sessions consumed a full agentic run (hundreds of assistant turns each), roughly tripling token/quota usage for what was intended as one request.

**Evidence (from local `~/.claude/projects//*.jsonl` transcripts)**

Three session files were created within the same second:
- Session A: `3cb5e67c-9a1d-4ccd-abca-81e1efb97fcf`
- Session B: `99a4d3be-9f1c-471d-a042-ae7578c82994`
- Session C: `454c035f-6482-4afa-a1ee-d6d120e4f092`

Key correlating identifiers that are identical across sessions A and C (indicating they originated from the *same* user submission, not two separate messages I typed):
- `promptId`: `127520aa-e797-4ee8-b68b-7502f86c1e3d` — identical in both session A and session C's first user message
- User-message `timestamp`: `2026-09-15T09:02:22.868Z` — identical to the millisecond in both
- User-message content length: identical (48702 chars) in both
- `cwd` identical in both
- SessionStart hook `toolUseID`: `0ec5dd30-2a2b-4e60-8f23-3593939dc83d` — identical across **all three** sessions' first log line

Session B additionally logged an explicit queue race right at the same moment:
```
{"type":"queue-operation","operation":"enqueue","timestamp":"2026-09-15T09:02:22.817Z","sessionId":"99a4d3be-..."}
{"type":"queue-operation","operation":"dequeue","timestamp":"2026-09-15T09:02:22.819Z","sessionId":"99a4d3be-..."}
```
(2ms apart), suggesting the same queued operation got picked up/processed into a distinct session rather than being deduplicated or routed to the single active session.

Despite the identical origin, the three sessions have **zero overlapping message UUIDs** afterward — each proceeded completely independently, each producing several hundred unique messages (927 / 678 / 577 unique message UUIDs respectively) over the next ~1-4 hours, i.e. three full independent agentic runs of what should have been one conversation.

**Impact**

This tripled token/session-quota consumption for a single user request — in my case this one duplication alone accounted for roughly a third of my 5-hour rate limit window.

**Ask**

Could you look into the session dispatch/queue logic in the VS Code extension for a race condition where one submitted prompt (same `promptId`) gets delivered to multiple newly-created sessions instead of exactly one? Happy to share the raw JSONL lines (sanitized) if useful — I've kept the actual task content out of this report since it involved private repository work, but the structural/metadata evidence above (uuids, timestamps, queue trace) should be reproducible-looking without needing that content.

Contributor guide

No contributing guide indexed for this repository

Research direction

Begin with the VS Code extension's `claude-vscode` entrypoint and trace the session dispatch and queue-operation path using the supplied promptId and session trace evidence. Reproduce or instrument the enqueue/dequeue race, then add regression coverage showing that one promptId creates and reaches exactly one session without duplicate runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.