Repository navigation
fix(discord): avoid blocking presence event handling - #149576
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: needs maintainer review before merge. Reviewed September 15, 2026, 9:49 PM ET / September 16, 2026, 01:49 UTC. ClawSweeper reviewWhat this changesMoves Discord greeting cooldown storage off the Gateway event loop and drains pending presence work during shutdown while preserving existing cooldown data and rules. Merge readiness✅ Ready for maintainer review The change remains useful: current main and the latest release still perform synchronous cooldown storage. No blocking introduced defect was found, and this maintainer-authored PR is protected from automatic closure. Priority: P2 Review scores
Verification
How this fits togetherDiscord presence updates feed a listener that checks greeting policy, channel visibility, and cooldowns before waking an agent. The shared SQLite worker now handles cooldown operations while the listener retains ordering and publication control. flowchart TD
A[Discord presence updates] --> B[Presence listener]
B --> C[Policy and channel visibility]
C --> D[SQLite worker cooldown claim]
D --> E[Recheck policy and session]
E --> F[Queue greeting and wake agent]
G[Provider shutdown] --> B
G --> H[Drain pending work and rollback]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +43, Tests +203, Docs +7. Total +253 across 12 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing asynchronous storage owner while retaining durable-before-greeting ordering, current-policy checks, conditional rollback, and joined shutdown. Do we have a high-confidence way to reproduce the issue? Yes, at source level: configured presence greetings on current main perform synchronous SQLite operations inside event handling. Runtime stall duration was not measured in this read-only review. Is this the best way to solve the issue? Yes. The patch adopts the existing worker-backed API and preserves its storage contract, while addressing the ordering and cleanup obligations introduced by awaiting persistence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fc1cadae3286. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Presence updates can stall Discord event handling while cooldown state is read or written synchronously.
User Impact
Presence cooldown persistence runs off the Gateway event loop, while greetings still wait for a durable claim and stale work cannot publish after a policy change, session replacement, or shutdown. Existing cooldown data, eight-hour expiry, and capacity rules stay compatible without migration.
Thread-binding persistence retains its shipped synchronous completion contract. On older hosts without conditional deletion, a failed greeting leaves its cooldown to expire instead of risking deletion of a newer reservation.
Why This Change Was Made
Use the existing asynchronous keyed-store owner for cooldown reads, claims, and atomic conditional rollback. Recheck policy and Gateway generation after storage waits, and join active work during provider cleanup, including work detached by reconnect resets and cleanup following a message-handler failure.
Evidence
pnpm buildpassed, including SDK export verification and the UI build.Validation uses synthetic Discord events and isolated SQLite state; no live channel sends were performed.