Skip to content

fix(telegram): preserve mixed text order and pending stop - #144839

Merged
obviyus merged 4 commits into
mainfrom
codex/issue-144722
Sep 11, 2026
Merged

obviyus merged 4 commits into
mainfrom
codex/issue-144722

Conversation

@obviyus

@obviyus obviyus commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks @xilopaint for the detailed reproduction.

Fixes #144722.

What Problem This Solves

Fixes an issue where a short Telegram message could be processed after a later long message and its continuation when inbound debounce was enabled. Native stop could also leave a buffered fragment pending.

Why This Change Was Made

Reserve fragment work in the existing inbound debounce queue on arrival, so both text paths share processing order. Authorized native stop now cancels through the same pending-buffer operation. Fragment thresholds and source metadata remain unchanged.

User Impact

Earlier text is processed first, canceled fragments do not reach the provider, and fresh messages work after cancellation. Ordinary-only debounce retains its behavior.

Evidence

Real Telegram direct messages reproduced both bugs. Seven acceptance cases passed, covering mixed order, ordinary/long pairs, thresholds, pending stop and reuse. Seven provider requests matched eight visible messages, including the stop acknowledgement; canceled input was absent. The ordinary debounce timing matrix and focused handler tests passed.

@obviyus obviyus self-assigned this Sep 11, 2026
@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram size: XL maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 6:37 AM ET / 10:37 UTC (Revision 2).

ClawSweeper review

What this changes

The PR preserves processing order between ordinary Telegram text and long-message fragments, connects authorized native stop commands to pending-input cancellation, and adds regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. The added redacted Telegram trace resolves the previous proof request, and source review found no blocking correctness defect.

Priority: P2
Reviewed head: c71e9117e4494fbced2648cfb8f9514853070aa5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with strong before/after Telegram evidence and meaningful regression coverage; no blocking defect was identified.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
Evidence reviewed 9 items Current main still needs the fix: Current main retains a separate KeyedAsyncQueue for fragments, independent of the ordinary inbound debouncer; the 1500 ms fragment wait can precede a configured 3000 ms ordinary debounce.
Latest release retains independent fragment processing: The supplied latest release, v2026.9.4, also contains textQueue and queueTextFlush with the 4000-character threshold and 1500 ms gap.
Shared queue and cancellation ownership: Fragments reserve the existing debouncer on arrival and wait for collection readiness. Pending fragment tracking survives timer expiry until processing starts, while cancellation releases claims and settles buffered participants.
Findings None None.
Security None None.

How this fits together

Telegram’s inbound buffers collect messages before handing them to agent processing. Their ordering and cancellation decisions determine which inputs reach the provider and produce chat replies.

flowchart TD
  A[Telegram messages] --> B[Authorization and conversation scope]
  B --> C[Ordinary text batch]
  B --> D[Long fragment collection]
  C --> E[Shared ordered queue]
  D --> E
  B --> F[Authorized stop cancels pending input]
  F --> E
  E --> G[Agent processing and Telegram replies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +135, Tests +827, Docs +1. Total +963 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 9 243 108 +135
Tests 6 928 101 +827
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1172 209 +963

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +135 net lines; tests/support +827 net lines Production growth implements the collection-to-queue cancellation lifecycle; most growth exercises observable ordering, authorization, and timing contracts.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144722
Summary: This PR is the open implementation candidate for the reported cross-buffer ordering defect.

Members:

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

Technical review

Best possible solution:

Keep one ordered buffer execution owner while preserving separate text batches, source metadata, and sender-scoped stop cancellation.

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

Yes: current main’s independent queues explain the 3000 ms short–long–continuation reordering, corroborated by the supplied baseline trace; this review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: reusing the existing ordered debouncer removes the competing execution queue while retaining fragment assembly and existing command authorization.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
  • 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 (logs): The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs bounded Telegram text-ordering and pending-stop failures without evidence of a wider urgent outage.
  • 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 (logs): The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
  • proof: sufficient: Contributor real behavior proof is sufficient. The added redacted trace exercises the changed buffer and native-stop owners through a real Gateway and Telegram Test Server, showing ordered provider admissions and chat receipts, canceled-input suppression, and clean reuse; subsequent changes are tests and type-only declarations.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Pending-stop suppression and subsequent chat replies are Telegram-visible behavior, covered by the supplied Test Server trace.

Evidence

What I checked:

  • Current main still needs the fix: Current main retains a separate KeyedAsyncQueue for fragments, independent of the ordinary inbound debouncer; the 1500 ms fragment wait can precede a configured 3000 ms ordinary debounce. (extensions/telegram/src/bot-handlers.inbound-buffer.ts:295, f50d4ce71e3e)
  • Latest release retains independent fragment processing: The supplied latest release, v2026.9.4, also contains textQueue and queueTextFlush with the 4000-character threshold and 1500 ms gap. (extensions/telegram/src/bot-handlers.inbound-buffer.ts:295, 3a9d69db306c)
  • Shared queue and cancellation ownership: Fragments reserve the existing debouncer on arrival and wait for collection readiness. Pending fragment tracking survives timer expiry until processing starts, while cancellation releases claims and settles buffered participants. (extensions/telegram/src/bot-handlers.inbound-buffer.ts:160, c71e9117e449)
  • Native cancellation follows authorization: The native command callback runs only after command authorization returns successfully and before slower binding preparation. Cancellation is limited to the authenticated sender’s chat/topic within the owning account. (extensions/telegram/src/bot-native-command-dispatch.ts:395, c71e9117e449)
  • Previous proof request addressed: The complete supplied PR body, captured in context sourceRevision f4adc96d88ab5ed4fa0ae66a5f5a9cd93c9baf4e837b72dd712b236cbcbb23a7, contains the requested redacted real Gateway and Telegram Test Server trace. It records A before B+C at provider admission and Telegram receipt, seven provider requests, eight visible messages including stop acknowledgment, absence of canceled source 1890 from provider bodies, and successful subsequent reuse. This addresses the rank-up move in fix(telegram): preserve mixed text order and pending stop #144839 (comment). The fixture used a deterministic loopback provider; group/media behavior and answer quality are outside its live coverage. (e36669eadfc2)
  • Live-tested runtime remains applicable: GitHub’s comparison from the recorded live-tested commit to the reviewed head contains test additions and type-only relocation/signature changes, with no changed runtime statements. The local comparison initially failed on a missing historical blob; the read-only GitHub comparison supplied the missing evidence. (c71e9117e449)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • obviyus: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-11T10:16:12.643Z sha 52545cd :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-unrelated-red
pr: 144839
head: c71e911
run: 34589657541 attempt: 1
failed: checks-node-compact-small-19 job=103231994989 conclusion=failure
check: openclaw/ci-gate

@obviyus
obviyus merged commit 62258ae into main Sep 11, 2026
159 of 161 checks passed
@obviyus
obviyus deleted the codex/issue-144722 branch September 11, 2026 10:51
@obviyus

obviyus commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @xilopaint for the detailed reproduction!

Proof: Real Telegram Test Server direct messages through a built Gateway and deterministic provider preserve short → long/continuation admission and reply order. Native /stop suppresses the pending fragment; fresh input then works. The redacted source/provider/reply trace is in the PR body. Independent behavior acceptance and exact-head local review passed.

  • Bug: Separate text queues could process later fragments before earlier short text; native stop did not reach the pending text buffer.
  • Fix: Use the existing inbound debouncer for processing order and the existing buffer owner for authorized pending cancellation.
Before After
Baseline admits B+C before A with 3000 ms debounce. A reaches processing and the provider before B+C.
Native stop acknowledges, then pending text receives a reply. Pending text has no provider admission; later valid input receives a reply.

CI: The introduced type-cycle and missing fixture account ID are fixed; hosted architecture and test-type checks pass. The completed final run has one unrelated failing child, checks-node-compact-small-19, and the resulting aggregate failure.

That child fails check-extension-package-tsc-boundary > reruns the real compiler after an inherited paths change in the CLI at its first cold-run assertion: process.execve failed with error code ETXTBSY, native compiler exit134. The operating system refuses compiler launch before typechecking the generated demo plugin. Its synthetic SDK declaration, fixture, compiler materializer, script dependencies, package lock and CI configuration are unchanged from the tested main parent f50d4ce71e3eee4005f297f05caa402f8a571fca to the actual tested merge fd686e36288aab055f75bb8c1f330efe27808cad. None of the changed Telegram source or tests enters that fixture. All109 jobs are terminal; no pending job is excepted.

The fixture materializer and its use were introduced by #138742, commit b78612ac3ac0fb7ba630ff20d5eaadf357215aae; that is verified code provenance, not attribution of the execution failure. The process or filesystem condition holding the executable busy was not captured, and no matching main-run failure or successful retry is claimed. The independent causal review found this failure unrelated to the PR. Landing uses the guarded standing-approval record here; CI is recorded as failed with that exception, not green.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…44839)

Coordinate ordinary Telegram text and near-limit fragment processing through the existing inbound debouncer while preserving assembly and source metadata. Connect authorized native stop to pending text cancellation before post-authorization preparation.

Real Telegram Test Server baseline and candidate proof covers mixed ordering, pairs, thresholds, pending cancellation and reuse. Focused owner, command, media, ingress and debounce checks cover the related internal contracts.

Thanks @xilopaint for the reproduction.

Fixes openclaw#144722

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

Coordinate ordinary Telegram text and near-limit fragment processing through the existing inbound debouncer while preserving assembly and source metadata. Connect authorized native stop to pending text cancellation before post-authorization preparation.

Real Telegram Test Server baseline and candidate proof covers mixed ordering, pairs, thresholds, pending cancellation and reuse. Focused owner, command, media, ingress and debounce checks cover the related internal contracts.

Thanks @xilopaint for the reproduction.

Fixes openclaw#144722

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 62258ae)
obviyus added a commit that referenced this pull request Sep 22, 2026
Related: #144839

## What Problem This Solves

Fixes partial prompts and multiple replies when Telegram delivers one long paste as a rapid burst of differently sized message chunks.

## User Impact

Telegram now batches ordinary text by default with a 300 ms quiet window, extending the wait for likely long-paste continuations. Existing global/per-channel settings still take precedence; explicit `0` disables ordinary burst batching while retaining automatic near-limit reassembly.

The tradeoff is a small delay before ordinary text starts a turn, and intentionally separate rapid messages may be combined. Commands and media remain separate, and stop still cancels pending input.

## Why This Change Was Made

Short text and near-limit fragments previously used separate collectors, and reassembly required consecutive message IDs. One shared keyed queue now collects both, preserves source metadata and cancellation, and orders forwarded batches without merging their origins into ordinary text.

Ordinary batches are bounded to 12 messages, 50,000 characters, and 7.5 seconds of collection (or a longer configured initial quiet window). Likely continuations retain a 1.5-second allowance. The separate fragment maps, timers, and completion bookkeeping are removed. No config migration or dependency change is required.

## Evidence

Real Telegram Test Server user → bot → OpenClaw Gateway → deterministic mock provider, with TDLib recording actual replies:

| Scenario | Pinned baseline | Candidate |
| --- | --- | --- |
| 3,999 + 4,096 + 200 characters, sent about 100 ms apart | Two user turns: first chunk, then remaining chunks; two replies | One combined user turn; one reply |
| 4,096 + 200 characters | One joined turn and one reply | One joined turn and one reply |
| Buffered long text, then native stop, then fresh text | — | Canceled text never reached the provider; fresh text produced one turn and reply |

The candidate mixed case exercised real transport deliveries 233 ms apart. Stop arrived 587 ms after the buffered text; the fresh message arrived at 2,999 ms. Counts above are primary user turns, not background session-recap requests. All proof leases, processes, listeners, and credential scratch were cleaned up.

- The mixed-burst regression fails on baseline `d15cac3f06178f7aa6a49d746ae2201dcd3eb4a4` and passes on the candidate.
- **328 focused tests passed** across shared debouncing, Telegram bot/media handling, durable ingress, cancellation, authorization, reply/quote context, entity formatting, and SDK mock conformance.
- Targeted type-aware lint, generated SDK declaration checks, formatting, and line-count ratchets passed. Full repository checks remain for hosted CI.
- The complete shared-debounce suite moved into its own directly imported test file; no existing coverage was dropped, and one obsolete oversized-file allowance was removed.
- Independent correctness review completed. Its channel-post concern was checked against the ingress normalizer and passing sender-less channel-post reassembly case; channel posts already receive a stable synthetic sender before batching.

<details>
<summary>Measured test cost (one worker)</summary>

- Shared debounce: 24 tests, 0.59 s test time.
- Remaining inbound tests: 39 tests, 0.23 s test time; both shared files completed in 19.03 s command wall time including preparation.
- Telegram bot boundary: 163 tests, 66.54 s test time.
- Telegram channel-post/media boundary: 41 tests, 25.46 s test time; the two-file command completed in 120.38 s wall time.
- SDK mock admission conformance: 1 targeted case, 16.56 s command wall time including preparation; it fails without the new mock member and passes with it.
- The existing large bot suite exercises registered handlers and durable SQLite-backed admission. New timing cases reuse its fixtures and fake clock rather than adding Gateway/process boots.
- Hosted CI timings will be available on the PR checks.

</details>

### Hosted CI follow-up

Regenerated the config-doc fingerprint for the intentional help change. Fixtures testing immediate delivery now explicitly disable ordinary batching, and typed Feishu debounce doubles expose the admission query. The SDK mock reuses the canonical debounce resolver rather than growing its duplicate policy. The 56 targeted repair tests, plugin test-typecheck lane, and size ratchet passed; Telegram production batching is unchanged from the live proof.

The initial launcher failure came from an unchanged main-parent test and was fixed upstream in #155825; this PR does not change launcher code.

The remaining bot context/media suite now explicitly opts out of ordinary batching through its shared config builders while retaining explicit debounce windows. All137 cases pass (58.75s test time,83.46s command wall time); no assertions or production batching behavior were weakened.

The final integration includes current main rather than copying an unrelated wrapper repair into the Telegram code. The wrapper closure tests passed 2/2 on the integrated source. A newly added disabled-binding startup fixture was made explicitly immediate; all 9 cases pass. The mixed-burst registered-handler and forwarded-context controls passed on the integrated runtime; the original Test Server capture remains for the unchanged batching owner.

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

## What Problem This Solves

Fixes partial prompts and multiple replies when Telegram delivers one long paste as a rapid burst of differently sized message chunks.

## User Impact

Telegram now batches ordinary text by default with a 300 ms quiet window, extending the wait for likely long-paste continuations. Existing global/per-channel settings still take precedence; explicit `0` disables ordinary burst batching while retaining automatic near-limit reassembly.

The tradeoff is a small delay before ordinary text starts a turn, and intentionally separate rapid messages may be combined. Commands and media remain separate, and stop still cancels pending input.

## Why This Change Was Made

Short text and near-limit fragments previously used separate collectors, and reassembly required consecutive message IDs. One shared keyed queue now collects both, preserves source metadata and cancellation, and orders forwarded batches without merging their origins into ordinary text.

Ordinary batches are bounded to 12 messages, 50,000 characters, and 7.5 seconds of collection (or a longer configured initial quiet window). Likely continuations retain a 1.5-second allowance. The separate fragment maps, timers, and completion bookkeeping are removed. No config migration or dependency change is required.

## Evidence

Real Telegram Test Server user → bot → OpenClaw Gateway → deterministic mock provider, with TDLib recording actual replies:

| Scenario | Pinned baseline | Candidate |
| --- | --- | --- |
| 3,999 + 4,096 + 200 characters, sent about 100 ms apart | Two user turns: first chunk, then remaining chunks; two replies | One combined user turn; one reply |
| 4,096 + 200 characters | One joined turn and one reply | One joined turn and one reply |
| Buffered long text, then native stop, then fresh text | — | Canceled text never reached the provider; fresh text produced one turn and reply |

The candidate mixed case exercised real transport deliveries 233 ms apart. Stop arrived 587 ms after the buffered text; the fresh message arrived at 2,999 ms. Counts above are primary user turns, not background session-recap requests. All proof leases, processes, listeners, and credential scratch were cleaned up.

- The mixed-burst regression fails on baseline `6e1eddbb57cb40a30cbe85cbef5bf6cf85319de4` and passes on the candidate.
- **328 focused tests passed** across shared debouncing, Telegram bot/media handling, durable ingress, cancellation, authorization, reply/quote context, entity formatting, and SDK mock conformance.
- Targeted type-aware lint, generated SDK declaration checks, formatting, and line-count ratchets passed. Full repository checks remain for hosted CI.
- The complete shared-debounce suite moved into its own directly imported test file; no existing coverage was dropped, and one obsolete oversized-file allowance was removed.
- Independent correctness review completed. Its channel-post concern was checked against the ingress normalizer and passing sender-less channel-post reassembly case; channel posts already receive a stable synthetic sender before batching.

<details>
<summary>Measured test cost (one worker)</summary>

- Shared debounce: 24 tests, 0.59 s test time.
- Remaining inbound tests: 39 tests, 0.23 s test time; both shared files completed in 19.03 s command wall time including preparation.
- Telegram bot boundary: 163 tests, 66.54 s test time.
- Telegram channel-post/media boundary: 41 tests, 25.46 s test time; the two-file command completed in 120.38 s wall time.
- SDK mock admission conformance: 1 targeted case, 16.56 s command wall time including preparation; it fails without the new mock member and passes with it.
- The existing large bot suite exercises registered handlers and durable SQLite-backed admission. New timing cases reuse its fixtures and fake clock rather than adding Gateway/process boots.
- Hosted CI timings will be available on the PR checks.

</details>

### Hosted CI follow-up

Regenerated the config-doc fingerprint for the intentional help change. Fixtures testing immediate delivery now explicitly disable ordinary batching, and typed Feishu debounce doubles expose the admission query. The SDK mock reuses the canonical debounce resolver rather than growing its duplicate policy. The 56 targeted repair tests, plugin test-typecheck lane, and size ratchet passed; Telegram production batching is unchanged from the live proof.

The initial launcher failure came from an unchanged main-parent test and was fixed upstream in openclaw#155825; this PR does not change launcher code.

The remaining bot context/media suite now explicitly opts out of ordinary batching through its shared config builders while retaining explicit debounce windows. All137 cases pass (58.75s test time,83.46s command wall time); no assertions or production batching behavior were weakened.

The final integration includes current main rather than copying an unrelated wrapper repair into the Telegram code. The wrapper closure tests passed 2/2 on the integrated source. A newly added disabled-binding startup fixture was made explicitly immediate; all 9 cases pass. The mixed-burst registered-handler and forwarded-context controls passed on the integrated runtime; the original Test Server capture remains for the unchanged batching owner.

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

Labels

channel: telegram Channel integration: telegram docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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]: Telegram debounce and text-fragment buffers can dispatch messages out of order

1 participant