Fix Claude agent interrupt race and refactor mode color tiers
- Fix race in agent-manager where pendingRun wasn't fully cleaned up before the next streamAgent call, causing "already has an active run" - Fix Claude agent query restart: null out query/input before awaiting old iterator return so the old pump skips failActiveTurns - Reset pendingInterruptAbort on new foreground turn - Add system error assertion to send-during-tool-call e2e test - Rename mode color tiers: drop "default", rename "readonly" to "planning", update color assignments across providers and UI
This commit is contained in:
@@ -1383,6 +1383,13 @@ export class AgentManager {
|
||||
timeout,
|
||||
]);
|
||||
}
|
||||
// The waiter settling wakes up the streamForwarder generator, but its
|
||||
// finally block (which deletes the pendingForegroundRun) runs asynchronously.
|
||||
// Wait for the pending run to be fully cleaned up so the next streamAgent
|
||||
// call doesn't see a stale entry and reject with "already has an active run".
|
||||
if (pendingRun && !pendingRun.settled) {
|
||||
await Promise.race([pendingRun.settledPromise, timeout]);
|
||||
}
|
||||
} else if (pendingRun) {
|
||||
const timeout = new Promise<void>((resolve) => setTimeout(resolve, 2000));
|
||||
await Promise.race([pendingRun.settledPromise, timeout]);
|
||||
|
||||
Reference in New Issue
Block a user