Files
hermes-agent/gateway
teknium1 9790d730c0 fix: a clarify card that resolves AMBIGUOUS after the ack window stays armed for the late tap
The late-failure watch treated every non-"sent" outcome as definitive: a relay
lost-ack (raw_response.ambiguous=True, the card may well have posted) arriving
after SEND_ACK_WINDOW tore down the registration and returned the delivery
notice, so the user's button tap on a card that WAS rendered found no pending
entry and was lost. That breaks the invariant _abort_for_outcome (and main)
keeps for an immediate ambiguous outcome. _on_card_done now returns early on
"ambiguous" and lets the bounded wait's own timeout cover a card that truly
never arrived.

Also while here:
- a late DECLINE releases with UNDELIVERED_DECLINED, matching the immediate
  path, instead of the generic notice (_release carries the outcome);
- when the text fallback cannot even be scheduled (fallback() -> None) the
  card's "failed" verdict stands instead of re-classifying None, which logged a
  misleading "no scheduling future (loop unavailable)";
- test_card_failing_after_the_ack_window_... now asserts the text prompt was
  sent exactly once and the wait released within ack window + 2 s, and the
  helper answers only after observing the prompt — with fallback/late-watch
  disabled it stayed green before (the helper answered on a 10 s deadline);
- telegram.md: clarify_timeout default is 3600 s (resolve_clarify_timeout,
  configuration.md), not 600.

Part of #112684
2026-09-17 09:06:17 -07:00
..