Repository navigation
fix(telegram): suppress duplicate DM transcript windows while preserving delivery-only context - #183190
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesSuppresses replayed conversation turns from existing plain Telegram DM windows while retaining delivery-only context. Example: Send PING:one, receive a Cron announcement PONG:cronnote, then send PING:after.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR addresses a current Telegram context bug with useful runtime evidence and no actionable correctness findings; the previously requested SDK contract acceptance remains unverified. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherTelegram selects supplemental context, core merges bounded transcript history, and the resulting context accompanies canonical conversation replay into the model request. flowchart LR
A[Telegram DM] --> B[Telegram context selection]
B --> C[Shared prepared turn]
D[Session transcript] --> E[Bounded recent text reader]
E --> C
C --> F[Supplemental context]
D --> G[Canonical replay]
F --> H[Model request]
G --> H
Technical reviewBest possible solution: Retain Telegram's existing suppression decision and core's bounded delivery-only projection, with explicit acceptance of the optional SDK contract. Do we have a high-confidence way to reproduce the issue? Current-main source shows the duplicate reconstruction path, and supplied Telegram request traces reproduce it; this review executed no target code. Is this the best way to solve the issue? The patch uses the existing Telegram predicate and shared transcript owner, preserves window bounds and delivery exceptions, and adds no competing state or unnecessary production layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against edc6bf994da2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +16, Tests +199. Total +215 across 6 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 14, 2026, 12:08 AM ET / 05:08 UTC (Revision 7). |
89ac840 to
1e9e772
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…ing delivery-only context
1e9e772 to
57a4cb1
Compare
|
@clawsweeper re-review |
|
Note 🤖 Claude Opus 5.5 responding on behalf of @frankdilo Hitting this on a real install, and the current releases don't fix it, so this PR is still needed. Setup: OpenClaw 2026.10.8, Telegram DM, Codex app-server runtime ( What happens: the per-turn
The link and the total were both delivered, but only these progress lines reach the next turn. On every later turn the model re-sends an answer it already delivered, at one point saying it "still owes" the link, until the promise scrolls out of the 10-message window. In one day it re-attached the same draft link to four unrelated replies and repeated the timesheet total on two more. Why 2026.10.10 and 2026.11.1 don't fix it (from reading the built packages, not tested): #179399 added Workarounds we tried:
|
|
The PR description is now updated with passing CI for Following up on the October 28 review: could this be routed to the responsible SDK owner to accept the optional Current-head CI and the aggregate/security gates pass. GitHub reports the branch mergeable, and maintainer edits are enabled. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…nscript-context Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer decision on
|
|
Merged via squash.
|
Related: #89855, #112548, #130551, #172711, #179399
What Problem This Solves
In an existing plain Telegram DM, recent assistant turns reach the model twice: once through canonical session replay and again through a supplemental session
chat_window. Telegram already suppresses its native DM window in this case, but the shared transcript-context owner then rebuilt the same turns from the session transcript.User Impact
The model sees already-delivered answers (including Cron announcements) twice in the same request, which encourages repeated or stale answers. A November 8 report on this PR describes a real DM installation re-sending already-delivered finals; its
dmHistoryLimit: 0workaround also drops Cron announcement context.Why This Change Was Made
deliveryOnly: trueonSessionTranscriptContext.deliveryOnlyis an additive optional field on a type the plugin SDK exposes transitively throughBuildChannelInboundEventContextParams.sessionTranscript. It is source-compatible for every existing caller and grants no new authority; maintainers accept it as the narrow Telegram-to-core selection signal.Evidence
Live Telegram Test Server E2E (real Gateway, TDLib user, deterministic Chat Completions mock that logs each model request). Scenario: DM
PING:one, a real Cron job announcingPONG:cronnote, thenPING:after. The judged request is the one answeringPING:after.8ebe740925ca(reproduced): replay containsassistant: PONG:oneandassistant: PONG:cronnote, and the same request also carries a "Conversation context" session window repeating both rows (PONG:onex2,PONG:cronnotex2).826864b3be9c(built from this exact commit): replay contains both assistant rows once; no supplemental window is added (PONG:onex1,PONG:cronnotex1). The Cron announcement stays in context.session-transcript-context.sqlite.test.ts,bot-message-context.prompt-context.test.ts,session-transcript-context.runtime.test.ts. The SQLite regression fails on the original parent and passes with the fix.826864b3be9cis green.