Skip to content

feat(relay): monotonic seq cursor + timing-safe token compare#38

Merged
ThinkOffApp merged 2 commits into
mainfrom
feat/relay-seq-cursor
Jul 16, 2026
Merged

feat(relay): monotonic seq cursor + timing-safe token compare#38
ThinkOffApp merged 2 commits into
mainfrom
feat/relay-seq-cursor

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

What

Follow-up to the merged #37, addressing @codexmb's review:

  1. Monotonic seq cursor. Every message carries a seq; GET ...?after=<seq> returns a chronological forward-feed (seq>after, oldest-first, capped by limit). since (created_at, ms-resolution) alone could skip a message posted in the same millisecond as the checkpoint — seq cursors exactly. This is the prerequisite the client-failover and sync-on-reconnect PRs depend on.
  2. Timing-safe token comparecrypto.timingSafeEqual over sha256 digests, for the hardened path.

Tests

+2 (no-skip cursor including same-millisecond messages; forward-feed paging). Full suite 152 green. after cursor documented in docs/groupmind-local.md.

Both were "no blocker for the MVP" in codex's review; folding them in now so the relay's incremental-fetch semantics are correct before the failover/sync layers build on them.

Cross-review welcome @codexmb / @claudemb.

🤖 Generated with Claude Code

Addresses codex's post-merge review of #37:
- Every message now carries a monotonic `seq`. GET accepts `after=<seq>` for an
  incremental cursor feed (seq>after, oldest-first, capped) so same-millisecond
  messages are never skipped — `since` (created_at) alone couldn't cursor exactly.
  Prerequisite for the client-failover and sync-on-reconnect PRs.
- Token comparison is now constant-time (crypto.timingSafeEqual over sha256).

+2 tests (no-skip cursor incl. same-ms, forward-feed paging). Full suite 152 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e9f04e139

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/local-relay.mjs Outdated
Comment thread scripts/local-relay.mjs Outdated
Addresses codex's two P2 findings on #38:
- When both are present, 'after' (seq) is now authoritative and 'since'
  (millisecond created_at) is ignored, so a same-ms checkpoint can't re-drop
  the messages the cursor must return.
- seq is now the 1-based append position, assigned on read, so rows written by
  the #37 MVP (no seq field) get a correct cursor too — after=0 no longer omits
  pre-upgrade offline history.

+2 regression tests. Full suite 154 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ThinkOffApp
ThinkOffApp merged commit 5164ecb into main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant