/compact queued during a running turn is sometimes sent to the model as a plain prompt (promptSource:"queued") instead of executing — 2.1.257

Status Open
Reported on v2.1.257
Maintainer reply None cached
Activity 0 comments · opened Sep 6, 2026

Summary

On Claude Code 2.1.257, a /compact <instructions> typed while a turn is running (so it is queued) is sometimes dispatched at the turn boundary as a plain user prompt instead of being executed as the slash command. The model then answers the text (writes a prose "summary"), no compaction happens, and nothing tells the user or an automation that the command was dropped.

On 2.1.222 the same flow executed the queued /compact every time in our data.

Environment

  • Claude Code 2.1.257 (swallowed cases); 2.1.222 never reproduced it (0/30)
  • macOS 15.6.1, terminal TUI (cmux), interactive session, claude --resume sessions included
  • /compact text was pasted into the prompt line while the assistant was mid-turn, followed by Return; the instructions were 840–1588 chars in the failing cases

Steps to reproduce

  1. Start a turn that runs for a while (a long tool loop).
  2. While it is running, type /compact <a few sentences of focus instructions> and press Return, so the input is queued.
  3. Let the turn finish.

Expected: at the turn boundary the queued /compact executes (command stub row, compact_boundary, compact summary).
Actual (7 of 36 queued cases on 2.1.257): the queued text is sent to the model as an ordinary user message. The model replies with a prose summary; no compact_boundary, no compaction.

Transcript evidence (~/.claude/projects/**/<session>.jsonl, content trimmed)

Every failing case has the same shape. The /compact user row carries "promptSource":"queued"; executed echoes never carry promptSource (29/29 on 2.1.257, 30/30 on 2.1.222), and the queued-command attachment is absent in both classes on 2.1.257.

Failing case:

{"type":"queue-operation","operation":"enqueue","timestamp":"2026-09-06T10:14:01.205Z","sessionId":"…","content":"/compact PR-A = …"}
{"type":"assistant","timestamp":"2026-09-06T10:14:08.959Z","message":{"role":"assistant","stop_reason":"end_turn","content":[{"type":"text","text":"…"}]}}
{"type":"user","timestamp":"2026-09-06T10:14:09.360Z","promptSource":"queued","version":"2.1.257","message":{"role":"user","content":"/compact PR-A = …"}}
{"type":"attachment","attachment":{"type":"total_tokens_reminder","text":"<total_tokens>…</total_tokens>"}}
{"type":"assistant","message":{"role":"assistant","content":[{"type":"text","text":"The pre-compaction context captured the full state; the summary below carries every…"}]}}

Executed case (same version, same queue path, ~0.4 s after end_turn as well):

{"type":"queue-operation","operation":"enqueue","timestamp":"2026-09-06T11:19:38.021Z","sessionId":"…","content":"/compact …"}
{"type":"assistant","timestamp":"2026-09-06T11:20:05.144Z","message":{"role":"assistant","stop_reason":"end_turn","content":[{"type":"text","text":"…"}]}}
{"type":"user","timestamp":"2026-09-06T11:20:05.564Z","version":"2.1.257","message":{"role":"user","content":"/compact …"}}
{"type":"file-history-snapshot",…}
{"type":"system","subtype":"compact_boundary","content":"Conversation compacted",…}
{"type":"user","isCompactSummary":true,…}
{"type":"user","isMeta":true,"message":{"role":"user","content":"<local-command-caveat>…"}}
{"type":"user","message":{"role":"user","content":"<command-name>/compact</command-name>\n<command-message>compact</command-message>\n<command-args>…"}}

Observations from 81 local /compact rows

| Path | 2.1.222 | 2.1.257 |
|---|---|---|
| typed at an idle prompt → executed | 5/5 | 6/6 (2.1.202: 6/6) |
| queued mid-turn → executed | 30/30 | 29/36 |
| queued mid-turn → dispatched as a plain prompt | 0 | 7 |

  • All 7 failures have the /compact text ≥ 840 chars; 27 of the 29 executed queued cases are ≤ 787 chars (one executed at 1606), so length is suggestive but not the rule.
  • In failures the row after the user message is a total_tokens_reminder attachment; in executed cases it is a file-history-snapshot, i.e. the input took the prompt path, not the command path.

Impact

Any automation that requests compaction by typing /compact (we do this from an orchestrator when context gets high) cannot tell the command was dropped except by reading the JSONL: the session ends up idle with an un-compacted context and a fake "summary" in the transcript. We now detect promptSource:"queued" on a /compact user row as the signal; a reliable command dispatch at the queue boundary (or a visible error when a queued slash command is not executed) would remove the need.

View original on GitHub ↗