fix: address systems review findings for agent-not-found fallback
1. [HIGH] Tool restrictions recomputed for fallback agent via buildFallbackBody() — no longer inherits original agent's restrictions. 2. [HIGH] Double-retry race prevented — handleSessionErrorEvent now returns early for agent-not-found errors, since the prompt catch block already handles them with agent fallback. This prevents tryFallbackRetry from racing with a model-level retry on the same error (the "not found" pattern in RETRYABLE_MESSAGE_PATTERNS). 3. [MEDIUM] task.agent updated to FALLBACK_AGENT after successful fallback — notifications, toast, and logging reflect actual agent. 4. [MEDIUM] FALLBACK_AGENT exported from spawner.ts and imported into manager.ts — single source of truth. 5. [LOW] resumeTask fallback now uses promptWithModelSuggestionRetry (consistent with startTask), getting timeout protection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,14 @@ describe("background-agent spawner agent-not-found fallback", () => {
|
||||
expect(promptCalls[1].body.agent).toBe("general")
|
||||
// Original prompt content preserved in fallback
|
||||
expect(promptCalls[1].body.parts).toEqual(promptCalls[0].body.parts)
|
||||
// Tool restrictions recomputed for fallback agent (general has no restrictions)
|
||||
expect(promptCalls[1].body.tools).toEqual({
|
||||
task: false,
|
||||
call_omo_agent: true,
|
||||
question: false,
|
||||
})
|
||||
// Task agent identity updated to reflect fallback
|
||||
expect(task.agent).toBe("general")
|
||||
// Task should not have errored
|
||||
expect(onTaskError).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user