[Bug] Restarting ACP creates a new backend session without resetting or re-syncing the webview transcript
Description
Running nanocoder.restartAcp disposes and restarts the child CLI process. NanocoderAcpClient.setConnection() clears this._sessionId = undefined. When the new process connects and handshake finishes, _initializeSessionIfReady() automatically creates a brand-new backend session. However, the webview transcript is never cleared, reloaded, or notified. The user sees their prior conversation, but the new backend agent has zero context from earlier turns.
Environment
- OS: Linux (reviewed); macOS / Windows potentially affected
- Node version: >= 22.0.0
- Nanocoder version: 1.31.0
Steps to Reproduce
- Carry out a conversation with Nanocoder in the chat webview.
- Run command
Nanocoder: Restart Nanocoder Agent Process(nanocoder.restartAcp). - Notice that the chat transcript remains visible.
- Send a follow-up question referencing an earlier turn (e.g., "What did we just discuss?").
Expected Behavior
After ACP restarts:
- The extension should automatically attempt to resume the last active session ID on the new process, OR
- The webview transcript should be explicitly reset with an announcement that the agent process was restarted in a fresh session.
Actual Behavior
The webview displays the old conversation, but prompts are dispatched to a blank backend session with no prior history.
Logs/Screenshots
(Illustrative control flow from source inspection)
Manually restarting ACP process...
[Extension] Webview ready; waiting for ACP handshake.
ACP Initialized.
[Extension] Session initialized automatically: session-new-uuid
// Webview transcript never received {type: 'clear'} or history reload
Additional Context
- [x] No matching open issue found in issue search performed on 2026-10-12
- [x] Relevant code paths inspected at commit
d5ff9c37
Implementation Notes (optional)
- Files:
plugins/vscode/src/extension.ts:109-117plugins/vscode/src/chat-webview-provider.ts:512-536
- Track the last active
sessionIdbefore disposingAcpProcessManager. - In
_initializeSessionIfReady(), attemptresumeSession(previousSessionId)before falling back tonewSession(). If falling back to a new session, notify the webview to clear and announce the reset.
Would love to work on this issue will soon propose my plan!
Hi @rishu685, I’m assigning this one to you. I’ll review your PR this time. Going forward, please comment on the issue first and wait until you’re assigned before you start working on it. That way we avoid duplicate work and keep things fair for everyone. Thanks for contributing!