fix: correctly trigger idle preemption in streaming input mode

The original notifyIdle condition (!result.result) never fired in
streaming input mode because every result has non-null text content.
This caused due tasks to wait up to 30 minutes for the idle timer.

- Call notifyIdle for ALL successful results (not just null ones)
- Add isTaskContainer flag so user messages queue instead of being
  forwarded to task containers (which blocked notifyIdle from the
  message container's onOutput path)
- Reset idleWaiting in sendMessage so containers aren't preempted
  while actively working on a new incoming message
- Replace 30-min IDLE_TIMEOUT with 10s close timer for task containers
  since they are single-turn and should exit promptly after their result

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Gavriel Cohen
2026-02-21 22:11:42 +02:00
committed by gavrielc
parent 93bb94ff55
commit c6b69e87a9
3 changed files with 22 additions and 15 deletions

View File

@@ -187,7 +187,7 @@ async function processGroupMessages(chatJid: string): Promise<boolean> {
resetIdleTimer();
}
if (!result.result && result.status === 'success') {
if (result.status === 'success') {
queue.notifyIdle(chatJid);
}