Repository navigation
fix(twitch): wait for authentication before probe success - #178354
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
openclaw/extensions/twitch/src/probe.ts
Lines 63 to 65 in aff5597
When Twitch emits the authentication failure handled here, the pinned @twurple/chat 8.2.0 client emits this callback and then waits its Fibonacci backoff before calling _ircClient.reconnect(). Rejecting causes the probe's finally to call quit(), but that does not cancel Twurple's already-scheduled continuation; it subsequently reconnects after all three probe listeners have been unbound and can continue retrying in the background. Because gateway health/status may invoke this probe repeatedly, rejected credentials can accumulate orphaned Twitch clients and sockets; cancel or otherwise own the library retry through settlement before returning the failed probe.
AGENTS.md reference: extensions/AGENTS.md:L23-L25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs changes before merge. What this changesThis PR makes Twitch probes wait for successful IRC authentication before reporting success. Example: The testbot account connects, then Twitch sends Login authentication failed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it fixes a real false-success status, but waiting for authentication exposes a retry lifecycle defect that can leave probe clients reconnecting after cleanup. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Twitch plugin's status adapter passes account credentials and a timeout to probeTwitch, which creates a temporary Twurple chat client and returns connection status. flowchart LR
A[Channel status request] --> B[Twitch status adapter]
B --> C[Temporary probe client]
C --> D[Twitch IRC authentication]
D --> E[Probe result]
C --> F[Client cleanup]
Technical reviewBest possible solution: Keep authentication-based success and make the temporary probe's transport lifecycle end completely when the probe settles. Do we have a high-confidence way to reproduce the issue? Source confirms that current main accepts transport connection before authentication; the PR reports a matching failing baseline test, but this review executed no target code. Is this the best way to solve the issue? Changing the success event is the smallest status correction, but the real dependency's authentication retry must also remain owned through teardown. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a52ba4f23384. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +25. Total +25 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 Reviewed October 20, 2026, 7:30 AM ET / 11:30 UTC. |
|
Merged via squash.
|
What Problem This Solves
Twitch status probes report a successful connection before Twitch accepts the OAuth credentials. A working IRC socket is not an authenticated chat session.
Why This Change Was Made
Twurple emits
onConnectfor the underlying IRC transport, then emitsonAuthenticationSuccesswhen IRC registration completes. Wait for the latter in the probe, matching the normal Twitch client. Authentication failure, disconnect, the existing timeout, and client cleanup remain unchanged.User Impact
Rejected credentials produce a failed probe instead of a misleading successful status. No configuration, SDK, protocol, dependency, or persistence change. Phase E memory machinery is untouched.
Best-effort tradeoffs accepted
None. This repairs a normal authentication-status outcome and removes no guard.
Evidence
ok: true; exactly one new case failed and four existing cases passed (24.01s wrapper, 12.47s Vitest wall).d8c96213c5cf.Production LOC: net zero (+2/-2); this is a bug fix, not a LARGE cleanup. Release-note context: Twitch status waits for accepted credentials before reporting success.