Repository navigation
fix(telegram): silently skip empty-text sends - #88810
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 9:04 AM ET / 13:04 UTC. ClawSweeper reviewWhat this changesThe PR classifies Telegram rendered-empty API rejections as skips and records delivery, keyboards, media captions, reply targets, and prompt context only for accepted messages. Merge readinessKeep open: current main still lacks this rendered-empty rejection handling, while the exact head implements the shared accepted-versus-skipped delivery boundary with no supported remaining correctness finding. Priority: P1 Review scores
Verification
How this fits togetherTelegram reply and outbound funnels format agent output, send text or media through the Bot API, then record channel receipts and prompt context. This change ensures rejected empty chunks do not become phantom delivery state while accepted earlier chunks remain accurately finalized. flowchart LR
A[Agent reply or outbound text] --> B[Telegram formatting and chunking]
B --> C[Reply or outbound delivery funnel]
C --> D[Telegram Bot API]
D --> E{Accepted, empty skip, or error}
E -->|Accepted| F[Receipts and prompt context]
E -->|Empty skip| G[No delivery state]
E -->|Other error| H[Failure or partial delivery]
F --> I[Visible Telegram message]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +310, Tests +392. Total +702 across 13 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the shared accepted-message accounting only after required exact-head checks complete, retaining the common tracker rather than adding downstream hook or transcript guards. Do we have a high-confidence way to reproduce the issue? Yes: the exact-head live Telegram userbot run reproduces a visible 4,000-character message followed by rejected invisible tail sends, and the source-level regression covers the same path. Is this the best way to solve the issue? Yes: a shared tracker plus accepted-message bookkeeping repairs the producing delivery boundary; downstream hook or transcript guards would leave phantom state possible in sibling funnels. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 74014c286d36. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (27 earlier review cycles; latest 8 shown)
|
|
ClawSweeper P1 findings on this PR addressed in P1.1 — Skipped-send accounting in the caller
P1.2 — deliverReplies regression test New file
P1.3 — Real Telegram round-trip proof Updated PR body adds a second
Local verification:
Branch: |
07dd75c to
b2653e1
Compare
b2653e1 to
f066f09
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Rebased onto current
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Addressed the open P1 ("Preserve first-delivery metadata after an outbound skip") at head c089d2330c9, rebased onto main a29214a. What changed ( One scope note on the finding: reply anchoring in this funnel was not index-broken -- Verification: 4 new regressions (trailing-skip retrofit, leading-skip part indexes, retrofit failure, rich-fallback final accounting) plus the existing hard-error flush test. Exact-head live proof (PR body's Real behavior proof section refreshed): live Bot API run at this head -- trailing chunk rejected @clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
CI note: |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
CI note: the last five runs on this branch each failed a different, unrelated test in the shared runner shards — |
|
Follow-up with sharper evidence, since this branch has now had six red runs on six different shards. The most recent failure is The test's temp workspace is supposed to be a non-git directory; on the runner it resolves as a git repo with no commits, so the code takes the worktree-add path instead of the not-a-checkout path. It passes locally (79/79 in that file). Same test also failed an earlier run here; the other four failures were entirely different tests ( For context, I am going to stop retriggering rather than burn more runner time; happy to re-run whenever CI settles or if a maintainer wants a fresh attempt. |
|
Added the requested redacted exact-head live Telegram evidence to the PR body for @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Rebased onto current Local verification on the same head: 231 focused tests passed; formatting, oxlint, and the Telegram TypeScript check passed; fresh full-diff review found no actionable findings. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Rebased onto current main and pushed exact head |
|
Fresh CI on exact head |
|
Final-head live Telegram proof is now in the PR body for Local verification on this head remains 234 focused tests plus formatting, oxlint, and the Telegram TypeScript check. The only exact-head CI failure is the unrelated gateway non-git-workspace test already identified above. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Alex Mittell <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Supersedes #59725.
What Problem This Solves
Telegram now rejects rendered-empty text with
400: Bad Request: text must be non-empty. A visible answer followed by an invisible tail could therefore send the visible part, then report the whole reply as failed. Voice/media fallbacks could also claim text delivery when Telegram accepted nothing.NO_REPLYis unchanged: it is still removed before channel delivery. This PR does not turn intentional suppression into an error.Root Cause
Telegram delivery tracked empty-content rejection as an unconditional successful skip. That was correct only when another text or media part had actually landed. With zero accepted parts, callers received a false success and could record phantom delivery state.
Final keyboard and prompt-context facts were also reported before the true last accepted Telegram message was known.
Fix
Evidence
Exact head:
c9f126cc7793587e1e78265c783a8962ba640ff6only-throw-errorstyle violations; both were fixed, then exact-head targeted Oxlint passed.Telegram real-behavior proof
telegram-e2e-userbotdrove a dedicated real Telegram user in a DM through an ephemeral exact-head gateway and deterministic mock provider. Provider output was exactly 4,000 visibleAcharacters plus two U+200B characters.{ "verdict": "pass", "head": "c9f126cc7793587e1e78265c783a8962ba640ff6", "driver": "telegram-e2e-userbot", "providerRequests": 1, "telegramApiEmptyRejections": 2, "sutEvents": { "typing": 2, "message": 1, "edit": 0, "delete": 0 }, "visibleMessageLength": 4000, "phantomTailMessages": 0, "visibleErrorMessages": 0 }The Bot API rejected the formatted invisible tail and its plain retry. The user saw one 4,000-character answer and no failure text.
ClawSweeper moves