[FEATURE] VS Code extension: Claude process should survive Extension Host shutdown (browser/serve-web, Agent Host)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
In code serve-web (and any remote setup), closing the browser tab sends a graceful disconnect. VS Code disposes the connection immediately and terminates the Extension Host. The extension spawns claude as a child of the Extension Host with stdio pipes, so the running session is killed mid-turn. --reconnection-grace-time does not apply to graceful disconnects, and a new tab gets a new reconnection token, so re-attaching to the old Extension Host is impossible by design.
What already works: Integrated terminals survive this (ptyHost is owned by the server process). claudeCode.useTerminal therefore survives, but loses the panel UI, and the sessions-list "new session" action ignores the setting.
Request: Decouple the Claude process lifetime from the Extension Host, e.g. spawn it detached and reattach via --resume on the next activation, or expose the session through VS Code's Agent Host / AHP (VS Code 1.136+ ships an agentHost process that already owns sessions independently of the window).
Environment: VS Code 1.136.1 code serve-web on Ubuntu 24.04, extension 2.1.260, browser client via reverse proxy.
Proposed Solution
In code serve-web (and any remote setup), closing the browser tab sends a graceful disconnect. VS Code disposes the connection immediately and terminates the Extension Host. The extension spawns claude as a child of the Extension Host with stdio pipes, so the running session is killed mid-turn. --reconnection-grace-time does not apply to graceful disconnects, and a new tab gets a new reconnection token, so re-attaching to the old Extension Host is impossible by design.
Request: Decouple the Claude process lifetime from the Extension Host, e.g. spawn it detached and reattach via --resume on the next activation, or expose the session through VS Code's Agent Host / AHP (VS Code 1.136+ ships an agentHost process that already owns sessions independently of the window).
Environment: VS Code 1.136.1 code serve-web on Ubuntu 24.04, extension 2.1.260, browser client via reverse proxy.
Alternative Solutions
Integrated terminals survive this (ptyHost is owned by the server process). claudeCode.useTerminal therefore survives, but loses the panel UI, and the sessions-list "new session" action ignores the setting.
Priority
Medium - Would be very helpful
Feature Category
Developer tools/SDK
Use Case Example
_No response_
Additional Context
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗