Skip to content

fix(hooks): keep ingest commit status off the drain residual - #1838

Merged
ScriptedAlchemy merged 4 commits into
masterfrom
cursor/hooks-ingest-drain-residual-0aa8
Sep 19, 2026
Merged

ScriptedAlchemy merged 4 commits into
masterfrom
cursor/hooks-ingest-drain-residual-0aa8

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • Cursor and Codex hook ingest now take their terminal status from the admission tally, not from the shared per-scope projection drain.
  • A drain residual can no longer promote a pass that persisted nothing into committed, hide a real commit, or invent an exact_duplicate.
  • The advisory Codex stop uses the same durable-terminal contract as the Cursor ingest: committed or exact_duplicate, never accepted_for_replay.

Motivation

packaged_host_ingest_delivers_a_registered_advisory_cycle flaked because the hook and the project catch-up drain one queue. Counting observations_committed beside that drain left the residual in the status equation. Leftover rows made a Codex pass that persisted nothing look committed; an empty residual left the peer-won pass as exact_duplicate. The stop assertion required committed, so which drainer won was the flake.

Changes

  • account_hook_admission keeps Cursor hook deferral and duplicate evidence on the admission, not the drain.
  • ingest_commit_verdict ignores drain messages_upserted when the route's admission owns the commit (Cursor and Codex project). Hermes and other message-counted routes are unchanged.
  • Byte-budget deferral still backpressures.
  • No CI workflow changes.

Test plan

  • cargo test -p tracedecay-sessions --lib runtime::hosts::cursor::tests:: — 13 passed
  • cargo test -p tracedecay-mcp --lib hook_runtime::ingest::tests:: — 13 passed
  • cargo test -p tracedecay-mcp --lib ingest::kernels::tests — 3 passed
  • cargo clippy -p tracedecay-sessions -p tracedecay-mcp --lib -- -D warnings
  • Full advisory daemon journey not re-run here; the status contract is covered by the unit tests above

Checklist

  • No secrets or credentials
  • CHANGELOG not updated (internal status accounting, no user-facing surface change)
  • ci.yml untouched; no pull_request trigger added
Open in Web Open in Cursor 

The hook and the project catch-up share one per-scope projection queue.
Counting observations_committed beside that drain still let the drain
residual decide the terminal status: leftover rows promoted a pass that
persisted nothing into committed, and an empty residual left a peer-won
Codex pass as exact_duplicate. The advisory stop required committed, so
the race was the flake.

Admission now owns the terminal status for Cursor and Codex. A drain
residual cannot commit a pass, hide a commit, or invent a duplicate.
Byte-budget deferral is unchanged. The Codex stop accepts the same
durable terminals as the Cursor ingest and still rejects
accepted_for_replay.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 79c8104

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 19, 2026 06:56
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Pairs with #1800 (Codex stop accepts peer-won exact_duplicate). Prefer merge order: #1838 (admission owns status) then #1800 (journey accepts terminals), or fold journey into this PR.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 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-09-19T07:00:38.557421Z 3cb4bc5 Draft marked ready
ℹ️ 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.

ScriptedAlchemy and others added 3 commits September 19, 2026 08:32
Master run 35431539771 failed Check formatting (projector.rs, query.rs) and
Clippy (items_after_test_module in query.rs) after #1844/#1845 merged
without CI.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 0096ead)
@ScriptedAlchemy
ScriptedAlchemy merged commit f7840f4 into master Sep 19, 2026
1 check 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.

2 participants