Commit Graph

2096 Commits

Author SHA1 Message Date
Ayaan Zaidi a53833e842 fix(telegram): fall back to plain captions when Telegram rejects caption HTML 2026-07-01 16:22:34 -07:00
Ayaan Zaidi 6ef0abbaae fix(telegram): fall back to plain text when rich entities are rejected on the durable send path 2026-07-01 16:22:34 -07:00
Ayaan Zaidi 55d31beeef fix(telegram): age-gate retry-limit spool tombstones (#98776) 2026-07-01 15:32:00 -07:00
Ayaan Zaidi ce9ec4e1c3 fix(telegram): tombstone completed spooled updates to dedupe refetches 2026-07-01 15:32:00 -07:00
Ayaan Zaidi eb41c7d2d3 fix(telegram): requeue spooled replays on transient store errors 2026-07-01 15:32:00 -07:00
Ayaan Zaidi 8dbcf6db16 fix(telegram): back off and dead-letter poisoned spooled updates 2026-07-01 15:32:00 -07:00
Ayaan Zaidi 5a10a29807 fix(telegram): retry transient getUpdates API errors in ingress worker 2026-07-01 15:24:05 -07:00
Ayaan Zaidi abaef63a35 fix(telegram): persist only new sent-message cache entries 2026-07-01 15:24:05 -07:00
Ayaan Zaidi 44e88f550b fix(telegram): keep media retry policy local 2026-07-01 13:05:42 -07:00
luoyanglang f9d7afda10 fix(telegram): narrow durable inbound media retry to transient + abort (#98076)
Review on #98102: the durable-retry classifier treated every MediaFetchError
`fetch_failed` as retryable, but `fetch_failed` also covers permanent failures
(SSRF/guard denials, local Bot API path/read errors). On spooled replay those
would requeue forever with the user-facing warning suppressed.

Move the policy to its owner: add `isDurablyRetryableMediaFetchError` to
`src/media/fetch.ts`, defined as `shouldRetryMediaFetch` (the canonical in-loop
transient policy) plus shutdown/abort `fetch_failed`. A restart-window abort is
the primary inbound-media loss vector and is recoverable on replay, whereas
in-loop retry mid-shutdown is futile; permanent `fetch_failed`, other 4xx, and
size limits stay non-retryable so they cannot loop in the spool.

Telegram reuses the shared helper instead of a local classifier
(`isAbortError`/`isTransientNetworkError` live in core; the classification must
not drift). Adds permanent-`fetch_failed` regression coverage at the unit and
behavioral level. Media-group partial delivery (#55216) unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 13:05:42 -07:00
luoyanglang 14a6cd9ee6 fix(telegram): durably retry inbound media dropped during restart (#98076)
A single-message inbound media fetch failure was handled best-effort: warn
and let the update complete, so bot-core acked the spooled update. During a
restart window the warning send also failed and the document was silently
lost with no durable retry.

Classify transient media fetch failures (network/abort fetch_failed and
408/429/5xx HTTP) and record them as failed-retryable, so spooled-replay
updates are kept and re-driven by the ingress spool with backoff instead of
acked. Live updates still ack and warn; permanent failures (size limit, 4xx)
stay best-effort. The retry notice is suppressed on spooled replay to avoid
repeating it on each replay.

The durable-retry classifier deliberately diverges from media/fetch.ts
shouldRetryMediaFetch on shutdown aborts: in-loop retry of a shutdown abort
is futile, but durable re-spool must retry it -- that abort is the primary
restart-window loss vector. Media-group partial delivery (#55216) is left
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 13:05:42 -07:00
Mark 5db7c3797d Fix Telegram plugin callback routing (#97174)
* fix telegram plugin callback routing

* Add Telegram callback proof coverage

* Fix proof script lint

* Fix Telegram proof CI regressions

* test: fix telegram callback proof CI regressions

* fix: retire registry-owned callbacks

* fix: retire registry-owned callbacks

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-01 19:49:54 +01:00
Ayaan Zaidi 477b27b6f8 refactor(telegram): reuse rich message extraction 2026-07-01 11:27:52 -07:00
Ayaan Zaidi 404e86f09a test(telegram): cover inbound rich message text 2026-07-01 11:27:52 -07:00
Ayaan Zaidi 8c7050423e fix(telegram): extract inbound rich message text 2026-07-01 11:27:52 -07:00
Josh Lehman bde0e4541e refactor: share codex login flow helpers 2026-07-01 11:16:49 -07:00
Eva af8a4540ed Address Codex login review feedback 2026-07-01 11:16:49 -07:00
Eva 918612513f Use nondeprecated provider auth SDK path 2026-07-01 11:16:49 -07:00
Eva 72653b600c Narrow Codex login SDK export 2026-07-01 11:16:49 -07:00
Eva 77edfe7414 Add Telegram Codex login pairing 2026-07-01 11:16:49 -07:00
Eva bfc4e1dcb5 fix(telegram): restore active-run steering 2026-07-01 10:34:20 -07:00
Ayaan Zaidi a5e11c0083 fix(plugin-sdk): honor suppressReply across native commands 2026-07-01 09:09:45 -07:00
Alexander Chen a1553c96fd test(telegram): restore DM binding regression test alongside suppression test
ClawSweeper review flagged that the new suppressReply test replaced the
existing direct-message binding regression test instead of being added
beside it. Restore the DM binding test to maintain coverage for the
plugin command dispatch surface.
2026-07-01 09:09:45 -07:00
alexuser 20fcd4a39c fix(telegram): suppress fallback reply when plugin command returns suppressReply: true
Adds  to the  type so plugin
commands that handle their own transport delivery (e.g. via Telegram Bot API
directly with retry logic, IPv4 forcing, etc.) can signal the channel adapter
to skip the fallback reply.

When a plugin command handler returns , the Telegram
native command dispatcher now:
1. Cleans up any progress placeholder
2. Returns early without sending the "No response generated. Please try again." fallback

Includes detailed JSDoc for the new  flag explaining its use
for plugin commands that deliver their own responses via channel-native APIs.

Fixes #80756
2026-07-01 09:09:45 -07:00
Marvinthebored b3b51b0c91 fix(anthropic): surface Discord pre-tool commentary
Route Anthropic pre-tool narration through the commentary progress lane, preserve shared channel progress defaults, and keep Discord/Telegram reasoning gates explicit.

Thanks @Marvinthebored!
2026-06-30 18:12:07 -07:00
Peter Lee e1724474d6 test(telegram): add regression test for forum topic message_thread_id with streamed reasoning (#94526)
* test(telegram): add regression test for forum topic message_thread_id with streamed reasoning

After thorough code tracing of all delivery paths (draft stream, durable,
non-durable, preview hooks), the current main branch already correctly
passes message_thread_id through all paths for the streaming reasoning +
final answer scenario in forum topics. The bug reported in #89352 may have
been resolved by earlier merged changes (media-path preservation,
draft/progress streaming, etc.).

This commit adds a focused regression test covering the combined
scenario to prevent future regressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(telegram): assert forum thread at draft-stream boundary for both lanes

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 17:58:00 -07:00
Vincent Koc 6528912e90 fix(telegram): recover stalled ingress spool claims
Backport of #97118 to release/2026.6.11.

(cherry picked from commit 8346e87808)
2026-06-30 15:54:11 -07:00
Ayaan Zaidi 86bdfec6b7 refactor(telegram): simplify album prompt selection 2026-06-30 10:45:44 -07:00
NianJiuZst 44f3c3e43a test(telegram): satisfy album context lint 2026-06-30 10:45:44 -07:00
NianJiuZst bba63d3fe0 fix(telegram): omit skipped album context 2026-06-30 10:45:44 -07:00
NianJiuZst 9aec0f089b fix(telegram): hydrate album sibling media context 2026-06-30 10:45:44 -07:00
Jason (Json) 455f813d6e fix(telegram): deliver durable reasoning when enabled
Preserve shared reasoning suppression by default while letting Telegram opt into durable reasoning payloads only when it has a deliverable reasoning lane. Covers persistent /reasoning on, separate reasoning stream lanes, and progress-stream suppression.\n\nVerification:\n- node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.test.ts extensions/telegram/src/bot-message-dispatch.test.ts\n- git diff --check upstream/main...HEAD\n- .agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/main --stream-engine-output\n- CI run 28411526182 green, including QA Smoke CI and check-test-types\n- Real behavior proof run 28411676681 passed\n\nPR: #97875
2026-06-29 17:31:06 -07:00
moguangyu5-design b28fcfe843 fix(telegram): fall back to plain text when rich message entity validation fails (#96642)
When Telegram rejects a rich message with RICH_MESSAGE_*_INVALID
(e.g., RICH_MESSAGE_EMAIL_INVALID on /status replies), the delivery
path now falls back to a plain text sendMessage instead of dropping
the reply.

Fixes #96363
2026-06-28 19:00:07 -07:00
llagy009 46434f0c71 fix(telegram): reject surrogate/out-of-range numeric HTML entities 2026-06-28 18:54:24 -07:00
linhongkuan 69b0604f31 fix(telegram): expose sender bot status in context (#96810)
* fix(telegram): expose sender bot status in context

* chore: retrigger PR checks

---------

Co-authored-by: lin-hongkuan <lin-hongkuan@users.noreply.github.com>
2026-06-28 18:40:06 -07:00
Shakker 1d4e7899a4 fix: preserve status model alias display 2026-06-29 00:37:49 +01:00
Ayaan Zaidi 52eb5946c7 fix(telegram): preserve literal reasoning tags 2026-06-28 15:49:03 -07:00
Ayaan Zaidi bc2728c6b1 fix(telegram): track chunked outbound sends 2026-06-28 15:48:24 -07:00
Ayaan Zaidi b5854c6f77 fix(telegram): preserve chunked bot replies 2026-06-28 15:48:24 -07:00
NIO b948c86b2a fix(telegram): bound getChat Bot API response reads (#97274)
* fix(telegram): bound getChat Bot API response reads

* fix(telegram): repair getChat bound-read type and proof script lint

---------

Co-authored-by: NIO <nocodet@mail.com>
2026-06-28 12:29:14 -07:00
NIO a07d59e014 fix(telegram): bound Bot API response reads to prevent OOM (#97271)
* fix(telegram): bound Bot API response reads to prevent OOM

* fix(scripts): make proof-telegram-bound.mjs lint-clean

---------

Co-authored-by: NIO <nocodet@mail.com>
2026-06-28 12:28:51 -07:00
Ayaan Zaidi c52adf7505 test(telegram): cover retained preview chunk gaps 2026-06-27 12:30:57 -07:00
Ayaan Zaidi 199700de26 fix(telegram): replay retained preview gaps 2026-06-27 12:30:57 -07:00
miorbnli ce15f348bb fix(telegram): use idempotent retry context for delete/reaction (#96612)
reactMessageTelegram and deleteMessageTelegram passed context: "send" to
isRecoverableTelegramNetworkError, which disables message-snippet matching
(allowMessageMatch defaults to false only for "send"). Both operations are
idempotent (setMessageReaction / deleteMessage are safe to repeat), yet a
transient snippet-only network error (e.g. "socket hang up", "undici network
error" with no error code) was not retried — stricter than polling/webhook/
unknown, which all default allowMessageMatch to true. Users saw spurious
reaction/delete failures on transient network errors.

Add delete | react to TelegramNetworkErrorContext (additive) and use them at
the two callers. The helper default (context !== "send") is unchanged, so
delete/react now match polling/webhook/unknown. sendMessage keeps "send".

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-27 09:31:52 -07:00
Vincent Koc b8e3de1160 fix(telegram): recover stalled ingress spool claims (#97118)
* fix(telegram): drain ingress with native queue claims

* fix(telegram): bound native claim drain snapshots

* fix(telegram): recover pid-reused ingress claims

* fix(channels): block claimed candidate lanes

* fix(telegram): recover stalled ingress spool claims

* test(telegram): cover native claimNext drain stalls

---------

Co-authored-by: Dallin Romney <dallinromney@gmail.com>
2026-06-27 09:14:14 -07:00
cornna 2100ee7cc8 fix(telegram): avoid duplicate dm chat window context (#89855)
Co-authored-by: Cornna <96944678+ymylive@users.noreply.github.com>
2026-06-27 07:29:57 -07:00
Peter Steinberger 072d3ed7b5 fix(telegram): retain socket failure context (#97130)
Co-authored-by: zhang-guiping <zhang.guiping@xydigit.com>
2026-06-27 02:11:36 +01:00
Josh Avant db255b1154 Fix Telegram spooled claim refresh (#96962) 2026-06-26 01:30:57 -05:00
VACInc 13ecca5408 fix(telegram): back off session init spool retries 2026-06-25 13:41:57 -07:00
Ayaan Zaidi a3b4e8102f test(telegram): fold draft preview surrogate clamp coverage 2026-06-25 09:10:07 -07:00