Repository navigation
fix(telegram): route commentary through one frozen progress owner - #128259
Conversation
Telegram progress mode enabled both the commentary-capable draft and durable commentary payloads without supplying the shared shouldDeliverCommentaryPayloads owner callback, so core defaulted durable delivery on while the draft also rendered each completed preamble (openclaw#128038). Wire the callback to the same verbose-visibility slot core freezes at turn start, gated exactly when the compositor can render interleaved commentary lines, mirroring the Slack/Discord wiring from openclaw#121009. Commentary-disabled configs keep today's durable-only path unchanged. Closes openclaw#128038 AI-assisted (Claude); regression tests fail pre-fix and pass post-fix.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:52 PM ET / August 26, 2026, 03:52 UTC. ClawSweeper reviewWhat this changesThis PR makes Telegram progress streaming select either the draft or durable delivery lane for each commentary preamble, with regression coverage for both ownership states. Merge readinessKeep this PR open for normal landing. The patch wires Telegram into the existing frozen one-owner contract, and its focused tests plus isolated gateway/transport proof support the intended single visible commentary copy; it needs an exact-current-main refresh before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherTelegram receives agent commentary through the shared reply dispatcher, which decides whether a progress draft or a durable message owns each update. That decision determines what the user sees in the active Telegram progress message. flowchart LR
A[Model commentary event] --> B[Shared reply dispatcher]
B --> C[Frozen visibility decision]
C --> D{Commentary owner}
D -->|Draft| E[Telegram progress draft]
D -->|Durable| F[Telegram durable delivery]
E --> G[One visible preamble]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +84. Total +90 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Mantis proof suggestionA Telegram Desktop recording would directly show the one-copy progress-message result under the reported configuration. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared frozen-owner callback, rebase onto current main, and land only after exact-head validation confirms one visible commentary projection per preamble. Do we have a high-confidence way to reproduce the issue? Yes—source establishes the prior path enabled both the Telegram draft projection and durable commentary without the shared owner callback; the PR tests exercise each frozen ownership result. Is this the best way to solve the issue? Yes—the PR reuses the shared Slack/Discord one-owner contract rather than creating a Telegram-specific delivery policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 345cfde43dc9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Merged via squash.
|
…enclaw#128259) * fix(telegram): route commentary through one frozen progress owner Telegram progress mode enabled both the commentary-capable draft and durable commentary payloads without supplying the shared shouldDeliverCommentaryPayloads owner callback, so core defaulted durable delivery on while the draft also rendered each completed preamble (openclaw#128038). Wire the callback to the same verbose-visibility slot core freezes at turn start, gated exactly when the compositor can render interleaved commentary lines, mirroring the Slack/Discord wiring from openclaw#121009. Commentary-disabled configs keep today's durable-only path unchanged. Closes openclaw#128038 AI-assisted (Claude); regression tests fail pre-fix and pass post-fix. * test(telegram): cover commentary ownership across streaming modes --------- Co-authored-by: Parker Fawcett <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
Closes #128038
AI-assisted: yes — built with Claude; prompts/session logs available on request.
What Problem This Solves
With
richMessages+streaming.mode="progress"+streaming.progress.commentary=true, every completed assistant commentary preamble appeared twice in the Telegram progress draft (#128038): once through the draft projection and again through the durable commentary path, because both stayed enabled for the same turn.Why This Change Was Made
Telegram never supplied the optional
shouldDeliverCommentaryPayloadsowner callback that #121009 added for Slack/Discord, soresolveTurnCommentaryProgressOwnerdefaulted durable commentary delivery to enabled while the Telegram draft also rendered each preamble as an interleaved 💬 line. Core's own verbose-visibility decision was frozen per run, but Telegram's draft-side visibility slot remained live, so the two projections could disagree within one turn.This wires the missing callback in
extensions/telegram/src/bot-message-dispatch-turn.ts, gated exactly on when the compositor can render interleaved commentary lines (streamMode === "progress" && commentaryProgressEnabled) and reading the sameverboseProgressActiveslot that core freezes at turn start and re-resolves per admitted follow-up. This mirrors Discord's wiring inmessage-handler.process-progress.ts.handleItemEventalready yields early and the durable lane delivers.commentaryProgressEnabled === false) → callback staysundefined; today's durable-only CLI-commentary path is unchanged (bot-message-dispatch.progress-lifecycle.test.tsstill asserts this).User Impact
One visible copy per completed commentary item during tool-heavy turns. Progress messages no longer grow by repeating status text, keeping long-running work readable in Telegram.
Evidence
Local, current
mainbase67613e73:bot-message-dispatch.progress-updates.test.tsreports 1 failed (owner-callback assertion); restored fix → green.bot-message-dispatch.progress-updates.test.ts30/30, plus full dispatch surface 251/251 across 17 suites (pnpm test extensions/telegram/src/bot-message-dispatch), re-run green after rebase (41/41 across the two touched suites).onVerboseProgressVisibility, draft renders exactly one copy when it owns commentary and nothing when the durable lane owns it.tsgo -p extensions/telegram/tsconfig.json --noEmitclean; oxlint (262 rules) and oxfmt clean on both changed files.Known proof gap: full
tsgo:extensions:test/ core lanes were not completable locally (host CPU saturation); CI covers those lanes.Mock-gateway harness verdict (authorized lane)
Ephemeral topology, all local, no private data in any payload:
gateway run --allow-unconfigured), loopback :19091, isolatedOPENCLAW_STATE_DIR, PR head4a51b972.channels.telegram.apiRoot; every bot-visible call captured to JSONL.exectool call, then the final answer after the tool result.verboseDefault: "on",richMessages: true,streaming.mode: "progress",streaming.progress.commentary: true— the exact repro configuration from [Bug]: Telegram progress draft repeats each commentary update twice #128038.Complete outbound Bot API traffic for the turn:
Verdict: exactly one visible copy of the completed commentary preamble across all outbound traffic; zero duplicated payloads; 2 model requests (commentary+toolcall, then final); final answer delivered.
{"scenario":"telegram-commentary-one-owner","head":"4a51b972","counts":{"commentarySentenceVisibleCopies":1,"duplicateCopiesOfAnyPayload":0,"modelRequests":2,"finalAnswerDelivered":true},"assertion":"PASS"}Scope note: steady-state runs render a single copy on unfixed
maintoo — the defect repaired here is the mid-turn visibility race where draft projection and durable delivery could each project the same preamble. The unit suites prove that frozen-owner contract differentially (regression tests fail pre-fix); this verdict proves the changed path end-to-end through a real gateway process, real channel transport, and real HTTP provider renders exactly one visible copy.