fix(hub): dedupe channel SystemEvents on dedupe_key before INSERT - #132
fix(hub): dedupe channel SystemEvents on dedupe_key before INSERT#132heavygee wants to merge 4 commits into
Conversation
💡 Codex ReviewLine 260 in 6436129 The new lookup targets ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
6436129 to
9bf65a7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bf65a757d
ℹ️ 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".
insertSystemEvent and insertChannelSystemEvent only checked idempotency_key. Re-emits with the same dedupeKey but a different idempotencyKey (e.g. exit-reflection skip reason drift) hit UNIQUE on overseer_events.dedupe_key and returned HTTP 500. Lookup dedupe_key like idempotency and return the existing row as deduped. Fixes tiann#1624 Co-authored-by: Cursor <cursoragent@cursor.com>
Persist namespace on events rows, replace global dedupe_key unique index with (namespace, dedupe_key), and pass request namespace through channel ingest so cross-tenant dedupe keys cannot collide. Closes tiann#1624 (partial — stacked on contrib-state ingest). Co-authored-by: Cursor <cursoragent@cursor.com>
9bf65a7 to
9d91e5a
Compare
Meta ping response — CI + P1 thread addressed @
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d91e5ac17
ℹ️ 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".
Legacy DBs with pre-namespace events tables failed Store init because the composite dedupe index ran before ensureEventsNamespaceColumn could ALTER. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3353ee0a44
ℹ️ 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".
Legacy channel events linked to non-default sessions were left at namespace 'default' after ALTER, breaking namespaced dedupe replay. Copy namespace from sessions.namespace for rows with related_session_id before creating the composite dedupe index. Co-authored-by: Cursor <cursoragent@cursor.com>
…fier cold-review-clean now passes the CI dimension when gh returns an empty check rollup or transport failure (GH 503), matching the existing bot override. Meta classifier treats CRC + merge-clean + no rollup as ✅ instead of⚠️ / "push to trigger bot review". Refs tiann#1624 flake noise on #91/#132. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Channel
POST /api/system-eventsreturned 500 when a producer re-emitted with the samededupeKeybut a differentidempotencyKey(SQLiteUNIQUE constraint failed: events.dedupe_key). Exit-reflection emit helpers use stablededupeKey(exit-reflection:<session>:<pr|0>) and varyidempotencyKeywith a hash of skip/reason text.Mirrors idempotency handling: lookup
dedupe_keybefore INSERT ininsertSystemEvent, exposegetByDedupeKeyon the event store, and check ininsertChannelSystemEventso the route returns200withdeduped: truewithout re-promoting inbox.Test plan
bun test hub/src/web/routes/systemEvents.test.ts(regression: same dedupeKey, different idempotencyKey)Issues
Fixes tiann#1624
Upstream handoff
Stacked on
feat/contrib-state-channel-ingest(1 commit, 4 files). Meta: open cross-repo PR totiann/hapiwhen channel ingest lands (Lane A prepare-only).