hermes-agent/gateway
Enough1122 5cc5c58e01 fix(gateway): flush pending memory writes before session teardown (#73297)
The gateway's /reset cleanup path called shutdown_memory_provider without
first draining the memory manager's serialized background write worker.
shutdown_all only gives that worker a bounded (~5s) drain and abandons
whatever is still queued past it, so a /reset could silently drop writes
the session had already handed off -- the next session then loaded
stale MEMORY.md.

The CLI exit path already drains via MemoryManager.flush_pending before
shutdown; this PR pins the same contract on the gateway cleanup path.

Cleanup now calls agent._memory_manager.flush_pending(timeout=10) before
the existing shutdown_memory_provider step. The flush is best-effort:
a flush failure must never block teardown, so it is wrapped in
try/except and the existing shutdown path remains the fallback.

Closes #73297
2026-07-29 17:21:55 +05:30
..
assets
…
builtin_hooks
…
platforms fix(gateway): dual-stack webhook bind for wecom/msgraph/whatsapp_cloud/teams/telegram siblings 2026-07-28 22:42:41 -07:00
relay fix(relay): per-platform capability descriptors for multi-platform gateways (#70717) 2026-07-27 14:24:14 +10:00
__init__.py
…
authz_mixin.py
…
cgroup_cleanup.py
…
channel_directory.py
…
code_skew.py
…
config.py fix(gateway): dual-stack webhook bind for wecom/msgraph/whatsapp_cloud/teams/telegram siblings 2026-07-28 22:42:41 -07:00
cwd_placeholder.py
…
dead_targets.py
…
delivery.py
…
delivery_ledger.py
…
display_config.py
…
drain_control.py
…
hooks.py
…
kanban_watchers.py
…
lifecycle_ledger.py fix(gateway): treat pid=None lifecycle sentinel as unknown ownership in mark_exited 2026-07-28 22:41:09 -07:00
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): flush pending memory writes before session teardown (#73297) 2026-07-29 17:21:55 +05:30
runtime_footer.py
…
scale_to_zero.py
…
session.py
…
session_context.py
…
shutdown_flush.py fix: consolidate agent-history preservation into shutdown_flush module 2026-07-29 16:45:35 +05:30
shutdown_forensics.py
…
shutdown_watchdog.py fix(gateway): detect and report unclean shutdowns via lifecycle ledger (NS-608) 2026-07-28 22:41:09 -07:00
slash_access.py
…
slash_commands.py refactor: fold simplify-code review findings 2026-07-29 17:13:48 +05:30
status.py
…
status_phrases.py
…
sticker_cache.py
…
stream_consumer.py fix(relay): per-platform capability descriptors for multi-platform gateways (#70717) 2026-07-27 14:24:14 +10:00
stream_dispatch.py
…
stream_events.py
…
streaming_tts_consumer.py feat(gateway): streaming TTS adapter contract and consumer (#60671) 2026-07-28 22:31:40 -07:00
systemd_notify.py
…
turn_lease.py
…
wake.py
…
whatsapp_identity.py
…