Skip to content

fix(channels): keep a queued message alive through a long turn instead of dead-lettering it - #127950

Merged
obviyus merged 1 commit into
openclaw:mainfrom
edenfunf:fix/ingress-deferred-liveness
Aug 28, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
edenfunf:fix/ingress-deferred-liveness

Conversation

@edenfunf

@edenfunf edenfunf commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #97435.

What Problem This Solves

A message that arrives while its session is busy can be retried and lost when the running turn lasts longer than the five-minute ingress watchdog.

Root Cause

The follow-up queue rechecks active-turn admission every 15 seconds, but it did not report those successful rechecks to the durable ingress claim. The ingress owner therefore treated a healthy queued wait as a silent handler when the five-minute watchdog expired.

Fix

The follow-up admission owner now reports a liveness heartbeat after each fresh active-run result. The existing ingress watchdog rearms only while the claim remains deferred. Silent handlers still reach the same timeout and retry path.

Lifecycle wrappers that own or combine durable claims forward the heartbeat through the shared core and Plugin SDK boundaries. The earlier separate watchdog module and deferred-log state are no longer needed.

User Impact

A second message sent during a long-running turn stays durable and runs after the first turn ends. Operators do not need a new setting or migration.

Evidence

Real Telegram red and green

A real Telegram Test Server user sent message 1, then sent message 2 five seconds later. The mock provider held message 1 for 315 seconds, past the default 300-second watchdog.

  • Current main f7a9a361d99176628faac626be54bace2ed05380: message 2 hit handler-timeout at 300 seconds. Only message 1 reached the model and replied.
  • Repaired head 06c16bf08ed4045e71580035a84486ed3cdb0ebf: no watchdog timeout occurred. Both messages reached the model, and Telegram delivered the two replies at 316.7 and 317.7 seconds.

Regression and repository checks

  • The admission regression failed before the fix with zero heartbeats and passed after the fix with two.
  • The ingress regression failed before the fix because the live deferred claim disappeared at the original deadline. It passed after the fix and still proved that silence eventually times out.
  • Focused admission, ingress-watchdog, and Feishu broadcast suites passed.
  • Build, formatting, four type-check lanes, changed-file lint, Plugin SDK surface checks, architecture guards, schema guards, and import-cycle checks passed.

Production code is +35 net lines. Tests are +25 net lines. The production growth is the new liveness capability and the relays required to preserve it across existing ownership boundaries.

@clawsweeper

clawsweeper Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 22, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 22, 2026
@clawsweeper

clawsweeper Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 3:37 AM ET / 07:37 UTC.

ClawSweeper review

What this changes

The PR lets queued follow-up turns report deferred liveness so durable channel-ingress claims survive long active turns instead of timing out, retrying, or being dead-lettered.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for normal merge review: the prior Feishu broadcast finding is fixed, and the core heartbeat design repairs the shared ingress owner rather than masking the timeout downstream.

Priority: P1
Reviewed head: 51112effbfd5fe1722ec7d15327bb561376b71f1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The root-cause repair and visible proof are strong; exact-head CI still needs to validate the final Feishu relay commit.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
Evidence reviewed 7 items Current-main failure path: Current main returns a deferred result for an active-run admission without notifying the durable owner, while its ingress drain keeps the pre-adoption watchdog armed for deferred claims; this establishes the timeout mechanism the PR addresses.
Producer-to-owner repair: The branch emits liveness only after a fresh active-run admission check, and the drain re-arms its watchdog only while the claim is still deferred and not guillotined or superseded.
Prior finding resolved: Feishu broadcast lanes now forward the heartbeat to the transport lifecycle, and the updated test exercises that forward; this addresses the latest completed ClawSweeper finding.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/channels/message/ingress-drain.watchdog.test.ts src/auto-reply/reply/followup-turn-admission.test.ts

Result: PASS (completed)

$ node --import tsx scripts/test-projects.mts src/channels/message/ingress-drain.watchdog.test.ts src/auto-reply/reply/followup-turn-admission.test.ts
[test] starting test/vitest/vitest.auto-reply.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-127950-yACOxt/target

 ✓  auto-reply  src/auto-reply/reply/followup-turn-admission.test.ts (38 tests) 61ms

 Test Files  1 passed (1)
      Tests  38 passed (38)
   Start at  07:38:47
   Duration  10.91s (transform 8.48s, setup 1.04s, import 9.44s, tests 61ms, environment 0ms)

[test] starting test/vitest/vitest.channels.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-127950-yACOxt/target

 ✓  channels  src/channels/message/ingress-drain.watchdog.test.ts (4 tests) 752ms
     ✓ retries pre-adoption stalls in lane order and fences late adoption  357ms

 Test Files  1 passed (1)
      Tests  4 passed (4)
   Start at  07:38:59
   Duration  2.90s (transform 1.63s, setup 1.01s, import 774ms, tests 752ms, environment 0ms)

[test] passed 2 Vitest shards in 20.74s
$ node --import tsx scripts/test-projects.mts src/channels/message/ingress-drain.watchdog.test.ts src/auto-reply/reply/followup-turn-admission.test.ts
[test] starting test/vitest/vitest.auto-reply.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-127950-yACOxt/target

 ✓  auto-reply  src/auto-reply/reply/followup-turn-admission.test.ts (38 tests) 53ms

 Test Files  1 passed (1)
      Tests  38 passed (38)
   Start at  07:39:10
   Duration  5.04s (transform 2.75s, setup 443ms, import 4.31s, tests 53ms, environment 0ms)

[test] starting test/vitest/vitest.channels.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-127950-yACOxt/target

 ✓  channels  src/channels/message/ingress-drain.watchdog.test.ts (4 tests) 739ms
     ✓ retries pre-adoption stalls in lane order and fences late adoption  322ms

 Test Files  1 passed (1)
      Tests  4 passed (4)
   Start at  07:39:15
   Duration  1.83s (transform 518ms, setup 446ms, import 415ms, tests 739ms, environment 0ms)

[test] passed 2 Vitest shards in 13.73s

Assertions:

  • NOT OBSERVED expect_output: keeps a queued message through a long turn instead of dead-lettering it — command exited successfully; expected output was not observed in the captured pane

How this fits together

Channel ingress durably claims inbound events before the reply system admits an agent turn. When a session is busy, the follow-up queue now reports that it still owns the event so the ingress watchdog preserves the claim until the turn can run.

flowchart LR
  A[Inbound channel event] --> B[Durable ingress claim]
  B --> C[Queued follow-up turn]
  C --> D{Active turn still owns session?}
  D -->|yes| E[Deferred liveness heartbeat]
  E --> F[Ingress stall watchdog]
  F --> B
  D -->|no| G[Adopted agent turn]
  G --> H[Channel reply]
Loading

Before merge

  • Resolve merge risk (P1) - The patch adds about 133 net production lines for a bug fix; the added watchdog/lifecycle boundary is justified by the new liveness capability, but avoidable scaffolding should not grow further.
  • Resolve merge risk (P1) - The latest Feishu forwarding commit postdates the supplied Telegram proof candidate, so exact-head focused checks must complete before merge.
  • Resolve merge risk (P1) - Historical ownership evidence is limited because the local partial clone could not retrieve missing Git objects while GitHub DNS was unavailable.
  • Complete next step (P2) - No discrete repair remains after the Feishu fix; this PR needs ordinary exact-head validation and maintainer merge review.
Agent review details

Security

None.

PR surface

Source +135, Tests +113. Total +248 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 19 189 54 +135
Tests 3 115 2 +113
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 304 56 +248

Review metrics

Metric Value Why it matters
Production versus test LOC production +187/-54 (net +133); tests and test support +117/-2 (net +115) The bug fix adds a shared lifecycle capability and relay forwarding across channels; the test growth covers its core watchdog, admission, and Feishu fan-out paths.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #97435
Summary: This PR is the candidate repair for the current durable-ingress mechanism that can produce the linked issue's delayed or absent inbound replies.

Members:

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

Merge-risk options

Maintainer options:

  1. Verify the final head before merge (recommended)
    Require the queued exact-head channel checks and the focused Feishu broadcast coverage to pass after the final lifecycle-forwarding commit.

Technical review

Best possible solution:

Keep one optional, producer-originated liveness callback through every durable lifecycle relay, retain the five-minute guillotine for silent handlers, and merge only after exact-head focused checks confirm the final adapter repair.

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

Yes. Current-main source leaves a deferred active-run claim under the armed watchdog, and the inspected baseline/candidate Telegram proof demonstrates the resulting loss-versus-recovery behavior.

Is this the best way to solve the issue?

Yes. Reporting liveness from the follow-up admission recheck lets the ingress owner distinguish healthy queueing from a silent handler without weakening the watchdog timeout.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 72912b159fc1.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 🎥 video: Current real behavior proof evidence kind is screenshot.

Label justifications:

  • P1: The shared durable-ingress path can silently lose or substantially delay channel messages during a long active turn.
  • merge-risk: 🚨 compatibility: The optional lifecycle callback crosses core, plugin SDK, and bundled channel relay boundaries.
  • merge-risk: 🚨 message-delivery: A missed relay could still let an otherwise healthy queued inbound message time out and retry or dead-letter.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected Telegram Desktop before/after screenshots show the queued second message missing after the long baseline turn and appearing after the candidate turn; the PR also supplies a real LINE run description.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The change determines whether a queued Telegram message later receives a visible reply after a long active turn.

Evidence

What I checked:

  • Current-main failure path: Current main returns a deferred result for an active-run admission without notifying the durable owner, while its ingress drain keeps the pre-adoption watchdog armed for deferred claims; this establishes the timeout mechanism the PR addresses. (src/auto-reply/reply/followup-turn-admission.ts:154, 72912b159fc1)
  • Producer-to-owner repair: The branch emits liveness only after a fresh active-run admission check, and the drain re-arms its watchdog only while the claim is still deferred and not guillotined or superseded. (src/auto-reply/reply/followup-turn-admission.ts:154, 51112effbfd5)
  • Prior finding resolved: Feishu broadcast lanes now forward the heartbeat to the transport lifecycle, and the updated test exercises that forward; this addresses the latest completed ClawSweeper finding. (extensions/feishu/src/bot-broadcast.ts:185, 51112effbfd5)
  • Sibling relay coverage: The monitor wrapper and Slack relay preserve the callback via lifecycle spreading, while the SDK fan-in explicitly forwards it to every source lifecycle. (src/plugin-sdk/channel-ingress-runtime.ts:183, 51112effbfd5)
  • Regression coverage: The watchdog test maintains a deferred claim for a simulated 40-minute turn with recurring heartbeats, logs the wait, then adopts the claim; the admission test limits heartbeats to active-run deferrals. (src/channels/message/ingress-drain.watchdog.test.ts:146, 51112effbfd5)
  • Real behavior proof inspected: The supplied Telegram Desktop baseline image shows the later two-message scenario ending after the first long-turn completion without the second-survived reply; the candidate image shows the second-survived reply after the first completion. (e8a0a357d334)

Likely related people:

  • edenfunf: Authored all four commits on this branch, including the Feishu broadcast forwarding repair at the current head; older current-main ownership could not be reconstructed from the partial checkout. (role: current lifecycle change author; confidence: medium; commits: 67719d4fd4c0, 237d72ed249b, 140c26f00e01; files: src/channels/message/ingress-drain.ts, src/auto-reply/reply/followup-turn-admission.ts, extensions/feishu/src/bot-broadcast.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for exact-head focused checks to complete green on the current commit.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-22T14:20:59.714Z sha 2b01c7592aff6eef16fd7ea3e6bd16a239958ebb :: needs changes before merge. :: [P1] Forward heartbeats through every durable replay adapter | [P1] Keep existing lifecycle implementers compatible
  • reviewed 2026-08-22T15:06:08.322Z sha 2b01c7592aff6eef16fd7ea3e6bd16a239958ebb :: needs changes before merge. :: [P1] Forward heartbeats through every durable replay adapter | [P1] Keep the exported monitor lifecycle source-compatible
  • reviewed 2026-08-22T15:24:21.272Z sha 2b01c7592aff6eef16fd7ea3e6bd16a239958ebb :: needs changes before merge. :: [P1] Forward heartbeats through every durable replay adapter | [P1] Keep the exported monitor lifecycle source-compatible | [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-22T15:58:54.711Z sha aedbe2027198c7fc533f1af0b6c90d72bff99720 :: needs changes before merge. :: [P1] Forward deferred heartbeats through every durable adapter
  • reviewed 2026-08-22T16:53:16.423Z sha 9ee25291ba6a654d08be7208d0c43716258c6a5d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T17:10:48.835Z sha 9ee25291ba6a654d08be7208d0c43716258c6a5d :: needs changes before merge. :: [P1] Forward deferred heartbeats through Feishu broadcast lanes
  • reviewed 2026-08-24T19:59:26.890Z sha 9ee25291ba6a654d08be7208d0c43716258c6a5d :: needs changes before merge. :: [P1] Forward deferred heartbeats through Feishu broadcast lanes
  • reviewed 2026-08-24T20:41:31.852Z sha 9ee25291ba6a654d08be7208d0c43716258c6a5d :: needs changes before merge. :: [P1] Forward heartbeats through Feishu broadcast lanes

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 22, 2026
@edenfunf
edenfunf marked this pull request as draft August 22, 2026 14:57
@edenfunf
edenfunf marked this pull request as ready for review August 22, 2026 15:17
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Aug 22, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 22, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 22, 2026
@edenfunf
edenfunf force-pushed the fix/ingress-deferred-liveness branch from aedbe20 to 9ee2529 Compare August 22, 2026 16:47
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch channel: sms Channel integration: sms labels Aug 22, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 22, 2026
@obviyus
obviyus force-pushed the fix/ingress-deferred-liveness branch from 51112ef to 06c16bf Compare August 28, 2026 10:01
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed channel: sms Channel integration: sms size: M labels Aug 28, 2026
@obviyus

obviyus commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks @edenfunf!

Proof: On Telegram Test Server, a second direct message sent five seconds into a 315-second turn timed out on current main at 300 seconds and received no reply. This exact head kept it queued and delivered both replies at 316.7 and 317.7 seconds. Exact-head CI and local ClawSweeper review are green.

  • Bug: A healthy message queued behind a long turn looked stalled and could be retried and lost.
  • Fix: The follow-up queue now reports liveness so the ingress owner rearms its watchdog while the message is still waiting.

Example

Before After
Message 2 times out while waiting and gets no reply. Message 2 stays queued and replies after message 1 finishes.

@obviyus
obviyus enabled auto-merge (squash) August 28, 2026 10:16
@obviyus
obviyus merged commit 2f3cd08 into openclaw:main Aug 28, 2026
271 checks passed
steipete added a commit that referenced this pull request Aug 28, 2026
…131742)

Recently landed #127849 and #127950 grew ingress-drain.ts past the
max-lines cap between each other's CI runs, so every merge ref now fails
check-lint-core-4. Move the bounded claim-write retries and the
complete/release/dead-letter wrappers into ingress-claim-writes.ts —
byte-identical functions, unchanged public surface and behavior — taking
the file from 703 to 625 counted lines with headroom, no suppression.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…w#127950)

Keep deferred ingress claims alive while the follow-up queue waits behind an active turn. Preserve the existing watchdog for silent handlers.

Co-authored-by: 許元豪 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…penclaw#131742)

Recently landed openclaw#127849 and openclaw#127950 grew ingress-drain.ts past the
max-lines cap between each other's CI runs, so every merge ref now fails
check-lint-core-4. Move the bounded claim-write retries and the
complete/release/dead-letter wrappers into ingress-claim-writes.ts —
byte-identical functions, unchanged public surface and behavior — taking
the file from 703 to 625 counted lines with headroom, no suppression.
obviyus added a commit that referenced this pull request Sep 14, 2026
…133248)

## Contributor description — original implementation

The contributor’s original description follows. Historical heads, scope and open decisions in this section refer to that implementation; the reviewed current implementation, compatibility decision and proof are recorded in the maintainer update below.

Closes #133245.

Related: #127950. This supersedes the current-main-incompatible queue-owned approach in #125385 while preserving today's canonical timeout retry disposition.

## What Problem This Solves

A durably claimed channel message can wait behind another follow-up turn for longer than the five-minute claim-to-adoption watchdog. Existing liveness renewal covers queue-head active-run admission checks, but not an ingress-backed lifecycle waiting deeper in the follow-up queue. The claim can therefore be retired before the message reaches the model.

## Why This Change Was Made

The follow-up queue now owns periodic deferred heartbeats for the exact ingress lifecycle while it remains in pending items, in-flight delivery, summary sources, or compacted summary elisions.

Ingress supplies a cadence derived from one third of its adoption-stall timeout. Debounce, Plugin SDK fan-in, and channel lifecycle wrappers preserve the shortest applicable cadence. Queue ownership triggers an immediate renewal, then periodic renewal; it stops after successful adoption, completion, ownership loss, or callback failure. A rejected adoption callback keeps renewal alive for the supported retry path.

The existing watchdog and canonical timeout retry policy remain unchanged, so silent handlers and orphaned claims still recover normally.

## User Impact

Messages accepted by durable channel ingress remain adoptable while they wait behind long-running work instead of silently disappearing before model execution. No setting or migration is required.

## Evidence

SDK documentation polish (2026-09-10, head `76097fef9397a04c10637e06dfaf64ebb6ca104a`): the public channel SDK guide now documents forwarding both heartbeat fields, the shortest-positive-finite fan-in cadence, renewal termination, and compatibility when older wrappers omit the optional cadence. The documentation-only addition passed changed-page formatting, MDX sanity, and `git diff --check`; production code and the previously tested runtime head below are unchanged. Current-head hosted CI has completed successfully; the final exact-head ClawSweeper review accepts the implementation and proof, leaving only SDK-owner acceptance of the documented contract.

Refreshed on 2026-09-08 for exact head `57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61`, rebased onto `1ff45cad5ae`.

- Preserved upstream's ingress-monitor type extraction and gateway-suspension repair; the optional cadence field follows its new type owner.
- Repaired the retry integration fixture: after real enqueue and initial renewal, only the abandoned message's heartbeat callback fails. The real watchdog then recovers it. Retry delivery, healthy sibling cleanup, and true duplicate assertions remain intact; no production behavior or timeout changed for this repair.
- 102 focused tests pass: dispatch ingress retry, queue in-flight/dedupe, ingress lifecycle/watchdog, Plugin SDK fan-in, Discord queue handling, and Slack handler.
- Changed-file gates pass: core/core-test/extension typechecks, formatting, changed core/extension lint, SDK boundaries/exports, dead-export scans, and repository guards.
- Fresh independent source review found no actionable P0–P2 defects. The standalone autoreview CLI failed at startup without a verdict and is not counted as review coverage.
- Current-head CI run [34520397963](https://github.com/openclaw/openclaw/actions/runs/34520397963) completed successfully. The earlier startup subprocess timeout is historical, not a current failing gate. Exact-head ClawSweeper review (September 10, 20:00 UTC) reports no actionable correctness or proof findings; explicit SDK-owner acceptance remains required before merge.
- Existing regressions cover immediate renewal after late handoff, periodic deeper-queue renewal, stopping after owner loss, and continuing across a rejected adoption callback.

Exact-head durable-ingress boundary proof used isolated SQLite with the production ingress drain/lifecycle binder, follow-up queue, and canonical adoption helper. The model callback was synthetic; this is not live Telegram or Discord transport proof. No production Gateway, channel state, or configuration was touched. Temporary state and queue ownership were cleaned up.

```json
{
  "schema": "openclaw.pr133248.durable-ingress-proof.v1",
  "exactHead": "57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61",
  "setup": {
    "durableStore": "isolated OpenClaw SQLite state",
    "executor": "production follow-up queue with synthetic model callback",
    "transportLifecycle": "production ingress drain lifecycle",
    "adoptionStallTimeoutMs": 180
  },
  "queuedBehindLongTurn": {
    "heldMs": 620,
    "formerDeadlineCrossed": true,
    "heartbeatCount": 11,
    "claimStillOwnedAtCheckpoint": [
      "queued-event"
    ],
    "retryRowsAtCheckpoint": 0,
    "failedRowsAtCheckpoint": 0,
    "executionCount": 1,
    "duplicateAfterAdoption": "completed"
  },
  "orphanRecovery": {
    "status": "released-for-retry",
    "attempts": 1,
    "lastErrorContainsHandlerTimeout": true
  },
  "productionTouched": false
}
```

Owner acceptance:
- Intended behavior: accepted messages remain adoptable while their exact lifecycle is owned by the queue; ownerless claims retain canonical timeout recovery.
- Boundary: one optional cadence field propagated through existing shared lifecycle and channel wrappers; no configuration, schema, or migration change.
- Maintainer decision remains open: accept the additive public Plugin SDK lifecycle field and its queue-owned cadence semantics. Bot review is not that acceptance.
- Rollback: revert the renewal fix and its companion retry-fixture adjustment.
- Scope: 23 files, +273/-2. The width is required lifecycle forwarding; renewal policy stays in the queue and ingress drain.

AI-assisted.

---

## Maintainer update — reviewed head `9325ad501aa4`

## What Problem This Solves

Messages accepted while a long reply is running can expire in the follow-up queue and consume a retry. The reproduction confirmed expiry and retry; all three messages eventually arrived. It did not reproduce the older permanent-loss report in #133245.

## Fix and impact

The queue starts one heartbeat when it accepts a lifecycle and stops it on adoption, completion, cancellation, or callback failure. Heartbeats no longer scan queue collections or copy the in-flight set. Ingress remains responsible for the watchdog and retry settlement, and a heartbeat cannot undo the watchdog pause during adoption finalization.

Ingress derives the cadence from its adoption timeout. The optional lifecycle metadata remains necessary because wrappers rebuild callbacks and combine abort signals, losing the original timeout. No channel setting, schema, migration, dependency, or protocol change is added.

The simplification removes 110 lines net from the initial implementation plus main merge. Total production growth is 40 lines. Existing lifecycle types are reused, and the queue cases share the existing lifecycle test fixtures.

## Evidence

- Real Gateway and Discord: three marked messages on one route, with a queued reply held for 330 seconds. Main expired the third claim after 300.004 seconds. This head retained the same claim at 322.257 seconds with zero attempts; replies arrived once, in order, at 17.804, 349.201, and 350.223 seconds.
- Real SQLite/drain/binder/queue controls: explicit abandonment releases the claim; callback failure stops renewal and lets the watchdog retry without model execution.
- 191 core owner/sibling tests and 190 channel tests passed. All five new regression cases failed on plain main for the intended reasons.
- The local preflight passed core/extension type-aware lint, production and test types, script types, and protocol checks in an isolated checkout of this head.
- External consumers compiled and ran against published 2026.9.4 and this head, including omitted metadata, forwarding, optional return fields, and asynchronous abandonment.

## Consumers

Shared ingress binding, batching, reply dispatch, and the Feishu, Slack, Telegram, and Twitch wrappers preserve the source cadence. The fan-in uses the shortest valid cadence. Legacy wrappers that omit the optional field retain their existing head-only heartbeat behavior. Adoption, queue clearing, overflow, cancellation, summaries, and drain replacement retain or finish the same lifecycle owner.

Closes #133245.

Original implementation and report by @PollyBot13 (#133245). The contributor's commits and authorship are retained.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
…penclaw#133248)

## Contributor description — original implementation

The contributor’s original description follows. Historical heads, scope and open decisions in this section refer to that implementation; the reviewed current implementation, compatibility decision and proof are recorded in the maintainer update below.

Closes openclaw#133245.

Related: openclaw#127950. This supersedes the current-main-incompatible queue-owned approach in openclaw#125385 while preserving today's canonical timeout retry disposition.

## What Problem This Solves

A durably claimed channel message can wait behind another follow-up turn for longer than the five-minute claim-to-adoption watchdog. Existing liveness renewal covers queue-head active-run admission checks, but not an ingress-backed lifecycle waiting deeper in the follow-up queue. The claim can therefore be retired before the message reaches the model.

## Why This Change Was Made

The follow-up queue now owns periodic deferred heartbeats for the exact ingress lifecycle while it remains in pending items, in-flight delivery, summary sources, or compacted summary elisions.

Ingress supplies a cadence derived from one third of its adoption-stall timeout. Debounce, Plugin SDK fan-in, and channel lifecycle wrappers preserve the shortest applicable cadence. Queue ownership triggers an immediate renewal, then periodic renewal; it stops after successful adoption, completion, ownership loss, or callback failure. A rejected adoption callback keeps renewal alive for the supported retry path.

The existing watchdog and canonical timeout retry policy remain unchanged, so silent handlers and orphaned claims still recover normally.

## User Impact

Messages accepted by durable channel ingress remain adoptable while they wait behind long-running work instead of silently disappearing before model execution. No setting or migration is required.

## Evidence

SDK documentation polish (2026-09-10, head `76097fef9397a04c10637e06dfaf64ebb6ca104a`): the public channel SDK guide now documents forwarding both heartbeat fields, the shortest-positive-finite fan-in cadence, renewal termination, and compatibility when older wrappers omit the optional cadence. The documentation-only addition passed changed-page formatting, MDX sanity, and `git diff --check`; production code and the previously tested runtime head below are unchanged. Current-head hosted CI has completed successfully; the final exact-head ClawSweeper review accepts the implementation and proof, leaving only SDK-owner acceptance of the documented contract.

Refreshed on 2026-09-08 for exact head `57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61`, rebased onto `5d7a53b6aad`.

- Preserved upstream's ingress-monitor type extraction and gateway-suspension repair; the optional cadence field follows its new type owner.
- Repaired the retry integration fixture: after real enqueue and initial renewal, only the abandoned message's heartbeat callback fails. The real watchdog then recovers it. Retry delivery, healthy sibling cleanup, and true duplicate assertions remain intact; no production behavior or timeout changed for this repair.
- 102 focused tests pass: dispatch ingress retry, queue in-flight/dedupe, ingress lifecycle/watchdog, Plugin SDK fan-in, Discord queue handling, and Slack handler.
- Changed-file gates pass: core/core-test/extension typechecks, formatting, changed core/extension lint, SDK boundaries/exports, dead-export scans, and repository guards.
- Fresh independent source review found no actionable P0–P2 defects. The standalone autoreview CLI failed at startup without a verdict and is not counted as review coverage.
- Current-head CI run [34520397963](https://github.com/openclaw/openclaw/actions/runs/34520397963) completed successfully. The earlier startup subprocess timeout is historical, not a current failing gate. Exact-head ClawSweeper review (September 10, 20:00 UTC) reports no actionable correctness or proof findings; explicit SDK-owner acceptance remains required before merge.
- Existing regressions cover immediate renewal after late handoff, periodic deeper-queue renewal, stopping after owner loss, and continuing across a rejected adoption callback.

Exact-head durable-ingress boundary proof used isolated SQLite with the production ingress drain/lifecycle binder, follow-up queue, and canonical adoption helper. The model callback was synthetic; this is not live Telegram or Discord transport proof. No production Gateway, channel state, or configuration was touched. Temporary state and queue ownership were cleaned up.

```json
{
  "schema": "openclaw.pr133248.durable-ingress-proof.v1",
  "exactHead": "57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61",
  "setup": {
    "durableStore": "isolated OpenClaw SQLite state",
    "executor": "production follow-up queue with synthetic model callback",
    "transportLifecycle": "production ingress drain lifecycle",
    "adoptionStallTimeoutMs": 180
  },
  "queuedBehindLongTurn": {
    "heldMs": 620,
    "formerDeadlineCrossed": true,
    "heartbeatCount": 11,
    "claimStillOwnedAtCheckpoint": [
      "queued-event"
    ],
    "retryRowsAtCheckpoint": 0,
    "failedRowsAtCheckpoint": 0,
    "executionCount": 1,
    "duplicateAfterAdoption": "completed"
  },
  "orphanRecovery": {
    "status": "released-for-retry",
    "attempts": 1,
    "lastErrorContainsHandlerTimeout": true
  },
  "productionTouched": false
}
```

Owner acceptance:
- Intended behavior: accepted messages remain adoptable while their exact lifecycle is owned by the queue; ownerless claims retain canonical timeout recovery.
- Boundary: one optional cadence field propagated through existing shared lifecycle and channel wrappers; no configuration, schema, or migration change.
- Maintainer decision remains open: accept the additive public Plugin SDK lifecycle field and its queue-owned cadence semantics. Bot review is not that acceptance.
- Rollback: revert the renewal fix and its companion retry-fixture adjustment.
- Scope: 23 files, +273/-2. The width is required lifecycle forwarding; renewal policy stays in the queue and ingress drain.

AI-assisted.

---

## Maintainer update — reviewed head `9325ad501aa4`

## What Problem This Solves

Messages accepted while a long reply is running can expire in the follow-up queue and consume a retry. The reproduction confirmed expiry and retry; all three messages eventually arrived. It did not reproduce the older permanent-loss report in openclaw#133245.

## Fix and impact

The queue starts one heartbeat when it accepts a lifecycle and stops it on adoption, completion, cancellation, or callback failure. Heartbeats no longer scan queue collections or copy the in-flight set. Ingress remains responsible for the watchdog and retry settlement, and a heartbeat cannot undo the watchdog pause during adoption finalization.

Ingress derives the cadence from its adoption timeout. The optional lifecycle metadata remains necessary because wrappers rebuild callbacks and combine abort signals, losing the original timeout. No channel setting, schema, migration, dependency, or protocol change is added.

The simplification removes 110 lines net from the initial implementation plus main merge. Total production growth is 40 lines. Existing lifecycle types are reused, and the queue cases share the existing lifecycle test fixtures.

## Evidence

- Real Gateway and Discord: three marked messages on one route, with a queued reply held for 330 seconds. Main expired the third claim after 300.004 seconds. This head retained the same claim at 322.257 seconds with zero attempts; replies arrived once, in order, at 17.804, 349.201, and 350.223 seconds.
- Real SQLite/drain/binder/queue controls: explicit abandonment releases the claim; callback failure stops renewal and lets the watchdog retry without model execution.
- 191 core owner/sibling tests and 190 channel tests passed. All five new regression cases failed on plain main for the intended reasons.
- The local preflight passed core/extension type-aware lint, production and test types, script types, and protocol checks in an isolated checkout of this head.
- External consumers compiled and ran against published 2026.9.4 and this head, including omitted metadata, forwarding, optional return fields, and asynchronous abandonment.

## Consumers

Shared ingress binding, batching, reply dispatch, and the Feishu, Slack, Telegram, and Twitch wrappers preserve the source cadence. The fan-in uses the shortest valid cadence. Legacy wrappers that omit the optional field retain their existing head-only heartbeat behavior. Adoption, queue clearing, overflow, cancellation, summaries, and drain replacement retain or finish the same lifecycle owner.

Closes openclaw#133245.

Original implementation and report by @PollyBot13 (openclaw#133245). The contributor's commits and authorship are retained.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
pash-openai added a commit that referenced this pull request Sep 17, 2026
…ranch (#150472)

* fix(channels): hide intermediate tool failures in quiet progress (#145345)

* fix(channels): hide intermediate tool failures in quiet progress

Keep authored plans, progress text, approvals, and terminal task errors visible while quiet/default progress omits individual failed-tool and nonzero-exit rows. Preserve explicit tool-log diagnostics and remove obsolete quiet failure recovery handling.

Fixes #140037. Reported by @stemkat100 and @joncursi. Validated with 359 focused tests, changed checks, and independent review.

* test(channels): align quiet failure visibility coverage

Keep explicit diagnostic, approval, plan, and terminal-error coverage while requiring quiet progress to omit intermediate failures across downstream adapters. Assert Mattermost observations after monitor shutdown so a failure cannot be swallowed until timeout.

(cherry picked from commit 3bfac2f)

* fix(channels): keep deeper queued messages alive through long turns (#133248)

The contributor’s original description follows. Historical heads, scope and open decisions in this section refer to that implementation; the reviewed current implementation, compatibility decision and proof are recorded in the maintainer update below.

Closes #133245.

Related: #127950. This supersedes the current-main-incompatible queue-owned approach in #125385 while preserving today's canonical timeout retry disposition.

A durably claimed channel message can wait behind another follow-up turn for longer than the five-minute claim-to-adoption watchdog. Existing liveness renewal covers queue-head active-run admission checks, but not an ingress-backed lifecycle waiting deeper in the follow-up queue. The claim can therefore be retired before the message reaches the model.

The follow-up queue now owns periodic deferred heartbeats for the exact ingress lifecycle while it remains in pending items, in-flight delivery, summary sources, or compacted summary elisions.

Ingress supplies a cadence derived from one third of its adoption-stall timeout. Debounce, Plugin SDK fan-in, and channel lifecycle wrappers preserve the shortest applicable cadence. Queue ownership triggers an immediate renewal, then periodic renewal; it stops after successful adoption, completion, ownership loss, or callback failure. A rejected adoption callback keeps renewal alive for the supported retry path.

The existing watchdog and canonical timeout retry policy remain unchanged, so silent handlers and orphaned claims still recover normally.

Messages accepted by durable channel ingress remain adoptable while they wait behind long-running work instead of silently disappearing before model execution. No setting or migration is required.

SDK documentation polish (2026-09-10, head `76097fef9397a04c10637e06dfaf64ebb6ca104a`): the public channel SDK guide now documents forwarding both heartbeat fields, the shortest-positive-finite fan-in cadence, renewal termination, and compatibility when older wrappers omit the optional cadence. The documentation-only addition passed changed-page formatting, MDX sanity, and `git diff --check`; production code and the previously tested runtime head below are unchanged. Current-head hosted CI has completed successfully; the final exact-head ClawSweeper review accepts the implementation and proof, leaving only SDK-owner acceptance of the documented contract.

Refreshed on 2026-09-08 for exact head `57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61`, rebased onto `1ff45cad5ae`.

- Preserved upstream's ingress-monitor type extraction and gateway-suspension repair; the optional cadence field follows its new type owner.
- Repaired the retry integration fixture: after real enqueue and initial renewal, only the abandoned message's heartbeat callback fails. The real watchdog then recovers it. Retry delivery, healthy sibling cleanup, and true duplicate assertions remain intact; no production behavior or timeout changed for this repair.
- 102 focused tests pass: dispatch ingress retry, queue in-flight/dedupe, ingress lifecycle/watchdog, Plugin SDK fan-in, Discord queue handling, and Slack handler.
- Changed-file gates pass: core/core-test/extension typechecks, formatting, changed core/extension lint, SDK boundaries/exports, dead-export scans, and repository guards.
- Fresh independent source review found no actionable P0–P2 defects. The standalone autoreview CLI failed at startup without a verdict and is not counted as review coverage.
- Current-head CI run [34520397963](https://github.com/openclaw/openclaw/actions/runs/34520397963) completed successfully. The earlier startup subprocess timeout is historical, not a current failing gate. Exact-head ClawSweeper review (September 10, 20:00 UTC) reports no actionable correctness or proof findings; explicit SDK-owner acceptance remains required before merge.
- Existing regressions cover immediate renewal after late handoff, periodic deeper-queue renewal, stopping after owner loss, and continuing across a rejected adoption callback.

Exact-head durable-ingress boundary proof used isolated SQLite with the production ingress drain/lifecycle binder, follow-up queue, and canonical adoption helper. The model callback was synthetic; this is not live Telegram or Discord transport proof. No production Gateway, channel state, or configuration was touched. Temporary state and queue ownership were cleaned up.

```json
{
  "schema": "openclaw.pr133248.durable-ingress-proof.v1",
  "exactHead": "57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61",
  "setup": {
    "durableStore": "isolated OpenClaw SQLite state",
    "executor": "production follow-up queue with synthetic model callback",
    "transportLifecycle": "production ingress drain lifecycle",
    "adoptionStallTimeoutMs": 180
  },
  "queuedBehindLongTurn": {
    "heldMs": 620,
    "formerDeadlineCrossed": true,
    "heartbeatCount": 11,
    "claimStillOwnedAtCheckpoint": [
      "queued-event"
    ],
    "retryRowsAtCheckpoint": 0,
    "failedRowsAtCheckpoint": 0,
    "executionCount": 1,
    "duplicateAfterAdoption": "completed"
  },
  "orphanRecovery": {
    "status": "released-for-retry",
    "attempts": 1,
    "lastErrorContainsHandlerTimeout": true
  },
  "productionTouched": false
}
```

Owner acceptance:
- Intended behavior: accepted messages remain adoptable while their exact lifecycle is owned by the queue; ownerless claims retain canonical timeout recovery.
- Boundary: one optional cadence field propagated through existing shared lifecycle and channel wrappers; no configuration, schema, or migration change.
- Maintainer decision remains open: accept the additive public Plugin SDK lifecycle field and its queue-owned cadence semantics. Bot review is not that acceptance.
- Rollback: revert the renewal fix and its companion retry-fixture adjustment.
- Scope: 23 files, +273/-2. The width is required lifecycle forwarding; renewal policy stays in the queue and ingress drain.

AI-assisted.

---

Messages accepted while a long reply is running can expire in the follow-up queue and consume a retry. The reproduction confirmed expiry and retry; all three messages eventually arrived. It did not reproduce the older permanent-loss report in #133245.

The queue starts one heartbeat when it accepts a lifecycle and stops it on adoption, completion, cancellation, or callback failure. Heartbeats no longer scan queue collections or copy the in-flight set. Ingress remains responsible for the watchdog and retry settlement, and a heartbeat cannot undo the watchdog pause during adoption finalization.

Ingress derives the cadence from its adoption timeout. The optional lifecycle metadata remains necessary because wrappers rebuild callbacks and combine abort signals, losing the original timeout. No channel setting, schema, migration, dependency, or protocol change is added.

The simplification removes 110 lines net from the initial implementation plus main merge. Total production growth is 40 lines. Existing lifecycle types are reused, and the queue cases share the existing lifecycle test fixtures.

- Real Gateway and Discord: three marked messages on one route, with a queued reply held for 330 seconds. Main expired the third claim after 300.004 seconds. This head retained the same claim at 322.257 seconds with zero attempts; replies arrived once, in order, at 17.804, 349.201, and 350.223 seconds.
- Real SQLite/drain/binder/queue controls: explicit abandonment releases the claim; callback failure stops renewal and lets the watchdog retry without model execution.
- 191 core owner/sibling tests and 190 channel tests passed. All five new regression cases failed on plain main for the intended reasons.
- The local preflight passed core/extension type-aware lint, production and test types, script types, and protocol checks in an isolated checkout of this head.
- External consumers compiled and ran against published 2026.9.4 and this head, including omitted metadata, forwarding, optional return fields, and asynchronous abandonment.

Shared ingress binding, batching, reply dispatch, and the Feishu, Slack, Telegram, and Twitch wrappers preserve the source cadence. The fan-in uses the shortest valid cadence. Legacy wrappers that omit the optional field retain their existing head-only heartbeat behavior. Adoption, queue clearing, overflow, cancellation, summaries, and drain replacement retain or finish the same lifecycle owner.

Closes #133245.

Original implementation and report by @PollyBot13 (#133245). The contributor's commits and authorship are retained.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit dba4da1)

* fix(slack): join deferred replay settlement on shutdown (#150073)

Recheck cancellation before message preparation after replay claims and lazy pipeline imports, releasing every acquired claim on failure. Keep deferred reply settlement owned through ingress stop and settle failed routed deliveries through the existing failure lifecycle without rejecting successful publication.

(cherry picked from commit 82d4d1c)

* Restore Slack’s quiet preamble previews (#150407)

* Restore Slack’s quiet preamble previews

* Keep quiet preambles visible without admitting tool telemetry

(cherry picked from commit a90b969)

* fix(slack): retry temporary authorization failures (#150457)

(cherry picked from commit edc1fa8)

* Regenerate release metadata with its pinned schema generator

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: PollyBot13 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
amittell pushed a commit to amittell/openclaw that referenced this pull request Sep 18, 2026
…penclaw#133248)

The contributor’s original description follows. Historical heads, scope and open decisions in this section refer to that implementation; the reviewed current implementation, compatibility decision and proof are recorded in the maintainer update below.

Closes openclaw#133245.

Related: openclaw#127950. This supersedes the current-main-incompatible queue-owned approach in openclaw#125385 while preserving today's canonical timeout retry disposition.

A durably claimed channel message can wait behind another follow-up turn for longer than the five-minute claim-to-adoption watchdog. Existing liveness renewal covers queue-head active-run admission checks, but not an ingress-backed lifecycle waiting deeper in the follow-up queue. The claim can therefore be retired before the message reaches the model.

The follow-up queue now owns periodic deferred heartbeats for the exact ingress lifecycle while it remains in pending items, in-flight delivery, summary sources, or compacted summary elisions.

Ingress supplies a cadence derived from one third of its adoption-stall timeout. Debounce, Plugin SDK fan-in, and channel lifecycle wrappers preserve the shortest applicable cadence. Queue ownership triggers an immediate renewal, then periodic renewal; it stops after successful adoption, completion, ownership loss, or callback failure. A rejected adoption callback keeps renewal alive for the supported retry path.

The existing watchdog and canonical timeout retry policy remain unchanged, so silent handlers and orphaned claims still recover normally.

Messages accepted by durable channel ingress remain adoptable while they wait behind long-running work instead of silently disappearing before model execution. No setting or migration is required.

SDK documentation polish (2026-09-10, head `76097fef9397a04c10637e06dfaf64ebb6ca104a`): the public channel SDK guide now documents forwarding both heartbeat fields, the shortest-positive-finite fan-in cadence, renewal termination, and compatibility when older wrappers omit the optional cadence. The documentation-only addition passed changed-page formatting, MDX sanity, and `git diff --check`; production code and the previously tested runtime head below are unchanged. Current-head hosted CI has completed successfully; the final exact-head ClawSweeper review accepts the implementation and proof, leaving only SDK-owner acceptance of the documented contract.

Refreshed on 2026-09-08 for exact head `57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61`, rebased onto `1ff45cad5ae`.

- Preserved upstream's ingress-monitor type extraction and gateway-suspension repair; the optional cadence field follows its new type owner.
- Repaired the retry integration fixture: after real enqueue and initial renewal, only the abandoned message's heartbeat callback fails. The real watchdog then recovers it. Retry delivery, healthy sibling cleanup, and true duplicate assertions remain intact; no production behavior or timeout changed for this repair.
- 102 focused tests pass: dispatch ingress retry, queue in-flight/dedupe, ingress lifecycle/watchdog, Plugin SDK fan-in, Discord queue handling, and Slack handler.
- Changed-file gates pass: core/core-test/extension typechecks, formatting, changed core/extension lint, SDK boundaries/exports, dead-export scans, and repository guards.
- Fresh independent source review found no actionable P0–P2 defects. The standalone autoreview CLI failed at startup without a verdict and is not counted as review coverage.
- Current-head CI run [34520397963](https://github.com/openclaw/openclaw/actions/runs/34520397963) completed successfully. The earlier startup subprocess timeout is historical, not a current failing gate. Exact-head ClawSweeper review (September 10, 20:00 UTC) reports no actionable correctness or proof findings; explicit SDK-owner acceptance remains required before merge.
- Existing regressions cover immediate renewal after late handoff, periodic deeper-queue renewal, stopping after owner loss, and continuing across a rejected adoption callback.

Exact-head durable-ingress boundary proof used isolated SQLite with the production ingress drain/lifecycle binder, follow-up queue, and canonical adoption helper. The model callback was synthetic; this is not live Telegram or Discord transport proof. No production Gateway, channel state, or configuration was touched. Temporary state and queue ownership were cleaned up.

```json
{
  "schema": "openclaw.pr133248.durable-ingress-proof.v1",
  "exactHead": "57c4faff0ed7bb2d9b4fd308aa46b19ae4095e61",
  "setup": {
    "durableStore": "isolated OpenClaw SQLite state",
    "executor": "production follow-up queue with synthetic model callback",
    "transportLifecycle": "production ingress drain lifecycle",
    "adoptionStallTimeoutMs": 180
  },
  "queuedBehindLongTurn": {
    "heldMs": 620,
    "formerDeadlineCrossed": true,
    "heartbeatCount": 11,
    "claimStillOwnedAtCheckpoint": [
      "queued-event"
    ],
    "retryRowsAtCheckpoint": 0,
    "failedRowsAtCheckpoint": 0,
    "executionCount": 1,
    "duplicateAfterAdoption": "completed"
  },
  "orphanRecovery": {
    "status": "released-for-retry",
    "attempts": 1,
    "lastErrorContainsHandlerTimeout": true
  },
  "productionTouched": false
}
```

Owner acceptance:
- Intended behavior: accepted messages remain adoptable while their exact lifecycle is owned by the queue; ownerless claims retain canonical timeout recovery.
- Boundary: one optional cadence field propagated through existing shared lifecycle and channel wrappers; no configuration, schema, or migration change.
- Maintainer decision remains open: accept the additive public Plugin SDK lifecycle field and its queue-owned cadence semantics. Bot review is not that acceptance.
- Rollback: revert the renewal fix and its companion retry-fixture adjustment.
- Scope: 23 files, +273/-2. The width is required lifecycle forwarding; renewal policy stays in the queue and ingress drain.

AI-assisted.

---

Messages accepted while a long reply is running can expire in the follow-up queue and consume a retry. The reproduction confirmed expiry and retry; all three messages eventually arrived. It did not reproduce the older permanent-loss report in openclaw#133245.

The queue starts one heartbeat when it accepts a lifecycle and stops it on adoption, completion, cancellation, or callback failure. Heartbeats no longer scan queue collections or copy the in-flight set. Ingress remains responsible for the watchdog and retry settlement, and a heartbeat cannot undo the watchdog pause during adoption finalization.

Ingress derives the cadence from its adoption timeout. The optional lifecycle metadata remains necessary because wrappers rebuild callbacks and combine abort signals, losing the original timeout. No channel setting, schema, migration, dependency, or protocol change is added.

The simplification removes 110 lines net from the initial implementation plus main merge. Total production growth is 40 lines. Existing lifecycle types are reused, and the queue cases share the existing lifecycle test fixtures.

- Real Gateway and Discord: three marked messages on one route, with a queued reply held for 330 seconds. Main expired the third claim after 300.004 seconds. This head retained the same claim at 322.257 seconds with zero attempts; replies arrived once, in order, at 17.804, 349.201, and 350.223 seconds.
- Real SQLite/drain/binder/queue controls: explicit abandonment releases the claim; callback failure stops renewal and lets the watchdog retry without model execution.
- 191 core owner/sibling tests and 190 channel tests passed. All five new regression cases failed on plain main for the intended reasons.
- The local preflight passed core/extension type-aware lint, production and test types, script types, and protocol checks in an isolated checkout of this head.
- External consumers compiled and ran against published 2026.9.4 and this head, including omitted metadata, forwarding, optional return fields, and asynchronous abandonment.

Shared ingress binding, batching, reply dispatch, and the Feishu, Slack, Telegram, and Twitch wrappers preserve the source cadence. The fan-in uses the shortest valid cadence. Legacy wrappers that omit the optional field retain their existing head-only heartbeat behavior. Adoption, queue clearing, overflow, cancellation, summaries, and drain replacement retain or finish the same lifecycle owner.

Closes openclaw#133245.

Original implementation and report by @PollyBot13 (openclaw#133245). The contributor's commits and authorship are retained.

AI-assisted.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit dba4da1)
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 channel: twitch Channel integration: twitch mantis: telegram-visible-proof Mantis should capture Telegram visible proof. 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. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] LINE channel inbound events were delayed before agent run and later drained

2 participants