Repository navigation
fix(telegram): voice mentions are ignored in groups when audio scope rules match on chat type - #163746
Conversation
…match chat type The audio preflight context carried no ChatType, so a tools.media.audio.scope rule that matches on chatType could never apply to it. With a default-deny scope that allows direct chats, voice notes in a Telegram DM were refused.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPass the Telegram conversation type into early audio transcription so existing chat-type scope rules work before voice-mention detection. Example: A mention-required Telegram group allows audio with default deny and a chatType group rule; a captionless voice note says “Open Claw, reply VOICE OK.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete bug still present on current main, with no actionable code or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTelegram inbound processing supplies media and conversation facts to shared audio transcription, then uses the transcript to decide whether a group message mentions the bot. flowchart TD
A[Telegram voice note] --> B[Telegram admission]
B --> C[Audio preflight context]
C --> D[Shared media scope evaluator]
D --> E[Transcription provider]
E --> F[Mention detection]
F --> G[Agent reply]
Technical reviewBest possible solution: Merge the focused context repair through the normal exact-head CI gates. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically omits the field required by group scope matching; the supplied base/head Test Server observations corroborate the failure without a new reviewer-run reproduction. Is this the best way to solve the issue? Supplying the existing classification at its producer fixes the cause without changing scope policy, defaults, routing, or admission guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a4f5ed1dda3b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +2. Total +3 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 14, 2026, 1:59 AM ET / 05:59 UTC (Revision 7). |
|
@clawsweeper proof telegram-bot-e2e-proof |
|
Supplemental local proof for PR #163746 on exact head This is not the requested Telegram Test Server proof yet; the live lane still requires either a maintainer-issued proof command or the QA Convex broker credential pair. It does prove the patched Telegram voice-preflight behavior in the focused regression suite on this PR head. Command run locally from a fresh checkout of PATH=/home/joseph/.local/opt/node-v24.21.0-linux-x64/bin:$PATH \
pnpm exec vitest run extensions/telegram/src/bot-message-context.body.test.ts \
-t 'transcribes only an authorized voice sender|honors topic audio-preflight precedence|preserves named-account.*voice' \
--reporter=verboseResult: Relevant assertion in Live proof status:
Remaining step for merge-clearing proof: run the Telegram Test Server proof lane from a maintainer context or provide the QA broker credential pair through a masked secret path, then attach the live DM-allowed/group-denied observations. |
|
The before/after proof for the group voice-mention case is now in the PR description (same build of this head, run with and without the The re-review it triggered did not run: the ClawSweeper job failed with |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
The latest review has no code findings and rates the proof sufficient (5/6). Its only open item is a Telegram Test Server run assigned to the team proof-lane owner, which needs the team-held QA credentials. Nothing is pending on my side despite the "waiting on author" label that appeared after I pressed Update branch. I tried to produce that Test Server run myself with the repository's userbot driver ( Could a maintainer run the Test Server lane for this scenario, or accept the existing real-Telegram proof in the description? |
|
@obviyus this one needs the Telegram Test Server lane you ran for #166567. ClawSweeper now rates it 5/6 with no findings; its single open item is that team-run step ("no additional contributor proof action"). To make it quick, the scenario is one group with
One practical note: |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer override: the The failing case is
Neither diff can reach the updater. The exact-head ClawSweeper review is ready with no findings. |
* commit '98116a50c5e3191283f12ee210aa774273f2b8fc': (4815 commits) chore(ui): refresh control ui locales (#171839) fix(gateway): server tests time out when a parallel shard starts cold (#171289) fix(agentsapi): allow shared compaction tuning in hosted sessions (#171813) test(live): prepare runtime config for admitted fixtures test(update): stub state-read retry in restart module fixture fix(test): pnpm test fails on small cloud containers (#171732) fix(code-mode): recover safely from invalid wait IDs (#128886) test(update): load acquisition owner in restart regression perf(gateway): avoid full row warmup for project and catalog pickers (#171714) fix(telegram): voice mentions are ignored in groups when audio scope rules match on chat type (#163746) fix(workboard): only promote todo cards to ready (#171743) perf(sqlite): avoid repeated admission registry publication (#171788) perf: skip unused size accounting for sole session actors (#171777) improve(ollama): cover literal fenced command replies (#166561) refactor(talk): admit cross-store voice writes once (#171721) fix(gateway): recover a Gateway stuck in startup instead of blocking every start (#171678) fix(muse): offer Muse Code sign-in from Provider Access (#171790) perf: avoid full device lists during silent pairing (#171703) docs(cloud): one coherent zero-setup cloud environments guide (#171767) fix(test): include cloud move in sidebar action inventory ...
* commit '98116a50c5e3191283f12ee210aa774273f2b8fc': (185 commits) chore(ui): refresh control ui locales (#171839) fix(gateway): server tests time out when a parallel shard starts cold (#171289) fix(agentsapi): allow shared compaction tuning in hosted sessions (#171813) test(live): prepare runtime config for admitted fixtures test(update): stub state-read retry in restart module fixture fix(test): pnpm test fails on small cloud containers (#171732) fix(code-mode): recover safely from invalid wait IDs (#128886) test(update): load acquisition owner in restart regression perf(gateway): avoid full row warmup for project and catalog pickers (#171714) fix(telegram): voice mentions are ignored in groups when audio scope rules match on chat type (#163746) fix(workboard): only promote todo cards to ready (#171743) perf(sqlite): avoid repeated admission registry publication (#171788) perf: skip unused size accounting for sole session actors (#171777) improve(ollama): cover literal fenced command replies (#166561) refactor(talk): admit cross-store voice writes once (#171721) fix(gateway): recover a Gateway stuck in startup instead of blocking every start (#171678) fix(muse): offer Muse Code sign-in from Provider Access (#171790) perf: avoid full device lists during silent pairing (#171703) docs(cloud): one coherent zero-setup cloud environments guide (#171767) fix(test): include cloud move in sidebar action inventory ...
…rules match on chat type (openclaw#163746) fix(telegram): let group voice-note mentions honor the audio transcription scope In a mention-required Telegram group, a voice note that spoke the bot's name was ignored even when the audio transcription scope allowed group chats. The preflight that transcribes voice notes to check for mentions did not pass the chat type, so a `chatType: group` scope rule never matched. The preflight context now includes the chat type. Proof: Telegram Test Server with a real user and a built Gateway, a mention-required group, and audio scope `default: deny` with an allow rule for `chatType: group`. A captionless voice note saying the bot's name was ignored on main. With this change it is transcribed (OpenAI) and the bot replies "VOICE OK". With a direct-only scope, group voice notes are still ignored on both versions. Thanks @jewseppi. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: a voice note mentioning the bot is ignored in a mention-required Telegram group when audio transcription is allowed by a
chatType: "group"scope rule.User Impact
User impact: operators can use chat-type-scoped transcription without losing voice mentions in groups. Direct-only audio rules still do not admit group voice notes. No configuration migration or default changes are required.
Why This Change Was Made
The preliminary transcription context omitted the chat type. Pass the existing group/direct classification to the media scope evaluator before checking the transcribed mention.
Thanks to @jewseppi for reporting and fixing this. The contributor's commits are retained; the revision only removes explanatory comments. No overlap with Pash/Sarah changes.
Evidence
Built Gateway, real Telegram Test Server, Convex-leased TDLib user, captionless OGG voice note saying “Open Claw, reply VOICE OK.” The group required a mention and used the
open[ -]?clawmention pattern. OpenAIgpt-4o-mini-transcribeperformed actual transcription through a host-side proxy; only the reply provider was scripted.Audio scope in the positive case:
{"default":"deny","rules":[{"action":"allow","match":{"chatType":"group"}}]}The negative control replaced
groupwithdirect. All four cases downloaded the real Telegram voice attachment successfully and observed the same QA user's live TDLib updates for 45 seconds after sending.55cdb94fc8ba4150c00484e8VOICE OK55cdb94fc8ba4150c00484e8Redacted head transcription response:
{"text":"Open claw, reply voice OK."}. The TDLib observer received the separatemessageTextreplyVOICE OKafter the captionlessmessageVoiceNote. Each final proof run deleted its own observed messages and released its lease.Focused regression suite:
node scripts/run-vitest.mjs extensions/telegram/src/bot-message-context.body.test.ts --maxWorkers=1— 34 passed; 82.95 seconds wall time. Isolatedoxfmt --check,oxlint, and build passed. Production delta: +1/-0; test delta: +2/-0 against the merge base. The existing group and direct preflight cases assert the scope input without adding another Gateway fixture.Merge danger: two-way door; reverting removes the context field without persisted state or schema changes. Blast radius is Telegram audio preflight admission, including mention-required group voice notes and direct-chat audio scope evaluation.