fix: settle prompts folded into a task-notification cycle

Merged
RI
1mo ago
+515-2

Motivation

A prompt sent while Claude Code runs a turn it started on its own, for example after a background task finished, is folded into that turn. The turn's result keeps origin: task-notification but lists the prompt in user_message_uuids. The adapter routed results by origin only, so session/prompt was never answered and the client stayed in a running state. A JetBrains AIR session stayed "running" for hours this way.

Change

A task-notification result that names a pending prompt now answers it. A turn held for its subagents still waits for them. Results without the uuids behave as before.

Tests

Unit tests in acp-agent.test.ts and a replay of the session in folded-prompt-scenario.test.ts. Both hang without the fix.