Keep Discord rich presence alive with bounded persistent IPC - #958
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Fixed the Windows cancellation finding and the CI formatting failure in Independent verification on the final source passed: Rust formatting, locked Clippy with warnings denied, the full core test suite, and a Windows cross-target check of the exact Discord module. Windows runtime behavior and live Discord rendering remain unverified. CI is rerunning. The push targeted only |
Changes
Replace one-shot Discord exchanges with one persistent IPC owner. Discord ties presence to the connection, so dropping the socket immediately after SET_ACTIVITY cleared the activity while the signature cache suppressed retries.
Keep a bounded latest-intent mailbox, correlate command replies, require READY, handle PING/CLOSE/EOF, and reconnect with capped backoff. Service drop releases the connection and stops the worker. Preserve legacy RPC timestamp units in seconds.
Use bounded overlapped Windows I/O with heap-owned pending buffers. If cancellation cannot complete, retain the live operation memory safely and disable further IPC for that service instance. This bounds abandoned resources and keeps session callers responsive.
Verification
Independently reviewed the final lifecycle, queue, framing, and Windows code and reran:
Fake IPC uses real Unix sockets and models connection-bound activity, restarts, fragmented replies, command errors, floods, opt-out, shutdown, and stalled peers. Regressions also cover latest-intent races, terminal-state spins, cancellation completion classification, and buffered-frame deadlines.
The configured application ID was independently checked through Discord's public RPC metadata and resolves to OpenNow.
Limits
No live Discord client was available, so real presence rendering and external-image acceptance remain unverified. The Windows path is compile-checked and tested through injected lifecycle/completion logic, not executed on a Windows host. Full Windows core cross-compilation was unavailable because native dependencies require the Windows build toolchain.