feat: Auto-resume idle agents for inter-agent conversations

When an agent asks a question via `cw ask` targeting an idle agent,
the conversation router now auto-resumes the idle agent's session so
it can answer. Previously, questions to idle agents sat unanswered
forever because target resolution only matched running agents.

Changes:
- Add `resumeForConversation()` to AgentManager interface and implement
  on MultiProviderAgentManager (mirrors resumeForCommit pattern)
- Relax createConversation target resolution: prefer running, fall back
  to idle (was running-only)
- Trigger auto-resume after conversation creation for idle targets
- Add concurrency lock (conversationResumeLocks Set) to prevent
  double-resume race conditions
This commit is contained in:
Lukas May
2026-03-03 13:29:39 +01:00
parent 938700d45d
commit 9edc93a268
7 changed files with 116 additions and 7 deletions

View File

@@ -80,6 +80,7 @@ function createMockAgentManager(
resume: vi.fn().mockResolvedValue(undefined),
getResult: vi.fn().mockResolvedValue(null),
getPendingQuestions: vi.fn().mockResolvedValue(null),
resumeForConversation: vi.fn().mockResolvedValue(false),
};
}