mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
A final response generated but not confirmed-delivered was the one artifact the gateway could lose without a trace: crash or planned restart between finalize and platform ACK dropped it silently, and the resume path re-ran the whole turn at full cost (#58818 P1, #41696, #63695's gateway half). gateway/delivery_ledger.py records each outbound final response in state.db (same conventions as the async-delegation ledger: WAL, owner pid + process-start-time liveness, bounded retention): pending -> attempting -> delivered | failed startup sweep on dead-owner rows -> redeliver | abandoned Contract (the lessons from the closed delivery-outbox attempt #61790): - obligation recorded BEFORE the first send attempt; cleared only on SendResult.success (destination acceptance, #51184) - ambiguity is labeled, never silently retried: rows that were mid-send when the process died redeliver with a visible '♻️ Recovered reply — may be a duplicate' prefix (honest at-least-once) - stable ids from session_key + inbound message id + content, so distinct threads/topics can never collide - poison rows bounded: 3 attempts / 24h freshness -> abandoned; claim atomically re-stamps ownership so racing sweeps can't double-claim - redelivery clears resume_pending for the session so the resume path never re-runs a turn whose answer the ledger already holds - best-effort everywhere: ledger failure can never block or delay a send - slash-command/ephemeral/empty responses are not recorded; cron and proactive delivery stay on DeliveryRouter (separate subsystem) Config: gateway.delivery_ledger (default on; no version bump needed). Validation: 30 ledger+producer tests; 352 blast-radius gateway tests green; cross-process E2E (record in process A, kill it mid-send, claim + marker + redeliver in a fresh process B against the same state.db). |
||
|---|---|---|
| .. | ||
| assets | ||
| builtin_hooks | ||
| platforms | ||
| relay | ||
| __init__.py | ||
| authz_mixin.py | ||
| cgroup_cleanup.py | ||
| channel_directory.py | ||
| code_skew.py | ||
| config.py | ||
| cwd_placeholder.py | ||
| dead_targets.py | ||
| delivery.py | ||
| delivery_ledger.py | ||
| 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 | ||
| runtime_footer.py | ||
| scale_to_zero.py | ||
| session.py | ||
| session_context.py | ||
| shutdown_forensics.py | ||
| shutdown_watchdog.py | ||
| slash_access.py | ||
| slash_commands.py | ||
| status.py | ||
| status_phrases.py | ||
| sticker_cache.py | ||
| stream_consumer.py | ||
| stream_dispatch.py | ||
| stream_events.py | ||
| systemd_notify.py | ||
| whatsapp_identity.py | ||