Skip to content

fix(sources): settle raw admission so the frontier gate has nothing to refuse - #4704

Merged
Sinity merged 4 commits into
masterfrom
lane/raw-admission-heads
Sep 5, 2026
Merged

Sinity merged 4 commits into
masterfrom
lane/raw-admission-heads

Conversation

@Sinity

@Sinity Sinity commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Four admission defects that each left the raw-frontier source-selection gate
with a row it could neither compare nor settle, so a fresh daemon refused its
whole catch-up backlog.

Problem

Fresh-root rehearsals stopped ingesting with live watcher source-selection gate blocked: N cursor/head authority row(s) could not be compared. Four
distinct causes:

  • polylogue-6vacn — Gemini CLI writes one session as several complete
    checkpoint files that share a sessionId and no byte prefix
    (session-2026-04-02T10-09-56cb9ec1.json and …T10-12-… carry the same id
    with different bytes). A byte-revision cohort over that logical key can only
    fail to order them, so admission logged no unique byte-revision candidate accepted and dropped through, leaving both raws quarantined with no
    receipt of any kind for the gate to read.
  • polylogue-6q16u — a quarantine was lifted the moment the watcher noticed
    a path deserved re-deciding, before anything was admitted. The row then sat
    excluded = 0 carrying its old byte offset until the next acquisition pass,
    and the raw-frontier cursor map reads exactly that shape as committed ingest
    authority with no accepted head. A live database whose stat changes on every
    poll re-entered that window on every poll.
  • polylogue-lqo6a — both raw_artifacts upserts replace artifact_kind
    unconditionally on artifact_id conflict, so an ordinary path
    classification landing on a terminal failure carrier's id takes the row
    back. _terminal_artifact_paths then reads the path as neither terminal nor
    headed, forever.
  • polylogue-6xqhp — a cursor advanced to EOF for a path with no
    raw_sessions, blob_refs, history_sidecars, raw_artifacts or
    source_items row: bytes consumed, nothing retained, and no route able to
    re-read them.

Solution

  • Origin.GEMINI_CLI_SESSION declares frontier_kind = "whole-snapshot", a
    new value on the existing source-level continuation law meaning successive
    observations are competing complete snapshots rather than continuations.
    Admission routes such an origin through the same typed membership authority
    browser captures already use, which yields one accepted head and a typed
    decision for the rest.
  • An unorderable byte cohort with no retired siblings now records
    DEFERRED_CAS_FRONTIER failure evidence and defers, instead of dropping
    through and leaving an untyped quarantined raw.
  • _needs_work_from_state_uncorroborated reports the fresh attempt without
    clearing excluded. The quarantine is lifted by the cursor write of an
    ingest that actually retained something, so a path that fails again stays
    quarantined and a never-admitted path never presents a stale byte offset as
    committed authority.
  • Both raw_artifacts upserts carry a shared guard
    (terminal_carrier_overwrite_predicate) refusing an ordinary classification
    that would replace a terminal failure carrier; only failure-evidence writes
    may change a carrier's kind.
  • _record_full_cursor refuses to advance when the source tier holds no row
    for the path, recording retryable raw_parse_recovery debt instead. The
    raw-id lookup it guards on was already being performed.

Deliberately not done: no gate exemption is widened, and the per-path drain
refusal owned by #4700 is untouched.

Verification

Fresh daemon on a scratch root over a frozen read-only copy of only the
gemini-cli and codex-state sources plus the three Claude JSONL files named in
polylogue-lqo6a (789 MB, /realm/tmp/work/lane-raw-admission), production
route polylogued run:

refused by cursor authority: 0
no unique byte-revision candidate: 0
broken_heads: 0
gemini-cli-session:56cb9ec1-ece5-4705-ac40-a3e1b1569c25 -> 1 head
both raws of the colliding pair: raw_membership_census status = complete
refusing to advance cursor past bytes that left no source evidence: 0

Before this branch the same pair produced two untyped quarantined raws, a
broken head, and repeated whole-backlog refusals.

devtools verify --quick — all 13 gates ok; render all --check reports
nothing out of sync.

Residuals: one source_raws_without_accepted_head gap remains for the second
file of the pair. That is a gap, not a violation — the path is typed and
materializing it is what resolves it — and #4700 is what stops gaps from
blocking. state_5.sqlite was still awaiting finalize_codex_state_snapshots
when the rehearsal's time budget ended; that finalizer is unchanged here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid

Sinity and others added 2 commits September 5, 2026 23:01
…refuse

Codex state databases are declared non-session snapshots, an exclusion is
lifted only by an admission that retains evidence, Gemini CLI checkpoints
are governed by membership authority, an unorderable byte cohort leaves a
deferred carrier, and a terminal failure carrier survives reclassification.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
…ntine on admission

A cursor commit claims the bytes were consumed and retained, so refuse to
advance when the source tier holds no row for the path. Lift a quarantine in
the acquisition pass that re-decides the path rather than when the watcher
notices it deserves one, so a live database's changing stat cannot leave a
stale byte offset visible to the raw-frontier cursor map.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: c4b250a3-53b7-458a-ac9f-764e536134a7


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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 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-05T22:47:43.661066Z 685fb66 New commits
ℹ️ 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.

Anti-vacuity per test: reverting the gemini-cli frontier_kind declaration
leaves both sibling raws untyped-quarantined with no head, and deleting the
acquisition-side revival leaves a parsed path quarantined forever.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid

@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: 3e193aa74f

ℹ️ 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 polylogue/sources/live/cursor.py Resolved
Comment thread polylogue/core/raw_failure_evidence.py Resolved
Noticing that a quarantined path deserves a fresh attempt no longer clears
excluded; the cursor write of an ingest that retained something does. A path
that fails again therefore stays quarantined, and a never-admitted path never
presents a stale byte offset to the raw-frontier cursor map.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
@Sinity
Sinity enabled auto-merge (squash) September 5, 2026 22:44
@Sinity
Sinity merged commit ddcbec6 into master Sep 5, 2026
3 checks passed
@Sinity
Sinity deleted the lane/raw-admission-heads branch September 5, 2026 22:45

@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: 685fb66031

ℹ️ 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 polylogue/sources/live/watcher.py Resolved
Comment thread polylogue/sources/origin_specs.py Resolved
Sinity added a commit that referenced this pull request Sep 5, 2026
…on (#4707)

## Summary

Restores `CursorStore.revive_replaced_exclusion`'s `excluded=False`
write,
which #4704 removed by accident.

## Problem

`sources/live/cursor_lifecycle.py` declares, as its first preventive
invariant, that `revive_replaced_exclusion` is the only actuator
permitted to
move a cursor `EXCLUDED -> ACTIVE`, and only on a proved file-identity
or
parser-fingerprint change. #4704 dropped the `excluded=False` write, so
that
transition became unreachable and two soundness-sweep assertions in
`tests/unit/sources/test_cursor_lifecycle.py` — the
proved-identity-change and
parser-fingerprint-change cases — assert `ACTIVE` against a store that
stays
`EXCLUDED`.

The change was collateral: an earlier revert of it in the lane ran after
the
commit that introduced it, so it restored the changed file rather than
the
original.

## Solution

Restore the store method to its pre-#4704 behavior. The polylogue-6q16u
fix
this belonged to lives entirely in
`LiveWatcher._needs_work_from_state_uncorroborated`,
which no longer calls this method when it merely notices a path deserves
a
fresh attempt; nothing in the live path depends on the store's own
behavior
changing too.

## Verification

`git show origin/master~1:polylogue/sources/live/cursor.py` and this
branch's
copy of the method are identical, so the two soundness-sweep cases
return to
the state they passed in.

Residual: the host `pytest` pueue group is paused, so the focused
selection
(`tests/unit/sources/test_cursor_lifecycle.py`) could not be run locally
to
confirm. The restored file is byte-identical to the version those tests
passed
against.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 5, 2026
… retry (#4710)

## Summary

Updates the excluded-cursor live proof to the contract #4704
established.

## Problem


`tests/unit/sources/test_excluded_cursor_live_proof.py::test_excluded_cursor_revives_through_the_live_watcher_gate`
asserts that `LiveWatcher._needs_work` itself calls
`CursorStore.revive_replaced_exclusion` and leaves the row `excluded =
0`.
#4704 (polylogue-6q16u) removed that call: noticing that a path deserves
a
fresh attempt no longer lifts its quarantine, because a cleared flag
over a
stale byte offset is what the raw-frontier cursor map reads as committed
ingest authority for a path nothing has admitted. The test is red on
master.

## Solution

Assert the contract that now holds: `_needs_work` reports True (the
fresh
attempt is scheduled, which is polylogue-ix5r's requirement) and the
quarantine persists, so a path that fails again stays dark. The
quarantine is
lifted by the cursor write of an ingest that retained something. The
proof's
recorded `production_route.transition` is updated to name that route.

Anti-vacuity: restore the `revive_replaced_exclusion` call in
`_needs_work_from_state_uncorroborated` and
`actuator.assert_not_called()`
plus `assert still_quarantined.excluded` both go red.

## Verification

`ruff format` / `ruff check` clean.

Residual: the host `pytest` pueue group is paused, so
`devtools test tests/unit/sources/test_excluded_cursor_live_proof.py`
could
not be run. This test is red on master as it stands; the change is the
minimal edit that matches the merged behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 22, 2026
…on path (#5403)

## Summary

Triage of **85 likely-live P1 review findings** anchored in
`polylogue/sources/`, from the 2,599-item backlog where **zero review
threads have ever been resolved**.

**33 STALE (39%) · 1 WONTFIX · 51 LIVE** — 14 fixed here, 37 reported
unfixed with reasons.

## How much to trust the filter — the answer for the other 322

**39% stale.** Treat it as a shortlist, not a verdict. Two failure modes
dominate and are predictable:

1. **Wholesale refactor.** All seven `watcher.py` findings are stale for
*one* reason: the `_flush_pending` / `_pending_paths` /
`_debounced_batch` / `_plan_catch_up` machinery no longer exists. **If a
cluster names one mechanism, check the mechanism exists before triaging
individually.**
2. **Silent follow-up fix.** The `#4520`/`#4662`/`#4663` append-proof
cluster was fixed by later PRs that rewrote neighbouring lines and left
the anchor byte-identical — several carry comments restating the
reviewer's own words, so **grepping HEAD for the finding's key phrase is
a fast stale test**.

The filter was reliable where the anchor is a self-contained expression:
`antigravity.py`, `codex.py`, `origin_specs.py` findings were nearly all
still exactly as reviewed.

**And LIVE does not mean the reviewer's consequence is right.**
`batch.py:2488` reproduces, but the claimed batch abort does *not*
happen — a group-level handler catches it. Measured: `failed=2
succeeded=0` → `failed=1 succeeded=1`. **Verify the consequence, not
just the code shape.**

## A pre-existing test refuted as vacuous

The lane first claimed
`test_sqlite_acquisition_failure_is_a_failed_file_not_a_batch_abort`
covered the Hermes fix. Removing the fix and running it: **`PASSED
exit=0`**. The test offers a *single* file, so chunk and file coincide —
it cannot distinguish the defect. Replaced with
`test_sqlite_acquisition_failure_does_not_fail_its_healthy_siblings`,
which measures the real difference.

## The fourteen, in one line each

`batch_support.py:443` an unterminated final line was reported
malformed, recording TERMINAL_CORRUPT_INPUT for an ordinary mid-write
snapshot · `watcher.py:867` EACCES/EIO escaped with no cursor or debt
row · `watcher.py:1222` `excluded=True` alongside the new stat made a
path report no-work **forever** · `batch.py:722` a symlink-spelled
violation admitted the identical blocked file after restart ·
`batch.py:4180` two independent opens now bound to one
`_file_observation` · `antigravity.py:586` ID-less steps keyed by
message count **renamed `step:1` → `step:0`** when an earlier step
became malformed · `antigravity.py:985` conflicting `parent_references`
asserted an arbitrary durable topology edge · `antigravity.py:830` a
null-key trajectory returned zero steps *and* a denominator of 0 ·
`dispatch.py:1463` GEMINI_CLI resolved sidecars path-independently ·
`source_acquisition.py:86` a foreign archive root was admitted instead
of refused — plus four more.

## Anti-vacuity — all fourteen, one executed reversion

`git checkout <base> -- polylogue/`, re-run the reproduction script,
restore. Verbatim base → fixed:

```
1  malformed_record: True -> False        1b terminated: True -> True   (opposite pinned)
2  RAISED PermissionError -> recorded, no exception
3  excluded: True -> False; needs_work: False -> True
5  admitted under symlinked block: ['session.jsonl','healthy.jsonl'] -> ['healthy.jsonl']
9  ['trajectory:step:0'] -> ['trajectory:step:1']
11 null-key messages: [] -> ['hello']     11b foreign-key: [] -> []     (opposite pinned)
12 conflicting parents: parent-1 -> None  12b single parent: -> parent-1 (opposite pinned)
```

Three opposite-direction pins are unchanged across the mutation, so a
blanket refusal cannot pass.

## Verification

```
devtools test <6 modules>   exit 0, 253 passed, git_dirty false
devtools test <final sha>   exit 0, 43 passed
devtools verify --quick     exit 0, 25/25
devtools render all --check exit 0, 'out of sync' 0
git merge-tree vs master    0 conflict markers
```

Closure: six `sources/` files **IN**, two `pipeline/services/` **out**.
INDEX `ce86c236… → 0936e4a9…`. **Self-corrected**: the commit message
quotes an intermediate identity measured before the Drive guard was
relocated — the landed value is `0936e4a9…`, and it must be re-measured
after rebase.

The lane also *moved* its Drive guard rather than grow the closure:
placing it in `sources/drive/__init__.py` (IN) added a baseline member
for no semantic gain, so it went to `acquisition_streams.py` (OUT) —
which is also the reviewer's own preferred site and covers both
branches.

## Highest-severity unfixed, filed separately

`revision_backfill.py:3668` — a pre-logical-export Codex
`state_5.sqlite` **page image** is not in `frozen_codex_state_raw_ids`,
reaches the JSON parser, and its exception is promoted to
`FrozenSourceRemediationRequiredError`, **aborting the entire index
rebuild**. Needs a terminal non-session receipt; naive rejection doesn't
provide one.

Also reported unfixed with reasons: the parser fingerprint was **never
bumped** for two admission-law changes (`#4704`, `#4925`), so unchanged
files are skipped forever; sidecar/assembly inputs never re-enrich their
owner; the write-hold budget is unenforced outside the full-ingest
route.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at bf68918):

  • P1 polylogue/sources/origin_specs.py:1521: Not a defect (checked at bf68918): The remedy exists only to reprocess cursors written before the Gemini frontier change; fresh-format archives observe Gemini files under the current whole-snapshot declaration from their first cursor, and earlier archive state is moved aside rather than carried forward (AGENTS.md:74-77, AGENTS.md:192-194).

Resolving every thread listed; confirmed defects are fixed under the named bead.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at bf68918):

  • P1 polylogue/sources/live/cursor.py:1433: Fixed on master (checked at bf68918): When a retry of an excluded cursor fails, _record_failed_cursor now rebinds the exclusion to the observation that attempt actually read (batch.py:2248-2266). The watcher then stops reparsing the same replacement bytes on every poll.
  • P1 polylogue/sources/live/watcher.py:1222: Fixed on master (checked at bf68918): _invalidate_cursor_for_full_retry now writes excluded=False along with the new observation (batch.py:2637-2644), so the watcher's exclusion branch no longer hides the unacquired bytes.

Resolving every thread listed; confirmed defects are fixed under the named bead.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 62.F013 / P1: fixed-already at the checked revision: The terminal-carrier overwrite predicate now requires raw_artifacts.raw_id = excluded.raw_id at polylogue/core/raw_failure_evidence.py:210. Terminal protection therefore applies to the same retained bytes, not to a newer raw that reuses the observation coordinate.

Only the rows listed above are dispositioned. Held findings remain open.

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