Skip to content

fix(twitch): normalize internal reply targets - #166750

Closed
LinzeShi wants to merge 1 commit into
openclaw:mainfrom
LinzeShi:daily/2026-10-07
Closed

LinzeShi wants to merge 1 commit into
openclaw:mainfrom
LinzeShi:daily/2026-10-07

Conversation

@LinzeShi

@LinzeShi LinzeShi commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: #166672

What Problem This Solves

Fixes Twitch replies failing with an invalid channel-name error when delivery receives an internal target such as twitch:channel:mychannel.

User Impact

Replies and media links reach the intended Twitch channel. Plain channel names, #channel names, and empty-target default-channel delivery retain their existing behavior. Unsupported direct-message targets are rejected before sending.

Why This Change Was Made

The Twitch plugin already understands these target prefixes, but its outbound adapter used a different normalizer. Share the existing plugin-local parser with target resolution and delivery so Twitch receives the bare channel name.

This addresses the target-format failure in the linked report. The separate runtime handoff error remains outside this change.

Evidence

  • pnpm test:extension twitch --maxWorkers=1: 239/239 passed across 17 executed files, 311.91 seconds command wall time. The initial candidate run had 234 passes and five ingress waitForIdle timeouts. A pinned-baseline run passed 225/225 (477.66 seconds), followed by the unchanged candidate passing 239/239 after competing checks finished. Test timeouts and assertions were unchanged. Vitest's file order differed in the last run, so this is not a controlled same-order reproduction or proof that those timeouts are fixed or flaky. The failing ingress owner and fixture are unchanged; their exact failure cause remains unresolved.
  • The outbound regression failed on the original implementation: 4 failures and 28 passes. All four failures passed the internal prefix to delivery instead of the bare channel name.
  • A source-runtime check uses the real outbound adapter, account resolution, sender, registry, and Twurple's toChannelName validator. Only network delivery is replaced by a recording transport. The original reproduction had 8 passes / 8 failures; the final check has 18 passes / 0 failures, including text, media, receipts, allowlist matching, default-channel fallback, and rejection before transport. No live Twitch connection was used.
Before/after runtime output
Before:
CAPTURE transport {"channel":"twitch:channel:proofroom","text":"Hello proof","messageId":"synthetic-message-3"}
FAIL text twitch:channel:ProofRoom: "twitch:channel:proofroom" is not a valid user or channel name. It must be at most 25 characters long, can only include letters, numbers and underscores, and can not start with an underscore.
SUMMARY 8 passed, 8 failed; 11 synthetic transport calls

After:
CAPTURE transport {"channel":"proofroom","text":"Hello proof","messageId":"synthetic-message-3"}
PASS text twitch:channel:ProofRoom
PASS media twitch:channel:ProofRoom
CAPTURE direct {"target":"twitch:user:ProofRoom","resolved":false,"transportCalls":0,"rejected":true}
SUMMARY 18 passed, 0 failed; 9 synthetic transport calls
- Independent P0-P3 review: no remaining actionable findings. - Known Windows baseline failure: the changelog attribution scan reports 1,335 violations on both this patch and a clean checkout of `d72a907b6125`. The entries match exactly; the scanner's docs-mirror path check expects forward slashes. No changelog or scanner files are changed.
  • pnpm test extensions/twitch/src/outbound.test.ts --maxWorkers=1: 40/40 passed. Full command wall time was 971.32 s; Vitest reported 795.74 s, with 707.04 s in transforms. No sleeps, timers, or extra process boots were added. Hosted CI completed successfully. The changed-extension shard ran 218 tests across 15 files in 23.15 seconds (21.48 seconds reported by Vitest); the full job took 170 seconds including setup. This is shard-level timing. CI job.

  • SQLite-worker, timeout-race, and mock-export ratchets passed in their native --staged mode on the same four-file patch. Working-tree SQLite scanning misclassifies Windows backslash paths (806 versus 1,969 calls); the index-based scan preserves Git path identities. Production and extension-test typechecks passed.

  • Doctor contract declarations and closure guards: 6/6 passed across both required files.

  • Changed-file formatting and type-aware lint, plugin boundaries, dependency guards, line/assertion ratchets, deprecation/coercion guards, storage/media/sidecar guards, and import-cycle checks passed. All three unused-export scans passed with the original configurations and acceptance rules. Their initial concurrent runs exceeded the 600-second tool timeout; sequential runs completed in 451 / 1,367 / 934 seconds. No scan rules or baselines were relaxed.

Remaining live validation

An authenticated Twitch test account and channel were not available, so the recording-transport output above is supplemental boundary proof only. This PR still needs an after-fix run in a real Twitch setup; CI passing does not establish delivery.

For a reviewer with a test setup: run this head with the existing Twitch plugin configuration, trigger a normal channel reply whose outbound target is twitch:channel:<channel>, and confirm the reply appears once in that channel. Also check the media-link reply path and a plain-channel control. Capture the redacted terminal delivery result and the resulting Twitch messages. The expected transport channel is the bare channel name, without the internal prefix. Do not publish credentials, private endpoints, or unrelated chat content.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@LinzeShi
LinzeShi marked this pull request as ready for review October 7, 2026 21:24
@openclaw-barnacle openclaw-barnacle Bot added channel: twitch Channel integration: twitch size: S labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR shares Twitch’s existing messaging-target parser across routing and outbound delivery to remove internal prefixes before sending.

Example: Send a reply to twitch:channel:ProofRoom.

  • Before: The sender passes twitch:channel:proofroom to Twitch, causing an invalid channel-name error.
  • After: The sender passes proofroom, the bare channel name.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch has no identified correctness finding and successful exact-head CI, but its useful boundary trace does not establish actual Twitch delivery.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: The agent receives a Twitch message, but its automatic reply fails because an internal conversation address reaches Twitch as a channel name.
Reason: The focused repair restores documented reply behavior; the linked report’s separate runtime-handoff errors are explicitly excluded, so Related is appropriate.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR repairs a source-confirmed Twitch reply-delivery defect still present on main, and no proven replacement supersedes it.

Priority: P1
Reviewed head: 25cab660aeba3d972c51cbf7c0635c0f2de22a80

Before merge

  • Add real behavior proof - The supplied trace exercises the real outbound adapter, account resolution, sender, and registry, showing proofroom replaces twitch:channel:proofroom and unsupported direct targets are rejected before transport; network delivery is substituted, so add redacted screenshots, a recording, or runtime logs from a real Twitch setup demonstrating the changed reply and media-link paths, removing IPs, API keys, phone numbers, and non-public endpoints. 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.

Findings

None.

Tests

  • Missing end-to-end proof: Missing a real Gateway-to-Twitch run showing a prefixed-target reply and media link arrive once in the intended chat, with a plain-channel control.
Agent review details

How this fits together

The Twitch plugin receives internal conversation targets from Gateway reply delivery and translates them into channel names for its Twurple transport.

flowchart LR
  A[Twitch chat] --> B[Twitch monitor]
  B --> C[Agent reply]
  C --> D[Durable delivery]
  D --> E[Twitch target parser]
  E --> F[Twitch outbound sender]
  F --> G[Twurple transport]
  G --> A
Loading

Technical review

Best possible solution:

Use the existing plugin-local parser consistently at Twitch outbound boundaries while preserving account selection, fallback behavior, and delivery safeguards.

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

Source establishes the failure path from the monitor’s prefixed durable target to the prefix-blind outbound sender; the reporter supplies matching release logs, but this review executed no target code.

Is this the best way to solve the issue?

Sharing the existing messaging parser fixes the owning boundary without broadening the low-level channel normalizer or bypassing runtime-handoff safeguards.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0387f4f96a29.

Provenance checked

  • Twitch messaging-target parser keeps the original intent (a2a68d1: Canonical recipient routing requires provider-owned channel identity and rejection of unsupported direct targets.)
  • Outbound account validation, default fallback, sender and receipts keeps the original intent (790bab7: Consolidate sending while retaining account and target validation, transport ownership, receipts, and public error behavior.)
  • Outbound target restrictions keeps the original intent (eaf8d91: Unify target rejection while preserving authorization and verification behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 790cd2a adds extensions/twitch/src/outbound.ts:46 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 790cd2aff2d4; files: extensions/twitch/src/outbound.ts)
  • jaydenfyi: Raw commit f5c90f0 adds extensions/twitch/src/outbound.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f5c90f0e5c7a; files: extensions/twitch/src/outbound.ts)

PR surface

Source +10, Tests +35. Total +45 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 29 19 +10
Tests 1 78 43 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 107 62 +45

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166672
Summary: This PR repairs the canonical report’s target-normalization defect; separate runtime symptoms remain outside its scope.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked report establishes failed automatic Twitch replies, and current main retains the responsible target-format mismatch.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-07T21:30:46.407Z sha 25cab66 :: needs real behavior proof before merge. :: none

Reviewed October 11, 2026, 8:18 PM ET / October 12, 2026, 00:18 UTC (Revision 2).

@obviyus

obviyus commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for digging into this. On current main (fafa5d4) we ran a built Gateway with real Twurple IRC against a local Twitch contract server, with block streaming off so the final reply goes through final delivery. The final-reply target was twitch:channel:proofroom, durable delivery declined it at preflight, and the direct fallback sent PRIVMSG #proofroom correctly. We couldn't reach a real configuration where durable final delivery accepts the prefixed target and then fails. Closing for now. If you can share the config or logs from a run where a Twitch final reply actually failed or went to the wrong channel, reopen and we'll pick it up.

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

Labels

channel: twitch Channel integration: twitch P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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.

2 participants