Skip to content

refactor(sources): acquire every origin only from its canonical location - #5684

Merged
Sinity merged 34 commits into
masterfrom
claude/canonical-sources
Sep 29, 2026
Merged

Sinity merged 34 commits into
masterfrom
claude/canonical-sources

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every origin is now acquired only from its canonical location. Custom source roots and source narrowing are gone, and config loading refuses keys Polylogue does not read.

Problem

[sources] roots, polylogued run --root, --default-source and --no-default-sources let a deployment point the daemon at arbitrary directories and drop built-in sources. The workstation's hand-enumerated --default-source list silently left out the hook spools, browser capture and the import inbox, and a watched account-export root bypassed the deliberate polylogue import route. Unread settings also loaded silently: daemon.watch.debounce_s was rendered and never consumed.

Solution

  • daemon/cli.py: _watch_sources builds the watch set from default_sources() only (the browser-capture spool override stays). run and watch lose --root, --default-source and --no-default-sources.
  • sources/live/watcher.py: the legacy data-home inbox watch is removed. Exports enter through polylogue import into the archive inbox.
  • config.py: sources.roots, ResolvedSourcePaths.explicit, source_declarations/configured_source_frontier and the configured-* runtime sources are removed. _apply_toml_layer raises ConfigError naming any TOML key no inventory entry declares.
  • Maintenance: the wanted-sources command (which only enumerated custom roots) is deleted. verify-archive and the Beads origin census no longer read explicit roots.
  • nix/: the daemon.watch, discoverSources, debounce-s, logging.level and ui.slow-query-notice-seconds options are removed, since nothing reads them.
  • Harnesses: tests/infra/daemon_cold_start.py and devtools/daemon_finished_build.py run the daemon with an isolated HOME and the corpus at its canonical path. For the finished-build qualification, --source-root is that home, and --input must sit under .codex/sessions or .claude/projects. Integration tests write under Path.home(), which the fixtures isolate.
  • Docs: daemon.md, configuration.md, getting-started.md and hermes-operators.md are updated.

Location binding: one acquisition boundary

A canonical location admits only its own origin's material. Every acquisition route reads bound source bytes through polylogue/sources/acquisition_boundary.py:

  • open_bound_path, open_bound_member and bind_stream return a stream that feeds each byte, on its first read and in order, to BoundRecordValidator. A foreign record raises ForeignOriginContentError from the read that delivers it. Every record (a JSONL line, an array element, an object document) is push-parsed and classified as both a record and a one-record sequence. Classification reads a bounded view of the record (_EvidenceBuilder: string prefixes, the first entries of each container, a per-record value and character budget), so memory does not grow with record size. No byte window truncates the stream.
  • capture_bound_path and capture_bound_stream are the only routes that retain source bytes. They copy exactly the bytes they validate, so a refusal raises before any publication is queued. _SessionEmitter.emit and iter_entry_payloads bind their input themselves. A bound stream or ZIP member is released as one unit, only after it has fully validated.
  • Intake and the production baseline share the refusal. classify_pre_acquisition refuses declared foreign databases and foreign unsupported-class files. The baseline hashes retained files through the same boundary and records intake_excluded:<intake's reason>.
  • tests/unit/sources/test_acquisition_boundary.py runs every acquisition route against a foreign tail. It also fails when any call that retains source bytes or opens a ZIP member appears outside the boundary without a declared reason.
    The per-site prefix, first-record and captured-blob checks (bound_capture.py, refuse_foreign_material, validate_bound_grouped_zip_member, expected= detection copies) are deleted.

Also in this PR: ops status probes the daemon's own watch set (operations/source_presence.py). init persists a Hermes root supplied by config. OTel GenAI exports arrive through polylogue import. The unread-key error names a recovery that works without the CLI. The salvage/strictdetect edits (whole-unit ZIP release, case-exact debt clearing) are folded in.

Config keys kept (source-related)

  • archive.root: selects the archive; the one path Polylogue owns.
  • daemon.browser_capture.spool_path / --spool: the browser-capture spool lives under Polylogue's own root. Scheduled for removal in favour of the fixed archive location (follow-up bead).
  • sources.hermes.root / POLYLOGUE_HERMES_ROOT, sources.hook_sidecar_dir, sources.hook_provider, drive.credentials_path / drive.token_path, sources.antigravity.language_server: per-origin overrides scheduled for removal in a follow-up bead (Hermes moves to its own HERMES_HOME). They are out of scope here, to keep this change reviewable.

Verification

All runs went through agentctl jobs. The final head is b5e390a0bc, merged with master at e14b47662d.

  • agentctl job start polylogue verify_quick --workspace <worktree>: job 2234 on b5e390a0bc, verify: PASSED exit=0.
  • agentctl job start polylogue pytest_focused -- tests/unit/sources/test_acquisition_boundary.py tests/unit/sources/test_location_binding.py tests/unit/sources/test_production_baseline.py tests/unit/sources/test_content_identity_member_refusal.py tests/unit/sources/test_retained_acquisition.py tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_live_storage_faults.py tests/unit/pipeline/test_acquisition_blob_gc_age_gate.py tests/unit/storage/test_ingest_governance.py tests/unit/storage/test_attachment_acquisition.py tests/unit/pipeline/test_ingest_batch.py tests/unit/browser_capture: job 2191 on d499a00f57, 645 passed, 2 failed.
    • test_ingest_governance.py::test_membership_that_becomes_eligible_after_preparation_defers_publication fails the same way on master 915a1f357d (job 2060).
    • test_acquisition_blob_gc_age_gate.py::test_slow_following_source_cannot_age_uncommitted_blob_into_gc was caused by this PR. It patched prepare_from_path, which the boundary capture no longer calls. Fixed in b5e390a0bc; job 2235 with tests/integration/test_live_read_amplification.py passes.
  • agentctl job start polylogue pytest_focused -- tests/unit/sources/test_acquisition_boundary.py tests/unit/sources/test_location_binding.py tests/unit/sources/test_production_baseline.py tests/unit/sources/test_content_identity_member_refusal.py tests/unit/sources/test_export_member_addressing.py tests/unit/sources/test_retained_acquisition.py tests/unit/sources/test_live_batch_support.py tests/unit/sources/test_live_watcher_parse_stage_equivalence.py tests/unit/sources/test_unbounded_probe_ceilings.py tests/unit/sources/test_source_laws.py tests/unit/sources/test_live_route_interpretation.py tests/unit/cli/test_status_diagnostics.py tests/unit/core/test_content_identity_streaming.py: job 2062 on fa3e6b2ccb, 690 passed.
  • agentctl job start polylogue pytest_focused -- tests/unit/daemon/test_daemon_cli.py tests/unit/core/test_config.py tests/unit/core/test_config_inventory.py tests/unit/cli/test_init.py tests/unit/devtools/test_daemon_finished_build.py tests/unit/devtools/test_isolated_environment.py: job 2142 on fa3e6b2ccb, 301 passed, 2 failed, 4 flaky.
    • The 2 failures are test_init.py::test_status_reports_absent_daemon_*. They fail the same way on master 915a1f357d (job 2171).
    • The 4 flaky tests are daemon timing tests that passed when rerun alone. They also flake on master (job 2074).

Residuals

  • test_init's two test_status_reports_absent_daemon_* tests fail the same way on master.
  • At a bound location, the emitter holds a stream's parsed sessions until the whole stream has validated. For one very large grouped file, that is every session in the file.
  • replay_zip_entry_acquisition_payloads still reads a whole preserved member into memory, within the ZIP-bomb ceiling. Its callers are backup-verification replay and tests. The production baseline now uses the streamed replay_zip_entry_acquisition_revisions.
  • Two ZIP refusal debt mechanisms now sit side by side. Content-identity refusals are recorded on the archive path by master's _settle_zip_member_refusals. Foreign-origin refusals are recorded per member under <zip>:#. Their subjects cannot collide.
  • The wanted-source receipt library and the per-origin overrides are bead polylogue-aar35.
  • The workstation config no longer sets any removed key (sinnix 04629c73, bd9c4028), so the new refusal does not trip the live daemon config.

Self-review

  • Sibling sites. The boundary census (test_no_route_reads_source_bytes_around_the_boundary) now also counts write_from_writer and prepare_from_writer. The master merge brought in _HashingZipEntry, which opened members outside the boundary. It now opens them through open_bound_member, so baseline member revisions refuse foreign records the way live intake does. Content-identity refusals from master reach every route: the live batch, iter_source_raw_data, the retained route, decoder_zip, the baseline, and the emitter. On each route the validated sibling splits or sessions survive the refusal.
  • Cancellation and shutdown in loops. The streamed member revision keeps master's checkpoint per chunk. The baseline still checks cancellation per member and per unit.
  • Unbounded reads. Before, the validator copied every value of a record into memory, with long strings cut to a prefix. It now keeps a bounded view per record. Retiring an earlier accepted ZIP member used to read the whole member through replay_zip_entry_acquisition_payloads. It now streams through replay_zip_entry_acquisition_revisions. The one remaining whole-member read is listed under Residuals.
  • Fail-open fallbacks. A split member that fails on a ZIP-bomb ceiling or a read fault now releases the captures it queued, instead of leaving them for flush to reserve. Retirement of an earlier acceptance returns "changed" on any replay fault, including a content-identity refusal, so the earlier revision stays demanded.
  • Compatibility shims. discard_queued, discard_pending_hash and discard_pending_blob were three discard paths. They are replaced by one receipt-keyed discard_pending_receipt, reached through release_refused_capture. The live batch's second split-release loop is deleted, because the member iterator owns that release. The Polylogue-owned watch-source names are declared once, in watcher.py, instead of in both daemon/cli.py and source_presence.py.
  • Vacuous tests. Two tests observed acquisition at write_from_path, which the boundary capture no longer calls. The GC age-gate test failed. The read-amplification counter's "no full reread" assertions held vacuously. Both now observe capture_bound_path or prepare_from_fileobj.
  • Master's publisher adoptions (fix(capture): stream capture bodies into the spool instead of refusing #5725). discard_pending_receipt also drops a queued adoption and keeps the latest-receipt bookkeeping (test_publisher_discards_one_refused_pending_blob). The ingest worker's attachment-carrier spill is declared in the boundary census.
  • Tests prove the production route. New tests:
    • test_a_record_of_many_values_is_classified_from_a_bounded_view fails if the builder copies every value, or if it stops reading before payload.
    • test_publisher_discards_one_refused_pending_blob runs release_refused_capture against a real publisher.
    • master's test_the_parse_route_captures_elements_after_a_refused_one runs process_zip at a bound location. It failed on the first merge ([] == [0, 1, 3]) and passes after ac368894ea.

🤖 Generated with Claude Code

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

@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 27, 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-28T20:26:33.707533Z a968a09 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: c861b7061f

ℹ️ 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/config.py Resolved
Comment thread polylogue/config.py Resolved
Comment thread polylogue/daemon/cli.py Resolved
Comment thread devtools/daemon_finished_build.py Resolved

@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: 8458849bb8

ℹ️ 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 devtools/daemon_finished_build.py Resolved
@Sinity
Sinity force-pushed the claude/canonical-sources branch from 8458849 to 897c0cf Compare September 28, 2026 01:33
@Sinity
Sinity enabled auto-merge (squash) September 28, 2026 01:34

@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: 897c0cfe06

ℹ️ 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/config.py Resolved
Comment thread docs/daemon.md Resolved
Sinity added a commit that referenced this pull request Sep 28, 2026
…#5687)

## Summary
A source location now admits only its own origin. Shape detection at a
bound location validates instead of re-identifying; content carrying
another origin's shape is a typed refusal, never reparsed as that
origin. Stacked on #5684 (canonical source locations); retarget to
`master` once it merges.

## Problem
Detection was cross-origin and outranked location: a payload's shape
picked the parser wherever the file sat (`detect_provider(...) or
fallback`). Evidence:
- A read-only scan of the operator's live sources (aggregate only) found
Gemini CLI prompt logs (`~/.gemini/tmp/<project>/logs.json`, 5 files)
and a Hermes observability `usage.json` classified as **Claude Code**
sessions.
- The Drive/AI Studio source admitted any `.json`/`.jsonl`/`.jsonl.txt`
file in the folder as a session, so a transcript uploaded to a chat was
parsed as a session. The real folder holds 212+ prompt files
(`application/vnd.google-makersuite.prompt`) beside ~2,500 attachments
(`.txt`, `.md`, `.pdf`, a `.json`, …).

## Solution
- `sources/dispatch.py`: `detect_provider*` take `expected`; a bound
location (anything but `UNKNOWN`) raises `ForeignOriginContentError`
(code `foreign_origin_content`, picklable for parse workers) when
another origin's detector matches. The raw-bytes chokepoint binds to its
`fallback_provider`. Browser-capture specs use the envelope's declared
provider, and refuse an envelope declaring a foreign origin at a bound
location.
- Live daemon (`sources/live/batch.py`, `batch_support.py`): the
JSONL/JSON sniffs bind to the watched source's origin; a refusal becomes
`_mark_refused_cursor` (warning event + `live_ingest_admission`
convergence debt, re-evaluated each pass). Path-only Hermes checks apply
only at a Hermes or unbound location.
- One-shot ingest (`source_acquisition*.py`, `source_parsing.py`,
`emitter.py`): the parse context carries `bound_provider`; ZIP exports
opened from the inbox stay unbound. Refusals are recorded as cursor
failures.
- Declared `raw-only` paths are classified by location without
consulting shape (live JSON branch and one-shot acquisition), so
sidecars and prompt logs are retained evidence, never refused as
foreign.
- `origin_specs.py`: Gemini CLI `logs.json` is declared a raw-only
`prompt_history_log`.
- Drive: only the AI Studio prompt MIME type is a session; every other
file in the folder is an attachment.
- `AGENTS.md` and `docs/provider-origin-identity.md` describe the
fail-closed rule.

## Verification
- `devtools test tests/unit/sources/test_location_binding.py
tests/unit/sources/test_drive_source_client.py
tests/unit/sources/test_source_laws.py::test_session_emitter_detects_individual_jsonl_provider_from_payloads
tests/unit/sources/test_live_batch_support.py
tests/unit/sources/test_dispatch_evidence.py
tests/unit/sources/test_dispatch_payloads.py` → 282 passed, 1 failed.
The failure,
`test_source_only_full_ingest_streams_admitted_zip_members_without_decoding`,
also fails on master.
- A broader 38-file sources/pipeline selection before the rebase: 1085
passed, 18 failed. Two were mine (a detection stub signature, and the
Drive pagination contract), both fixed. Of the other 16, six were re-run
on the base and fail identically there:
`test_origin_contract[grok-export]`, the two otel tool-outcome
contracts, the capability-matrix ingest seam, the hook-producer import
check, and the gemini-cli token test. The remaining ten were not re-run
on the base. They are the browser-capture tests that require a daemon
(7), the `skill_asset` taxonomy test, the grok advertised-shapes test,
and the ZIP streaming test; other workers today reported all of them
failing on master.
- Replay parity: `parse_one_source_path` over a 262 MB synthetic
workload corpus (`generate_workload_corpus(seed=11)`, 105 files, 61
sessions), base vs branch. The provider, session id and
`session_content_hash` for every file are byte-identical (`cmp`). Timing
is 23.8 s vs 24.0 s on alternating warm runs.
- Real-source scan with the branch: all 24,324 Claude Code and 9,247
Codex files are unaffected. The Gemini CLI prompt logs are now raw-only
evidence, and the Hermes `usage.json` is refused.
- `devtools schema closure`: dispatch, batch, batch_support,
source_acquisition_components, source_parsing, emitter, cursor,
origin_specs and drive/source_support are IN, so this moves the derived
identity and must land before the fresh build.

## Residuals
- Refused files are re-evaluated and re-recorded on every live pass (by
design; moving the file clears it).
- `import explain` and retained reparse sites stay unbound, since they
also serve inbox ZIP exports with mixed record kinds; admission, where
binding matters, happens at acquisition.

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

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity and others added 5 commits September 28, 2026 09:22
Remove custom source roots and source narrowing: sources.roots, the
run/watch flags --root, --default-source and --no-default-sources, the
legacy data-home inbox watch, and the nix watch/discoverSources options.
Each origin is read where its tool writes it; account exports arrive
through polylogue import into the inbox. The configured-source
declarations and the wanted-sources command, which only enumerated
custom roots, are deleted.

Config loading now refuses TOML keys Polylogue does not read, so a
stale or misspelled setting fails loudly instead of doing nothing; the
unread debounce, logging.level and ui.slow_query_notice_seconds nix
options are dropped. Harnesses run the daemon under an isolated HOME
with the corpus at its canonical path.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Create only archive-owned source roots at startup, so a missing or
dangling provider directory reads as unavailable instead of being
created or failing startup; isolate XDG roots and path overrides in the
finished-build qualification; drop the documented unread [daemon] host
and port aliases; keep the cold-build receipt tests independent of the
deleted declarations helper.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
The source root becomes the daemon's HOME and each canonical source
under it is acquired, so a Codex state database or any other entry
would enter the build unnamed by the receipt; only the declared input
may be present.

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

A source location now admits only its own origin. Shape detection at a
bound location validates instead of re-identifying; content carrying
another origin's shape is a typed refusal, never reparsed as that
origin. Stacked on #5684 (canonical source locations); retarget to
`master` once it merges.

Detection was cross-origin and outranked location: a payload's shape
picked the parser wherever the file sat (`detect_provider(...) or
fallback`). Evidence:
- A read-only scan of the operator's live sources (aggregate only) found
Gemini CLI prompt logs (`~/.gemini/tmp/<project>/logs.json`, 5 files)
and a Hermes observability `usage.json` classified as **Claude Code**
sessions.
- The Drive/AI Studio source admitted any `.json`/`.jsonl`/`.jsonl.txt`
file in the folder as a session, so a transcript uploaded to a chat was
parsed as a session. The real folder holds 212+ prompt files
(`application/vnd.google-makersuite.prompt`) beside ~2,500 attachments
(`.txt`, `.md`, `.pdf`, a `.json`, …).

- `sources/dispatch.py`: `detect_provider*` take `expected`; a bound
location (anything but `UNKNOWN`) raises `ForeignOriginContentError`
(code `foreign_origin_content`, picklable for parse workers) when
another origin's detector matches. The raw-bytes chokepoint binds to its
`fallback_provider`. Browser-capture specs use the envelope's declared
provider, and refuse an envelope declaring a foreign origin at a bound
location.
- Live daemon (`sources/live/batch.py`, `batch_support.py`): the
JSONL/JSON sniffs bind to the watched source's origin; a refusal becomes
`_mark_refused_cursor` (warning event + `live_ingest_admission`
convergence debt, re-evaluated each pass). Path-only Hermes checks apply
only at a Hermes or unbound location.
- One-shot ingest (`source_acquisition*.py`, `source_parsing.py`,
`emitter.py`): the parse context carries `bound_provider`; ZIP exports
opened from the inbox stay unbound. Refusals are recorded as cursor
failures.
- Declared `raw-only` paths are classified by location without
consulting shape (live JSON branch and one-shot acquisition), so
sidecars and prompt logs are retained evidence, never refused as
foreign.
- `origin_specs.py`: Gemini CLI `logs.json` is declared a raw-only
`prompt_history_log`.
- Drive: only the AI Studio prompt MIME type is a session; every other
file in the folder is an attachment.
- `AGENTS.md` and `docs/provider-origin-identity.md` describe the
fail-closed rule.

- `devtools test tests/unit/sources/test_location_binding.py
tests/unit/sources/test_drive_source_client.py
tests/unit/sources/test_source_laws.py::test_session_emitter_detects_individual_jsonl_provider_from_payloads
tests/unit/sources/test_live_batch_support.py
tests/unit/sources/test_dispatch_evidence.py
tests/unit/sources/test_dispatch_payloads.py` → 282 passed, 1 failed.
The failure,
`test_source_only_full_ingest_streams_admitted_zip_members_without_decoding`,
also fails on master.
- A broader 38-file sources/pipeline selection before the rebase: 1085
passed, 18 failed. Two were mine (a detection stub signature, and the
Drive pagination contract), both fixed. Of the other 16, six were re-run
on the base and fail identically there:
`test_origin_contract[grok-export]`, the two otel tool-outcome
contracts, the capability-matrix ingest seam, the hook-producer import
check, and the gemini-cli token test. The remaining ten were not re-run
on the base. They are the browser-capture tests that require a daemon
(7), the `skill_asset` taxonomy test, the grok advertised-shapes test,
and the ZIP streaming test; other workers today reported all of them
failing on master.
- Replay parity: `parse_one_source_path` over a 262 MB synthetic
workload corpus (`generate_workload_corpus(seed=11)`, 105 files, 61
sessions), base vs branch. The provider, session id and
`session_content_hash` for every file are byte-identical (`cmp`). Timing
is 23.8 s vs 24.0 s on alternating warm runs.
- Real-source scan with the branch: all 24,324 Claude Code and 9,247
Codex files are unaffected. The Gemini CLI prompt logs are now raw-only
evidence, and the Hermes `usage.json` is refused.
- `devtools schema closure`: dispatch, batch, batch_support,
source_acquisition_components, source_parsing, emitter, cursor,
origin_specs and drive/source_support are IN, so this moves the derived
identity and must land before the fresh build.

- Refused files are re-evaluated and re-recorded on every live pass (by
design; moving the file clears it).
- `import explain` and retained reparse sites stay unbound, since they
also serve inbox ZIP exports with mixed record kinds; admission, where
binding matters, happens at acquisition.

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

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
`polylogue init` still wrote `sources.roots` and `[daemon] host/port`,
which the loader now refuses, so first-run onboarding produced a config
that `polylogued run` rejected. The starter config now lists the
canonical source directories as comments and writes the API bind under
`[daemon.api]`. The `no_sources` status diagnostic checks whether any
canonical chat source directory exists instead of parsing `roots`, and
the daemon docs drop the surviving custom-root sentence.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
@Sinity
Sinity force-pushed the claude/canonical-sources branch from 5689fcd to 4f07ccc Compare September 28, 2026 07:29

@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: 4f07cccd56

ℹ️ 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/daemon/cli.py Resolved
Comment thread polylogue/sources/bound_capture.py Resolved
Comment thread devtools/dev_loop_service.py Resolved
Sinity and others added 2 commits September 28, 2026 09:44
Rebasing onto master brought the detection-crash evidence, so the JSONL
classifier returns (provider, parse_as_session, crash). The ZIP-decode
guard also patched a batch symbol master had already removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
- A captured bound JSONL blob is validated record by record, not only
  from its 8 KiB prefix: a foreign record after an oversized first record
  was retained and parsed as the location's origin. Each line is decoded
  whole when it fits the validation window and otherwise validated from
  its leading bytes' completed structure, so memory stays bounded.
- Startup creates a source root only when Polylogue owns it by role
  (browser-capture spool, inbox, primary hook spool). Resolved
  containment treated a dangling provider symlink into the archive tree
  as owned and aborted startup on `mkdir`.
- `detect_chat_sources` and the `no_sources` diagnostic read the
  runtime's resolved source paths, so a configured Hermes root counts.
- The dev-loop proof daemon runs in an isolated home with the XDG roots
  and Polylogue path overrides replaced, shared with the finished-build
  qualification through `devtools.isolated_environment`.
- `ops status` without a daemon to serve it reports the first-run
  diagnostic for an absent archive instead of "Daemon: unreachable"
  (inherited from master).

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

@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: 65199ed82f

ℹ️ 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 tests/infra/daemon_cold_start.py Resolved
Comment thread polylogue/sources/dispatch.py Resolved
Comment thread docs/configuration.md Resolved
…tart

- `BoundRecordValidator` validates a bound JSONL stream incrementally.
  The production baseline feeds it the bytes it hashes, so the baseline
  no longer accepts a file that live capture refuses. The append route
  validates each appended delta; a foreign record falls back to the full
  route, which records the typed refusal.
- The cold-start qualification builds its environment with
  `isolated_home_environment`, so inherited XDG roots cannot hand it the
  operator's Drive credentials.
- A staged export in the archive inbox counts as a source for the
  `no_sources` diagnostic.
- docs/configuration.md limits content detection to the import inbox
  and browser-capture envelopes.
- Revert the `ops status` first-run change from the previous commit: the
  two test_init failures pass in isolation and are order-dependent, and
  the change broke the daemon-required status contract.
- The live-watcher test double accepts `prepared_json_paths`, which the
  batch already passes on master.

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

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

ℹ️ 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/daemon/cli.py Resolved
Comment thread polylogue/sources/dispatch.py Resolved
Comment thread devtools/isolated_environment.py Resolved
BoundRecordValidator capped each record's buffer at the 8 KiB validation
window and discarded the rest, so a foreign discriminator sitting past
that window inside one oversized record (a large leading field before
Codex's type/payload keys) went unseen: the record was retained under
the bound location and later parsed as its content. The validator now
buffers each line whole and decodes it in full; only a genuinely
truncated trailing line (no terminating newline) falls back to the
completed structure of what was read.

Regression: test_record_validation_inspects_a_whole_oversized_line
builds a single record whose own padding field exceeds the window
before its Codex type/payload keys and asserts capture refuses it.

Co-Authored-By: Claude Sonnet 5 <[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: edbe5bd17d

ℹ️ 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/daemon/cli.py Resolved
Comment thread polylogue/sources/bound_capture.py Resolved
Comment thread polylogue/sources/dispatch.py Resolved
Sinity and others added 2 commits September 28, 2026 16:36
isolated_home_environment replaced HOME and every XDG root but dropped
POLYLOGUE_CONFIG instead of overriding it. _user_config_path falls
through to <cwd>/polylogue.toml when no override is set, and the
dev-loop proof deliberately runs its daemon from the repository root,
so an untracked project-local polylogue.toml there (e.g. one setting
sources.hermes.root to an operator's real home) still reached config
discovery despite the replaced HOME/XDG roots. POLYLOGUE_CONFIG is now
pointed at a nonexistent path under the isolated home: an explicit
override, present or not, disables the cwd fallback outright.

Regression: test_isolated_environment_disables_the_cwd_config_fallback.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Update the isolated-home proof test for the isolated_environment.py fix:
POLYLOGUE_CONFIG is now pointed at a nonexistent path under the isolated
home rather than removed from the environment.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
@Sinity
Sinity force-pushed the claude/canonical-sources branch from edbe5bd to 0cb6a2f Compare September 28, 2026 14:37

@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: 0cb6a2fdaf

ℹ️ 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/config.py Resolved
Comment thread devtools/daemon_finished_build.py Resolved
Comment thread polylogue/cli/commands/init.py Resolved
Sinity and others added 2 commits September 28, 2026 16:52
…r-adapter

Answers the fresh Codex review of the master-merge head (3 threads):

- BoundRecordValidator gated `active` on `is_jsonl_source_path`, so a
  single-document `.json` capture was never validated past the 8 KiB
  prefix `refuse_foreign_material` already checks: a foreign discriminator
  past that prefix in one oversized document was retained under the bound
  location. `.json` documents are now validated too, as one whole record
  (no per-line split -- pretty-printed JSON can carry literal newlines),
  bounded the same way JSONL lines are.
- BoundRecordValidator's own oversized-record fix (a7a71ee) buffered a
  whole line without a cap, so one pathological multi-gigabyte line could
  grow the buffer unbounded. Records and documents now buffer up to
  _RECORD_VALIDATION_MAX_LINE_BYTES (16 MiB -- generous enough that any
  realistic padding field ahead of a discriminator stays inside it) and
  fall back to partial-structure inspection beyond that, restoring a real,
  documented physical bound instead of removing the cap outright.
- MultiplexIntakeAdapter.discover awaited each sub-adapter without
  isolating WalkRefusedError, so one absent or relocated provider root
  (an uninstalled tool) aborted the whole round-robin discovery pass
  before a sibling root that IS present got a turn. A WalkRefusedError
  from one sub-adapter is now caught and reported per sub-unit so
  installed siblings still discover their own pending files that pass.

Regression tests: test_a_whole_json_document_is_validated_not_only_its_prefix.
The two existing oversized-record tests continue to cover the (now bounded)
whole-record buffering.

Co-Authored-By: Claude Sonnet 5 <[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: c6d57b4821

ℹ️ 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/dispatch.py Resolved
Comment thread polylogue/sources/dispatch.py Resolved
Comment thread polylogue/daemon/cli.py Resolved

@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: 14b740309f

ℹ️ 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 tests/infra/daemon_cold_start.py Resolved
Sinity and others added 2 commits September 28, 2026 20:42
From salvage/strictdetect (bead xqqwv): a bound ZIP member is one
admission unit in acquisition and in the baseline replay (nothing
leaves before every record validated; a refusal releases its splits),
and convergence-debt prefix clearing compares exactly instead of
through case-folding LIKE. The one-shot ZIP emitter change moves into
_SessionEmitter.emit itself, so every bound parse stream is released
whole. The dev-loop proof test follows the isolated home's XDG roots.

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: a968a093e2

ℹ️ 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/operations/source_presence.py Resolved
Sinity and others added 3 commits September 28, 2026 22:30
- BoundRecordValidator push-parses each JSONL line (no line buffer or
  second decoded copy; long strings kept as a prefix) and classifies a
  record in both record and sequence mode.
- iter_zip_entry_raw_data holds a member's splits until the member
  validated and releases them on refusal; the caller copies are deleted.
- A refused ZIP member records intake's intake_excluded: reason, and an
  unchanged earlier member acceptance is retired by unbound replay.
- ops status probes the daemon's effective watch set, including a
  configured capture spool (daemon_watch_sources is shared).
- The cold-start harness replaces a stale fixture link.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Adds a CircleCI job, `stacked-review-threads`, to the `gate` workflow.
On a PR targeting master, it fails while any PR merged into that PR's
head branch, at any stack depth, has an unresolved review thread. The
log names each offending PR and thread URL.

## Problem

Master's branch protection requires conversation resolution, but a PR
merged into another PR's head branch is never checked. #5682 merged into
#5643's branch and #5687 into #5684's with 11 unresolved Codex threads
between them; that code reaches master through the parent PR.

## Solution

- `devtools/stacked_review_threads.py` (stdlib only) walks merged PRs
whose base is the root's head branch, then their head branches,
recursively. Every PR merged into the root's head branch counts, and so
does every PR merged into a stacked head before that head merged. Commit
ancestry and PR creation windows are not used, because rebases and
squash merges erase both. Each parent PR is expanded once, and threads
are read only for PRs inside the stack.
- `.circleci/config.yml` gains the `stacked-review-threads` job. It
skips non-PR builds and fork PRs, since nothing in this repository can
merge into a fork branch. GitHub Actions is billing-locked on this repo,
so CircleCI is the mechanism.
- Actions has no trigger for resolving a thread, and CircleCI has none
either. The job re-evaluates on each push, and "Rerun workflow"
re-triggers it by hand.

## Verification

- `nix develop --command devtools test
tests/unit/devtools/test_stacked_review_threads.py`: `devtools test:
PASSED exit=0` (9 passed). The tests use synthetic GraphQL responses and
cover two-level stacks, PRs merged before the root or the child opened,
reused child lifetimes, post-merge grandchildren, thread pagination, and
a branch cycle.
- `ruff check`, `ruff format --check`, and `mypy` on both files: clean.
- A read-only live run of `python3 -m devtools.stacked_review_threads
--repo Sinity/polylogue --pr 5643` exits 1 and names #5682 with 7
unresolved threads. The same run with `--pr 5684` names #5687 with 4.

## Residuals

- **Operator action needed.** The CircleCI project has no GitHub token,
so the job currently fails with `no GitHub token: set GH_TOKEN or
GITHUB_TOKEN`. Add a read-only token (pull requests: read on
Sinity/polylogue) as the project's `GH_TOKEN` variable. After that, add
`ci/circleci: stacked-review-threads` to master's required contexts.
- A PR merged long ago into a branch whose name was later reused fails
the gate and is named in the log; resolving its threads clears it. A
read-only run across all 36 open master PRs showed no such case.
- Branch renames are not followed, because GitHub keeps no rename
history.
- After a thread is resolved, or unresolved again, the result stays
stale until the next push or a rerun.

🤖 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 and others added 4 commits September 29, 2026 04:11
Master's content-identity refusal (#5659) and streamed member revisions
now meet the acquisition boundary:
- One receipt-keyed discard (discard_pending_receipt) replaces both
  discard_queued and discard_pending_hash; identity refusals release
  through release_refused_capture.
- A split member's validated siblings survive a content-identity
  refusal, in acquisition and in the production baseline.
- The streamed member-revision reader opens the member through the
  boundary, and retirement of an earlier acceptance streams the member
  instead of reading it whole.
- The boundary census also covers write_from_writer/prepare_from_writer.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
- BoundRecordValidator classifies each record from a bounded view: long
  strings keep a prefix, containers their first entries, and a record a
  fixed number of values and characters, so a record of millions of
  small values no longer copies into memory.
- iter_zip_entry_raw_data releases a member's captures on any failure
  (a ZIP-bomb ceiling, a read fault), since none was yielded; the live
  batch's second release loop is gone.
- The retained route iterates members again instead of collecting them,
  so a content-identity refusal keeps the member's validated siblings.
- Member debt is swept under "<zip>:#", which only member coordinates
  carry, and the Polylogue-owned watch-source names are declared once.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
At a bound location the emitter collects a stream's sessions until the
stream validated. A content-identity refusal raised after the payload
loop dropped every collected session with it; the stream is now drained
through the boundary and its validated sessions are emitted before the
refusal propagates, as on an unbound stream.

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

# Conflicts:
#	docs/plans/schema-closure-baseline.json
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sinity and others added 2 commits September 29, 2026 05:32
Master's blob adoptions (#5725) join the receipt-keyed discard:
discard_pending_receipt drops a queued adoption too and keeps the
latest-receipt bookkeeping master's discard_queued kept. The boundary
census declares the ingest worker's attachment-carrier spill.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Plain-file acquisition and the live batch retain bytes through
capture_bound_path, which streams into prepare_from_fileobj. The GC age
gate patched prepare_from_path and never measured its window, and the
read counter counted write_from_path, which the live batch no longer
calls, so its no-full-reread assertions held vacuously.

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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Sinity
Sinity enabled auto-merge (squash) September 29, 2026 03:52
@Sinity
Sinity merged commit a6d1a1b into master Sep 29, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the claude/canonical-sources branch September 29, 2026 03:55
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