Repository navigation
refactor(telegram): consolidate outbound contracts and targets - #119438
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 11:27 PM ET / August 5, 2026, 03:27 UTC. ClawSweeper reviewWhat this changesThe branch centralizes private Telegram outbound option contracts and target parsing while preserving sending, editing, forum-topic, and rich-message behavior. Merge readinessNo blocking correctness or security finding was found. This is a behavior-preserving Telegram refactor with sufficient exact-head mock-gateway proof; the protected Priority: P3 Review scores
Verification
How this fits togetherGateway and action requests enter the Telegram plugin, which parses a recipient and optional topic before invoking Telegram operations. Those operations return delivery metadata to the channel and gateway layers. flowchart LR
A[Gateway or action request] --> B[Telegram plugin]
B --> C[Target and option normalization]
C --> D[Send edit or action]
D --> E[Telegram Bot API]
E --> F[Delivery metadata]
Decision needed
Why: The patch is clean, proof-positive, and has no actionable defect, but the protected maintainer label requires an explicit human merge decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource -127. Total -127 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single owner-local outbound contract and parser, then land after an authorized Telegram owner confirms the clean GitHub merge result. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors existing Telegram behavior rather than addressing a reported user-visible defect. Is this the best way to solve the issue? Yes. Consolidating behavior-identical private contracts at the Telegram owner keeps one canonical path without expanding the plugin or SDK surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bf1bdb429ece. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
* origin/main: fix(channels): honor explicit preview streaming settings refactor(telegram): consolidate outbound contracts and targets (#119438) fix(qa): retry transport cleanup and always stop owned labs (#119442) fix(mcp): guard stdio stdout frame parsing against oversized-buffer crash (#119379) refactor(auto-reply): centralize delivery deduplication and routing (#119436) fix(qa): preserve scenario isolation in serial suites (#119439) perf(xai): lazy-load optional capability runtimes (#119374) refactor(browser): consolidate browser CLI and normalization helpers (#119432) fix(qa): require ready transport accounts (#119431) refactor(media): share image and video geometry normalization (#119416) fix(config): preserve plugin metadata for missing config (#119421) fix: retry delivery when outbound adapter is unavailable (#119371) fix(cli): retire invalid secret flags and prove doctor recovery (#118926) refactor(signal): share outbound and reaction transport (#119415)
What Problem This Solves
Telegram outbound actions, edits, forum topics, and rich-message handling duplicated equivalent option contracts and target parsing. This is part of a maintainer-requested project-wide production LOC reduction campaign.
Why This Change Was Made
Move equivalent outbound options to their canonical Telegram owner and share behavior-identical target/record parsing without changing the plugin public surface.
User Impact
Telegram sending, editing, unsafe-topic rejection, reply threading, and rich-message formatting remain unchanged; removes 127 production lines.
Evidence
gpt-5.6-solwithxhighreasoning; no accepted or actionable findings.git diff --check, scoped formatting, and direct before/after behavioral equivalence checks passed.Exact-head Telegram mock-gateway delivery proof
An isolated in-memory mock gateway loaded nine actual committed production modules, verified their exact Git object IDs, and executed the real Telegram outbound adapter through the real send owner and text sender into a synthetic Bot API. No Telegram token, network, operator gateway, or live account was used. The following JSON was actually observed and asserted:
{ "verdict": "PASS", "head": "38250ac3b0afe00f5fcee841df82a291a64fa8bd", "execution": "real Telegram outbound adapter -> real sendMessageTelegram -> real text sender -> synthetic Bot API; no token or network", "cases": [ { "scenario": "target-qualified direct chat", "target": "telegram:123456789", "parsed": {"chatId":"123456789","chatType":"direct"}, "botApiRequest": {"method":"sendMessage","chat_id":"123456789","text":"direct target-qualified delivery","parse_mode":"HTML"}, "gatewayDelivery": {"channel":"telegram","messageId":"9001","chatId":"123456789","meta":{"telegramDeliveredText":"direct target-qualified delivery","telegramHasInlineKeyboard":false}}, "result": {"channel":"telegram","messageId":"9001","chatId":"123456789"} }, { "scenario": "target-qualified forum topic", "target": "telegram:group:-1001234567890:topic:77", "parsed": {"chatId":"-1001234567890","messageThreadId":77,"chatType":"group"}, "botApiRequest": {"method":"sendMessage","chat_id":"-1001234567890","text":"forum target-qualified delivery","parse_mode":"HTML","message_thread_id":77}, "gatewayDelivery": {"channel":"telegram","messageId":"9002","chatId":"-1001234567890","meta":{"telegramDeliveredText":"forum target-qualified delivery","telegramHasInlineKeyboard":false}}, "result": {"channel":"telegram","messageId":"9002","chatId":"-1001234567890"} }, { "scenario": "unsafe topic suffix rejected before Bot API", "target": "telegram:group:-1001234567890:topic:9007199254740992", "parsed": {"chatId":"-1001234567890:topic:9007199254740992","chatType":"unknown"}, "rejection": "Telegram recipient target is not a valid numeric chat ID", "botApiCallsBefore": 2, "botApiCallsAfter": 2 } ] }All production-path assertions passed at the exact reviewed commit. Direct chat, group forum-thread propagation, mock-gateway delivery metadata, and rejection before any unsafe Bot API call are demonstrated without external side effects.
Base-refresh disposition: Current main has not changed any of the seven touched Telegram production paths since this branch diverged. A rebase is therefore intentionally skipped: it would replace the already-reviewed exact commit and invalidate its 427 passing focused tests, full remote changed gate, exact-head hosted ci-gate, and production mock-gateway proof without addressing a conflict. The canonical maintainer merge workflow rechecks current-main drift immediately before landing and treats it as advisory.