hermes-agent/gateway
synapsesx d5d7cab2b6 fix(gateway): persist compressed transcript before repointing /compress session
When /compress rotates the session, the handler repointed the live
session entry onto the new (empty) continuation session_id and _save()d
that BEFORE writing the compressed transcript — and rewrite_transcript
swallowed DB write failures at DEBUG. A transient write failure (SQLite
lock under concurrent writes, ENOSPC, disk/IO error) left the session
pointing at an empty id while the handler still reported a cheerful
'Compressed: N → M' success. The active conversation vanished from view.

- gateway/session.py: rewrite_transcript now returns bool (True on write
  success or no-DB, False on canonical write failure). /retry, /undo, and
  yuanbao recall ignore the result, so their behavior is unchanged.
- gateway/slash_commands.py: _handle_compress_command persists the
  compressed transcript FIRST and treats a write failure as fatal (raises
  into the outer handler's 'compress failed' banner). Only repoints +
  _save()s the session on a successful write. Widened beyond the original
  rotation case to also cover in-place compaction (#38763): a failed
  in-place write would otherwise leave the DB untouched while still
  reporting success.
- tests: regression tests for both the rotation and in-place write-failure
  paths — assert a failure banner, unchanged session_id, and no _save().

Co-authored-by: Hermes Agent <agent@nousresearch.com>
2026-07-01 01:39:23 -07:00
..
assets
…
builtin_hooks
…
platforms fix(api_server): pop fallback model kwarg to prevent AIAgent collision 2026-07-01 01:26:27 -07:00
relay refactor(relay): purge platform-specific scope terminology from the relay adapter (D-Q2.5c) (#56016) 2026-07-01 12:30:59 +10:00
__init__.py
…
authz_mixin.py
…
cgroup_cleanup.py
…
channel_directory.py
…
code_skew.py
…
config.py
…
dead_targets.py
…
delivery.py refactor(gateway): reuse looks_like_telegram_private_chat_id helper 2026-07-01 01:01:36 -07:00
display_config.py
…
drain_control.py
…
hooks.py
…
kanban_watchers.py
…
memory_monitor.py
…
message_timestamps.py
…
mirror.py
…
pairing.py
…
platform_registry.py
…
response_filters.py fix(gateway): suppress NO_REPLY/[SILENT] markers on the streaming path 2026-06-30 23:37:04 -07:00
restart.py
…
rich_sent_store.py style(profile): frame comments around what the code does 2026-06-30 15:30:06 -07:00
run.py refactor(gateway): reuse looks_like_telegram_private_chat_id helper 2026-07-01 01:01:36 -07:00
runtime_footer.py
…
scale_to_zero.py
…
session.py fix(gateway): persist compressed transcript before repointing /compress session 2026-07-01 01:39:23 -07:00
session_context.py
…
shutdown_forensics.py
…
slash_access.py
…
slash_commands.py fix(gateway): persist compressed transcript before repointing /compress session 2026-07-01 01:39:23 -07:00
status.py
…
sticker_cache.py
…
stream_consumer.py fix(gateway): suppress NO_REPLY/[SILENT] markers on the streaming path 2026-06-30 23:37:04 -07:00
stream_dispatch.py
…
stream_events.py
…
whatsapp_identity.py
…