Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 12:12 AM ET / 04:12 UTC. Summary PR surface: Source +9, Tests +47. Total +56 across 3 files. Reproducibility: yes. from source inspection: aborting after a failed READY restart leaves the raw two-second timer running until its next loop check. The submitted wall-clock harness demonstrates that path, although this review did not establish it against a real Discord connection. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep one abort-aware READY retry delay regardless of whether the final policy remains fixed or becomes exponential, with focused regression coverage and a redacted live Discord account stop or restart transcript demonstrating prompt cancellation. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: aborting after a failed READY restart leaves the raw two-second timer running until its next loop check. The submitted wall-clock harness demonstrates that path, although this review did not establish it against a real Discord connection. Is this the best way to solve the issue? Yes. Reusing the existing abort-aware sleep helper at the exact uncancellable delay is narrower and more maintainable than adding another timer or lifecycle abstraction, provided any exponential-backoff follow-up preserves the signal. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 4b7f193c9d57. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +47. Total +56 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: wangmiao0668000666 <[email protected]>
|
Merged via squash.
|
…penclaw#108561) * fix(discord): honor abortSignal during gateway READY retry backoff * fix(discord): avoid __testing alias to satisfy Knip production scan * test(discord): make READY abort proof deterministic Co-authored-by: wangmiao0668000666 <[email protected]> * fix(retry): support unref abort sleeps Co-authored-by: wangmiao0668000666 <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
The bare setTimeout in ensureBrowserRunning prevents abort during the 250ms retry window. Replace with sleepWithAbort + .catch + throwIfAborted so the caller's abort signal cancels promptly while preserving the original abort reason in the error response. Add a real-timer production-route proof test exercising the actual registerBrowserTabRoutes handler with real performance.now() timers. Related: openclaw#108561, openclaw#108408
…penclaw#108561) * fix(discord): honor abortSignal during gateway READY retry backoff * fix(discord): avoid __testing alias to satisfy Knip production scan * test(discord): make READY abort proof deterministic Co-authored-by: wangmiao0668000666 <[email protected]> * fix(retry): support unref abort sleeps Co-authored-by: wangmiao0668000666 <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
waitForGatewayReadyinextensions/discord/src/monitor/provider.lifecycle.ts:402-405slept the fullDISCORD_GATEWAY_READY_RETRY_BACKOFF_MS = 2_000between READY retry attempts using a baresetTimeout(resolve, ms)that never received the owning monitor'sAbortSignal. WhenmonitorDiscordAccount.stop()fires mid-backoff, the loop sits through the full 2 s before the nextwhile (!params.abortSignal?.aborted)check at line 371 notices.Sibling abort points around it are wired correctly:
restartGatewayAfterReadyTimeout(line 396) already honors the signal at lines 73, 80, 115, 173. Only the backoff sleep itself was unwired. PR #104339 (open) replaces this fixed 2 s backoff with exponential backoff up to 30 s+, making the unwired sleep more visible once it lands — whichever PR merges first, the other rebases cleanly (disjoint lines).Why This Change Was Made
The retry-backoff sleep is now
sleepWithAbort(..., params.abortSignal)wrapped intry { ... } catch { return; }.sleepWithAbort(packages/retry/src/index.ts:36) rejects on abort, the same shape used by sibling callerschannel.ts:713-717andmessage-handler.retry.ts:52inside this plugin.waitForGatewayReadyis exposed via atestingexport re-exported fromtest-api.tsso the regression test can drive the production path directly; signature and behavior for the existing caller at line 532 are unchanged.The inner READY poll sleep at line 354-357 (
DISCORD_GATEWAY_READY_POLL_MS = 250) is intentionally left alone: the enclosingwhilealready re-checks abort every 250 ms, the same cadence as the poll.No new config, no new env, no SDK change, no shared helper change.
User Impact
Stopping or restarting a Discord account while the gateway is mid READY retry no longer holds the loop for the remainder of the 2 s backoff. The loop now exits on the next abort event, the same cadence already used by the sibling session-conflict retry and channel startup delay. Happy-path behavior is unchanged.
Evidence
Fix before
Abort fired 950 ms into the 2 000 ms backoff; the loop still waited the full backoff before returning — 1 050 ms wasted.
Fix after
Same harness, same timing; the abort listener now interrupts the backoff sleep immediately — 1 ms response.
connectCalls: 1confirms no second restart cycle fired.How the proof was produced
Uncommitted
scratchpad/discord-lifecycle-abort-proof.tsdrives the productionwaitForGatewayReadywith a stub gateway whoseisConnectedstaysfalse, a realAbortController, and real wall-clock timers.readyTimeoutMs = 200so the first READY wait times out at ~200 ms, the gateway restart runs, then the 2 000 ms backoff starts. Abort fires at 1 200 ms (950 ms into the backoff).Mutation proof
git stash push extensions/discord/src/monitor/provider.lifecycle.ts(keep test changes) → the new test fails withTypeError: waitForGatewayReady is not a functionbecause thetestingexport is part of the fix.Tests & checks
provider.lifecycle.test.ts21/21 passedextensions/discord/src/retry.test.ts30/30 passedtsgo -p tsconfig.extensions.jsonexit=0 (only pre-existingpackages/net-policyerrors)tsgo -p test/tsconfig/tsconfig.extensions.test.jsonexit=0 (same pre-existing errors)oxlintexit=0 on changed filesgit diff --checkcleanProd-only non-test LOC:
+10 / -6on one file.