feat(gateway): persist inbound turns and outbound delivery across gateway restarts
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- python, sqlite
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 4.1k
- フォーク
- 94
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 216
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
EverMind-AI/Raven のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
EverMind-AI/Raven#1413 ·
メンテナーはふだん 1 日以内に返信
-
feat: allow users to build ui-web and ui-tui with `bun`再び着手できるかも @0warning0error が 8 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
EverMind-AI/Raven#1283 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
EverMind-AI/Raven#121 ·
メンテナーはふだん 1 日以内に返信
-
fix: Feishu channel status wrongly reports missing credentials and "not connected" while WebSocket is live対応中かも @pcbeingused333 が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 18/100
EverMind-AI/Raven#1399 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
WebUI tab froze silently while gateway stayed healthy (heartbeat stopped 1h49m); reproducible /auth refresh dead-end fixed in #1392対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
EverMind-AI/Raven#1393 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
EverMind-AI/Raven の issue をすべて見る
似ている issue
-
bug docs
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ActivityWatch/docs#223 ·
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier capture対応中かも @jianyx1 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
volcengine/OpenViking#8354 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ARTPARK-SAHAI-ORG/calibrate-frontend#842 ·
メンテナーはふだん 1 日以内に返信
-
comp/tools P2 tool/skills type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#159541 ·
メンテナーはふだん 1 日以内に返信