Commit Graph

832 Commits

Author SHA1 Message Date
Ayaan Zaidi
dc3b10285d fix(telegram): require authorized abort supersede 2026-04-18 10:14:08 +05:30
Rubén Cuevas
996eb9a024 fix: fence Telegram stale reply delivery after abort (#68100) (thanks @rubencu)
* fix(telegram): fence stale reply delivery after abort

* refactor(telegram): narrow abort fence scope

* fix(telegram): ignore stale reply finalization after abort

* fix(telegram): close abort supersession races

* fix(telegram): release abort fences on setup errors

* fix(telegram): discard superseded draft cleanup

* refactor(telegram): distill abort fence cleanup

* fix: fence Telegram stale reply delivery after abort (#68100) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-18 10:02:38 +05:30
Peter Steinberger
a22b789547 test: stabilize telegram status lane test 2026-04-18 02:13:11 +01:00
Peter Steinberger
569247cff8 test: speed channel contract hotspots 2026-04-18 01:36:15 +01:00
Peter Steinberger
ed65e8017d test: slim channel directory contracts 2026-04-18 01:36:15 +01:00
Gustavo Madeira Santana
5ae059db16 test: speed legacy state migration discovery
Keep bundled legacy migration discovery on narrow setup-entry surfaces so
state-migration tests and doctor cold paths avoid unrelated channel runtime
loads. Add targeted setup feature metadata, narrow Telegram/WhatsApp legacy
contracts, and a path-only pairing SDK helper.
2026-04-17 16:41:43 -04:00
Gustavo Madeira Santana
8b76bcba90 test: avoid real Telegram config writes in retry tests 2026-04-17 15:50:41 -04:00
Gustavo Madeira Santana
54e4e16844 Tests: narrow session binding contract setup 2026-04-17 03:36:13 -04:00
Ayaan Zaidi
5aad79571e fix(telegram): clear compaction replay after visible boundaries 2026-04-17 11:18:22 +05:30
Chinar Amrutkar
8205de84a9 fix: clear stale telegram ACP bindings on startup (#67822) (thanks @chinar-amrutkar)
* fix(telegram): clean up thread bindings to stale/failed ACP sessions on startup

When loading persisted thread bindings on manager creation, validate each
ACP session against the session store. Remove bindings where:
- Session entry doesn't exist (deleted externally)
- Session status is failed/killed/timeout
- ACP runtime state is 'error'

This addresses issue #60102 where Telegram DMs remained routed to stale
ACP sessions even after restart, because the binding file persisted
across restarts without validating the target session was still valid.

* fix(telegram): guard against null session entry and transient store read failures

Address review comments on PR #67822:

1. Skip bindings when readAcpSessionEntry returns null or when
   session store is temporarily unreadable (storeReadFailed: true).
   Without this, a transient I/O error would mark all ACP bindings
   as stale and delete them on every startup.

2. Only set needsPersist when bindings were actually removed.
   Previously, stale session keys from OTHER accounts could set
   needsPersist=true even when zero bindings were removed for
   the current account — causing spurious disk writes.

Also clean up redundant optional chaining on entry.status now
that we guard against undefined/nullable sessionEntry.

* perf(telegram): dedupe ACP session reads in startup cleanup

Cache readAcpSessionEntry calls by targetSessionKey. Multiple bindings
to the same ACP session now result in a single session store read instead
of one read per binding.

Addresses chatgpt-codex-connector P2 review comment on PR #67822.

* fix(telegram): skip non-ACP session keys in stale binding cleanup

Address chatgpt-codex-connector P1 review comment on PR #67822:

Plugin-bound Telegram conversations use "plugin-binding:*" keys
with targetKind === "acp", but these are NOT ACP runtime sessions.
readAcpSessionEntry() returns no entry for them, so !sessionEntry.entry
would classify them as stale and delete them on every startup.

Now checks isAcpSessionKey(binding.targetSessionKey) to skip plugin-bound
sessions from the stale session cleanup scan.

Also clarifies the comment to explain why we use targetKind === "acp"
// together with isAcpSessionKey() check.

* fix(telegram): import isAcpSessionKey from sessions/session-key-utils

isAcpSessionKey is not re-exported from openclaw/plugin-sdk/routing.
Fix import to use the correct subpath: openclaw/sessions/session-key-utils.

Addresses chatgpt-codex-connector P1 review comment on PR #67822.

* fix(telegram): import from relative path, remove unused variable

- Import isAcpSessionKey from relative path ../../sessions/session-key-utils.js
  (not openclaw/sessions/session-key-utils which doesn't exist)
- Remove unused 'bindings' variable in for-of loop

Addresses CI failures on PR #67822.

* fix(telegram): export isAcpSessionKey from plugin-sdk/routing

isAcpSessionKey lives in src/routing/session-key.ts, which is already
exported via openclaw/plugin-sdk/routing. Re-export it from routing.ts
so extensions can import via the public plugin-sdk path.

Fixes chatgpt-codex-connector P1: relative path ../../sessions/session-key-utils.js
doesn't exist in the build output, making the Telegram extension fail
module resolution before startup cleanup can run.

* test(telegram): cover startup ACP binding cleanup

* fix: clear stale telegram ACP bindings on startup (#67822) (thanks @chinar-amrutkar)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-17 11:03:36 +05:30
Rubén Cuevas
c65f356ddc fix: keep telegram transient preview across compaction retry (#66939) (thanks @rubencu)
* fix(telegram): keep transient previews across compaction

* test(telegram): cover suppressed approval previews after compaction

* fix(telegram): preserve delayed message-start boundaries

* fix: keep telegram transient preview across compaction retry (#66939) (thanks @rubencu)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-17 10:57:46 +05:30
Peter Steinberger
0dc4c4076c chore: bump version to 2026.4.16 2026-04-17 00:45:04 +01:00
Peter Steinberger
8a37bb4ed6 perf: speed up security audit test imports 2026-04-16 21:54:13 +01:00
Peter Steinberger
372c0051ba test: speed up slow import-boundary tests 2026-04-16 21:14:17 +01:00
Gustavo Madeira Santana
78ac118427 fix(plugins): stabilize bundled setup runtimes (#67200)
Merged via squash.

Prepared head SHA: e8d6738fd0
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-04-15 12:35:18 -04:00
Peter Steinberger
b3fa5880dd build(extensions): bump bundled plugin versions to 2026.4.15-beta.1 2026-04-15 15:06:13 +01:00
Mr.NightQ
b1d03b4057 fix: keep Telegram command sync process-local (#66730) (thanks @nightq)
* fix: use process-scoped cache for Telegram command sync to fix missing menu after restart

Fixes openclaw#66714, openclaw#66682

Root cause: The command hash cache was persisted to disk across gateway
restarts. When the hash matched (commands unchanged), setMyCommands was
skipped entirely. But Telegram bot commands can be cleared by external
factors, so the cached state becomes stale after restart.

Fix: Replace file-based hash cache with a process-scoped Map. This preserves
the rapid-restart rate-limit protection within a single process, but ensures
commands are always re-registered after a gateway restart.

* fix(telegram): drop stale async command cache calls

* fix: keep Telegram command sync process-local (#66730) (thanks @nightq)

---------

Co-authored-by: nightq <zengwei@nightq.cn>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-15 08:02:23 +05:30
François Martin
734bb9c2e7 Telegram/documents: sanitize binary payloads to prevent prompt input inflation (#66877)
Merged via squash.

Prepared head SHA: 09a87c184f
Co-authored-by: martinfrancois <14319020+martinfrancois@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-04-14 20:53:00 -04:00
Vincent Koc
97ee0c6fd3 perf(migrations): trim legacy migration and bind cold paths 2026-04-15 00:38:45 +01:00
Josh Avant
1769fb2aa1 fix(secrets): align SecretRef inspect/strict behavior across preload/runtime paths (#66818)
* Config: add inspect/strict SecretRef string resolver

* CLI: pass resolved/source config snapshots to plugin preload

* Slack: keep HTTP route registration config-only

* Providers: normalize SecretRef handling for auth and web tools

* Secrets: add Exa web search target to registry and docs

* Telegram: resolve env SecretRef tokens at runtime

* Agents: resolve custom provider env SecretRef ids

* Providers: fail closed on blocked SecretRef fallback

* Telegram: enforce env SecretRef policy for runtime token refs

* Status/Providers/Telegram: tighten SecretRef preload and fallback handling

* Providers: enforce env SecretRef policy checks in fallback auth paths

* fix: add SecretRef lifecycle changelog entry (#66818) (thanks @joshavant)
2026-04-14 17:59:28 -05:00
Vincent Koc
2aaa17dc6f fix(ci): restore main typecheck 2026-04-14 18:53:14 +01:00
OfflynAI
3a371a32e2 fix: filter telegram binary caption text (#66663) (thanks @joelnishanth)
* Telegram: filter binary content from msg.caption to prevent token explosion (#66647)

When a user sends a binary document (e.g. .mobi, .epub) via Telegram, raw
binary bytes can leak into msg.caption. getTelegramTextParts() passes this
through to the LLM prompt, causing catastrophic token explosion (~460K tokens).

Add isBinaryContent() that detects non-printable control characters (0x00-0x08,
0x0E-0x1F) and use it to sanitize the text in getTelegramTextParts() before it
reaches the prompt pipeline. When binary content is detected, the text and
entities are both replaced with empty values so the message is still processed
(media placeholder still works) but the binary junk is dropped.

Made-with: Cursor

* fix: distill telegram binary caption filtering

* fix: filter telegram binary caption text (#66663) (thanks @joelnishanth)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-14 22:14:50 +05:30
Vincent Koc
e58d50b7a8 fix(telegram): trust explicit proxy DNS for media downloads (#66461) 2026-04-14 10:42:33 +01:00
VACInc
26e80cc6cc [codex] Telegram: unblock status commands behind busy turns (#66226)
* Telegram: unblock status commands behind busy turns

* fix(telegram): keep export-session on topic lane

* Update CHANGELOG.md

---------

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-04-14 08:57:07 +01:00
Luke
0abe64a4ff Agents: clarify local model context preflight (#66236)
Merged via squash.

Prepared head SHA: 11bfaf15f6
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Reviewed-by: @ImLukeF
2026-04-14 15:38:10 +10:00
Peter Steinberger
55604a9a91 test: keep telegram cache boundary compatible 2026-04-13 20:50:11 -07:00
Peter Steinberger
df84225504 test: align post-rebase full-suite drift 2026-04-13 20:49:39 -07:00
Peter Steinberger
d4f556a052 fix: align latest main type drift 2026-04-13 20:49:39 -07:00
Ayaan Zaidi
3c501d3554 test: remove timer dependency from telegram topic cache tests 2026-04-14 08:58:07 +05:30
Ayaan Zaidi
556905a3f4 fix: restore pnpm check 2026-04-14 08:48:15 +05:30
Ayaan Zaidi
c91d3d4537 fix(telegram): persist topic cache via default runtime 2026-04-14 08:32:27 +05:30
Ayaan Zaidi
4f92b1fbb0 fix(telegram): allow topic cache without session runtime 2026-04-14 08:32:27 +05:30
Ayaan Zaidi
59afcf9922 test(telegram): cover topic-name cache reload 2026-04-14 08:32:27 +05:30
Ayaan Zaidi
ad181b2361 fix(telegram): persist topic-name cache 2026-04-14 08:32:27 +05:30
Vincent Koc
955270fb73 fix(ci): repair telegram ui and watch regressions 2026-04-13 23:49:59 +01:00
Vincent Koc
94779b4fb1 fix(ci): repair telegram topic cache typing 2026-04-13 23:33:41 +01:00
Vincent Koc
8ab89989c2 fix(ci): restore plugin-local whatsapp deps 2026-04-13 23:26:25 +01:00
Vincent Koc
f3283a330b fix(ci): repair extension boundary contracts 2026-04-13 22:37:25 +01:00
Ptah.ai
8c43768e27 fix: expose telegram topic names in agent context (#65973) (thanks @ptahdunbar)
* feat(telegram): expose forum topic names in agent context

Telegram Bot API does not provide a method to look up forum topic names
by thread ID. This adds an in-memory LRU cache that learns topic names
from service messages (forum_topic_created, forum_topic_edited,
forum_topic_closed, forum_topic_reopened) and seeds from
reply_to_message.forum_topic_created as a fallback for pre-existing
topics.

The resolved topic name is surfaced as:
- TopicName in MsgContext (available to {{TopicName}} in templates)
- topic_name in the agent prompt metadata block
- topicName in plugin hook event metadata

Includes unit tests for the topic-name-cache module (11 tests including
eviction and read-recency).

Known limitation: cache is in-memory only; after a restart it falls back
to the creation-time name until a rename event is observed.

* refactor(telegram): distill topic name flow

* fix: expose telegram topic names in agent context (#65973) (thanks @ptahdunbar)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-13 23:38:14 +05:30
Mariano
a56dbae80b test(telegram): add inbound retry regressions (#66075)
Merged via squash.

Prepared head SHA: 175cd25889
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
2026-04-13 20:07:23 +02:00
Vincent Koc
77f1ea0de8 fix(telegram): retry failed approval callbacks 2026-04-13 18:00:38 +01:00
Vincent Koc
aa017bf9dd fix(telegram): retry failed model selections 2026-04-13 17:57:05 +01:00
Vincent Koc
88111453cb fix(telegram): retry failed model browser callbacks 2026-04-13 17:42:06 +01:00
Vincent Koc
1f7f8b02d0 fix(telegram): retry failed pagination preflight 2026-04-13 17:38:02 +01:00
Vincent Koc
f1ec7a75f6 fix(telegram): retry failed plugin binding callbacks 2026-04-13 17:34:59 +01:00
Vincent Koc
0c5471ef8e fix(telegram): retry failed commands pagination callbacks 2026-04-13 17:26:55 +01:00
Vincent Koc
a78d922acf fix(telegram): retry failed model callbacks 2026-04-13 17:24:51 +01:00
Vincent Koc
ab143a754c fix(telegram): retry failed reaction updates 2026-04-13 17:19:46 +01:00
Vincent Koc
8628d05ecd fix(telegram): retry failed group migration updates 2026-04-13 17:16:39 +01:00
Vincent Koc
7c71255948 fix(telegram): defer replay commit until update succeeds 2026-04-13 17:03:17 +01:00