Skip to content

fix(twitch): send channel-prefixed targets to Twitch channels - #105909

Closed
lzw112 wants to merge 1 commit into
openclaw:mainfrom
lzw112:fix/twitch-channel-target-normalization
Closed

lzw112 wants to merge 1 commit into
openclaw:mainfrom
lzw112:fix/twitch-channel-target-normalization

Conversation

@lzw112

@lzw112 lzw112 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users sending Twitch messages to a channel-prefixed target such as twitch:channel:OpenClaw or twitch-chat:group:OpenClaw could fail to deliver to the intended Twitch channel.

Twitch already accepted those canonical channel targets when building outbound session routes. For example, twitch:channel:OpenClaw is routed as the openclaw group conversation in extensions/twitch/src/plugin.test.ts. However, the normal message-send target normalization path did not expose Twitch's existing target normalizer through the plugin messaging metadata. As a result, ordinary message sends could pass the raw prefixed string into Twitch outbound delivery instead of the actual channel name.

Concrete example before this fix:

  • User/model target: twitch:channel:OpenClaw
  • Expected Twitch channel: openclaw
  • Actual send target could remain effectively prefixed because the shared message target normalizer had no Twitch normalizeTarget hook.

Why This Change Was Made

This change exposes Twitch's existing normalizeTwitchMessagingTarget through the standard channel messaging metadata and declares the supported Twitch target prefixes (twitch, twitch-chat).

That keeps the normal message tool path aligned with Twitch's existing outbound session routing behavior. It does not add a new target format; it makes the already-supported twitch:channel:* and twitch-chat:group:* forms work consistently for real message sends.

User Impact

Users can now send Twitch messages using the same prefixed target forms OpenClaw already uses for routed Twitch conversations:

  • twitch:channel:OpenClaw
  • twitch-chat:group:OpenClaw
  • #OpenClaw

All of these normalize to the actual Twitch channel openclaw before delivery.

Unsupported Twitch direct-message-style targets still do not become valid channel targets. The regression test keeps twitch:user:alice and twitch:dm:alice normalized to an empty target, matching the plugin's group-channel-only behavior.

Evidence

Code evidence:

  • extensions/twitch/src/plugin.ts already had normalizeTwitchMessagingTarget, which strips twitch / twitch-chat provider prefixes and channel/group kind prefixes before normalizing the Twitch channel.
  • The same file's outbound session route already used that helper to route twitch:channel:OpenClaw as openclaw.
  • The fix wires that existing helper into messaging.normalizeTarget and declares messaging.targetPrefixes.

Regression coverage added in extensions/twitch/src/plugin.test.ts:

  • twitch:channel:OpenClaw normalizes to openclaw
  • twitch-chat:group:OpenClaw normalizes to openclaw
  • #OpenClaw normalizes to openclaw
  • twitch:user:alice and twitch:dm:alice remain unsupported direct targets

Validation run:

OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/twitch/src/plugin.test.ts

Result:

[test] passed 1 Vitest shard

Also checked:

git diff --check

Proof gap:

  • Blacksmith/Testbox prewarm was unavailable in this environment because the Crabbox wrapper failed its basic sanity check.
  • Autoreview could not run here because the codex executable is not installed in this environment.

@openclaw-barnacle openclaw-barnacle Bot added channel: twitch Channel integration: twitch size: XS labels Jul 13, 2026
@lzw112
lzw112 force-pushed the fix/twitch-channel-target-normalization branch from 671d5d3 to 8ca6bce Compare July 13, 2026 03:26
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 13, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close this stale PR: its small owner-plugin fix remains plausible, but the branch is conflicted, has had no author activity since 2026-07-13, and never supplied the real message-delivery proof requested on 2026-07-24.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

Retire this unmergeable stale branch and carry the two metadata declarations into a current-main replacement only after a real Twitch delivery or approved mock-gateway harness demonstrates the normalized outbound target.

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

Yes, from source: current main routes a Twitch-prefixed target through shared normalization without a Twitch normalizeTarget hook, leaving the raw target for the outbound adapter; this review did not execute contributor code.

Is this the best way to solve the issue?

No for this branch as a landing vehicle: exposing the existing plugin normalizer is the right owner boundary, but the stale conflicted branch needs a current-main rebase and real delivery proof.

Security review:

Security review cleared: The diff only changes Twitch plugin metadata and tests; it adds no dependency, credential, workflow, or supply-chain surface.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current-main defect remains: Current main has the Twitch normalizer and uses it for outbound session routing, but its messaging metadata does not expose normalizeTarget or targetPrefixes; shared target normalization therefore has no Twitch hook. (extensions/twitch/src/plugin.ts:55, b6548e509aac)
  • Shared consumer contract: Shared outbound normalization calls only plugin.messaging.normalizeTarget and otherwise retains the raw target, so a Twitch-prefixed target is not canonicalized on current main. (src/infra/outbound/target-normalization.ts:117, b6548e509aac)
  • Proposed owner-boundary repair: The branch adds the two missing messaging metadata fields and tests prefixed group/channel inputs plus rejected direct-message forms. (extensions/twitch/src/plugin.ts:99, 8ca6bce51f7f)
  • Stalled proof gate: The branch commit is dated 2026-07-13T11:26:17+08:00; the supplied context records the proof request on 2026-07-24 and no subsequent author commit or real-delivery evidence. (8ca6bce51f7f)
  • Current-path provenance: Blame attributes the current Twitch messaging block to the recent current-main refactor commit, providing a routing contact for a replacement based on current main. (extensions/twitch/src/plugin.ts:99, 144a59883152)

Likely related people:

  • Peter Steinberger: Current-main blame assigns the Twitch messaging block, including the existing normalizer and session route, to this recent refactor commit. (role: recent current-main contributor; confidence: medium; commits: 144a59883152; files: extensions/twitch/src/plugin.ts)

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

@clawsweeper

clawsweeper Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@lzw112 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 added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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

Labels

channel: twitch Channel integration: twitch P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS 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.

1 participant