Skip to content

fix(sessions): block cover-past on observation commit failures - #528

Merged
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-planfrom
cursor/sessions-cover-past-contract-100d
Aug 19, 2026
Merged

fix(sessions): block cover-past on observation commit failures#528
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-planfrom
cursor/sessions-cover-past-contract-100d

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Live symptom

daemon.err.log (7.9MB) is dominated by ~32k WARNs at ~8630/min:

WARN tracedecay_sessions::runtime::jsonl_observation_admission admission refused; covering past it provider=codex reason=observation_commit_failed

matching a 2.8G user-sessions.db + 415M WAL. Cursor hits the same path. Root cause: ActiveAdmission::capture treated every non-retryable capture error as a deterministic content refusal and wrote AdmissionRefused coverage from a stale in-memory expected_cursor — after a persist that had already committed the row and advanced the source cursor. Each frame produced a successful persist plus a conflicting cover-past cursor write, 32k times, while a live reader held the WAL open.

Cover-past contract (two outcomes)

  1. Exact duplicate (same identity + digest) → idempotent no-op receipt. No WARN, no cover-past, no extra cursor write; the frontier already reflects the durable row.
  2. Cursor-gap past an uncommitted record → typed TranscriptIngestError::HostAdmission block, no retry, the frontier does not advance.

observation_commit_failed, authority_write_failed, and observation_persisted_value_unavailable are store write/read failures, not content refusals — they now take the typed-block arm. Only deterministic content refusals (invalid_observation_contract, privacy_boundary_failed) still cover past so the stream converges. Retryable races (cursor_conflict, still-mounting authority, cancellation) keep their own verdict via host_admission_error instead of being laundered into a terminal NonDurableRecord.

A committed persist whose immediate read-back returns None (missed read-your-writes under a busy WAL) now reports the Queued status persist just wrote instead of failing the capture as PersistedObservationUnavailable; exact_duplicate_reports_authoritative_projection_status still passes when the read succeeds.

Isolated tests (this crate only, no live home dirs)

  • observation_test.rs: persist commits, read-back misses → capture stays Persisted with Queued.
  • runtime/jsonl_observation_admission/tests.rs (tempfile rollouts + MemoryHostAdmission spy):
    • all three commit-failure codes → typed HostAdmission block, advance_non_durable_source_cursor never called, frontier stays put;
    • retryable cursor_conflict keeps retryable: true;
    • invalid_observation_contract still covers past with AdmissionRefused and the stream converges (second pass reads 0 bytes, no re-written coverage);
    • exact-duplicate replay from a lost frontier → no-op receipts, no coverage writes, cursor byte-identical.

cargo test -p tracedecay-sessions (all targets) and cargo clippy -p tracedecay-sessions --all-targets are green. Only crates/tracedecay-sessions is touched; sessions stays robust to the usecases classify_error mapping without changing it.

Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3b26f3c

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

@cursor
cursor Bot force-pushed the cursor/sessions-cover-past-contract-100d branch from e4d59ab to e782c3b Compare August 19, 2026 21:51
@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review August 19, 2026 21:51

@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: e782c3b7e6

ℹ️ 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 crates/tracedecay-sessions/src/observation.rs Outdated
Live daemon.err.log carries ~32k 'admission refused; covering past it'
WARNs (provider=codex, reason=observation_commit_failed, ~8630/min) with a
2.8G user-sessions.db and 415M WAL. The JSONL admission seam treated every
non-retryable capture error as a content refusal and wrote AdmissionRefused
coverage from a stale in-memory cursor over a persist that had already
committed and advanced the source cursor.

Cover-past now has exactly two outcomes: deterministic content refusals
(invalid_observation_contract, privacy_boundary_failed) still cover past so
the stream converges; store commit/read-back failures and retryable races
surface as typed HostAdmission blocks so the frontier never advances over a
record whose durable fate is unknown. A committed persist whose immediate
read-back misses reports the Queued status persist just wrote instead of
failing the capture as PersistedObservationUnavailable.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/sessions-cover-past-contract-100d branch from 94b39dd to fcc5a76 Compare August 19, 2026 22:45
@ScriptedAlchemy
ScriptedAlchemy merged commit 9430898 into codex/tracedecay-total-redesign-plan Aug 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