Repository navigation
Closed as not planned
Labels
P2Normal backlog priority with limited blast radius.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.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.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
Description
Description
After a gateway restart (e.g. VPS reboot, openclaw gateway restart, or service crash), the gateway delivers all queued/pending outbound messages at once. This creates a flood of stale messages that are no longer relevant.
Steps to Reproduce
- Have an active conversation with the agent via Telegram (or any channel)
- Reboot the VPS or restart the gateway service
- After the gateway comes back online, all pending messages from before the restart are delivered to the channel simultaneously
Observed Behavior
- ~20+ stale messages delivered all at once, all with the same timestamp
- Messages reference work that was already completed hours ago
- Users see a confusing flood of old context that looks like the agent "went nuts"
- Had to use
/stopto cut it off
Expected Behavior
Messages queued before a restart should either:
- Be dropped if they exceed a configurable TTL (e.g. 60 seconds)
- Be silently discarded on restart
- At minimum, have a config option like
gateway.delivery.maxAgeMsto control this
Environment
- OpenClaw 2026.3.24
- Ubuntu 22.04 (ARM64)
- Channel: Telegram (forum/topic mode)
- Gateway runs as systemd user service
Workaround
None currently. Users must manually /stop to halt the flood.
Suggestion
Add a gateway.delivery.staleTTLMs config option (default ~60000ms) that drops queued messages older than the threshold on gateway startup. This would prevent stale message replay while still allowing brief network interruptions to recover gracefully.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.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.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Activity
clawsweeper commentedon Apr 30, 2026
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.
Close as duplicate/superseded: the stale outbound replay behavior is still present, but the remaining TTL/config policy is already tracked by the open canonical issue and the focused implementation candidate remains open for review.
Canonical path: Keep the remaining TTL/default/expire-action decision in #16555, then land or replace #54900 with a backward-compatible outbound expiry policy.
So I’m closing this here and keeping the remaining discussion on #16555 and #54900.
Review details
Best possible solution:
Keep the remaining TTL/default/expire-action decision in #16555, then land or replace #54900 with a backward-compatible outbound expiry policy.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level. Seed an old pending delivery entry with retryCount 0 and no lastAttemptAt, then run recoverPendingDeliveries; current main treats it as eligible and gateway startup calls that path.
Is this the best way to solve the issue?
Yes for cleanup routing. The code fix should be resolved through the canonical TTL policy issue and focused PR candidate rather than keeping this duplicate report open.
Security review:
Security review: No patch is under review, and the issue itself is not a security-sensitive report.
What I checked:
src/infra/outbound/delivery-queue-recovery.ts:588, bb5010b89a5a)src/infra/outbound/delivery-queue-recovery.ts:330, bb5010b89a5a)src/infra/outbound/delivery-queue-storage.ts:145, bb5010b89a5a)src/gateway/server-runtime-services.ts:156, bb5010b89a5a)src/config/types.messages.ts:101, bb5010b89a5a)Likely related people:
src/infra/outbound/delivery-queue-recovery.ts,src/infra/outbound/delivery-queue-storage.ts,src/infra/outbound/delivery-queue.policy.test.ts)src/infra/outbound/delivery-queue.ts,src/infra/outbound/deliver.ts,src/gateway/server.impl.ts)src/infra/outbound/delivery-queue-recovery.ts,src/infra/outbound/delivery-queue-storage.ts,src/infra/outbound/delivery-queue.reconnect-drain.test.ts)src/infra/outbound/delivery-queue.ts,src/infra/outbound/outbound.test.ts)Codex review notes: model gpt-5.5, reasoning high; reviewed against bb5010b89a5a.