Skip to content

Commit 8c0cbed

Browse files
committed
fix(ai-chat): abort in-flight Claude query on destroySession
destroySession was nulling currentAbortController without calling .abort() on it first, so clicking "+ New" while the AI was streaming left the Claude query churning in the background. Now mirrors the resumeSession path: abort first, then null. Adds i18n strings for the new "AI is working" confirmation dialogs surfaced by the chat panel when New / history-resume interrupt a streaming run.
1 parent c21ad35 commit 8c0cbed

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src-node/claude-code-agent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,11 @@ exports.resumeSession = async function (params) {
673673
* Destroy the current session (clear session ID).
674674
*/
675675
exports.destroySession = async function () {
676+
if (currentAbortController) {
677+
currentAbortController.abort();
678+
currentAbortController = null;
679+
}
676680
currentSessionId = null;
677-
currentAbortController = null;
678681
_queuedClarification = null;
679682
return { success: true };
680683
};

src/nls/root/strings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,6 +2368,10 @@ define({
23682368
"AI_CHAT_HISTORY_DELETE_CONFIRM": "Delete this session?",
23692369
"AI_CHAT_SWITCH_PROJECT_TITLE": "AI is working",
23702370
"AI_CHAT_SWITCH_PROJECT_MSG": "AI is currently working on a task. Switching projects will stop it. Continue?",
2371+
"AI_CHAT_NEW_WHILE_STREAMING_TITLE": "AI is working",
2372+
"AI_CHAT_NEW_WHILE_STREAMING_MSG": "AI is currently working on a task. Starting a new conversation will stop it. Continue?",
2373+
"AI_CHAT_RESUME_WHILE_STREAMING_TITLE": "AI is working",
2374+
"AI_CHAT_RESUME_WHILE_STREAMING_MSG": "AI is currently working on a task. Switching to a previous conversation will stop it. Continue?",
23712375
"AI_CHAT_SETTINGS_TITLE": "Claude Code Settings",
23722376
"AI_SETTINGS_API_KEY": "API Key",
23732377
"AI_SETTINGS_BASE_URL": "Base URL",

0 commit comments

Comments
 (0)