Files
hermes-agent/apps/shared/src
Teknium e11ec55b0d fix(cli): a mid-turn plugin command's clarify and the turn's never swap
Live on e7a7e414 (classic `hermes chat`, /sidecheck ask typed while the turn's
terminal ran, then the turn called clarify): the turn's pump took the command's
SIDE_Q and the command's waiter took the turn's MAIN_Q, because both consumed
any `clarify` server request for the session from the one events queue. When
slash.exec returned, call_unbounded withdrew the panel its waiter held, which
was the turn's: MAIN_Q never showed and the tool returned outcome=cancelled.

Route by owner instead of first-come:
- slash.exec takes an opaque `ask_owner`; the gateway echoes it as `owner` on
  every clarify its ctx.ask_choice sends (viewer_choices / _ask_viewers).
- GatewayConnection routes a server request whose `owner` it registered to that
  owner's inbox at ingestion, so neither the turn pump nor an idle drain
  (queue_admitted_turn, _drain_stale) ever sees it; untagged requests and
  another viewer's go to the session queue as before.
- _answer_choices reads only its inbox, so the command-end withdraw only ever
  closes the command's own question.
- A gateway older than ask_owner refuses the key (invalid_params) before it
  runs anything: the command is re-sent without it, and its untagged ask is
  taken between turns, as before (such a gateway runs no command mid-turn).

Contracts: SlashExecParams.ask_owner, ClarifyRequestParams.owner (regenerated).
2026-11-29 14:14:47 -08:00
..
…
…
…
…
…
…
…
…
…