hermes-agent/gateway
brooklyn! 7d28e84e72
fix(gateway): deliver assistant prose before the clarify poll (#69775)
* fix(gateway): deliver assistant prose before clarify poll

The clarify poll is sent on a separate, agent-thread-blocking path while
buffered assistant prose (interim commentary / streamed deltas) sits in
the GatewayStreamConsumer queue, drained asynchronously. The poll won the
race, so the question rendered ABOVE its own explanation, and a redundant
'clarify: ...' tool-progress bubble wedged between them.

- Add GatewayStreamConsumer.flush_pending_sync(): a synchronous flush
  barrier (_FLUSH sentinel + threading.Event) that blocks the agent
  thread until everything queued before it is finalized and delivered.
- Call it in the gateway clarify callback before send_clarify, so prose
  always lands before the poll. Best-effort with a 3s timeout.
- Suppress the redundant clarify tool-progress bubble (the poll already
  shows the question + options).

Tests: 3 new ordering/timeout cases in test_stream_consumer.py.
(cherry picked from commit 9a6e27badb)

* chore(contributors): map matvey.sakhnenko03@icloud.com -> sakhnenkoff

Attribution mapping for the salvaged #54328 commit (Cluster C).

---------

Co-authored-by: Matvii Sakhnenko <matvey.sakhnenko03@icloud.com>
2026-07-22 23:25:35 -05:00
..
assets
…
builtin_hooks
…
platforms fix(slack): handle leading-space text commands 2026-07-22 20:55:51 -07:00
relay fix(relay): declare explicit relevance policy when require_mention is configured false (#69816) 2026-07-23 13:57:57 +10:00
__init__.py
…
authz_mixin.py fix(relay): restore streaming delivery, Slack command parity, and status clearing (salvage of #69716) (#69747) 2026-07-23 12:51:13 +10:00
cgroup_cleanup.py
…
channel_directory.py
…
code_skew.py
…
config.py fix(gateway): normalize YAML boolean streaming mode and keep enabled a mode-only alias 2026-07-20 05:39:09 -07:00
cwd_placeholder.py
…
dead_targets.py
…
delivery.py
…
delivery_ledger.py fix(gateway): don't spend a redelivery attempt when the platform is down 2026-07-20 11:52:41 +05:30
display_config.py
…
drain_control.py
…
hooks.py
…
kanban_watchers.py
…
memory_monitor.py
…
message_timestamps.py
…
mirror.py
…
pairing.py
…
platform_registry.py
…
profile_routing.py
…
readiness.py
…
response_filters.py
…
restart.py
…
restart_loop_guard.py
…
rich_sent_store.py
…
run.py fix(gateway): deliver assistant prose before the clarify poll (#69775) 2026-07-22 23:25:35 -05:00
runtime_footer.py
…
scale_to_zero.py
…
session.py fix(slack): expose shared-thread author mention target 2026-07-22 07:22:55 -07:00
session_context.py
…
shutdown_forensics.py
…
shutdown_watchdog.py
…
slash_access.py
…
slash_commands.py fix: forward timestamp in CLI, gateway, and TUI branch copy loops 2026-07-22 06:58:27 -07:00
status.py fix(status): make gateway_updated_at a stable RFC3339-or-null contract (#68657) 2026-07-21 13:12:41 -07:00
status_phrases.py
…
sticker_cache.py
…
stream_consumer.py fix(gateway): deliver assistant prose before the clarify poll (#69775) 2026-07-22 23:25:35 -05:00
stream_dispatch.py
…
stream_events.py
…
systemd_notify.py
…
turn_lease.py fix(gateway): per-session turn lease + conversation-scope funnel (#64934) (#67401) 2026-07-19 03:49:29 -07:00
whatsapp_identity.py
…