feat(gateway): persist inbound turns and outbound delivery across gateway restarts
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- python, sqlite
- Ambito
- backend, database, distributed-systems
Direzione di ricerca
Start by tracing the Weixin adapter through Intake.publish and the Spine scheduler, including shutdown behavior, then review the suggested restart, duplicate-delivery, lease, and outbox tests. Done means accepted turns and outbound replies survive restart, duplicate deliveries execute once, expired claims are handled safely, and pending delivery can resume without exposing private content or credentials.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Raven's channel intake and Spine scheduler currently provide in-process concurrency and per-conversation serialization, but they do not establish a durable acceptance boundary for inbound turns or a durable outbox for completed replies.
If the gateway restarts after a channel has received a message but before the turn finishes, the accepted turn cannot be recovered from persistent state. If outbound delivery fails after execution succeeds, there is no channel-neutral durable outbox that guarantees redelivery after recovery.
This proposal is about failure containment and recoverability. It does not assume that a specific channel, model provider, or network is at fault.
Version inspected
- Raven
0.1.7 mainatc3f3678a24d4cbda6204c5142c681235f5df15c4
Current behavior
The current Weixin adapter illustrates the gap:
- It keeps recently seen message IDs in the process-local
_seencollection. - It calls and awaits
intake.publish(...)after parsing the inbound message. Intake.publish(...)submits theTurnRequestto the in-process Spine scheduler.- Scheduler lanes and queued futures live in the gateway process and are intentionally drained or cancelled during shutdown.
This is a sound in-process scheduling model, but it does not persist the fact that Raven accepted a user request. A process restart therefore loses unstarted or unfinished in-memory work. The same gap exists on the outbound side: delivery success/failure is not represented by a durable, retryable outbox shared across channels.
Minimal reproduction
The issue is channel-neutral and can be reproduced with a synthetic slow runner:
- Start the gateway with a channel adapter and a runner that blocks long enough to observe restart behavior.
- Send one user turn and confirm that the adapter has parsed and submitted it.
- Restart the gateway before the turn produces an outbound reply.
- Observe that there is no persistent accepted-task record from which the turn can be resumed or definitively reported as failed.
- Separately, make a completed turn's outbound send fail, restart the gateway, and observe that there is no durable outbox item guaranteeing later redelivery.
Provider timeouts such as #150 reduce the duration of one failure mode, and structured termination such as #149 improves diagnosis, but neither creates a durable channel-to-run-to-delivery contract.
Expected behavior
Once Raven acknowledges a turn as accepted:
- the inbound request should survive gateway restart;
- a stable idempotency key should prevent duplicate execution after channel redelivery;
- processing should be claimable with a lease and safely recoverable after worker death;
- task completion and outbound delivery should be recorded as separate states;
- a failed outbound send should remain pending and retry after channel recovery;
- users should be able to query an accepted task's state even if the original run failed.
Proposed direction
Introduce channel-neutral persistence interfaces rather than implementing reliability independently in every adapter:
-
Durable inbox
- Persist
TurnRequest, conversation ID, origin, channel message ID, and timestamps transactionally. - Enforce a unique idempotency key per channel message.
- Persist
-
Recoverable dispatch
- Claim accepted turns with expiring leases.
- On restart, inspect expired claims before retrying so non-idempotent tool effects are not repeated blindly.
-
Durable outbox
- Persist final replies and delivery attempts separately from run completion.
- Retry transient channel failures and resume pending delivery after restart.
-
Acknowledgement and status hooks
- Allow a channel to acknowledge only after durable acceptance.
- Expose accepted, running, awaiting confirmation, completed, failed, cancelled, and delivery-pending states.
SQLite WAL could be a practical default local backend, but the core contract should remain storage-neutral. Whether the worker stays in the gateway process or moves to a separate service can remain an implementation choice as long as accepted work and delivery state survive process failure.
Suggested tests
- duplicate channel delivery produces one accepted turn;
- restart after acceptance but before execution resumes or reports the same turn;
- restart during execution safely handles an expired lease;
- successful execution plus failed send leaves a pending outbox item;
- channel recovery drains the outbox exactly once;
- scheduler shutdown cannot silently discard a previously acknowledged turn;
- no private message content or channel credentials appear in diagnostic status output.
I am happy to help refine the design and contribute a tested implementation once maintainers confirm the preferred persistence and process boundaries.
- Lingua principale
- Python
- Stelle
- 4.1k
- Fork
- 94
- Merge medio
- 2g 7h
- PR unite (30g)
- 216
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di EverMind-AI/Raven
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
EverMind-AI/Raven#1413 ·
I maintainer di solito rispondono entro 1 giorno
-
feat: allow users to build ui-web and ui-tui with `bun`Forse di nuovo libera @0warning0error l’ha presa 8 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
EverMind-AI/Raven#1283 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
EverMind-AI/Raven#121 ·
I maintainer di solito rispondono entro 1 giorno
-
fix: Feishu channel status wrongly reports missing credentials and "not connected" while WebSocket is liveForse già presa @pcbeingused333 l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 18/100
EverMind-AI/Raven#1399 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
WebUI tab froze silently while gateway stayed healthy (heartbeat stopped 1h49m); reproducible /auth refresh dead-end fixed in #1392Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
EverMind-AI/Raven#1393 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di EverMind-AI/Raven
Issue simili
-
bug docs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ActivityWatch/docs#223 ·
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier captureForse già presa @jianyx1 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
volcengine/OpenViking#8354 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ARTPARK-SAHAI-ORG/calibrate-frontend#842 ·
I maintainer di solito rispondono entro 1 giorno
-
comp/tools P2 tool/skills type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#159541 ·
I maintainer di solito rispondono entro 1 giorno