Skip to content

fix(telegram): preserve forum topic routing - #76920

Closed
kesslerio wants to merge 10 commits into
openclaw:mainfrom
kesslerio:fix/telegram-topic-thread-fallback
Closed

fix(telegram): preserve forum topic routing#76920
kesslerio wants to merge 10 commits into
openclaw:mainfrom
kesslerio:fix/telegram-topic-thread-fallback

Conversation

@kesslerio

@kesslerio kesslerio commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep Telegram thread-not-found fallback for General topic (message_thread_id=1), while failing closed for explicit non-General forum topic sends and direct/private topic sends.
  • Preserve Telegram topic routing for automatic async/heartbeat follow-ups by reusing stored topic thread IDs for plugin-owned group routes.
  • Seed explicit cron announce targets into isolated-session delivery context so completion and heartbeat notices stay on the configured topic instead of falling back to an agent default group.
  • Keep the effective diff focused on Telegram topic routing, cron delivery context, outbound target reconstruction, and the temporary current-main memory-core test-contract shim needed for CI.

Change Type

  • Bug fix
  • Refactor required for the fix
  • Feature
  • Documentation
  • Tests only

Scope

Telegram extension outbound delivery, shared heartbeat target resolution, isolated cron session delivery metadata, and one test-only memory-core mock compatibility update for the current subagent runtime contract.

Linked Issue / PR

Root Cause

The Telegram sender retried 400: message thread not found by removing message_thread_id too broadly. That is safe only for General-topic recovery, but unsafe for explicit non-General forum topics and direct/private topic sends because Telegram can then deliver into the wrong root context.

A separate async path could reconstruct heartbeat/completion delivery from incomplete session metadata. Topic-scoped Telegram sessions and explicit cron announce jobs could lose the thread id before later automatic notices were sent.

Regression Test Plan

  • Explicit forum topic text/media/sticker/poll sends reject after the first thread-not-found error and do not retry threadless.
  • Topic-qualified recipient strings such as telegram:group:<id>:topic:<thread> fail closed.
  • Direct/private and resolved username DM sends with explicit thread ids reject after the first thread-not-found error and do not retry threadless.
  • Draft stream preview/materialize sends fail closed for non-General forum topics and keep the existing stricter DM-preview behavior.
  • Heartbeat target resolution preserves stored thread IDs for plugin-owned group routes when only deliveryContext or origin.chatType carries the topic context.
  • Explicit Telegram cron announce targets persist session delivery context with the resolved chat id and topic thread id.

Real behavior proof

  • Behavior or issue addressed: Telegram topic sends must not silently retry without message_thread_id after Telegram reports message thread not found; async heartbeat/completion delivery must preserve the intended topic route instead of falling back to a group/default route.

  • Real environment tested: Disposable OpenClaw staging gateway on NixOS Linux, PR worktree /tmp/openclaw-pr76920-merge, head f515e5d36ac1166b955838c21489390dbfd9dbe2, using @kesslerClawBot in a real Telegram forum group (-1003908474243). The staging gateway was started from this PR head, and the proof script used the PR's built Telegram runtime, sendMessageTelegram from dist/extensions/telegram/runtime-api.js.

  • Exact steps or command run after this patch: Started the disposable gateway with OPENCLAW_CONFIG_PATH=/home/art/.local/state/openclaw-staging/disposable/openclaw.json and OPENCLAW_STATE_DIR=/home/art/.local/state/openclaw-staging/disposable/state, then ran a redacted proof script from /tmp/openclaw-pr76920-merge that exercised: root chat-scoped send to -1003908474243, explicit General topic -1003908474243:topic:1, invalid explicit non-General topic -1003908474243:topic:999999, and valid explicit non-General topic -1003908474243:topic:16.

  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Copied live output from the staging gateway/proof run. Full PR comment: fix(telegram): preserve forum topic routing #76920 (comment)

    Key copied output:

    head=f515e5d36ac1166b955838c21489390dbfd9dbe2
    chat=-1003908474243
    generalTopic=1
    [telegram] outbound send ok accountId=default chatId=-1003908474243 messageId=14 operation=sendMessage deliveryKind=text chunkCount=1
    rootSend=ok messageId=14 chatId=-1003908474243
    [telegram] outbound send ok accountId=default chatId=-1003908474243 messageId=15 operation=sendMessage deliveryKind=text chunkCount=1
    generalTopicSend=ok messageId=15 chatId=-1003908474243 topic=1
    [telegram] message failed: Call to 'sendMessage' failed! (400: Bad Request: message thread not found)
    invalidTopicSend=failed_closed topic=999999
    invalidTopicCheck=no_threadless_retry_observed
    
    nonGeneralTopicProof=head=f515e5d36ac1166b955838c21489390dbfd9dbe2
    nonGeneralTopic=16
    [telegram] outbound send ok accountId=default chatId=-1003908474243 messageId=17 operation=sendMessage deliveryKind=text threadId=16 chunkCount=1
    nonGeneralTopicSend=ok messageId=17 chatId=-1003908474243 topic=16
    
  • Observed result after fix: Root chat-scoped send succeeded without a topic/thread id; General topic delivery succeeded and remained chat-scoped; an invalid explicit non-General forum topic failed closed and did not retry threadless; a valid explicit non-General forum topic sent with threadId=16, proving delivery stayed in the requested forum topic.

  • What was not tested: I did not run a full live cron or heartbeat follow-up through the gateway in this proof pass. Existing focused tests still cover cron session delivery context and heartbeat topic-route reconstruction.

  • Proof limitations or environment constraints: The live proof covers the real Telegram transport and topic send path. Cron/heartbeat route reconstruction remains covered by focused regression tests rather than a scheduled end-to-end cron/heartbeat run.

  • Before evidence (optional but encouraged): ClawSweeper's current-main/source review for this PR identifies the pre-patch failure mode: explicit Telegram topic sends could retry threadless after message thread not found, and async follow-up routing could lose topic context. The after-fix proof above shows the explicit send path no longer retries threadless for an invalid non-General topic.

Verification

Current head 75acdc52684b07c8355966394f5ad5347a713e0a was refreshed against latest origin/main, trimmed back to the intended nine-file effective diff, and pushed after the commands above passed locally.

Security Impact

Reduces cross-topic message leakage in Telegram forum groups and private/direct topic contexts by failing closed when an explicit thread is stale or invalid, and by preserving topic context for automatic follow-up notices.

Compatibility / Migration

No config migration. Non-General forum topic and direct/private topic sends now surface the Telegram error instead of silently retrying threadless. Explicit cron announce routes now persist the intended delivery context for later automatic notices.

Risks

If an operator intentionally relied on stale explicit topic sends falling back to a root chat, those sends now fail. That behavior was the leakage bug this PR is meant to prevent.

The cron/session change is intentionally limited to resolved explicit delivery targets; bare delivery.mode: none jobs still avoid implicit last-target resolution.

AI Assistance

AI-assisted refresh, simplification, validation, and PR-body update.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: M labels May 3, 2026
@clawsweeper

clawsweeper Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 7:15 AM ET / 11:15 UTC.

ClawSweeper review

What this changes

The branch limits Telegram threadless retries, preserves topic IDs through draft and media sends, and carries explicit cron topic routes into later heartbeat and completion delivery.

Merge readiness

Blocked until stronger real behavior proof is added - 6 items remain

Keep this PR open: it addresses a real Telegram cross-topic delivery problem and current main does not contain its central routing changes, but the branch is conflicted and its intended direct/private fallback change reverses the earlier DM-recovery direction without clear owner approval. The supplied live Telegram proof is meaningful but predates the current head’s media-caption fallback and does not prove the async cron/heartbeat path on the mergeable branch.

Priority: P1
Reviewed head: 16fe70e4f40588c626aa0e65a1a2143a5509d4ee
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has focused routing tests and useful older live proof, but the current conflicted head lacks proof for its newest behavior and an owner decision is still needed for compatibility.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR contains credible redacted live Telegram forum output, but it runs an older head and does not demonstrate the current media-caption fallback or current-head async route behavior; add redacted current-head evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR contains credible redacted live Telegram forum output, but it runs an older head and does not demonstrate the current media-caption fallback or current-head async route behavior; add redacted current-head evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main gap: The current-main Telegram sender imports only the existing typing-thread helper and does not contain this PR's shared threadless-fallback policy or its explicit thread-not-found guard, so the central behavior is not already implemented on main.
Changed routing boundary: The PR adds a shared policy that permits a threadless retry only for no thread or Telegram's General topic, with a separately gated DM path; the same policy is applied to normal sends and draft-stream sends.
Prior compatible behavior: Merged PR #30892 established one-shot threadless recovery for DM-thread sends while keeping forum sends fail-closed. This branch intentionally changes the direct/private half of that established behavior, so the compatibility policy needs an owner decision.
Findings 1 actionable finding [P1] Preserve DM recovery unless owners adopt the breaking contract
Security None None.

How this fits together

Telegram inbound topic metadata becomes an outbound message_thread_id when OpenClaw replies or sends media. Cron and heartbeat flows later reconstruct that delivery target from session state, so losing the topic ID can send automatic notices to the wrong chat context.

flowchart LR
  A[Telegram forum topic] --> B[Inbound session route]
  B --> C[Telegram outbound send]
  C --> D{Thread-not-found error?}
  D --> E[General-topic recovery]
  D --> F[Fail closed for explicit topic]
  G[Cron announce target] --> H[Session delivery context]
  H --> I[Heartbeat or completion route]
  I --> C
Loading

Decision needed

Question Recommendation
Should explicit direct/private Telegram topic sends replace the previously merged DM threadless-retry recovery with fail-closed behavior when Telegram reports a stale thread? Adopt fail-closed direct/private routing: Treat an explicit direct/private topic as a scoped destination, document the resulting delivery error, and require refreshed current-head proof before merge.

Why: This is a deliberate delivery-scope tradeoff: fail-closed behavior avoids cross-topic/root-chat leakage, while the prior merged behavior preserves recovery for stale DM thread IDs. Tests cannot choose the supported compatibility contract.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR contains credible redacted live Telegram forum output, but it runs an older head and does not demonstrate the current media-caption fallback or current-head async route behavior; add redacted current-head evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve DM recovery unless owners adopt the breaking contract (P1) - The branch makes direct/private stale-thread sends fail closed, while merged fix(telegram): safe DM threadless retry for missing message_thread_id #30892 established a one-shot DM threadless recovery path. This can break existing recoverable DM-thread sends; retain that behavior or obtain an explicit owner decision and document the upgrade contract before merging.
  • Resolve merge risk (P1) - Merging would replace the previously merged DM stale-thread recovery behavior with fail-closed direct/private delivery for some existing routes; that may prevent cross-topic leakage but can also turn a formerly recoverable send into a user-visible failure.
  • Resolve merge risk (P1) - The branch is currently conflicted with main, so the reviewed code is not yet the actual three-way merge result.
  • Resolve merge risk (P2) - The live forum proof is from an older head and does not cover the current media-caption fallback or a current-head cron/heartbeat delivery run.

Findings

  • [P1] Preserve DM recovery unless owners adopt the breaking contract — extensions/telegram/src/bot/helpers.ts:112-120
Agent review details

Security

None.

PR surface

Source +274, Tests +412. Total +686 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 6 356 82 +274
Tests 6 428 16 +412
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 784 98 +686

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/cron/isolated-agent.direct-delivery-core-channels.test.ts. Confirm migration or upgrade compatibility proof before merge.

Mantis proof suggestion

A current-head Telegram Desktop recording would directly validate that valid topic media stays in the requested topic and invalid explicit topics do not fall back to the root chat. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify the current PR head keeps valid forum text and media sends in the requested topic, while invalid explicit topics fail without root-chat fallback.

Merge-risk options

Maintainer options:

  1. Resolve the fallback contract, then refresh (recommended)
    Choose the supported direct/private stale-thread behavior, rebase the branch cleanly, and prove the selected behavior on the current head before merging.
  2. Accept the fail-closed behavior
    Merge only if an owner explicitly accepts that some stale direct/private sends will now surface an error instead of retrying to the root chat.
  3. Pause the stale branch
    Do not merge the conflicted implementation if no owner wants to adopt the behavior change and refresh its proof.

Technical review

Best possible solution:

First make the direct/private fallback policy explicit: either preserve the established DM recovery path or accept fail-closed routing as the supported contract. Then rebase to a clean current-main result and provide redacted current-head proof for topic media plus one end-to-end async route before merge.

Do we have a high-confidence way to reproduce the issue?

No high-confidence current-main live reproduction was established in this review. The supplied base-fails/head-passes test and older live Telegram transcript make the transport bug source-reproducible, but the current conflicted head still needs a refreshed real setup run.

Is this the best way to solve the issue?

Unclear. The forum fail-closed path is the narrowest way to prevent root-chat misdelivery, but changing direct/private fallback behavior from the merged recovery policy needs an explicit owner decision before it can be called the best solution.

Full review comments:

  • [P1] Preserve DM recovery unless owners adopt the breaking contract — extensions/telegram/src/bot/helpers.ts:112-120
    The branch makes direct/private stale-thread sends fail closed, while merged fix(telegram): safe DM threadless retry for missing message_thread_id #30892 established a one-shot DM threadless recovery path. This can break existing recoverable DM-thread sends; retain that behavior or obtain an explicit owner decision and document the upgrade contract before merging.
    Confidence: 0.82

Overall correctness: patch is incorrect
Overall confidence: 0.77

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 22911713e511.

Labels

Label justifications:

  • P1: This PR addresses a real channel-routing regression that can misdeliver user-visible Telegram messages across topic or chat context.
  • merge-risk: 🚨 compatibility: The branch changes the established direct-message stale-thread recovery behavior and can make existing recoverable sends fail.
  • merge-risk: 🚨 message-delivery: The modified retry and media paths decide whether a Telegram message remains in its requested topic, retries elsewhere, or fails.
  • merge-risk: 🚨 session-state: Cron session metadata and heartbeat route reconstruction now persist and reuse thread IDs for later automatic delivery.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR contains credible redacted live Telegram forum output, but it runs an older head and does not demonstrate the current media-caption fallback or current-head async route behavior; add redacted current-head evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. Valid and invalid forum-topic text or media sends are user-visible Telegram behavior that can be demonstrated in a short Desktop recording on the current head.

Evidence

What I checked:

Likely related people:

  • steipete: The available feature history identifies Peter Steinberger as the recent author of the current Telegram fallback implementation that this PR refines and partially reverses. (role: recent area contributor; confidence: medium; files: extensions/telegram/src/send.ts, extensions/telegram/src/bot/helpers.ts)
  • obviyus: Authored the merged DM-versus-forum fallback boundary in fix(telegram): safe DM threadless retry for missing message_thread_id #30892, which is the most direct compatibility predecessor for this branch. (role: earlier fallback-policy contributor; confidence: high; commits: e6e3a7b497f1; files: extensions/telegram/src/send.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase to a clean current-main result before asking for final review.
  • Add redacted current-head Telegram proof for media-caption fallback and a cron or heartbeat follow-up route.
  • Get explicit owner direction on direct/private stale-thread fallback behavior.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-03T21:02:47.376Z sha 16fe70e :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 5, 2026
@kesslerio kesslerio changed the title fix(telegram): fail closed on stale forum threads fix(telegram): preserve forum topic routing May 5, 2026
@kesslerio

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in d40225f83e.

Addressed the prior review items:

  • Added cfg: TELEGRAM_TEST_CFG to the new Telegram send/sticker/poll tests and removed stale previewTransport test options that no longer exist in the draft stream API.
  • Added a CHANGELOG.md entry.
  • Extended the fix beyond thread-not-found retry: explicit cron announce topic routes are now persisted into isolated-session delivery context, and heartbeat target reconstruction preserves stored topic thread IDs for plugin-owned group routes when the session only has deliveryContext or origin.chatType.

Verification run locally:

  • pnpm test src/infra/outbound/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts
  • pnpm test src/infra/heartbeat-runner.ghost-reminder.test.ts src/cron/isolated-agent/session.test.ts src/cron/isolated-agent.delivery-awareness.test.ts src/cron/isolated-agent/delivery-target.test.ts
  • pnpm test extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts src/cron/isolated-agent.test-setup.ts src/cron/isolated-agent/run.ts src/infra/outbound/targets.test.ts src/infra/outbound/targets.ts
  • git diff --check
  • pnpm check:changed

@hclsys

This comment was marked as low quality.

@kesslerio

Copy link
Copy Markdown
Contributor Author

Rebased and refreshed this PR on current main.

Current head: 54b7b0d1f842
Base tested: origin/main 3f590b48280e
OpenClaw package version tested: 2026.5.12-beta.1
Node/pnpm: v22.21.1 / 11.1.0

Updates in this refresh:

  • Resolved the rebase conflicts against current main.
  • Kept the original fail-closed behavior for explicit non-General Telegram forum topics.
  • Preserved the cron/heartbeat topic-route work from d40225f83e.
  • Ran a simplification pass and collapsed the threadless fallback policy into the shared Telegram helper, while keeping normal send and draft-preview DM behavior distinct.
  • Updated the PR body with tested versions, base/head SHAs, and the remaining live-proof residual.

Local verification:

  • pnpm test extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts
  • pnpm test src/infra/outbound/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts
  • pnpm test src/infra/heartbeat-runner.ghost-reminder.test.ts src/cron/isolated-agent/session.test.ts src/cron/isolated-agent.delivery-awareness.test.ts src/cron/isolated-agent/delivery-target.test.ts
  • pnpm check:changed
  • git diff --check
  • codex review --base origin/main

GitHub check status after push: mergeable, 88 checks passing, 20 skipped, 0 pending. The only failed check is still Real behavior proof, which is expected from the existing label/gate because I cannot provide after-fix live Telegram forum proof from this checkout. This needs maintainer override or a live Telegram bot/forum verification run.

@kesslerio

Copy link
Copy Markdown
Contributor Author

Test-based reproduction proof

This is automated reproduction evidence for the threadless-fallback boundary in this PR. It is not a live Telegram forum smoke, so it should not be treated as replacing the remaining Real behavior proof gate unless maintainers accept test proof for that gate.

Base reproduces the bug boundary

Base: origin/main at 3f590b48280e

I added a temporary failing regression test to a clean base worktree:

pnpm test extensions/telegram/src/draft-stream.test.ts -- -t "reproduction: does not retry forum message preview sends without thread when thread is not found"

Result: failed as expected. Base retries a forum/topic preview send without message_thread_id after Telegram returns 400: Bad Request: message thread not found.

Key failure:

AssertionError: expected "vi.fn()" to be called 1 times, but got 2 times
extensions/telegram/src/draft-stream.test.ts:199:29

That proves the pre-fix behavior still has a threadless retry path for explicit forum sends.

PR head passes the fixed behavior

Head: 54b7b0d1f842

The same behavior is covered by the committed PR test:

pnpm test extensions/telegram/src/draft-stream.test.ts -- -t "does not retry forum message preview sends without thread when thread is not found"

Result:

Test Files  1 passed (1)
Tests  1 passed | 32 skipped (33)
[test] passed 1 Vitest shard

So the current PR head proves base-fails/head-passes for the explicit forum send retry case: when a forum/topic send has a message_thread_id, this PR now fails closed instead of retrying into the group root.

Residual: I still have not run a live Telegram forum bot smoke against this PR head. The local tests prove the fallback bug boundary; they do not prove end-to-end production Telegram delivery into a real forum topic.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 13, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L proof: supplied External PR includes structured after-fix real behavior proof. and removed size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 13, 2026
@kesslerio
kesslerio force-pushed the fix/telegram-topic-thread-fallback branch from 7fe0c05 to bee6adf Compare May 13, 2026 17:55
@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix gateway Gateway runtime labels May 13, 2026
@kesslerio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased this branch onto current upstream/main and addressed the P2 finding plus current-main CI guardrail failures:

  • Direct/private Telegram topic sends now fail closed on message thread not found; no threadless retry for DM/direct sends.
  • PR body has the required Real Behavior Proof fields and current tested versions/head SHA.
  • Patched the inherited lint/type/contract/OpenGrep failures that showed up after rebase (src/media/fetch.ts, plugin runtime config scope, Matrix test runtime boundary, and the sessions-patch lint cleanup).

Local checks run after the update:

pnpm check:test-types
pnpm lint --threads=8
pnpm test extensions/telegram/src/send.test.ts extensions/telegram/src/draft-stream.test.ts src/infra/outbound/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts src/infra/heartbeat-runner.ghost-reminder.test.ts src/cron/isolated-agent/session.test.ts src/cron/isolated-agent.delivery-awareness.test.ts src/cron/isolated-agent/delivery-target.test.ts
pnpm test src/plugins/contracts/deprecated-internal-config-api.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.ts
pnpm test src/plugins/registry.runtime-config.test.ts src/media/fetch.test.ts extensions/matrix/src/matrix/subagent-hooks.test.ts

I could not run local OpenGrep because opengrep is not installed in this environment, but the reported direct Response.arrayBuffer() finding in src/media/fetch.ts is removed.

@clawsweeper

clawsweeper Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@kesslerio
kesslerio force-pushed the fix/telegram-topic-thread-fallback branch from 244d1d0 to d7045b1 Compare May 13, 2026 18:51
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label May 13, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 27, 2026
@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@kesslerio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re_review

kesslerio added 10 commits July 3, 2026 10:58
…back

ClawSweeper P1: the media wrapper passed removeMessageThreadIdParam(
plainMediaParams) even for the first attempt, so an HTML caption parse
error for a topic-scoped media send retried without message_thread_id and
could deliver topic media to the group root. Keep the thread for caption
parse fallback; only strip it for the allowed thread-not-found retry.
@kesslerio

Copy link
Copy Markdown
Contributor Author

@clawsweeper re_review

@kesslerio

Copy link
Copy Markdown
Contributor Author

@openclaw-mantis telegram desktop proof: verify current PR head keeps valid Telegram forum text/media sends in the requested topic and invalid explicit topics fail without a root-chat fallback.

@clawsweeper

clawsweeper Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@kesslerio thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward.

Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive.

Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it.

@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(telegram): preserve forum topic routing This is item 1/1 in the current shard. Shard 40/44.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@obviyus

obviyus commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the careful work here. We retested current main at f2af4e9 with a real Telegram user in non-General forum topic 17. The inbound turn, typing state, and outbound reply all remained in topic 17, with one provider request and one reply. Since current main already has the intended behavior and we cannot reproduce the routing bug, this PR is no longer needed. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants