fix(discord): add timeouts to PluralKit lookup requests#104121
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 5:48 AM ET / 09:48 UTC. Summary PR surface: Source +16, Tests +41. Total +57 across 3 files. Reproducibility: yes. Current main has no PluralKit deadline, and the exact-head controlled stalled-host path provides a high-confidence reproduction method for both header and body stalls. 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:
Next step before merge
Security Review detailsBest possible solution: Merge the focused shared-helper integration after ordinary maintainer handling; keep the timeout internal and fixed rather than adding a Discord-local helper or user-facing configuration knob. Do we have a high-confidence way to reproduce the issue? Yes. Current main has no PluralKit deadline, and the exact-head controlled stalled-host path provides a high-confidence reproduction method for both header and body stalls. Is this the best way to solve the issue? Yes. Reusing the plugin SDK timeout primitive at the Discord-owned lookup boundary is the narrowest maintainable fix; it covers the complete response lifecycle, relays caller cancellation, and preserves optional null degradation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2e2366b6d394. Label changesLabel justifications:
Evidence reviewedPR surface: Source +16, Tests +41. Total +57 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
Review history (5 earlier review cycles)
|
a0d97d4 to
ae5ab9a
Compare
|
@clawsweeper re-review Updated exact head to Changes/proof since the prior review:
Validation: Redacted live/runtime proof from the current head: Output: I do not have a credentialed live Discord message-preflight environment in this local run, so this proof covers the live PluralKit API path plus the runtime caller-abort behavior directly at the patched boundary. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…kit-timeouts # Conflicts: # extensions/discord/src/pluralkit.ts
|
@clawsweeper re-review Latest head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
) * fix(discord): add timeouts to PluralKit lookup requests * fix(discord): bound PluralKit preflight cancellation * docs(changelog): note PluralKit lookup deadline * chore: keep changelog release-owned * test(discord): reject PluralKit aborts with errors --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Discord PluralKit lookups are optional inbound message enrichment, but the PluralKit fetch and response body read did not have a deadline. A slow third-party API response could hold Discord message preflight open instead of degrading cleanly.
Why This Change Was Made
Add a small PluralKit lookup timeout, preserve the caller abort signal from preflight, and keep the timer active until the API body has been read. Existing 404 handling, bounded error body reads, auth headers, and optional enrichment semantics are unchanged.
The latest head also replaces the Discord-local timeout/abort helper with the shared SDK
buildTimeoutAbortSignalhelper, so PluralKit uses the same timeout diagnostics, safe timer bounds, parent abort relay, and cleanup contract as the rest of the plugin SDK HTTP timeout paths.User Impact
If PluralKit is slow or hangs, Discord inbound message handling can abort the optional lookup instead of waiting indefinitely, keeping the core message flow responsive.
Evidence
Exact head after ordinary branch update:
ab842be7a31b8ff2f77cec586265c35bde20a265.Code/merge update:
upstream/mainintoalix/discord-pluralkit-timeoutswith a normal merge commit; no rebase or force-push.extensions/discord/src/pluralkit.ts.createPluralKitLookupSignalhelper.buildTimeoutAbortSignalfromopenclaw/plugin-sdk/extension-sharedwithtimeoutMs: params.timeoutMs ?? 10_000,operation: "discord.pluralkit.lookup", and the redaction-safe PluralKit URL.finally, so the deadline covers the fetch, non-OK bounded error-body reads, and successful JSON body reads.Focused validation run in this worktree:
Controlled stalled-host runtime proof from the current code path:
resolveDiscordPreflightPluralKitInfo()with PluralKit enabled.loadPluralKitRuntime().fetchPluralKitMessageInfo()usedglobalThis.fetch, wrapped byresolveFetch(), and the new SDKbuildTimeoutAbortSignalpath.globalThis.fetchwas temporarily routed from the PluralKit URL to the local stalled server so the network request, abort signal, body read, timeout, catch, and preflightnulldegradation path all ran in-process without Discord credentials.Transcript:
Known proof limits:
command -v crabboxand../crabbox/bin/crabbox --versionfailed; the focused local test/proof commands above are the fallback.ab842be7a31b8ff2f77cec586265c35bde20a265is still running at the time of this body update.