Skip to content

fix: stop channel messages replaying when reply queue fills - #182252

Closed
emeric-dandelion-cult wants to merge 10 commits into
openclaw:mainfrom
karmaterminal:emeric/20261023-upstream-queue-cap
Closed

emeric-dandelion-cult wants to merge 10 commits into
openclaw:mainfrom
karmaterminal:emeric/20261023-upstream-queue-cap

Conversation

@emeric-dandelion-cult

@emeric-dandelion-cult emeric-dandelion-cult commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #182246

What Problem This Solves

Durable channel messages discarded by a full follow-up queue were re-claimed and retried as abandoned turns until their retry budget ran out. The Discord fan-in and inbound-debounce wrappers, Telegram spooled replay, Feishu fan-in/broadcast, and Slack logical replay guards also lost the new terminal-drop callback, so the initial queue fix did not reach those channels.

User Impact

Actual queue-cap evictions now settle once in the failed-message ledger with a policy reason, including through Discord’s and iMessage’s shared composed ingress lifecycle, Telegram’s spooled replay participant, Feishu’s flush/broadcast adapters, and Slack’s logical replay guard. Summary-elision cap eviction has the same terminal disposition. A full queue with no evictable item remains retryable backpressure, not a policy drop. Ordinary abandonment and cancellation remain unchanged. No migration or user action is required.

Why This Change Was Made

The queue previously completed cap-dropped sources through the same callback used when a turn never adopted the reply lane. The ingress drain interpreted that as retryable abandonment. The queue now gives deliberate discards an explicit terminal lifecycle disposition; ingress classifies it as non-retryable and retains asynchronous settlement custody before marking the source complete. Channel fan-in and inbound debounce forward that disposition without losing the claims (the same fan-in is used by iMessage). Telegram spooled replay forwards and awaits the terminal disposition through its deferred participant, then settles the durable row. Feishu flush and broadcast carry terminal drops through transport and replay-claim settlement; Slack preserves the callback through its ingress lifecycle and commits its separate logical replay claim on a drop. The all-protected refusal keeps the retry path.

Evidence

  • Initial red-first queue and ingress fossils were added before the implementation on ancestor 7ab64536d3eb75e7020a90ebce0b6eafc06502e4; the touched four-file suite passed 97/97 after the fix.
  • Independent review at 54c515a2 identified the Discord wrapper gap and all-protected backpressure. Three further red-first cases failed on that head, then passed after the correction: composed fan-in→debounce drop (2 claims), protected backpressure, and summary-elision cap eviction.
  • Corrected head 1e971137a52124ad9fc2ddf9f341e7328d4aecfc: prior 51 focused core tests passed; red-first Telegram fossils failed on 0f0f5fb080b6 and passed after correction (processor 19/19 and SQLite ingress 23/23). Slack ingress/message-handler suites passed 38/38; Feishu ingress/broadcast suites passed 24/24, followed by a targeted drop-settlement-failure case 2/2. Core/core-test and extension/extension-test typechecks, touched-file oxlint and oxfmt, and git diff --check passed. That head’s CI had two failing Node shards; they are under attribution, not counted as green.
  • Current head 8eb4fe75bba4d4decf2ef906a789673b4a507e80: red-first Feishu broadcast failure probe now verifies the dropped-lane claim releases when durable settlement fails; Slack success/failure probes verify the logical claim commits only after both lifecycle callbacks succeed. Feishu broadcast 11/11 and Slack message-handler 19/19 passed; extension production/test typechecks, touched-file oxlint/oxfmt, and git diff --check passed. Current-head CI completed with two gateway test failures: server.chat-abort-settlement.test.ts accepted-injection dispatch expected one injection but saw none, and server.subagent-stop-followup.product.test.ts parent-stop case observed a missing killReconciliation. Both signatures also failed on prior head 1e971137; the failure report marks them unknown because it found no matching main jobs. A focused local Bun rerun of both files passed 17/17, which is not evidence that the CI failures are fixed or inherited. Exact-head independent review remains pending.
  • The required Codex autoreview was attempted but failed authentication. A Claude delta review returned incomplete on a proposed mixed-lane gap; source and the existing passing mixed-lane test show dropReason selects terminal drop even when another lane adopted, so the alleged orphan path is not reachable. Neither attempt is presented as a clean whole-PR review. No production deployment was used for this PR; the isolated Gateway proof is below.
  • Scope: iMessage uses the fixed shared fan-in/debounce chain. LINE, SMS, and Google Chat pass through their supplied ingress lifecycle. The new direct adapter corrections cover Telegram, Feishu, and Slack logical replay custody.
  • Post-fix isolated Discord Gateway proof at 8eb4fe75 is below; the pre-fix fleet evidence remains separate.

Live evidence (before fix)

Behavior or issue addressed: #182246 — queue-cap drops replay durable ingress.

Before evidence: #182246 (comment)

Live evidence from a deployed fleet, 2026-10-24 03:30–04:30Z, posted at the reporter's request. Discord IDs, session keys and message text are redacted.

Setup

  • Discord guild channel with 6 agents in one busy room.
  • messages.queue.cap = 10, messages.queue.drop = old.
  • The builds carry a bounded-retry change for abandoned ingress (turn-abandoned counts as an attempt; 8 attempts, then dead-letter). On upstream main the abandonment path releases the claim without consulting the dead-letter disposition, so the same messages would re-queue indefinitely rather than exhaust. That is the "eventual retry exhaustion" open point.

Observed on two hosts

One message's history (seat A). The same <msg-A> is re-dispatched and abandoned again about every 1–2 min:

21:08:45 [discord] ingress: spooled update <msg-A> failed; keeping for retry: turn-abandoned
21:10:13 [discord] ingress: spooled update <msg-A> failed; keeping for retry: turn-abandoned
21:10:48 … turn-abandoned
21:11:50 … turn-abandoned
21:13:42 … turn-abandoned
21:14:42 … turn-abandoned
21:17:14 … turn-abandoned

Ingress rows that reached terminal state in that hour (channel_ingress_events, status failed):

seat retry-limit-exceeded rows max attempts turn-abandoned log lines (1h)
A (build 03de0ce5d3) 9 7 160
B (build 7d8a1a91c6) 16 7 244

Each dead-lettered row's last_error is turn-abandoned. Each loop iteration re-runs the model. Seat B logged 186 abandons against 12 model calls in 16 min, and the agent stayed mute.

Attribution caveats

  • The queue-cap drop path does not log, so these rows are not individually tagged as cap drops. The attribution is from the shape of the loop: the same oldest IDs fail together, it only happens under room load, and a fresh or quiet session shows 0.
  • Seat A's build also lacks fix(sessions): rebase stale actor admissions under the writer FIFO #169107 (stale-actor rebase under the writer FIFO), which produces a different abandonment path. That one logs refusing replay: Session actor version changed…. Seat A logged 2 of those against 160 abandons. Seat B logged 0 of them against 244. So seat B's loop is not that race.
  • A small log line on policy drops (queue-cap-old / queue-cap-new, plus the source id) would make this attributable in the field. It might be worth adding alongside fix: stop channel messages replaying when reply queue fills #182252.

Related review note on #182252: on the Discord path, onDropped does not survive fanInChannelIngressLifecycles and createInboundDebounceFlush, so Discord drops still fall back to onAbandoned. Details will go on the PR.

🌿 frond-scribe, via Claude Code
https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg

Live proof (after fix; isolated Gateway)

Exact PR head: 8eb4fe75bba4d4decf2ef906a789673b4a507e80. This is an isolated local Gateway running the bundled Discord channel adapter against a synthetic local Discord provider (Crabline) and a local mock model provider, not a production deployment or a live Discord account. A one-off, uncommitted QA Lab probe used the existing channel-progress-presentation.e2e.test.ts fixture, held the first model response, and sent synthetic QCAP-RUNNER, QCAP-A, and QCAP-B Discord messages through the channel ingress endpoint. Each policy had fresh Gateway/SQLite state, messages.queue = { mode: collect, cap: 1, drop: old|new, debounceMsByChannel.discord: 0 }, and inbound debounce 0. The probe released the held response, then checked the SQLite failed ledger, model requests, and Discord outbound writes after settlement.

The failed row was terminal exactly once (attempts: 0) with the dropped source and policy reason; the dropped source did not become a model request. The survivor did become the next model request and received a distinct model reply. The drop:new queue-full notice is counted separately from model replies.

Redacted terminal output (all IDs/markers are synthetic; only status, reason, and counts are printed):

QUEUE_CAP_PROOF {"head":"8eb4fe75bba4d4decf2ef906a789673b4a507e80","drop":"old","rows":[{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"failed","reason":"queue-cap-old","attempts":0,"source":"QCAP-A"},{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"completed","reason":null,"attempts":0,"source":null}],"modelReplies":2,"queueFullNotices":0,"providerRequests":["QCAP-RUNNER","QCAP-B"]}
QUEUE_CAP_PROOF {"head":"8eb4fe75bba4d4decf2ef906a789673b4a507e80","drop":"new","rows":[{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"failed","reason":"queue-cap-new","attempts":0,"source":"QCAP-B"},{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"completed","reason":null,"attempts":0,"source":null},{"status":"completed","reason":null,"attempts":0,"source":null}],"modelReplies":2,"queueFullNotices":1,"providerRequests":["QCAP-RUNNER","QCAP-A"]}
Tests  2 passed | 16 skipped (18)
Duration  95.47s (tests 87%, transform 8%, import 4%)
[test] passed 1 Vitest shard in 107.01s

The adapter-propagation note in the historical pre-fix comment above describes the original PR revision; the current head includes those adapter fixes. This proof covers Discord old/new policy behavior through an isolated Gateway. It does not claim a real Discord deployment or independent live proof for the Telegram, Feishu, or Slack adapters, which have separate focused tests described above.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@emeric-dandelion-cult
emeric-dandelion-cult marked this pull request as ready for review October 24, 2026 05:03
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR makes deliberate reply-queue discards terminal ingress failures instead of retryable abandonment.

Example: With cap 1 and drop old, QCAP-B arrives while QCAP-A waits behind an active turn.

  • Before: QCAP-A is evicted but its durable ingress row becomes retryable and can reappear.
  • After: QCAP-A receives one terminal queue-cap-old failure while QCAP-B remains runnable.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful production-path harness evidence supports the central repair, but two concrete cleanup regressions block the patch.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Messages deliberately discarded from a full queue can reappear and consume channel processing capacity.
Reason: Terminal handling restores the documented old/new discard behavior without adding configuration or changing ordinary retry policy.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this PR open: current main still has the replay defect, but the patch bypasses two channel cleanup paths.

Priority: P2
Reviewed head: 8eb4fe75bba4d4decf2ef906a789673b4a507e80

Before merge

  • Add real behavior proof - The exact-head isolated Gateway trace meaningfully exercises Discord queue overflow through the bundled adapter and SQLite, showing terminal old/new reasons and surviving replies, but uses a synthetic Discord provider and mock model; it does not satisfy the scoped real-channel/real-model requirement or Telegram restart-replay proof, so the contributor should supply those traces with IPs, API keys, phone numbers, and non-public endpoints redacted. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Release Slack routing fences when a queued source is dropped (P2) - After onSessionRouted retains a channel-turn fence, a queued message calls routed onDeferred and returns with adoptOnCompletion=false. If drop:old later evicts it, this callback invokes the inherited ingress onDropped directly. The routed lifecycle in ingress.ts wraps only onAdopted and onAbandoned with settleTurn(), so the fence remains unresolved after the durable row fails. A later channel_id_changed event waits indefinitely in Promise.all(channelTurns), blocking migration and following channel traffic. Add a routed onDropped wrapper that performs the same terminal routing cleanup and cover deferred eviction followed by channel migration.
  • Clean up deferred MMS attachments on terminal queue drops (P2) - A downloaded MMS queued behind active work sets adoptionState='deferred'. Its lifecycle spreads the ingress onDropped unchanged, while file deletion exists only in the local onAbandoned wrapper. The new source-settlement branch invokes onDropped instead of onAbandoned, so an old-policy eviction skips materialized.cleanup(); the finalizer also skips cleanup for deferred work. Repeated evictions leave unused attachment files behind. Wrap onDropped in this media owner, clean up before forwarding the terminal disposition, and extend the existing deferred-MMS regression. This concern was equally visible at the earlier reviewed head and was missed in that review; the relevant SMS and source-settlement code is unchanged.
  • Resolve merge risk - A maintainer must establish the cause of the failing required Node check before merge; available evidence does not attribute it to this diff or establish an inherited failure.

Findings

  • [P2] Release Slack routing fences when a queued source is dropped — extensions/slack/src/monitor/message-handler.ts:322-324
  • [P2] Clean up deferred MMS attachments on terminal queue drops — extensions/sms/src/inbound.ts:138-144

Tests

  • Missing end-to-end proof: Provide redacted real-channel Gateway evidence with a real agent/model for old/new discards and surviving work, plus restart-replay evidence for the changed Telegram spool path.
Agent review details

How this fits together

Channel adapters carry durable ingress claims into the session reply queue; lifecycle callbacks return adoption, retry, or terminal failure to the ingress owner.

flowchart LR
  A[Channel event] --> B[Durable ingress]
  B --> C[Channel lifecycle adapter]
  C --> D[Session reply queue]
  D --> E[Adopt surviving input]
  D --> F[Terminal policy drop]
  F --> G[Failed ingress ledger]
Loading

Technical review

Best possible solution:

Keep terminal discards in the existing ingress failure owner while preserving Slack routing cleanup, SMS media cleanup, and retryable backpressure.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes cap discard → source abandonment → ingress release, and the contributor supplies red-first regressions and corroborating fleet logs; no target code was executed during this review.

Is this the best way to solve the issue?

An explicit terminal disposition matches the documented discard contract and reuses the correct settlement owner, but every adapter must preserve its existing cleanup when abandonment is bypassed.

Full review comments:

  • [P2] Release Slack routing fences when a queued source is dropped — extensions/slack/src/monitor/message-handler.ts:322-324
    After onSessionRouted retains a channel-turn fence, a queued message calls routed onDeferred and returns with adoptOnCompletion=false. If drop:old later evicts it, this callback invokes the inherited ingress onDropped directly. The routed lifecycle in ingress.ts wraps only onAdopted and onAbandoned with settleTurn(), so the fence remains unresolved after the durable row fails. A later channel_id_changed event waits indefinitely in Promise.all(channelTurns), blocking migration and following channel traffic. Add a routed onDropped wrapper that performs the same terminal routing cleanup and cover deferred eviction followed by channel migration.
    Confidence: 0.98
  • [P2] Clean up deferred MMS attachments on terminal queue drops — extensions/sms/src/inbound.ts:138-144
    A downloaded MMS queued behind active work sets adoptionState='deferred'. Its lifecycle spreads the ingress onDropped unchanged, while file deletion exists only in the local onAbandoned wrapper. The new source-settlement branch invokes onDropped instead of onAbandoned, so an old-policy eviction skips materialized.cleanup(); the finalizer also skips cleanup for deferred work. Repeated evictions leave unused attachment files behind. Wrap onDropped in this media owner, clean up before forwarding the terminal disposition, and extend the existing deferred-MMS regression. This concern was equally visible at the earlier reviewed head and was missed in that review; the relevant SMS and source-settlement code is unchanged.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3183356530eb.

Merge-risk options

Maintainer options:

  1. Complete the channel cleanup cutover (recommended)
    The contributor should wrap terminal drops in the existing Slack routing and SMS media owners and add regressions for both cleanup contracts.

Provenance checked

  • Queue and session source settlement keeps the original intent (36e277d: The session-controller refactor centralized source custody and completion; the patch carries its new disposition through that owner.)
  • Core ingress abandonment and failure keeps the original intent (4151625: Restore retry-accounted genuine abandonment while keeping cancellation separate; intentional cap discards now use a distinct terminal failure.)
  • Inbound debounce admission keeps the original intent (a24c1ce: Release keyed admission separately from dispatch completion so follow-ups can reach active turns; forwarding drops retains that ownership split.)
  • Telegram replay finalization keeps the original intent (refactor(telegram): split bot handler runtime #106324: Split the existing handler runtime without changing behavior; the patch extends its existing participant and dedupe finalization path rather than adding a separate replay owner.)
  • Feishu flush and broadcast claims keeps the original intent (736dddb: Preserve accepted messages across restarts and settle fan-out claims independently; the patch explicitly accounts for terminally dropped lanes.)
  • Slack logical replay guard keeps the original intent (c45f299: Durably admit transport events while suppressing logical message/app_mention twins; terminal drops retain that guard but miss the routing owner's cleanup.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test extensions/slack/src/monitor/ingress.test.ts extensions/slack/src/monitor/message-handler.test.ts
  • pnpm test extensions/sms/src/inbound.test.ts
  • pnpm test src/auto-reply/reply/queue.policy-drop.test.ts src/plugin-sdk/channel-ingress-runtime.test.ts
  • git diff --check

What I checked:

  • Current-main defect remains: Current main completes old/new cap-discarded sources without a terminal disposition; ordinary abandonment releases their ingress claims for retry. (src/auto-reply/reply/queue/enqueue.ts:138, 3183356530eb)
  • Introduced change and earlier finding: The pinned introduced diff adds terminal-drop settlement and forwards it through fan-in, debounce, Telegram, Feishu, and Slack, addressing the previous review's missing-callback finding. (src/plugin-sdk/channel-ingress-runtime.ts:339, 8eb4fe75bba4)
  • Slack routing cleanup is bypassed: Slack releases its channel-turn fence through routed onAdopted/onAbandoned wrappers, but inherits onDropped directly; channel_id_changed waits for those retained fences. (extensions/slack/src/monitor/ingress.ts:368, 8eb4fe75bba4)
  • SMS cleanup is bypassed: Deferred MMS cleanup runs through the SMS onAbandoned wrapper; inherited onDropped skips it, and the finalizer deliberately retains files while adoptionState is deferred. (extensions/sms/src/inbound.ts:138, 8eb4fe75bba4)
  • Late-finding comparison: The earlier reviewed head and current head have identical SMS inbound and source-settlement code; the SMS file has blob 38f93e642e1ea82a5f8a404635455c5ff509d077 at both revisions. (extensions/sms/src/inbound.ts:138, 8eb4fe75bba4)
  • Supplied execution evidence: The current PR body records exact-head isolated Gateway output for old/new Discord drops, failed-ledger reasons, excluded model requests, and surviving replies, using a synthetic Discord provider and mock model. (8eb4fe75bba4)

Likely related people:

  • Ayaan Zaidi: Raw commit fc6b9da adds src/channels/message/ingress-drain.ts:534 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: fc6b9dad0b13; files: src/channels/message/ingress-drain.ts)

PR surface

Source +235, Tests +348. Total +583 across 30 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 20 277 42 +235
Tests 10 348 0 +348
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 30 625 42 +583

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #182246
Summary: This PR owns the proposed repair for terminal cap-discard replay; broader abandonment accounting and overflow-summary attribution remain distinct work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The source-confirmed defect affects finite-cap queues under load, with a focused repair available.
  • merge-risk: 🚨 compatibility: The patch adds a plugin-facing lifecycle disposition and changes which cleanup callback existing adapters receive.
  • merge-risk: 🚨 message-delivery: A dropped deferred Slack message can retain a migration fence and block subsequent channel migration and delivery.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-24T05:22:32.772Z sha 54c515a :: needs real behavior proof before merge. :: [P2] Forward terminal drops through every ingress lifecycle adapter

Reviewed October 24, 2026, 9:12 AM ET / 13:12 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot added the channel: telegram Channel integration: telegram label Oct 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack channel: feishu Channel integration: feishu labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 25, 2026
The composite carries the three upstream-open grafts on top of the
continuation absorb: openclaw#121204 (248cf17), openclaw#124337
(cd8a6e2) and openclaw#182252 (8eb4fe7). This merges jump 5, i.e. P
ea81534 + upstream 9629838, into the previous composite 8ce7a05.

Clean merge. The graft delta is byte-identical:
git diff ea81534 8ce7a05 and git diff 17d81d6 <this commit> touch
the same 95 files with the same added and removed lines.

Refs: karmaterminal/openclaw-bootstrap#1727

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 28, 2026
…8 composite

Graft: emeric/20261027-182252-on-124337-j8 @ 7c3cd5f
(openclaw#124337 pre-adoption abandonment bounded by the retry budget, with
openclaw#182252 queue-cap policy drops reconciled over it; queue semantics
reviewed by frond-gloss).

Conflict: src/channels/message/ingress-drain.ts, import block only
(openclaw#121204 moved the drain option types to ingress-drain-options.ts;
openclaw#182252 added the queue-cap drop import). Resolved to openclaw#121204's narrowed
imports plus openclaw#182252's ingress-queue-cap-drop import; both bodies
auto-merged. The j8 candidate does not touch this file.

Composite manifest: #1491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 28, 2026
Graft: emeric/20261027-182252-j8-backmerge @ c2ea410
(queue-cap policy drops no longer replay channel ingress). Merged so the
standalone openclaw#182252 head is an ancestor of the composite.

Conflict: src/auto-reply/reply/queue/enqueue.ts resolved to graft 2's
combined bytes (emeric/20261027-182252-on-124337-j8 @ 7c3cd5f), whose
releaseBeforeTurnAdoptionRetry already releases the dedupe source on
onDropped by inputInstance (023b34c's fix). The Slack test and
queue.policy-drop.test.ts merge to the same combined bytes. This merge
changes no tree content.

Composite manifest: #1491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 28, 2026
…9 composite

Graft: emeric/20261027-182252-on-124337-j8 @ 7c3cd5f
(openclaw#124337 pre-adoption abandonment bounded by the retry budget, with
openclaw#182252 queue-cap policy drops reconciled over it; queue semantics
reviewed by frond-gloss). Carried as-is from the j8 composite.

Conflict: src/channels/message/ingress-drain.ts, import block only
(openclaw#121204 moved the drain option types to ingress-drain-options.ts;
openclaw#182252 added the queue-cap drop import). Resolved to openclaw#121204's narrowed
imports plus openclaw#182252's ingress-queue-cap-drop import, the same
resolution as the j8 composite's 1ca76ba; both bodies auto-merged.
Verified the staged file equals the raw three-way merge with only that
hunk resolved. The j9 candidate does not touch this file.

Composite manifest: #1491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 28, 2026
Graft: emeric/20261027-182252-j8-backmerge @ c2ea410
(queue-cap policy drops no longer replay channel ingress). Merged so the
standalone openclaw#182252 head is an ancestor of the composite; carried as-is
from the j8 composite.

Conflict: src/auto-reply/reply/queue/enqueue.ts resolved to graft 2's
combined bytes (emeric/20261027-182252-on-124337-j8 @ 7c3cd5f, blob
5deb399). The Slack message-handler, message-handler test and
ingress test, and queue.policy-drop.test.ts, merge to the same combined
bytes. This merge changes no tree content (index tree == first-parent
tree 77b0873).

Composite manifest: #1491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 31, 2026
steipete added a commit that referenced this pull request Nov 5, 2026
Merge current main while retaining its monitor-owned custody and per-claim
retirement fence. Forward queue-policy drops through the existing settlement
path, preserve non-durable and explicit followup outcomes, and release Feishu
replay claims after late drops.

Keep policy drops separate from delivery failures in notices, health, and
bounded retention. Preserve summary unbinding and all original contributor
commits for #182252. Fixes #182246.
steipete added a commit that referenced this pull request Nov 5, 2026
Closes #182246. Maintainer continuation of #182252, preserving the contributor commits. Thanks @emeric-dandelion-cult for the original repair.

## What Problem This Solves

Messages intentionally discarded by the session queue's `old`/`new` cap policies could re-enter durable ingress, replay, and delay surviving messages.

## User Impact

Policy-discarded messages receive a terminal queue-policy outcome without retry-failure notices or resend invitations. Surviving messages retain FIFO ordering. Protected-only capacity rejection remains retryable; surfaces without durable ingress keep visible queue-full feedback, and a refused `/followup` reports that it was not queued.

Policy drops do not count as dead letters in health or Doctor. Retention bounds their replay guards separately from actual failures under the existing TTL. No config option, schema migration, dependency, or manual action is added. Old dropped content can still appear in Discord's independently recovered room history; it does not execute as a separate turn.

## Why This Change Was Made

The existing queue, source-custody, and ingress owners carry a distinct dropped outcome through debounce and channel wrappers. The ingress monitor forwards it through its existing settlement wrapper. Failure reporting and bounded pruning remain with their existing owners. Feishu settles dropped session lanes independently, and summary eviction unbinds a source before awaiting its receipt.

Reload and claim ownership come from merged main, including #193564. The monitor change only forwards `onDropped` through `settleLifecycle`; this PR adds no competing custody or fence mechanism. SDK docs describe forwarding and cleanup. Wrappers without durable terminal-drop custody retain their existing abandonment fallback.

Redelivery while a drop callback's receipt is still pending receives the existing bounded pending refusal; this is accepted, and no eager commit or `onDropped` wrapper is added.

## Evidence

Three dispatch/real-ingress/real-followup composition regressions cover old eviction, new rejection, and summarized eviction. Each verifies a terminal row with attempts 0 and its policy reason, then settled-source same-ID redelivery returns `skipped:duplicate`, makes no second resolver call, and sends no final reply. All three already passed on the merged head before this continuation; they protect composition with #193564 rather than establish a newly fixed post-settlement leak.

Real local-model proof used an isolated Gateway through `pnpm openclaw`, synthetic Discord transport, real shared Ollama `qwen2.5:7b`, and the real queue, ingress ledger, model request and delivery path. These are macOS arm64 results, not live Discord-service or Linux/Windows proof.

- Node 26.12.1 and pinned Bun 1.4.4 each passed reload plus old/new policy survival. Reload produced exactly RUNNER/B/C/D requests and replies in order; A ended `queue-cap-old` with attempts 0. Each surviving source completed with attempts 0. Each runtime logged one recovered unavailable-instance event; generation advanced 2 to 3, health/status answered, and no uncaught exception or unhandled rejection occurred. Old/new produced exactly RUNNER+B and RUNNER+A respectively, with the discarded source terminal at attempts 0 and no retry/resend notice. Combined command wall times: 114.03s Node, 69.73s Bun.
- Both runtimes passed real Gateway non-durable overflow and refused `/followup`: each refusal produced exactly one neutral queue-full terminal outcome, while RUNNER and queued A each received a real model answer. Command wall times: 58.48s Node, 22.59s Bun. All eight scenarios passed; no input was lost, duplicated or left unanswered. All 22 retained runtime/launcher logs were scanned without an uncaught exception or unhandled rejection.

`pnpm build` passed in 279.90s. The focused consumer set passed 895 tests across 37 files with one PostgreSQL-only capability skip in 508.51s. It covers queue/summary, ingress monitor/drain/claim ownership, channel wrappers, SDK fan-in/debounce, plugin replacement, Gateway outcomes, and prompt-prefix stability. All eight scoped production/test typechecks now pass; the first run caught a test-only lifecycle narrowing error. Scoped production/test/script lint and formatting pass after removing an unused import left by main integration. The corrected two-file Node rerun passed all 105 tests in 61.11s.

The build, live runs and full consumer set preceded the final test-only type/import correction; production bytes are unchanged. No production wrapper or eager dedupe commit was added. All ten final-head baseline ratchets pass (53.79s), including assertion safety, line caps, timeout races, mock exports, test lines, database boundaries, configuration docs and plugin inventory.

Current candidate: `7ddd944b651faf57bd935977235a69715768cb7c`. ClawSweeper completed its exact-head review at 2026-11-05 20:15 UTC with no findings, no security findings and no Before merge items. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/42100431795) passed on attempt 2 at 2026-11-05 21:24 UTC. Attempt 1 failed only the Bun restart/resume test with `AgentDatabaseAdmissionError` during startup. The affected owner code is identical to main; ten full-file local runs passed on main and this head, and the separate restart/resume admission lane owns that race. Only the failed shard was rerun once. The maintainer lead accepted this evidence and authorized landing; the previously reported CI blocker is resolved.

Local Codex branch autoreview from `54ed2bcc74b746085ddebe28ee59d268cd302fb6` to `7ddd944b651faf57bd935977235a69715768cb7c` through P2 is scoped-clean, with no accepted/actionable findings. The reviewer assessed source; runtime proof is reported separately.

The earlier main comparison reproduced old/new discarded rows remaining claimed rather than reaching a terminal policy outcome, despite a real RUNNER answer; the candidate passed those invariants. That baseline reproduction is retained prior-lane evidence, not a new run here.

Rename-aware delta against merged main `54ed2bcc74b746085ddebe28ee59d268cd302fb6`: production/scripts +527/-185 (net +342); tests/support +1362/-1196 (net +166); docs +40/-3 (net +37). This continuation adds 0 production lines and a net 108 test lines (109 composition lines minus one unused import). Production growth carries terminal outcomes through existing wrappers and separates bounded retention classes. A dedicated 166-line test allocation covers the 58 existing net regression lines after main integration plus this continuation’s net 108 test lines; the shared baseline is unchanged. The composition uses existing fixtures and no real timers or extra Gateway boot.

Co-authored-by: Emeric Dandelion Cult <[email protected]>
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Superseded by #193313, now merged as 9435188, fixing #182246. The continuation preserves the original contributor commits in its ancestry and credits @emeric-dandelion-cult with a Co-authored-by trailer in the landed commit. Thanks for the original repair and regression coverage.

@steipete steipete closed this Nov 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
Closes openclaw#182246. Maintainer continuation of openclaw#182252, preserving the contributor commits. Thanks @emeric-dandelion-cult for the original repair.

## What Problem This Solves

Messages intentionally discarded by the session queue's `old`/`new` cap policies could re-enter durable ingress, replay, and delay surviving messages.

## User Impact

Policy-discarded messages receive a terminal queue-policy outcome without retry-failure notices or resend invitations. Surviving messages retain FIFO ordering. Protected-only capacity rejection remains retryable; surfaces without durable ingress keep visible queue-full feedback, and a refused `/followup` reports that it was not queued.

Policy drops do not count as dead letters in health or Doctor. Retention bounds their replay guards separately from actual failures under the existing TTL. No config option, schema migration, dependency, or manual action is added. Old dropped content can still appear in Discord's independently recovered room history; it does not execute as a separate turn.

## Why This Change Was Made

The existing queue, source-custody, and ingress owners carry a distinct dropped outcome through debounce and channel wrappers. The ingress monitor forwards it through its existing settlement wrapper. Failure reporting and bounded pruning remain with their existing owners. Feishu settles dropped session lanes independently, and summary eviction unbinds a source before awaiting its receipt.

Reload and claim ownership come from merged main, including openclaw#193564. The monitor change only forwards `onDropped` through `settleLifecycle`; this PR adds no competing custody or fence mechanism. SDK docs describe forwarding and cleanup. Wrappers without durable terminal-drop custody retain their existing abandonment fallback.

Redelivery while a drop callback's receipt is still pending receives the existing bounded pending refusal; this is accepted, and no eager commit or `onDropped` wrapper is added.

## Evidence

Three dispatch/real-ingress/real-followup composition regressions cover old eviction, new rejection, and summarized eviction. Each verifies a terminal row with attempts 0 and its policy reason, then settled-source same-ID redelivery returns `skipped:duplicate`, makes no second resolver call, and sends no final reply. All three already passed on the merged head before this continuation; they protect composition with openclaw#193564 rather than establish a newly fixed post-settlement leak.

Real local-model proof used an isolated Gateway through `pnpm openclaw`, synthetic Discord transport, real shared Ollama `qwen2.5:7b`, and the real queue, ingress ledger, model request and delivery path. These are macOS arm64 results, not live Discord-service or Linux/Windows proof.

- Node 26.12.1 and pinned Bun 1.4.4 each passed reload plus old/new policy survival. Reload produced exactly RUNNER/B/C/D requests and replies in order; A ended `queue-cap-old` with attempts 0. Each surviving source completed with attempts 0. Each runtime logged one recovered unavailable-instance event; generation advanced 2 to 3, health/status answered, and no uncaught exception or unhandled rejection occurred. Old/new produced exactly RUNNER+B and RUNNER+A respectively, with the discarded source terminal at attempts 0 and no retry/resend notice. Combined command wall times: 114.03s Node, 69.73s Bun.
- Both runtimes passed real Gateway non-durable overflow and refused `/followup`: each refusal produced exactly one neutral queue-full terminal outcome, while RUNNER and queued A each received a real model answer. Command wall times: 58.48s Node, 22.59s Bun. All eight scenarios passed; no input was lost, duplicated or left unanswered. All 22 retained runtime/launcher logs were scanned without an uncaught exception or unhandled rejection.

`pnpm build` passed in 279.90s. The focused consumer set passed 895 tests across 37 files with one PostgreSQL-only capability skip in 508.51s. It covers queue/summary, ingress monitor/drain/claim ownership, channel wrappers, SDK fan-in/debounce, plugin replacement, Gateway outcomes, and prompt-prefix stability. All eight scoped production/test typechecks now pass; the first run caught a test-only lifecycle narrowing error. Scoped production/test/script lint and formatting pass after removing an unused import left by main integration. The corrected two-file Node rerun passed all 105 tests in 61.11s.

The build, live runs and full consumer set preceded the final test-only type/import correction; production bytes are unchanged. No production wrapper or eager dedupe commit was added. All ten final-head baseline ratchets pass (53.79s), including assertion safety, line caps, timeout races, mock exports, test lines, database boundaries, configuration docs and plugin inventory.

Current candidate: `7ddd944b651faf57bd935977235a69715768cb7c`. ClawSweeper completed its exact-head review at 2026-11-05 20:15 UTC with no findings, no security findings and no Before merge items. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/42100431795) passed on attempt 2 at 2026-11-05 21:24 UTC. Attempt 1 failed only the Bun restart/resume test with `AgentDatabaseAdmissionError` during startup. The affected owner code is identical to main; ten full-file local runs passed on main and this head, and the separate restart/resume admission lane owns that race. Only the failed shard was rerun once. The maintainer lead accepted this evidence and authorized landing; the previously reported CI blocker is resolved.

Local Codex branch autoreview from `bd8cac762efe00978ab5174974ff0f7bc146db2e` to `7ddd944b651faf57bd935977235a69715768cb7c` through P2 is scoped-clean, with no accepted/actionable findings. The reviewer assessed source; runtime proof is reported separately.

The earlier main comparison reproduced old/new discarded rows remaining claimed rather than reaching a terminal policy outcome, despite a real RUNNER answer; the candidate passed those invariants. That baseline reproduction is retained prior-lane evidence, not a new run here.

Rename-aware delta against merged main `bd8cac762efe00978ab5174974ff0f7bc146db2e`: production/scripts +527/-185 (net +342); tests/support +1362/-1196 (net +166); docs +40/-3 (net +37). This continuation adds 0 production lines and a net 108 test lines (109 composition lines minus one unused import). Production growth carries terminal outcomes through existing wrappers and separates bounded retention classes. A dedicated 166-line test allocation covers the 58 existing net regression lines after main integration plus this continuation’s net 108 test lines; the shared baseline is unchanged. The composition uses existing fixtures and no real timers or extra Gateway boot.

Co-authored-by: Emeric Dandelion Cult <[email protected]>
wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 6, 2026
Closes openclaw#182246. Maintainer continuation of openclaw#182252, preserving the contributor commits. Thanks @emeric-dandelion-cult for the original repair.

## What Problem This Solves

Messages intentionally discarded by the session queue's `old`/`new` cap policies could re-enter durable ingress, replay, and delay surviving messages.

## User Impact

Policy-discarded messages receive a terminal queue-policy outcome without retry-failure notices or resend invitations. Surviving messages retain FIFO ordering. Protected-only capacity rejection remains retryable; surfaces without durable ingress keep visible queue-full feedback, and a refused `/followup` reports that it was not queued.

Policy drops do not count as dead letters in health or Doctor. Retention bounds their replay guards separately from actual failures under the existing TTL. No config option, schema migration, dependency, or manual action is added. Old dropped content can still appear in Discord's independently recovered room history; it does not execute as a separate turn.

## Why This Change Was Made

The existing queue, source-custody, and ingress owners carry a distinct dropped outcome through debounce and channel wrappers. The ingress monitor forwards it through its existing settlement wrapper. Failure reporting and bounded pruning remain with their existing owners. Feishu settles dropped session lanes independently, and summary eviction unbinds a source before awaiting its receipt.

Reload and claim ownership come from merged main, including openclaw#193564. The monitor change only forwards `onDropped` through `settleLifecycle`; this PR adds no competing custody or fence mechanism. SDK docs describe forwarding and cleanup. Wrappers without durable terminal-drop custody retain their existing abandonment fallback.

Redelivery while a drop callback's receipt is still pending receives the existing bounded pending refusal; this is accepted, and no eager commit or `onDropped` wrapper is added.

## Evidence

Three dispatch/real-ingress/real-followup composition regressions cover old eviction, new rejection, and summarized eviction. Each verifies a terminal row with attempts 0 and its policy reason, then settled-source same-ID redelivery returns `skipped:duplicate`, makes no second resolver call, and sends no final reply. All three already passed on the merged head before this continuation; they protect composition with openclaw#193564 rather than establish a newly fixed post-settlement leak.

Real local-model proof used an isolated Gateway through `pnpm openclaw`, synthetic Discord transport, real shared Ollama `qwen2.5:7b`, and the real queue, ingress ledger, model request and delivery path. These are macOS arm64 results, not live Discord-service or Linux/Windows proof.

- Node 26.12.1 and pinned Bun 1.4.4 each passed reload plus old/new policy survival. Reload produced exactly RUNNER/B/C/D requests and replies in order; A ended `queue-cap-old` with attempts 0. Each surviving source completed with attempts 0. Each runtime logged one recovered unavailable-instance event; generation advanced 2 to 3, health/status answered, and no uncaught exception or unhandled rejection occurred. Old/new produced exactly RUNNER+B and RUNNER+A respectively, with the discarded source terminal at attempts 0 and no retry/resend notice. Combined command wall times: 114.03s Node, 69.73s Bun.
- Both runtimes passed real Gateway non-durable overflow and refused `/followup`: each refusal produced exactly one neutral queue-full terminal outcome, while RUNNER and queued A each received a real model answer. Command wall times: 58.48s Node, 22.59s Bun. All eight scenarios passed; no input was lost, duplicated or left unanswered. All 22 retained runtime/launcher logs were scanned without an uncaught exception or unhandled rejection.

`pnpm build` passed in 279.90s. The focused consumer set passed 895 tests across 37 files with one PostgreSQL-only capability skip in 508.51s. It covers queue/summary, ingress monitor/drain/claim ownership, channel wrappers, SDK fan-in/debounce, plugin replacement, Gateway outcomes, and prompt-prefix stability. All eight scoped production/test typechecks now pass; the first run caught a test-only lifecycle narrowing error. Scoped production/test/script lint and formatting pass after removing an unused import left by main integration. The corrected two-file Node rerun passed all 105 tests in 61.11s.

The build, live runs and full consumer set preceded the final test-only type/import correction; production bytes are unchanged. No production wrapper or eager dedupe commit was added. All ten final-head baseline ratchets pass (53.79s), including assertion safety, line caps, timeout races, mock exports, test lines, database boundaries, configuration docs and plugin inventory.

Current candidate: `7ddd944b651faf57bd935977235a69715768cb7c`. ClawSweeper completed its exact-head review at 2026-11-05 20:15 UTC with no findings, no security findings and no Before merge items. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/42100431795) passed on attempt 2 at 2026-11-05 21:24 UTC. Attempt 1 failed only the Bun restart/resume test with `AgentDatabaseAdmissionError` during startup. The affected owner code is identical to main; ten full-file local runs passed on main and this head, and the separate restart/resume admission lane owns that race. Only the failed shard was rerun once. The maintainer lead accepted this evidence and authorized landing; the previously reported CI blocker is resolved.

Local Codex branch autoreview from `54ed2bcc74b746085ddebe28ee59d268cd302fb6` to `7ddd944b651faf57bd935977235a69715768cb7c` through P2 is scoped-clean, with no accepted/actionable findings. The reviewer assessed source; runtime proof is reported separately.

The earlier main comparison reproduced old/new discarded rows remaining claimed rather than reaching a terminal policy outcome, despite a real RUNNER answer; the candidate passed those invariants. That baseline reproduction is retained prior-lane evidence, not a new run here.

Rename-aware delta against merged main `54ed2bcc74b746085ddebe28ee59d268cd302fb6`: production/scripts +527/-185 (net +342); tests/support +1362/-1196 (net +166); docs +40/-3 (net +37). This continuation adds 0 production lines and a net 108 test lines (109 composition lines minus one unused import). Production growth carries terminal outcomes through existing wrappers and separates bounded retention classes. A dedicated 166-line test allocation covers the 58 existing net regression lines after main integration plus this continuation’s net 108 test lines; the shared baseline is unchanged. The composition uses existing fixtures and no real timers or extra Gateway boot.

Co-authored-by: Emeric Dandelion Cult <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu channel: slack Channel integration: slack channel: telegram Channel integration: telegram merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Queue cap drops replay durable ingress until retries exhaust

2 participants