diff --git a/src/agent/turn-recovery-policy.ts b/src/agent/turn-recovery-policy.ts index 3277a89..e9faeb0 100644 --- a/src/agent/turn-recovery-policy.ts +++ b/src/agent/turn-recovery-policy.ts @@ -15,8 +15,7 @@ import { isZaiNonRetryableError } from "../cli/helpers/zaiErrors"; const INVALID_TOOL_CALL_IDS_FRAGMENT = "invalid tool call ids"; const APPROVAL_PENDING_DETAIL_FRAGMENT = "waiting for approval"; -const CONVERSATION_BUSY_DETAIL_FRAGMENT = - "another request is currently being processed"; +const CONVERSATION_BUSY_DETAIL_FRAGMENT = "is currently being processed"; const EMPTY_RESPONSE_DETAIL_FRAGMENT = "empty content in"; const RETRYABLE_PROVIDER_DETAIL_PATTERNS = [ "Anthropic API error", diff --git a/src/tests/turn-recovery-policy.test.ts b/src/tests/turn-recovery-policy.test.ts index 5f3d33e..8d24d58 100644 --- a/src/tests/turn-recovery-policy.test.ts +++ b/src/tests/turn-recovery-policy.test.ts @@ -57,6 +57,14 @@ describe("isConversationBusyError", () => { ).toBe(true); }); + test("detects busy error with run_id (run_id breaks old substring match)", () => { + expect( + isConversationBusyError( + "Cannot send a new message: Another request (run_id=run-abc-123) is currently being processed for this conversation. Please wait for it to complete.", + ), + ).toBe(true); + }); + test("rejects approval-pending", () => { expect(isConversationBusyError("The agent is waiting for approval")).toBe( false,