Skip to content

Commit 87c5cce

Browse files
authored
fix: Fix session race condition killing active agents and retry loop (#1627)
## Problem Fix session race condition killing active agents and retry loop. <!-- Who is this for and what problem does it solve? --> <!-- Closes #ISSUE_ID --> ## Changes 1. Scope process cleanup to the current taskRunId instead of killing all agent/child processes for the task 2. Clear initialPrompt on session error to prevent retry loops <!-- What did you change and why? --> <!-- If there are frontend changes, include screenshots. --> ## How did you test this? Manually <!-- Describe what you tested -- manual steps, automated tests, or both. --> <!-- If you're an agent, only list tests you actually ran. -->
1 parent 3c54ea4 commit 87c5cce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

apps/code/src/main/services/agent/service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,10 @@ When creating pull requests, add the following footer at the end of the PR descr
573573
}
574574

575575
for (const proc of this.processTracking.getByTaskId(taskId)) {
576-
if (proc.category === "agent" || proc.category === "child") {
576+
if (
577+
(proc.category === "agent" || proc.category === "child") &&
578+
proc.metadata?.taskRunId === taskRunId
579+
) {
577580
this.processTracking.kill(proc.pid);
578581
}
579582
}

apps/code/src/renderer/features/sessions/service/service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ export class SessionService {
11211121
isPromptPending: false,
11221122
isCompacting: false,
11231123
promptStartedAt: null,
1124+
initialPrompt: undefined,
11241125
});
11251126
} else {
11261127
sessionStoreSetters.updateSession(session.taskRunId, {

0 commit comments

Comments
 (0)