Repository navigation
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
Description
问题描述
Gateway 重启后,OpenClaw 的 main-session-restart-recovery 恢复了被中断的 session transcript,agent 重新运行并产出回复。但这个回复被写入 transcript 后没有触发 reply_payload_sending event,导致渠道插件无法 delivery——用户永远看不到回复。
重现步骤
- 用户通过蓝信发送消息 → 插件
handleInbound()→inbound.run()注册 delivery adapter → 发 ack 消息 - Gateway 重启(插件升级、配置变更等) → SIGTERM → session transcript 被 drain 保存
main-session-restart-recovery恢复 session → agent 产出新回复 → 回复写入 transcript- 没有任何
reply_payload_sendingevent 触发 → 渠道插件的 fallback delivery hook 无法执行 → 用户永远收不到回复
关键日志证据
测试环境:OpenClaw 2026.6.1 + 蓝信渠道插件 3.14.2
17:28:07 inbound.run starting (旧进程)
17:29:27 SIGTERM → gateway draining
17:29:55 restart-recovery: resumed interrupted session
17:29:55~17:32 agent 精确产出完整回复(输出内容出现在 gateway log 中)
之后没有任何 reply_payload_sending 或 deliverReply 的日志。
蓝信插件在 3.14.2 中已经加了 fallback delivery(通过 reply_payload_sending hook),但这个 hook 本身没有被 core 触发,所以 fallback 也没机会执行。
根因分析
main-session-restart-recovery 在恢复 session 后,可能通过 "internal transcript append" 的方式写入 agent 回复,绕过了正常的 reply event pipeline(reply_payload_sending → channel delivery adapter)。这意味着所有依赖 reply_payload_sending hook 做回复 delivery 的渠道插件(不仅仅是蓝信)在 restart-recovery 场景下都会丢失回复。
影响范围
这个问题影响所有渠道插件,不只是蓝信:
- Telegram、Discord、Signal、WhatsApp 等所有通过
reply_payload_sendinghook 做 delivery 的插件都会受影响 - 每次插件升级或 gateway 重启都会触发
建议修复方向
- Core 应在 restart-recovery agent 回复完成后触发
reply_payload_sendingevent,让渠道插件有机会通过正常 pipeline delivery - 或者:Core 在 recovery 完成后 emit 一个专门的
session.recoveredevent,包含最后一条 agent 回复内容,让渠道插件可以主动 delivery - 或者:Core 提供一个
session.getLastReply()API,让插件在 recovery 场景下可以主动提取并发送回复
优先级
🔴 高 — 这是 OpenClaw core 的 bug,影响所有渠道插件的用户体验。每次 gateway 重启都会导致正在处理的消息回复丢失。
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Jun 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 10:39 AM ET / 14:39 UTC.
Summary
Keep open: current main and latest release still send restart-recovered agent-command final replies without
replyPayloadSendingHook, and the linked closing PR is open but currently conflicting rather than merged.Reproducibility: yes. Source inspection shows restart recovery calls Gateway
agentwith delivery enabled, while current main sends the recovered final payload withoutreplyPayloadSendingHook; I did not run a live external-channel restart.Root-cause cluster
Relationship:
canonicalCanonical: #90282
Summary: This issue is the canonical user report for restart-recovered agent-command replies missing
reply_payload_sending; the open linked PR is the active candidate fix, and the earlier equivalent PR is closed unmerged.Members:
fixed_by_candidate: fix: route agent command replies through reply hooks #90300 - The PR uses closing syntax for this issue and adds the missing hook metadata to agent-command durable final delivery.same_root_cause: [codex] fix(agents): run reply payload hooks for agent delivery #90293 - The closed-unmerged PR attempted the same hook pass-through for the same user report, so it is related context but not a viable canonical replacement.adjacent_distinct: [Bug]: Session stuck in permanent busy state after mid-turn gateway restart — no auto-recovery, only /new or /reset clears it #92519 - The issue also concerns restart recovery and message/session availability, but its reported permanent busy-state mechanism is distinct from the missing hook pass-through here.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
No new repair PR should be queued because the linked open PR already owns the implementation path for this issue.
Review details
Best possible solution:
Land or replace #90300 so agent-command durable delivery supplies the existing reply hook metadata while preserving current restart-abort handling.
Do we have a high-confidence way to reproduce the issue?
Yes. Source inspection shows restart recovery calls Gateway
agentwith delivery enabled, while current main sends the recovered final payload withoutreplyPayloadSendingHook; I did not run a live external-channel restart.Is this the best way to solve the issue?
Yes. Reusing the existing durable
reply_payload_sendinghook metadata is the narrow maintainable fix; adding a new recovery event or last-reply API would duplicate the established pre-delivery hook path.AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 0ad48dad2c47.
Label changes
Label justifications:
P1: The report describes a broken restart-recovered agent/channel workflow where users can miss the final reply after a gateway restart.impact:message-loss: Recovered agent replies can be produced but not delivered through channel plugins that depend on the documented pre-delivery hook.impact:session-state: The failure occurs while resuming persisted main-session state after an interrupted run.Evidence reviewed
What I checked:
AGENTS.md:1, 0ad48dad2c47)VISION.md:18, 0ad48dad2c47)resumeMainSessioncalls Gatewayagentwithdeliver: Boolean(deliveryContext)and channel/target fields, so recovered replies flow into agent-command delivery. (src/agents/main-session-restart-recovery.ts:580, 0ad48dad2c47)deliverAgentCommandResultcallssendDurableMessageBatchwith payloads, session, reply/thread ids, restart-abort signal, and callbacks, but noreplyPayloadSendingHook. (src/agents/command/delivery.ts:750, 0ad48dad2c47)replyPayloadSendingHookwith kind, channel, session key, run id, and context into the same durable send API. (src/auto-reply/reply/route-reply.ts:278, 0ad48dad2c47)params.replyPayloadSendingHookbefore channel send, so the current source gap is the agent-command caller not supplying it. (src/infra/outbound/deliver.ts:1618, 0ad48dad2c47)Likely related people:
feat(plugin-sdk): add reply payload sending hookadded the hook surface, docs, routed reply wiring, and outbound delivery support. (role: introduced hook surface; confidence: high; commits: b474f429ee4b; files:docs/plugins/hooks.md,src/auto-reply/reply/route-reply.ts,src/infra/outbound/deliver.ts)src/agents/agent-command.ts,src/agents/command/delivery.ts,src/agents/main-session-restart-recovery.ts)src/agents/agent-command.ts,src/agents/main-session-restart-recovery.ts,src/infra/outbound/targets-session.ts)src/agents/agent-command.ts,src/agents/command/delivery.ts,src/agents/command/delivery.test.ts)src/agents/command/delivery.ts,src/agents/command/delivery.test.ts,src/agents/main-session-restart-recovery.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.