Skip to content

feat(inbound-meta): expose per-turn source modality - #93754

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
liuhao1024:fix/expose-voice-message-type-v3
Jun 16, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
liuhao1024:fix/expose-voice-message-type-v3

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve a typed inbound SourceModality through the shared channel event context.
  • Mark Telegram voice notes as voice without treating ordinary audio attachments as voice notes.
  • Expose source_modality in dynamic per-turn conversation metadata, with bounded MIME-derived fallback for channels that only provide media types.

Fixes #50482

Verification

  • node scripts/run-vitest.mjs src/auto-reply/reply/inbound-meta.test.ts src/channels/inbound-event/context.test.ts extensions/telegram/src/bot-message-context.dm-topic-threadid.test.ts
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main
  • OPENCLAW_TESTBOX=1 node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox -- env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed

Real behavior proof

Behavior addressed: Telegram voice-note origin remains distinguishable after transcription and is exposed to the agent on every turn.
Real environment tested: OpenClaw Telegram inbound context and agent prompt boundary in the repository test harness.
Exact steps or command run after this patch: Ran the focused Telegram, channel-context, and inbound-metadata Vitest shards listed above.
Evidence after fix: The Telegram context test proves msg.voice produces SourceModality: "voice" while ordinary msg.audio does not; the inbound metadata test proves source_modality: "voice" reaches per-turn conversation metadata.
Observed result after fix: Voice-note provenance survives shared context normalization and resumed-session prompt construction.
What was not tested: A live Telegram account sending a real voice note.

@openclaw-barnacle openclaw-barnacle Bot added size: S proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 16, 2026
@vincentkoc vincentkoc self-assigned this Jun 16, 2026
@vincentkoc vincentkoc changed the title feat(inbound-meta): expose message_type in trusted inbound metadata (fixes #50482) feat(inbound-meta): expose per-turn source modality Jun 16, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 16, 2026
liuhao1024 and others added 2 commits June 17, 2026 05:04
…ixes openclaw#50482)

Add resolveInboundMessageType() that extracts the media type prefix
(e.g. 'audio' from 'audio/ogg') from MediaType or MediaTypes fields.
Expose it as message_type in the inbound metadata JSON so agents can
distinguish voice messages from typed text for turn-completion heuristics.
@vincentkoc
vincentkoc force-pushed the fix/expose-voice-message-type-v3 branch from 20d1a2e to 33f0055 Compare June 16, 2026 21:05
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer repair and land-ready verification complete.

  • Replaced stable trusted MIME metadata with typed per-turn source_modality.
  • Preserved Telegram msg.voice through the shared channel context without treating ordinary audio as a voice note.
  • Kept MIME fallback bounded and in untrusted per-turn conversation metadata.
  • Focused proof: node scripts/run-vitest.mjs src/auto-reply/reply/inbound-meta.test.ts src/channels/inbound-event/context.test.ts extensions/telegram/src/bot-message-context.dm-topic-threadid.test.ts (56 + 6 + 19 passed).
  • Direct Codex resume-contract inspection confirmed dynamic source modality must be emitted in the per-turn user context, not the first-turn-only system prompt.
  • Fresh autoreview: clean, no accepted/actionable findings.
  • Testbox changed gate: tbx_01kv93byz8mnxmv3h8ekrh8q59 passed.
  • Final maintained head: 33f00553d2c200608b38d20e7723ee93c9951860.

Known proof gap: no live Telegram account was used.

@openclaw-barnacle openclaw-barnacle Bot added the channel: telegram Channel integration: telegram label Jun 16, 2026
@vincentkoc vincentkoc added the proof: override Maintainer override for the external PR real behavior proof gate. label Jun 16, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. label Jun 16, 2026
@vincentkoc
vincentkoc merged commit 003d310 into openclaw:main Jun 16, 2026
180 of 184 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 17, 2026
* feat(inbound-meta): expose message_type in trusted inbound metadata (fixes openclaw#50482)

Add resolveInboundMessageType() that extracts the media type prefix
(e.g. 'audio' from 'audio/ogg') from MediaType or MediaTypes fields.
Expose it as message_type in the inbound metadata JSON so agents can
distinguish voice messages from typed text for turn-completion heuristics.

* fix(inbound-meta): preserve per-turn source modality

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram proof: override Maintainer override for the external PR real behavior proof gate. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Expose voice message flag in inbound agent context

2 participants