fix(telegram): preserve outbound prompt context projections#102469
Conversation
32d4ade to
e79c7a3
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 8:56 PM ET / July 11, 2026, 00:56 UTC. Summary PR surface: Source +195, Tests +3165, Docs +1. Total +3361 across 28 files. Reproducibility: yes. Current-main source and the linked live instrumentation show that Telegram-rendered plain text can differ from the canonical Markdown transcript and evade the timestamp-qualified dedupe, although this review did not execute a live current-main reproduction. Review metrics: 3 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsDo we have a high-confidence way to reproduce the issue? Yes. Current-main source and the linked live instrumentation show that Telegram-rendered plain text can differ from the canonical Markdown transcript and evade the timestamp-qualified dedupe, although this review did not execute a live current-main reproduction. Is this the best way to solve the issue? Yes at the design level. Stable transcript identity plus durable proof of a complete multipart projection is narrower and safer than stripping Markdown or matching body text, but exact-head runtime and upgrade proof remain required. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1a9d09a23833. Label changesLabel justifications:
Evidence reviewedPR surface: Source +195, Tests +3165, Docs +1. Total +3361 across 28 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (19 earlier review cycles; latest 8 shown)
|
d74803c to
8779ae8
Compare
Security-sensitive guard clearedThis PR no longer has blocked security-sensitive file changes. A future security-sensitive change requires a fresh
|
83ad940 to
dbdc319
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Co-authored-by: 陈杨俊0668000971 <[email protected]>
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs showing repeated long Telegram replies in chat.
Motion-trimmed clips: |
|
Land-ready maintainer proof for exact head
The Mantis candidate lane passed at the exact PR SHA and published native Telegram Desktop screenshots, GIFs, MP4s, and its raw evidence manifest. The focused suite covers stable source identities, multipart projection completeness, streamed/fallback/media delivery, reply ownership, business identities, and durable SQLite projection state. |
|
Merged via squash.
|




What Problem This Solves
Telegram follow-up turns could include both the canonical assistant transcript row and one or more Telegram-rendered cache rows for the same reply. Markdown rendering, chunking, rich fallback, media delivery, retries, and streaming make visible-text/timestamp comparison unable to prove that two rows represent the same complete assistant turn.
This addresses #102257 and supersedes the narrower approaches in #102259 and #100333.
Why This Change Was Made
Carry the stable transcript message identity into every concrete Telegram delivery and persist a versioned projection with contiguous part indexes and exactly one terminal part. Prompt assembly suppresses the canonical transcript row only when the complete projected Telegram sequence is present; incomplete, invalid, future-version, hook-mutated, or failed sequences retain the transcript instead.
The maintainer rewrite keeps the contract inside the Telegram plugin, uses the shared SQLite-backed plugin state store, migrates the shipped legacy cache through doctor, and applies the same projection owner across plain, rich-fallback, media, streamed, paginated, and retried delivery paths.
User Impact
Telegram conversations no longer spend context on duplicated Markdown-formatted assistant replies. Multipart and repeated-identical replies retain their exact turn identity, while partial delivery or stale cache state fails safe by preserving the full canonical transcript.
Evidence
pnpm check:changedpassed extension/test typechecks, extension lint, database-first guards, and import-cycle checksoxfmt --check: 28 changed files passedContributor credit is retained for @chenyangjun-xy, @consoleaf, and @crabkun.