[BUG] [VSCode] Crash when auto-compact triggers during plan mode — ExitPlanMode tool filtered out after compact boundary
Resolved 💬 3 comments Opened Mar 29, 2026 by rodrigopinhoaragao-byte Closed May 3, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When auto-compact triggers during an active plan mode session in the VS Code extension, the session crashes with an error prompting the user to stop the prompt.
ExitPlanMode is a deferred tool only available while plan mode is active. When the compact agent rebuilds the session, the tool reference carried from pre-compact history is present but the tool itself isn't loaded into the new session context, causing it to be silently filtered out and leaving the session in a broken state.
What Should Happen?
Auto-compact completes and the session resumes normally, still in plan mode.
Error Messages/Logs
Session crashes after compaction. The extension logs show:
[DEBUG] autocompact: tokens=172076 threshold=167000 effectiveWindow=180000
[DEBUG] Forked agent [compact] finished: 1 messages ...
[WARN] Filtering out tool_reference for unavailable tool: ExitPlanMode
Steps to Reproduce
- Open a plan mode session in the VS Code extension
- Continue working until the session approaches the auto-compact threshold (~167k tokens)
- Auto-compact triggers
- Session crashes with an error prompting to stop the prompt
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.85.82d
Platform
Other
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗