Skip to content

fix(mcpx): events resume — since=0 gap after trim + 400 on malformed cursors (#1679) - #3057

Merged
dezren39 merged 1 commit into
mainfrom
queue/4237-1679-events-since
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/4237-1679-events-since

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1679 (queue task 4237, per triage task 1881's executed-probe confirmation).

(A) events.SubscribeFrom — the gap check was gated on since > 0, so an explicit since=0 resume after the retained history had been trimmed replayed mid-history with no gap signal (since=1 in the same state did report). The gate is dropped; the uniform formula len(h) > 0 && h[0].Seq > since+1 applies. Untrimmed since=0 still reports no gap (h[0].Seq == 1).

(B) daemon.handleEvents — the strconv.ParseUint error for the resume cursors was discarded, silently coercing a malformed since/Last-Event-ID to 0 (replay everything) or MaxUint64 (replay nothing). Both parameters are now validated when present: unparseable (syntax or range) → HTTP 400 naming the parameter, before stream headers. Absent stays live-only; explicit 0 stays replay-all-retained.

Tests (laptop): go test ./internal/events/ ./internal/daemon/ — both packages pass.

  • TestExplicitZeroReportsAGapAfterTrim: history 3, 10 published, since=0 → gap=true, replay starts at seq 8.
  • TestEventsRejectsAMalformedSince / TestEventsRejectsAMalformedLastEventID: banana / -1 / out-of-range / empty → 400 naming the parameter.
  • TestEventsCursorBehavioursUnchanged: absent = live-only, since=0 replays all retained, since=2 replays nothing, Last-Event-ID=1 resumes after it.

Out of scope per the packet: history sizing, filter semantics, MCP subscriptions/listen translation.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 12:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T12:52:39.713293Z 4e44dfc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61ae954d-c829-452b-877f-68172b875125
Commits

Reviewing files that changed from the base of the PR and between 1f8ab4f and 4e44dfc.

Files selected for processing: 4
  • pkgs/mcpx/internal/daemon/events_cursor_test.go
  • pkgs/mcpx/internal/daemon/server.go
  • pkgs/mcpx/internal/events/events.go
  • pkgs/mcpx/internal/events/events_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39
dezren39 merged commit 454e0fc into main Oct 31, 2026
11 checks passed
@dezren39
dezren39 deleted the queue/4237-1679-events-since branch October 31, 2026 14:20
@dezren39
dezren39 restored the queue/4237-1679-events-since branch November 1, 2026 09:10
@dezren39
dezren39 deleted the queue/4237-1679-events-since branch November 1, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant