hermes-agent/gateway/platforms
Teknium 64ed99a6e6
fix(webhook): close per-delivery session at the true end of the run (#57423)
The merged webhook session-close fix (#57370, salvaging #57322) wrapped
handle_message in a try/finally — but BasePlatformAdapter.handle_message
is fire-and-forget: it spawns _process_message_background and returns
before the agent run starts. The finally-close therefore ran BEFORE
get_or_create_session created the session row, found no session_id, and
silently no-op'd — the ghost-session leak persisted on the real path.
(The shipped test masked this by stubbing handle_message with a fake
that created the row synchronously.)

Move the close to an on_processing_complete override — the lifecycle
hook the base class fires at the TRUE end of the run, on the success,
failure, and cancellation paths alike. Empirically verified through the
real fire-and-forget pipeline: before, ended_at stayed NULL; after,
ended_at is set with end_reason=webhook_complete and the row is
prunable.

Tests now stub only the runner-side _message_handler (the seam the live
gateway injects) so handle_message / _process_message_background /
on_processing_complete all run for real; adds an AsyncSessionDB-facade
coverage test for the coroutine-await branch.
2026-07-02 17:39:09 -07:00
..
qqbot fix(gateway): fail-closed external-surface defaults + profile-aware multiplex authz 2026-07-01 03:56:28 -07:00
__init__.py
_http_client_limits.py
ADDING_A_PLATFORM.md
api_server.py feat(api-server): per-client model routing via model_routes (#3176 salvage) 2026-07-02 05:23:28 -07:00
base.py feat(cron/slack): flat in-channel continuable cron delivery surface 2026-07-01 03:16:13 -07:00
bluebubbles.py
helpers.py
msgraph_webhook.py
signal.py
signal_format.py
signal_rate_limit.py
webhook.py fix(webhook): close per-delivery session at the true end of the run (#57423) 2026-07-02 17:39:09 -07:00
weixin.py fix(gateway): fail-closed external-surface defaults + profile-aware multiplex authz 2026-07-01 03:56:28 -07:00
whatsapp_cloud.py
whatsapp_common.py fix(gateway): fail-closed external-surface defaults + profile-aware multiplex authz 2026-07-01 03:56:28 -07:00
yuanbao.py fix(gateway): fail-closed external-surface defaults + profile-aware multiplex authz 2026-07-01 03:56:28 -07:00
yuanbao_media.py
yuanbao_proto.py
yuanbao_sticker.py