Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 16, 2026, 12:12 AM ET / 04:12 UTC. Summary PR surface: Source +20, Tests +86. Total +106 across 2 files. Reproducibility: yes. at source level with high confidence: delay the first websocket handler, deliver another event, and close the socket before the first handler completes; the pre-patch listener can reconnect using the prematurely advanced cursor. The supplied report and harness describe this current-main path, though this review did not independently execute it. Review metrics: none identified. Stored data model 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the per-socket ordered queue and post-success cursor commitment after refreshing the branch against current main and confirming the focused gateway tests and real reconnect proof still pass unchanged. Do we have a high-confidence way to reproduce the issue? Yes at source level with high confidence: delay the first websocket handler, deliver another event, and close the socket before the first handler completes; the pre-patch listener can reconnect using the prematurely advanced cursor. The supplied report and harness describe this current-main path, though this review did not independently execute it. Is this the best way to solve the issue? Yes. Serializing work at the websocket-cycle boundary and committing only the successful contiguous cursor is the narrowest maintainable fix and matches the upstream sequential-processing contract; the branch only needs an exact-main refresh before landing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4b7f193c9d57. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +20, Tests +86. Total +106 across 2 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
|
Serialize realtime events and wait for queued handlers before reconnecting so only successfully processed cursors advance. Co-Authored-By: OpenAI Codex <[email protected]>
Keep the last successful cursor when realtime handling fails, then reconnect through durable backlog recovery before reopening the stream. Co-authored-by: 詹幸心0668001037 <[email protected]>
ac8bb62 to
faa987d
Compare
|
Maintainer repair complete on exact head The original queue fix still rejected the entire gateway on a handler failure. A supervisor restart then reset ClickClack startup-tail state, so the failed durable event could still disappear. I changed failure handling to close only that websocket cycle, retain the last successfully processed cursor, and replay the failed event plus later queued events through the HTTP backlog before reopening realtime. A repeated failure during canonical backlog replay remains surfaced to the gateway supervisor. The queue stays lexical to each account/gateway invocation; a slow stream does not block unrelated streams. Proof:
Upstream contract checked against live |
|
Merged via squash.
|
…enclaw#108577) * fix(clickclack): commit websocket cursors after processing Serialize realtime events and wait for queued handlers before reconnecting so only successfully processed cursors advance. Co-Authored-By: OpenAI Codex <[email protected]> * fix(clickclack): replay failed websocket events Keep the last successful cursor when realtime handling fails, then reconnect through durable backlog recovery before reopening the stream. Co-authored-by: 詹幸心0668001037 <[email protected]> --------- Co-authored-by: OpenAI Codex <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…enclaw#108577) * fix(clickclack): commit websocket cursors after processing Serialize realtime events and wait for queued handlers before reconnecting so only successfully processed cursors advance. Co-Authored-By: OpenAI Codex <[email protected]> * fix(clickclack): replay failed websocket events Keep the last successful cursor when realtime handling fails, then reconnect through durable backlog recovery before reopening the stream. Co-authored-by: 詹幸心0668001037 <[email protected]> --------- Co-authored-by: OpenAI Codex <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Closes #108570
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Fixes an issue where ClickClack users could lose an inbound event when a websocket disconnect overlapped slow event processing. The gateway advanced its reconnect cursor before the event handler completed and started each message handler independently, so a reconnect could skip an in-flight or failed event.
Why This Change Was Made
The websocket cycle is the ownership boundary for event order and cursor commitment. It now serializes message processing, commits each cursor only after that event succeeds, waits for queued handlers before a normal reconnect, and terminates the queue on the first processing failure so backlog recovery can retry from the last successful cursor.
User Impact
ClickClack reconnects no longer acknowledge work that has not completed. Normal ordered delivery, malformed-frame skipping, shutdown aborts, and empty-queue reconnects retain their existing behavior.
Evidence
Real behavior proof
Behavior addressed: A websocket reconnect no longer skips an event whose inbound handler is still running or has failed.
Real environment tested: Linux x86_64, Node 24.15.0, commit
ac8bb62b702d92f7535068b872abc72bd10a9873on branchfix/clickclack-commit-cursor-after-processing.Exact steps or command run after this patch:
node --import tsx .artifacts/verify-clickclack-cursor.ts- started a real local HTTP/WebSocket server, delayed the first inbound handler, closed the first socket, and inspected the reconnect cursor and timing.Evidence after fix: Terminal capture of
noderuntime verification (copied live output):Observed result after fix: The second websocket connection opened only after the delayed handler and reconnect backoff completed, and it resumed from the successfully processed
cursor-1.What was not tested: A production ClickClack tenant was not used; the proof used the actual gateway against a local protocol-compatible HTTP/WebSocket server. Cross-platform execution is left to CI.
Tests and validation
The regressions defer the first event to prove strict ordering and reconnect waiting, then reject an event to prove later queued events are neither processed nor committed.
Risk checklist
AI assistance
This PR is AI-assisted. OpenAI Codex helped investigate, implement, test, and review the change. I reviewed the resulting code and understand its behavior. Automated structured review was attempted, but the local review engine failed before producing a clean/finding result; GitHub review and CI remain authoritative.