Repository navigation
fix(remote-connect): surface relay rejection reason for peer events - #3655
Merged
Merged
Conversation
`RealtimeSender::event` discarded the relay acknowledgement payload and
returned a fixed "Relay event rejected" error, so every failed peer event
fanout produced the same undiagnosable log line. The relay returns
`{"ok": false, "error": "..."}` (for example `event target offline`),
which is exactly the information needed to tell an offline controller
apart from a forbidden or malformed event.
`RealtimeSender::call` already surfaces `payload["error"]`; make `event`
consistent with it.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
RealtimeSender::event在 relay 返回{"ok": false, ...}时,直接bail!("Relay event rejected"),把 ack 里的error丢掉了。结果是:任何一次 peer event fanout 失败,日志都长得一模一样:
但 relay 侧其实是有区分度的 ——
src/crates/services/relay-service/src/realtime/mod.rs的machine-eventhandler 会返回:event forbiddenevent target offlineinvalid event{"ok": false}(目标 socket emit 失败)这几种情况在排查时是完全不同的方向,现在一条都看不到。
证据
本机
app.log里这条日志连续刷了 483 条(15:49:43 → 16:42:05),涉及两个不同的 peer,全都是同一句Relay event rejected。期间 RPC 通道是正常的(每 2 秒一条RPC request received from relay),说明不是连接整体断开。产生的实际影响:无法判断到底是 controller 已经离线(
event target offline,host 侧 controller 列表是陈旧的),还是事件被 relay 拒绝,只能靠猜。改动
RealtimeSender::event保留 relay 的拒绝原因,与同文件里RealtimeSender::call已有的写法保持一致(那里已经是bail!("{}", result["error"]...)):改完之后日志会变成:
关联现象(不在本 PR 范围)
Remote Web 端(
remote.openbitfun.com)聊天页的 prompt suggestion 气泡一直不出现。四端(web / iOS / Android / HarmonyOS)的 UI 实现都是有的:src/mobile-web/src/components/ChatComposerBar.tsx(visibleSuggestion)src/apps/mobile/ios/OpenBitFun/Features/Chat/ComposerBar.swift+PromptSuggestionUITests.swiftsrc/apps/mobile/android/app/src/main/kotlin/com/openbitfun/mobile/app/ui/chat/ComposerBar.ktsession_event_publication也已经把agentic://prompt-suggestion标成「到达 controller 但不写 transcript」(persist_control: true),并有测试覆盖。所以问题大概率不在 UI,而在 peer event 推送这一段 —— 也正是本 PR 想让它变得可观测的那条路径。不声称本 PR 修复了那个问题;它只是让下一次失败能直接说明原因。
验证
通过。