Skip to content

fix(telegram): make ingress coalescing checks wait for dispatch - #150093

Merged
steipete merged 1 commit into
mainfrom
codex/telegram-coalescing-fixture-main-20260916
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/telegram-coalescing-fixture-main-20260916

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #150080

What Problem This Solves

Telegram's durable-ingress tests can assert delivery before the debounce window has elapsed or before a claimed follower reaches dispatch, obscuring validation of the account-shutdown fix in #150080.

User Impact

No runtime behavior changes. This maintainer-requested fixture repair preserves the message counts, ordering checks, durable tombstones, and existing test deadlines.

Why This Change Was Made

Wait for the real handler to reach the buffer before advancing each 20 ms timer step. At the existing 400 ms maximum-wait boundary, observe the existing downstream-dispatch callback before admitting the final four of 24 messages. Real asynchronous preparation remains awaited. The session-conflict case checks its follower inside the existing wait barrier because an empty pending queue can still contain claimed work.

This proves logical debounce progress and ordered delivery; it does not measure end-to-end real-wall-clock throughput. Production code and the existing 1-second, 5-second, and outer test deadlines are unchanged.

Evidence

  • On the main-based candidate, all eight existing cases pass in their original order: OPENCLAW_E2E_SKIP_BUILD=1 node scripts/run-vitest.mjs extensions/telegram/src/telegram-ingress-coalescing.e2e.test.ts.
  • Removing only the existing maximum-wait cap makes the sustained case fail under the unchanged 120-second test deadline. The production file was restored byte-for-byte afterward.
  • Independent review of this exact main-based fixture found no actionable P0–P2 findings. Pinned-base scoped repository checks passed, including extension-test types, lint, formatting, ratchets, plugin boundaries, and dead-export scans.

The earlier 11-case shutdown-candidate result used a different completion waiter and is not final proof for #150080. That PR must consume this canonical fix and rerun its own 11-case sequence.

@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@steipete
steipete marked this pull request as ready for review September 16, 2026 13:50
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 9:57 AM ET / 13:57 UTC.

ClawSweeper review

What this changes

The PR synchronizes Telegram ingress tests with buffer entry and downstream dispatch while preserving delivery order, message counts, and durable-completion assertions.

Merge readiness

✅ Ready for maintainer review

Keep open: this focused fixture repair remains useful for validating the linked shutdown work, and current main retains the premature assertions. No actionable correctness defect was found.

Priority: P3
Reviewed head: 3faf5ff3b3e9c3996a3b86aeb08375a7b863e3e0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent test repair with relevant supplied validation and no blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored fixture repair changes no production behavior; the reported eight-case pass and cap-removal negative control validate the test contract without claiming live Telegram proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored fixture repair changes no production behavior; the reported eight-case pass and cap-removal negative control validate the test contract without claiming live Telegram proof.
Evidence reviewed 7 items Verified introduced scope: The pinned merge-base-to-head comparison changes only the coalescing test. The full file preserves all eight cases, ordered delivery assertions, tombstone checks, and existing assertion timeouts; diff whitespace validation passed.
Current-main necessity: Current main retains the real-time sleeps and separate follower assertion; its comparison with the reviewed head contains the same focused synchronization changes. No merged replacement was established.
Debounce timing contract: The shared debouncer fixes a monotonic deadline at five debounce windows; Telegram uses an 80 ms forward window. Advancing the controlled clock to 400 ms while awaiting actual dispatch therefore exercises the existing maximum-wait contract.
Findings None None.
Security None None.

How this fits together

Telegram updates enter a durable queue, pass through the shared ingress monitor, and reach a buffer that combines related messages before agent dispatch. These tests check that buffering preserves progress, ordering, and replay protection.

flowchart LR
  A[Synthetic Telegram updates] --> B[Durable ingress queue]
  B --> C[Ingress monitor]
  C --> D[Message buffer]
  E[Controlled debounce clock] --> D
  D --> F[Observed agent dispatch]
  F --> G[Ordering and completion checks]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +13. Total +13 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 22 9 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 22 9 +13

Review metrics

None.

Technical review

Best possible solution:

Keep lifecycle-based synchronization in the existing fixture, with logical timing coverage separate from shutdown settlement and wall-clock performance claims.

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

Yes, source establishes the assertion race: durable admission and an empty pending queue do not establish downstream dispatch. The supplied full-file results support it; this read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. Waiting at existing lifecycle boundaries and controlling the debounce clock addresses the race without changing production code or weakening final delivery assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-reliability repair with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored fixture repair changes no production behavior; the reported eight-case pass and cap-removal negative control validate the test contract without claiming live Telegram proof.

Label justifications:

  • P3: This is a bounded test-reliability repair with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored fixture repair changes no production behavior; the reported eight-case pass and cap-removal negative control validate the test contract without claiming live Telegram proof.

Evidence

What I checked:

  • Verified introduced scope: The pinned merge-base-to-head comparison changes only the coalescing test. The full file preserves all eight cases, ordered delivery assertions, tombstone checks, and existing assertion timeouts; diff whitespace validation passed. (extensions/telegram/src/telegram-ingress-coalescing.e2e.test.ts:384, 3faf5ff3b3e9)
  • Current-main necessity: Current main retains the real-time sleeps and separate follower assertion; its comparison with the reviewed head contains the same focused synchronization changes. No merged replacement was established. (extensions/telegram/src/telegram-ingress-coalescing.e2e.test.ts:383, ebae945b4afa)
  • Debounce timing contract: The shared debouncer fixes a monotonic deadline at five debounce windows; Telegram uses an 80 ms forward window. Advancing the controlled clock to 400 ms while awaiting actual dispatch therefore exercises the existing maximum-wait contract. (src/auto-reply/inbound-debounce.ts:428, 3faf5ff3b3e9)
  • Handler and deferred-work boundary: The monitor waits for admission, inspection, active delivery handlers, and drain tasks. Telegram handlers can return deferred after entering the buffer, so this wait can establish buffer entry without requiring the debounce clock to expire. (src/channels/message/ingress-monitor.ts:765, 3faf5ff3b3e9)
  • Supplied validation and related work: The captured PR body reports all eight cases passing in original order and a negative control failing when the maximum-wait cap is removed. It explicitly limits the claim to logical debounce progress, not wall-clock throughput. fix(telegram): wait for accepted work during account shutdown #150080 remains open and unmerged; its shutdown validation must consume this fixture independently. (3faf5ff3b3e9)
  • History-based routing: Current-main file history lists Ayaan Zaidi's participant-settlement work and Peter Steinberger's policy work. These support routing candidates only: deeper blame and parent-patch inspection failed because required objects could not be retrieved, so source-line introduction is unverified. (extensions/telegram/src/telegram-ingress-coalescing.e2e.test.ts, cf6f6d926fd8)

Likely related people:

  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit afb631b into main Sep 16, 2026
177 checks passed
@steipete
steipete deleted the codex/telegram-coalescing-fixture-main-20260916 branch September 16, 2026 14:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant