Skip to content

refactor(twitch): consolidate inbound and outbound sending - #135254

Merged
steipete merged 2 commits into
mainfrom
codex/qa50-twitch-send-owner
Sep 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa50-twitch-send-owner

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Twitch outbound and inbound delivery now share one sender. The outbound adapter keeps account and target validation, the sender owns Markdown conversion and receipts, and the client manager keeps transport, chunking, logging and its existing success/error envelope. This removes repeated preparation and error plumbing while preserving the public error shape, including the absence of a cause.

Production is +72/−196 = −124 physical lines, or −114 operational lines after excluding deletion of a test-only clearing method. Tests are net −166 lines, including the CI regression coverage below. There are no configuration, dependency, public API, storage or protocol changes.

Validation:

  • The actual owner corpus preserves 75 outcomes and 72 target cases, including validation order, partial chunk failure, attachment joins, intentional no-send, receipts and registry lifecycle. Normalization is limited to generated IDs and clocks.
  • Actual Twurple 8.1.4 runs against a local WebSocket IRC server: ten outcomes, seven PRIVMSG messages and parsed echoes match the baseline. This proves the installed SDK/local protocol flow; it does not claim Twitch authentication or remote acceptance.
  • All 16 public exception shapes match the baseline, excluding source-dependent stacks. 146 maintained tests across ten files passed on the final source.
  • Production/test type checks, formatting, changed-file lint and the remaining selected guards passed. Fresh independent Codex high/P2 review returned scoped-clean. The managed reviewer excluded the unchanged token source after its sensitive-filename preflight; it was inspected locally without bypassing that restriction.
  • A normal full build passed. Emitted-file inspection confirms the plugin still loads its monitor dynamically and both use the same sender chunk, with zero ineffective-dynamic-import diagnostics. The SDK exports, bootstrap guard, runtime post-processing and UI build checks also passed.

Before landing: exact-head CI must pass the production/full-tree dead-code gate. Both local attempts reached the existing 600-second limit on an earlier revision; those failures are retained, and the aggregate changed-file command is not claimed as passed. Earlier lint failures were repaired in the final source and rechecked.

The final patch SHA-256 is 9efed5f57efe83b093f4b8cc6874f479d9a93dd615e8a9d650a54fc2c4639556. The original production files match stable v2026.8.1. No runtime bug or speedup is claimed for this refactor.

Named follow-ups: the Twitch README and missing-token diagnostic still say token where the schema and resolver use accessToken; a pre-existing rapid-client-creation test comment also contradicts the creation-promise owner. These are recorded separately from this frozen delivery change.

The hosted typecheck shard exposed a separate CI defect: package-script presence was inferred from formatted pnpm run output, and the job reported a declared root script as absent. Both remaining listing-based probes now use the step's existing manifest-based has_package_script helper. Current targets still fail when a required script is genuinely missing; historical targets retain their optional-script behavior. Workflow production delta is zero (two lines replaced).

Five behavioral cases execute the actual workflow shell with current/historical package manifests and an unavailable listing command. The old workflow fails three cases; the repaired workflow passes all five plus the existing guard fixture. All 14 selected checks pass. A fresh managed high/P2 review of the combined Twitch and CI change is clean. The exact hosted cause of the listing failure (including any pipe behavior) was not reproduced locally; no such mechanism is asserted. New-head hosted CI, including the full-tree dead-code gate, is still required before landing.

Landing verification: the latest ClawSweeper review (15:34 UTC) has no introduced correctness or security finding. Its CI requests and rank-up are now satisfied by all187 successful/skipped jobs in CI33525719241 on019d3fb1b39c; the hosted dependency checks also close the earlier local dead-code deadlines. A clean three-way merge against current main2cedaddb5e23 retains the independent CI changes and introduces exactly the two reviewed script lookups plus their fixture coverage. The shared sender retains monitor/outbound account and lifecycle ownership; operational production decreases114 lines after excluding10 deleted test-seam lines, and tests decrease166 lines.

@steipete
steipete marked this pull request as ready for review September 1, 2026 14:10
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: twitch Channel integration: twitch size: L maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 11:34 AM ET / 15:34 UTC.

ClawSweeper review

What this changes

The PR routes Twitch monitor replies and direct outbound sends through one sender that strips Markdown, records intentional no-send outcomes, and creates delivery receipts, while also fixing CI script detection to read the package manifest.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The refactor remains useful and the reviewed delivery paths preserve their responsibilities; no introduced correctness or security defect was found. Keep this maintainer-owned PR open until its exact-head CI completes.

Priority: P3
Reviewed head: 019d3fb1b39c17b554723c7742015e4a88ed4bea

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner boundary and focused coverage, with exact-head CI still needed for merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to this maintainer-authored PR; the PR body additionally describes an after-fix local Twurple IRC exercise, but the supplied snapshot contains no independently inspectable trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to this maintainer-authored PR; the PR body additionally describes an after-fix local Twurple IRC exercise, but the supplied snapshot contains no independently inspectable trace.
Evidence reviewed 5 items Shared sender owner: The sender now performs plain-text conversion, intentional no-send handling, client-manager invocation, and receipt construction; its callers provide their already-resolved account and lifecycle owner.
Both delivery callers: The monitor creates its lifecycle-owned manager and sends replies through the shared sender; direct outbound validates the resolved account and passes the registered manager to that same sender.
Boundary coverage: The updated tests cover receipts, Markdown conversion, no-send handling, absent managers, formatted failures, configured-account validation, and registry replacement behavior at the sender and outbound boundaries.
Findings None None.
Security None None.

How this fits together

Twitch chat replies enter through the monitor while agent-initiated sends enter through the outbound adapter; both now pass through one sender before the client manager writes to Twitch. The CI shard reads package scripts to decide which typecheck commands apply to current and historical targets.

flowchart LR
  A[Twitch chat input] --> B[Twitch monitor]
  C[Agent outbound request] --> D[Outbound adapter]
  B --> E[Shared Twitch sender]
  D --> E
  E --> F[Client manager]
  F --> G[Twitch chat]
  H[Package manifest] --> I[CI script check]
  I --> J[Typecheck commands]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is still incomplete, and the supplied test-merge ref is stale, so neither establishes the current three-way merge result despite GitHub reporting the PR mergeable.
  • Complete next step (P2) - No concrete repair is needed; the remaining merge gate is the in-progress exact-head CI run.
Agent review details

Security

None.

PR surface

Source -124, Tests -166, Config 0. Total -290 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 72 196 -124
Tests 6 272 438 -166
Docs 0 0 0 0
Config 1 2 2 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 346 636 -290

Review metrics

Metric Value Why it matters
Production versus test delta production +74/-198 (net -124); tests +272/-438 (net -166) The refactor removes duplicated production delivery plumbing while replacing its focused coverage; the CI repair is a two-line production substitution.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single Twitch sender as the owner of formatting and receipts, with monitor and direct outbound callers retaining their separate account and lifecycle preparation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single Twitch sender as the owner of formatting and receipts, with monitor and direct outbound callers retaining their separate account and lifecycle preparation.

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

Not applicable: this PR refactors existing delivery ownership and repairs CI script detection rather than reporting a separate user bug.

Is this the best way to solve the issue?

Yes: concentrating Markdown conversion, no-send disposition, and receipt creation in the shared sender removes duplicated monitor/outbound preparation while preserving caller-owned account and manager lifecycle.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a maintainability refactor and narrow CI guard correction with no claimed new user capability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable to this maintainer-authored PR; the PR body additionally describes an after-fix local Twurple IRC exercise, but the supplied snapshot contains no independently inspectable trace.

Evidence

What I checked:

  • Shared sender owner: The sender now performs plain-text conversion, intentional no-send handling, client-manager invocation, and receipt construction; its callers provide their already-resolved account and lifecycle owner. (extensions/twitch/src/send.ts:29, f650244fdaf8)
  • Both delivery callers: The monitor creates its lifecycle-owned manager and sends replies through the shared sender; direct outbound validates the resolved account and passes the registered manager to that same sender. (extensions/twitch/src/monitor.ts:202, f650244fdaf8)
  • Boundary coverage: The updated tests cover receipts, Markdown conversion, no-send handling, absent managers, formatted failures, configured-account validation, and registry replacement behavior at the sender and outbound boundaries. (extensions/twitch/src/send.test.ts:36, f650244fdaf8)
  • CI guard repair: The changed typecheck branch uses the step-local manifest-based helper already defined in the same shell step, and the guard fixture exercises current and historical manifests while making pnpm run --silent unavailable. (.github/workflows/ci.yml:3454, 019d3fb1b39c)
  • Current-main and history check: Current main does not contain this PR's Twitch sender refactor, so it is not obsolete. History shows prior merged Twitch delivery and adapter work by the same area contributor. (extensions/twitch/src/outbound.ts:157, 8361f3704dd5)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Wait for the active exact-head CI gates to finish successfully before landing.

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-09-01T14:18:03.780Z sha f650244 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 790bab7 into main Sep 1, 2026
245 checks passed
@steipete
steipete deleted the codex/qa50-twitch-send-owner branch September 1, 2026 15:57
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
…135254)

* refactor(twitch): consolidate inbound and outbound sending

* fix(ci): detect typecheck scripts from package manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: twitch Channel integration: twitch maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant