hermes - 💡(How to fix) Fix gateway: pre-output message assimilation with tool-dispatch gate (follow-up to #31341)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

#31341 landed B1.2 active-session text debounce — rapid follow-ups during a turn are now merged into the next turn instead of being clobbered or fragmenting. That solves the correctness problem.

When the agent has started a turn internally but hasn't yet produced visible output or dispatched tools, a follow-up message still results in two turns: response-to-msg1, then response-to-msg2+msg3. With assimilation, this could collapse into one turn where the agent responds to all three messages together.

Proposed approach: tool-dispatch gate

RAW_BUFFERClick to expand / collapse

Background

#31341 landed B1.2 active-session text debounce — rapid follow-ups during a turn are now merged into the next turn instead of being clobbered or fragmenting. That solves the correctness problem.

Remaining gap

When the agent has started a turn internally but hasn't yet produced visible output or dispatched tools, a follow-up message still results in two turns: response-to-msg1, then response-to-msg2+msg3. With assimilation, this could collapse into one turn where the agent responds to all three messages together.

This is an optimization, not a correctness fix — the user-visible behavior is "2 turns instead of 1" rather than anything broken.

Why my previous attempt (#29943) was wrong

The timing-window approach didn't gate on side effects. Cancel/restart could discard a turn after a tool had already executed (file write, network call, terminal command). Shipping behind an off-by-default flag confirmed it wasn't ready.

Proposed approach: tool-dispatch gate

Replace the timing window with a state machine on the agent run context:

  • Track committed: bool on the run context
  • Set True on first tool dispatch (before execution) OR first visible output token
  • Adapter checks is_turn_committed(session_key) before attempting assimilation
  • Assimilation only allowed while committed == False
  • No timing deadline as correctness gate — only as a staleness hint for stale revisions
  • Ship default-on once correct (no `HERMES_PRE_OUTPUT_*` flag needed)

The key shift: "no side effects until commit" instead of "race to assimilate before side effects."

Question for maintainers

Is this optimization worth pursuing as a follow-up to #31341, or is the 2-turn case acceptable given the user value B1.2 already delivers?

If yes, I'd implement in a focused PR with the gate in `gateway/run.py` and a thin adapter-side check — no large state expansion in `BasePlatformAdapter` this time.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix gateway: pre-output message assimilation with tool-dispatch gate (follow-up to #31341)