fix(app): important policy ranks a tie against the running answer; timer and ordering fixes

- A new request that ties the running answer on priority and wake word
  is ranked against it by the brain; a win interrupts, a loss or a
  timeout lets the answer go on. The ranking is dropped when the answer
  ends first.
- A ranking that arrives after its deadline counts as a timeout.
- Candidates collected while an answer runs keep end-time order, so the
  timeout fallback picks the earliest-ended one.
- A spent collect timer is cleared, so next_deadline reports the settle
  deadline instead of a time already passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-11 22:09:57 +09:00
parent 6fc3983a40
commit 46eebcd256
2 changed files with 130 additions and 19 deletions

View File

@@ -98,8 +98,14 @@ Per policy:
`important` ranks by (1) priority, (2) `direct`, then (3) the brain's importance ranking, asked for only
when two or more candidates tie on (1) and (2). While the ranking is pending nothing new starts; if it
does not come within 1.5 s, or fails, the earliest-ended of the tied candidates wins. A candidate
beats the running answer only on (1) or (2); the ranking is not asked for an interruption.
does not come within 1.5 s (a ranking that arrives later counts as late), or fails, the earliest-ended
of the tied candidates wins. Candidates are kept in `ended_at` order, whenever they arrived.
A new request that beats the running answer on (1) or (2) interrupts it at once. One that ties it on
both is ranked against it (the running answer keeps playing meanwhile): if the ranking puts the new
request first, the answer stops (missed, `interrupted`) and the new request is answered; if it puts the
running answer first, or does not come in time, the answer goes on and the new request waits. The
ranking is dropped when the running answer ends first.
## Tests