Skip to content

fix(cold-build): let intake's exclusions settle the source baseline - #5724

Merged
Sinity merged 5 commits into
masterfrom
claude/coldbuild-baseline-exclusions
Sep 28, 2026
Merged

Sinity merged 5 commits into
masterfrom
claude/coldbuild-baseline-exclusions

Conversation

@Sinity

@Sinity Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

A cold build now promotes when the source tree holds files that intake excludes. The live batch and the production source baseline share one pre-acquisition decision, classify_pre_acquisition. The baseline records each file intake excludes as excluded with reason intake_excluded:<reason>, so promotion no longer requires a raw row for it.

Problem

A cold build over a 148-file stratified sample finished intake with three typed exclusions. Two were declared-artifact JSONL (a meta-only Codex rollout and a Gemini CLI JSONL), and the third was the Gemini logs.json path rule. daemon.cold_build.promote then failed on every settlement retry with ProductionBaselineError: production source baseline has 3 unretained revision(s). Baseline discovery had accepted those paths, but the batch's pre-acquisition rules never retain a raw row for them. One excluded file blocks promotion of the whole build.

Solution

  • batch_support.classify_pre_acquisition holds every pre-acquisition exclusion rule, in the batch's branch order: unsupported source class, out-of-scope or unverified Codex state database, definitive non-session path, known-provider non-session JSONL, and non-JSON that is not a session artifact. It also returns the content sniff it performed, so the acquiring branch does not sniff the file again.
  • LiveBatchProcessor._ingest_full_paths_sync_staged applies this decision once per file. Its separate exclusion branches are deleted.
  • capture_production_source_baseline applies the same decision to every accepted non-ZIP file, using the ordinary route (source_only=False).
  • merge_pending_production_baseline drops an earlier accepted row for a path the current observation excludes at intake. Without this, a resumed build would carry the old demand forward.

Verification

  • devtools test tests/unit/sources/test_cold_build_generation.py tests/unit/sources/test_production_baseline.py tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_codex_state_live_ingest.py tests/unit/sources/test_raw_admission_settlement.py tests/unit/daemon/test_fair_resumable_intake.py tests/unit/sources/test_live_metrics.py: 4 failed, all others passed. The same 4 fail identically on the base 3ec9f7fb54 (devtools test --on-default-branch <the 4 ids>: 4 failed). They are inherited, and fix(intake): one interpretation across live and retained routes #5643 lists two of them as failing on its base too: test_live_full_ingest_offloads_sync_work_to_keep_loop_responsive, test_source_only_full_ingest_streams_admitted_zip_members_without_decoding, test_every_planned_path_is_accounted_for, test_offered_bytes_split_puts_a_refused_file_in_the_refused_bucket.
  • New regressions: test_a_file_intake_excludes_does_not_block_promotion goes through the ordinary route (baseline, then batch ingest, then promote()). test_baseline_records_intake_exclusions_instead_of_requiring_retention checks each exclusion rule. test_intake_exclusion_retires_an_earlier_accepted_observation covers the merge.
  • Schema closure: batch.py, batch_support.py and production_baseline.py are all IN, so this moves the derived identity and must land before the fresh build.

Residuals

  • refactor(sources): acquire every origin only from its canonical location #5684 (canonical sources) edits the same batch branches and adds typed foreign-origin refusals. Whichever PR lands second must move those refusals into classify_pre_acquisition, or the baseline will demand retention of refused files.
  • One Claude Code transcript in the sample is retained but its parse is refused (no positive conversational evidence). Its raw row exists, so it does not block promotion. Whether it blocks terminal readiness is unverified.

🤖 Generated with Claude Code

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

Sinity and others added 3 commits September 28, 2026 16:50
The production baseline recorded every file discovery accepted as a
revision the build must retain, while full intake excludes some of those
files before acquisition (known-provider JSONL sidecars, definitive
non-session paths, unverified Codex state databases, unsupported source
classes). No raw row is ever written for them, so promotion refused with
"unretained revision(s)" forever.

classify_pre_acquisition is now the one decision: the batch applies it
to every file it acquires and the baseline applies it to every accepted
file, recording "intake_excluded:<reason>" instead of requiring
retention.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
A resumed build merged the previous baseline's accepted rows back in, so
a sidecar accepted before the shared pre-acquisition decision stayed a
promotion demand intake never meets.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
@Sinity
Sinity enabled auto-merge (squash) September 28, 2026 15:06
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 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-28T16:02:25.199189Z c4be975 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.

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

ℹ️ 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/batch_support.py Resolved
…on in the baseline

- An excluded SQLite path is probed read-only first: a structural recognizer
  reads an unreadable database as foreign, which must stay a retryable
  fault, not a terminal exclusion.
- A resumed build retires an earlier accepted row only when the path still
  holds that exact revision.
- The sidecar session-evidence scan calls the observation's cancellation
  checkpoint as it reads.

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

@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: 80a1809829

ℹ️ 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/batch_support.py Resolved
… long lines

- A non-retryable probe fault on an excluded database (bytes that are not
  SQLite) keeps the intake exclusion; only a retryable fault is retried.
  The handling reuses the baseline's existing fault handler, so no new
  degradation site is added.
- An earlier accepted database revision is never retired on re-observation.
- The admission scan reads fixed chunks and checkpoints before each one,
  so cancellation reaches the middle of one long record.

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

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

ℹ️ 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/batch_support.py Resolved
Comment thread polylogue/sources/live/batch_support.py Resolved
@Sinity
Sinity merged commit 7e5b96e into master Sep 28, 2026
3 checks passed
@Sinity
Sinity deleted the claude/coldbuild-baseline-exclusions branch September 28, 2026 16:04
Sinity added a commit that referenced this pull request Sep 28, 2026
…5729)

## Summary

Fixes six tests that fail on master and one intake bug. Five tests
encoded contracts that earlier PRs changed on purpose, and are
realigned. The intake bug: a SQLite database that could not be read at
probe time was excluded for good.

## Problem

A focused run on `7e5b96e15d` failed six tests:

| Test | Broken by | Cause |
| --- | --- | --- |
| `test_live_full_ingest_offloads_sync_work_to_keep_loop_responsive` |
#5557 | `_ingest_full_paths` now passes `prepared_json_paths`; the test
stub rejected the keyword. |
|
`test_source_only_full_ingest_streams_admitted_zip_members_without_decoding`
| #5557 | #5557 removed `_detect_provider_from_raw_bytes` from
`live.batch`, and `monkeypatch.setattr` failed on the missing name. |
| `test_every_planned_path_is_accounted_for`,
`test_offered_bytes_split_puts_a_refused_file_in_the_refused_bucket` |
#5557 | #5557 retains a JSON document of any shape and lets the parser
record unsupported-shape evidence. The `notes.json` fixture meant to be
refused therefore succeeds. |
| `test_authentication_refusal_is_not_an_indeterminate_mutation` | #5705
| The exception text is now the daemon's detail (`machine authentication
required`), not the code. |
| `test_restart_recovers_indeterminate_mutation_without_replaying_it` |
#5688 | Startup recovery now resolves an `unknown` run by convergent
replay, so the restarted daemon applies once more. |

Intake bug: the Codex, Hermes and Antigravity recognizers catch
`sqlite3.Error`/`OSError` and answer "not ours".
`classify_pre_acquisition` turns that answer into an exclusion, and
`_mark_excluded_cursor` records `excluded=True`. A database that is
locked or unreadable during the probe (EACCES, SQLITE_BUSY/CANTOPEN) was
never retried while its observation stayed unchanged. #5724 had guarded
only the cold-build baseline against this.

## Solution

- Tests: accept `prepared_json_paths` in the stub. Point the ZIP
no-decode guard at `detect_provider_from_path_sample_evidence`. Refuse a
JSONL record stream that no origin claims instead of a JSON document.
Assert `rejected.value.outcome == "unauthorized"`. In the restart test,
count the one startup replay and check that the retried request id does
not dispatch again.
- Intake: `classify_pre_acquisition` probes a SQLite path before
excluding it and raises a retryable read fault. The batch records that
fault as an ordinary retryable failure. Bytes that are not a database
stay excluded. The baseline's own probe and `_retryable_read_fault` move
into `batch_support`, so intake and the baseline apply the same rule.
The baseline branch those helpers made dead is removed.

`batch.py`, `batch_support.py` and `production_baseline.py` are in the
derived schema-identity closure (`devtools schema closure`), so this
must land before a rebuild starts.

## Verification

- `devtools test tests/unit/sources/test_live_watcher.py
tests/unit/sources/test_raw_admission_settlement.py
tests/unit/sources/test_live_batch_support.py
tests/unit/sources/test_production_baseline.py
tests/unit/sources/test_cold_build_generation.py
tests/unit/daemon/test_daemon_operation_route.py`: `418 passed`, 1
flaky. The flaky test was
`test_cancelled_long_delete_retains_writer_until_blocked_apply_releases`:
a 25 ms deadline returned `completed` under load, and the test passed
when rerun alone.
- After the final baseline cleanup: `devtools test
tests/unit/sources/test_production_baseline.py
tests/unit/sources/test_cold_build_generation.py`: `64 passed`.
- `devtools verify --quick`: `PASSED` (includes mypy, patterns,
schema-closure).
- The new
`test_unreadable_state_database_stays_retryable_instead_of_excluded`
drives a mode-0 `state_5.sqlite` through `_ingest_full_paths_sync`.
Without the probe, the file is not failed and gets an excluded cursor.

## Residuals

- If a lock clears between the recognizer's failed read and the probe,
the file is still excluded. That window was already accepted for the
baseline in #5724. Closing it needs the recognizers to propagate read
faults.
- The unbounded JSONL session scan is filed separately and is not
changed here.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 28, 2026
Master commit #5724 (already merged, unrelated to this batch) added a
typed-degradation sqlite3.Error handler in
polylogue/sources/codex_state_evidence.py and shifted the normalized
digest of an existing one in
polylogue/sources/live/production_baseline.py. `devtools gate layering
--prune-baselines` dropped the one stale anchor; the two new legitimate
sites (both already-accepted master code, not this batch's own) are
declared here so the gate's asymmetric ratchet sees them as known
rather than newly introduced.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
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