[BUG] Compaction artifacts: session model silently resets to default; compactor prompt attributed as a user message in subagent transcript

Open 💬 0 comments Opened Jul 4, 2026 by lebaige

Preflight

  • [x] I have searched existing issues and this hasn't been reported yet (searched: "compaction model reset", "compact model switch default", "compaction fabricated user message")
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code (2.1.200)

What's Wrong?

Two related artifacts observed after context compaction (/compact or auto-compaction) in long sessions:

(a) The session's selected model silently resets to the configured default. In a long session running a non-default model, after compaction the session's declared model reverted to the configured default model with no notice to the user. The session continued on the wrong model until the user noticed the status line. (Observed 2026-07-01, session id beginning 621cc741; model selection reverted from the session-selected model to the account default.)

(b) The compactor's own prompt can appear as a user message in a subagent transcript. In a compacted subagent's transcript, the compaction machinery's internal instruction text was injected as if it were a message typed by the user, and the agent then responded to it as user input (in our instance the agent began obeying a spurious "TEXT ONLY" style instruction that no human ever sent). Observed 2026-06 on an earlier project; the fabricated message is visible in the saved .jsonl transcript.

Filed together because they share the trigger (compaction) and likely the same code path (reconstruction of session state after summarization); happy to split if maintainers prefer.

What Should Happen?

  • (a) Compaction preserves the session's model selection; if it cannot, it should surface the change loudly rather than silently switching. (Silent model switches also undermine any workflow that treats the declared model as an invariant.)
  • (b) Compaction-internal prompts must never be attributed as user messages in any transcript — neither the main session's nor a subagent's.

Steps to Reproduce

(a):

  1. Start a session and select a non-default model for it.
  2. Work until compaction triggers (or run /compact) in a long session.
  3. Check the declared model after compaction — intermittently it has reverted to the configured default with no notification.

(b): observed rather than reliably reproduced — a compacted subagent transcript contained the compactor's instruction as a user message. If useful we can share the sanitized transcript excerpt.

Environment

  • Claude Code 2.1.200 (model reset observed on 2.1.x), Windows 11 Pro (10.0.26200), PowerShell + Git Bash
  • Session model: Fable 5 selected; configured default Opus 4.8 (the model it reverted to)

View original on GitHub ↗