mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
feat(vscode-ide-companion): implement session rehydration for loading past conversations
- Add rehydratingSessionId flag to track session loading state - Route message chunks as discrete messages during rehydration instead of streaming - Update session handlers to properly manage conversation switching - Improve session manager documentation
This commit is contained in:
@@ -598,24 +598,22 @@ export class SessionMessageHandler extends BaseMessageHandler {
|
||||
|
||||
// Try to load session via ACP (now we should be connected)
|
||||
try {
|
||||
// Set current id and clear UI first so replayed updates append afterwards
|
||||
this.currentConversationId = sessionId;
|
||||
this.sendToWebView({
|
||||
type: 'qwenSessionSwitched',
|
||||
data: { sessionId, messages: [], session: sessionDetails },
|
||||
});
|
||||
|
||||
const loadResponse = await this.agentManager.loadSessionViaAcp(
|
||||
sessionId,
|
||||
(sessionDetails?.cwd as string | undefined) || undefined,
|
||||
);
|
||||
console.log(
|
||||
'[SessionMessageHandler] session/load succeeded:',
|
||||
'[SessionMessageHandler] session/load succeeded (per ACP spec result is null; actual history comes via session/update):',
|
||||
loadResponse,
|
||||
);
|
||||
|
||||
this.currentConversationId = sessionId;
|
||||
|
||||
const messages = await this.agentManager.getSessionMessages(sessionId);
|
||||
|
||||
this.sendToWebView({
|
||||
type: 'qwenSessionSwitched',
|
||||
data: { sessionId, messages, session: sessionDetails },
|
||||
});
|
||||
|
||||
// Reset title flag when switching sessions
|
||||
this.isTitleSet = false;
|
||||
|
||||
@@ -1029,17 +1027,15 @@ export class SessionMessageHandler extends BaseMessageHandler {
|
||||
|
||||
// Try ACP load first
|
||||
try {
|
||||
await this.agentManager.loadSessionViaAcp(sessionId);
|
||||
|
||||
// Pre-clear UI so replayed updates append afterwards
|
||||
this.currentConversationId = sessionId;
|
||||
|
||||
const messages = await this.agentManager.getSessionMessages(sessionId);
|
||||
|
||||
this.sendToWebView({
|
||||
type: 'qwenSessionSwitched',
|
||||
data: { sessionId, messages },
|
||||
data: { sessionId, messages: [] },
|
||||
});
|
||||
|
||||
await this.agentManager.loadSessionViaAcp(sessionId);
|
||||
|
||||
// Reset title flag when resuming sessions
|
||||
this.isTitleSet = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user