fix: always-queue + ACK mailbox for reliable Codex→Claude delivery (fixes #223)#237
Closed
RyanZhang33 wants to merge 1 commit into
Closed
fix: always-queue + ACK mailbox for reliable Codex→Claude delivery (fixes #223)#237RyanZhang33 wants to merge 1 commit into
RyanZhang33 wants to merge 1 commit into
Conversation
Messages from Codex were silently lost when Claude was idle because pushNotification used fire-and-forget JSON-RPC notifications that resolve when bytes hit the stdio pipe, with no delivery confirmation. When the session was idle, the push was silently dropped and the fallback queue never activated (no error was thrown). Three-layer fix in claude-adapter.ts: 1. Always-queue: queueFallbackMessage() now runs before pushViaChannel(), so get_messages always has messages regardless of push outcome. 2. ACK mailbox: Messages are no longer drained-and-cleared atomically. get_messages returns un-acked messages but keeps them in the mailbox; only an explicit ack_ids parameter removes them. This guarantees at-least-once delivery across multiple get_messages calls. 3. Overflow eviction: When the mailbox is full, already-acked entries are evicted first before dropping oldest un-acked messages. Also updated file header comment and CLAUDE_INSTRUCTIONS to reflect the new delivery semantics. Fixes raysonmeng#223
Contributor
|
Thanks for the PR! Before we can merge it, please sign our lightweight Contributor License Agreement — it keeps the project able to offer a future commercial edition alongside the open-source one. Reply here with: I have read the CLA Document and I hereby sign the CLA RyanZhang33 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Codex→Claude 消息在 Claude 会话 idle 时静默丢失(Issue #223)。根因:pushNotification 使用 fire-and-forget JSON-RPC notification,idle 丢弃不抛异常,回退队列永远不会被填充。
修复方案(三层防护)
修改文件
src/claude-adapter.ts(+109/-49 行)测试
字母接力测试:13 轮往返(Claude→Codex 13 次,Codex→Claude 39 条消息),0 丢失。get_messages 在 5 次连续调用中稳定返回相同消息(未签收前),签收后立即清空。