Skip to content

refactor(operations): Move ref resolution and anchor reads on every surface - #5370

Merged
Sinity merged 3 commits into
masterfrom
fix/read-route-completion
Sep 21, 2026
Merged

Sinity merged 3 commits into
masterfrom
fix/read-route-completion

Conversation

@Sinity

@Sinity Sinity commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

Moves ref resolution into operations/ as a single implementation, makes the
around window expressible on all four surfaces, and moves three more read
views onto the daemon.

One hypothesis in the bead set is refuted below, and r3cuz is delivered
partially with the reasons stated rather than narrowed silently.

polylogue-j5u2b — one implementation, reachable from both sides

operations/ref_resolution.py holds the whole resolution as a plan:
plan_ref_resolution() classifies the ref archive-free and either decides the
payload or names the one archive read it needs (operation, arguments, projection,
stable order). Polylogue.resolve_ref frames that read with run_archive_read;
daemon/http.py::_handle_ref_resolve frames it against the reader it already pins.

962 lines deleted from api/archive.py, and no copy remains — grep for the
three private resolvers outside the new module returns only two test docstrings.

Anti-vacuity executed: adding a handler-side block-anchor branch that drops the
resolved object ref →
{'object_refs': []} != {'object_refs': ['message:claude-code-session:c1:n:m-c1']}.

It does not unblock decision D2 — my premise was wrong

I filed j5u2b partly on the hypothesis that one move would unblock D2's
_resolve_user_state_target. Verified false at head: that resolver never calls
resolve_ref. It is independent, over api/user_state_resolver.py plus three facade
helpers. The two blockers are structurally identical but share no code, so
r29bv AC3 is unblocked and D2 is not.

Cheap lead for whoever takes D2: api/user_state_resolver.py measures closure out
and its only surface import is a re-export of a storage function — so it is an
operations-layer resolver mis-filed under polylogue/api/, and moving it is
mechanical.

polylogue-idrej — around on all four surfaces, plus a typed refusal that was missing

read_contracts.py declares ANCHORED_SESSION_READ_KINDS and
SessionReadRequest.around, refusing around on a non-anchored kind, around +
continuation, and around + offset. The anchor is resolved before the window
is framed, so the minted continuation carries the resolved coordinate and nothing
about the anchor
. Wired through the CLI (--around, new Click param placed last),
Polylogue.read_transcript_window, and MCP read. raw keeps its own option set
rather than inheriting an --around it could only ignore.

A refusal that would have reached the operator as a traceback is now typed.
MessageNotInSessionError was a bare LookupError, which the declared read
operation's error map does not classify — so on the CLI route it was unclassified. It
now subclasses (LookupError, ValueError), so one class with one
code="message_not_found" reaches HTTP 404, a CLI non-zero exit, the MCP
error_json and a Python raise. Asserted on all four.

The parity test compares row ids, resolved offset and total across all four surfaces,
asserts the anchor is inside the window, that the offset is the page-aligned 2
(neither the first nor the last window — so a trivial implementation cannot pass),
and that the anchored window equals the window fetched by the offset it reports. Both
mutations executed: dropping the plumbing from the CLI route puts it on page zero;
dropping it from the API route does the same in the other direction plus
DID NOT RAISE MessageNotInSessionError.

polylogue-r3cuz — 3 of 11 moved, and two are held back for contract reasons, not effort

file-edits, agent-policies and web-content now lower onto session.read
evidence kinds; the ratchet drops 11 → 8. hooks moved to the same shared adapter and
gained the served-by: marker it never printed.

  • events is not movable as it stands. It accepts --limit and its payload
    reports the truncated row count as total. An evidence kind is answered whole,
    so lowering it would make session.read report complete=true for a truncated body
    — which SessionReadResult's validator refuses outright. It needs a windowed-evidence
    contract, or an explicit decision to change that payload's total semantics.
  • raw is genuinely windowed, with a real limit/offset and a real total — but
    transcript_window.py owns the message window vocabulary, and minting artifact
    continuations into that family is exactly the mixing the family exists to prevent. It
    needs a third body vocabulary and its own projection token.
  • dialogue, temporal and chronicle accept query sets rather than one exact
    reference, so they are not session.read projections at all; effective_context is a
    compaction-aware replay; neighbors and correlation reach different subsystems.
    Each needs its own operation declaration, not a kind.

The row-vocabulary test is load-bearing for a non-obvious reason

test_session_evidence_readers.py compares the operation's evidence body against the
facade reader it replaced, field for field — because after the move both CLI legs run
the same operation, so a daemon-vs-direct parity test would drop a field on both legs
together and stay green.
Mutation: renaming structured_patch → red.

Both served-by directions executed on the new parity tests: forcing daemon_disabled
→ assert 'served-by: daemon (uds,' in 'served-by: direct (21ms)'; hard-coding the
identity → the same assertion in reverse.

Landing window

All 30 changed files measure out. The derived identity does not move — this can
land during a rebuild.

That was deliberate, not luck: surfaces/payloads.py is IN and was untouched
because read_contracts.py exists so a new declaration stays off the boundary, and
that held for the new around field and the three new kinds. archive_tiers/archive.py,
write.py and queries/session_events.py are IN and were avoided — the evidence
reader table now holds callables into operations/session_evidence.py instead of
ArchiveStore method names, and the three new sync readers went into query modules
that measure out.

Verification

devtools verify --quick exit 0, 25/25 gates · render all --check exit 0, zero
out of sync · 14-selection focused run 1037 passed / 1 failed, the one failure
reproduced identically at origin/master in a clean detached worktree. Zero new
failures.

Broad tests/unit/cli tests/unit/operations before the final rebase: 3662 passed / 46
failed against 3657 / 46 at base — node-id sets identical, none new, none fixed. Most
were cleared upstream by #5367, which is why the final run shows one.

Residuals

  • 8 of 11 IN_PROCESS_READ_VIEWS remain, each with its blocker named above.
  • r29bv AC3 is unblocked but not executed — that is its own bead's work, and
    lowering annotations import touches the mutation-authority baseline.
  • Inherited red, unrelated and unfixed here:
    test_seed_ontology.py::test_seed_catalog_is_registered_and_replayed_without_user_schema_bump
    asserts target_ref_kinds still contains 'phase', which refactor(storage): Delete session_phases and session_work_events #5314 deleted with
    session_phases. Reproduced at origin/master. The correct fix — drop 'phase' or
    restore the kind — is a judgement about the seed ontology, not the read route.

Closes polylogue-j5u2b, polylogue-idrej. Advances polylogue-r3cuz (3 of 11).

🤖 Generated with Claude Code

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

Sinity and others added 3 commits September 21, 2026 22:14
``Polylogue.resolve_ref`` was a surface method, so a daemon handler could
not reach it: substrate must not import a surface. ``daemon/http.py``
worked around that by constructing a ``Polylogue`` facade inside the
daemon's own process for every ``GET /api/refs/resolve``, opening a second
archive generation per request; ``annotations import`` had no workaround at
all, which is why lowering it to a declared operation was blocked
(polylogue-j5u2b).

A handler-side reimplementation was the wrong answer specifically because
``import_annotation_batch`` admits or rejects every durable ``user.db``
candidate row on this answer. Two implementations that drift change which
annotation rows are admitted, with no failure at the point of divergence.

The resolution now lives in ``polylogue/operations/ref_resolution.py`` as a
plan: ``plan_ref_resolution`` classifies the ref without touching the
archive and either decides the payload outright or names the one archive
read that decides it, transaction identity included. The facade frames that
read with ``run_archive_read``; the daemon frames it against the reader it
already pinned. Neither owns the resolution.

Anti-vacuity: ``test_ref_resolution_is_one_implementation_for_the_daemon_
and_the_facade`` feeds a block anchor, a session ref and a message ref
through both routes and compares the rendered documents. Reintroducing a
handler-side block-anchor branch that drops the resolved-message
``object_refs`` entry reds it with
``{'object_refs': []} != {'object_refs': ['message:...']}``.

Verification: ``devtools verify --quick`` exit 0 (25 gates),
``devtools render all --check`` exit 0 with zero "out of sync",
``devtools test tests/unit/api/test_facade_contracts.py -k "resolve_ref or
ref_resolution or annotation_batch"`` 24 passed,
``devtools test tests/unit/daemon/test_web_reader.py -k "ref_resolve or
ref_resolution"`` 2 passed. All four changed files measure schema-closure
``out``.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
`around=<message id>` landed as an HTTP query parameter on the messages
read-view capability (#5359), so a deep link resolved in one page request
at any depth -- but only there. `operations/read_contracts.py`'s
`SessionReadRequest` still took `limit`/`offset` only, which left "give me
the window around this message" inexpressible on `read --view messages`,
the MCP `read` tool and the Python API: three surfaces that can otherwise
answer the same question (polylogue-idrej).

`around` is sugar over the existing coordinate, and it is implemented that
way: the anchor is resolved to an offset *before* the window is framed, so
the window, its `next_offset` and the continuation it mints are identical
to asking for the offset the result reports back. It is declared on the
`messages` kind only -- the kind the HTTP capability declared it on -- and
refused by name elsewhere, including on `read --view raw`, whose window is
over artifacts rather than messages and which would have inherited an
anchor it could only ignore.

The locate and the page-size alignment become one shared step
(`message_locator.window_offset_around`) because separating them is what
lets two surfaces align the same index differently. `MessageNotInSessionError`
gains a `ValueError` base: it was a bare `LookupError`, which the declared
read operation's error map does not classify, so the CLI route would have
reached the operator as a traceback instead of the typed
`message_not_found` refusal the HTTP route already returns.

Anti-vacuity, both executed:

* drop the anchor plumbing from the CLI/daemon handler and the CLI answers
  `('...message-0', '...message-1'), 0` while the other three answer
  `('...message-2', '...message-3'), 2`;
* drop it from `Polylogue.read_transcript_window` and the Python API and
  MCP flip to page zero instead, plus `DID NOT RAISE
  MessageNotInSessionError`.

Testing only the new surfaces could not see either, which is why the test
compares all four against each other and against the coordinate each
reports resolving to.

Verification: `devtools verify --quick` exit 0,
`devtools render all --check` exit 0 with zero "out of sync",
`devtools test tests/integration/test_transcript_window_differential.py`
7 passed, `test_continuation_surface_parity.py` + `test_messages.py` +
the three read-view registry selections 54 passed. All 13 changed files
measure schema-closure `out`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
`file-edits`, `agent-policies` and `web-content` were three of the eleven
`IN_PROCESS_READ_VIEWS`: each opened the archive in the CLI's own process
through the Python API facade, so a healthy daemon paid for a local archive
open on every invocation (polylogue-r3cuz). They now lower onto
`session.read` evidence kinds, following the pattern #5354 built for
`messages` and #5310 built for `hooks`.

Four views render four relations of the same request with a different
relation named, so `read_views/session_evidence.py` is one adapter rather
than four; `hooks` moves onto it too and gains the `--verbose`
`served-by:` marker it did not print.

Three constraints the pattern imposes, honoured:

* **Row vocabulary.** `operations/session_evidence.py` projects exactly the
  documents the facade readers returned, and shares the SQL and record
  mappers with the async twins rather than restating them.
  `test_session_evidence_readers.py` compares the operation's body against
  the facade reader it replaced, field for field -- a daemon/direct parity
  test cannot see a dropped field, because after the move both legs run the
  same operation and would drop it together.
* **Continuation family.** These relations are answered whole, so they
  issue no continuation and join `_WHOLE_EVIDENCE_KINDS`; the message
  continuation family is untouched.
* **Closure.** The evidence reader table now holds callables rather than
  `ArchiveStore` method names, because `archive_tiers/archive.py` is
  closure IN -- growing the table by adding methods there would move the
  schema identity for a read that adds no derived semantics. All 19 changed
  files measure `out`.

Not moved, with reasons rather than silence. `events` accepts `--limit` and
reports the *truncated* row count as its `total`; an evidence kind is
answered whole, so lowering it as it stands would make the operation report
`complete` for a truncated body, which the result contract refuses outright.
`raw` windows source-tier artifacts with a real `limit`/`offset` and total,
so it is a windowed kind -- but `transcript_window` owns the *message*
window vocabulary, and minting artifact continuations into the message
continuation family is the mixing that family exists to prevent. Both need a
windowed-evidence contract of their own. `dialogue`, `effective_context`,
`neighbors`, `correlation`, `temporal` and `chronicle` remain untouched.

The ratchet drops from eleven entries to eight.

Anti-vacuity, all executed:

* force `daemon_disabled` in the adapter -> `assert 'served-by: daemon
  (uds,' in 'served-by: direct (21ms)'`, reds both parity tests;
* hard-code the `served-by` identity -> `assert 'served-by: direct' in
  'served-by: daemon (uds, 21ms)'`, reds them in the other direction;
* rename one row key (`structured_patch` -> `structured_patch_json`) ->
  reds the facade-vs-operation row comparison.

Verification: `devtools verify --quick` exit 0,
`devtools render all --check` exit 0 with zero "out of sync",
`devtools test tests/unit/cli tests/unit/operations` 3662 passed / 46
failed, byte-for-byte the same 46 as `origin/master` ce2dea2 over the
same selection (3657 passed / 46 failed) -- zero new failures.

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

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 1bcd7610-2414-4d3a-97ea-fa30b18e6631

📥 Commits

Reviewing files that changed from the base of the PR and between f0c3e26 and 63be78a.

📒 Files selected for processing (30)
  • polylogue/api/archive.py
  • polylogue/api/sync/sessions.py
  • polylogue/archive/viewport/profiles.py
  • polylogue/cli/lowering.py
  • polylogue/cli/messages.py
  • polylogue/cli/query_verbs.py
  • polylogue/cli/read_view_handlers.py
  • polylogue/cli/read_view_registry.py
  • polylogue/cli/read_views/base.py
  • polylogue/cli/read_views/file_edits.py
  • polylogue/cli/read_views/messages.py
  • polylogue/cli/read_views/session_evidence.py
  • polylogue/cli/read_views/web_content_constructs.py
  • polylogue/daemon/http.py
  • polylogue/mcp/server_cutover.py
  • polylogue/operations/daemon_reads.py
  • polylogue/operations/message_locator.py
  • polylogue/operations/read_contracts.py
  • polylogue/operations/ref_resolution.py
  • polylogue/operations/session_evidence.py
  • polylogue/storage/sqlite/queries/file_edits.py
  • polylogue/storage/sqlite/queries/session_agent_policies.py
  • polylogue/storage/sqlite/queries/web_content_constructs.py
  • tests/integration/test_transcript_window_differential.py
  • tests/unit/cli/test_daemon_golden_parity.py
  • tests/unit/cli/test_messages.py
  • tests/unit/cli/test_read_view_classification.py
  • tests/unit/cli/test_read_view_execution_routes.py
  • tests/unit/daemon/test_web_reader.py
  • tests/unit/operations/test_session_evidence_readers.py

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 21, 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-21T20:52:40.412144Z 63be78a PR opened
🔒 Security Review ✅ Completed 2026-09-21T20:52:10.963383Z 63be78a PR opened
ℹ️ 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.

@Sinity
Sinity enabled auto-merge (squash) September 21, 2026 20:37
@Sinity
Sinity merged commit 874fc3a into master Sep 21, 2026
3 checks passed
@Sinity
Sinity deleted the fix/read-route-completion branch September 21, 2026 20:48

@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: 63be78a79d

ℹ️ 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/api/archive.py Resolved
Comment thread polylogue/api/archive.py Resolved
Comment thread polylogue/operations/read_contracts.py Resolved
Comment thread polylogue/cli/messages.py Resolved
Comment thread polylogue/cli/messages.py Resolved
Sinity added a commit that referenced this pull request Sep 21, 2026
)

## Summary

`events` and `raw` were the two `IN_PROCESS_READ_VIEWS` that **#5370
could not
move for contract reasons rather than effort**. Both are fixed here; the
ratchet
drops **8 → 6**.

Taken over directly after the lane died mid-run on a network error with
uncommitted work.

## Why they could not move as they were

**`events`** accepted `--limit` and reported the **clipped** row count
as its own
`total`. An evidence kind is answered whole, so lowering it unchanged
would have
made `session.read` report `complete=true` for a truncated body — which
`SessionReadResult`'s validator refuses outright. Nothing in the payload
separated a cut body from a finished one.

**`raw`** is genuinely windowed, with a real limit/offset and a real
total — but
`operations/transcript_window.py` owns the **message** window vocabulary
(`TRANSCRIPT_WINDOW_PROJECTION`, `session-owner-v1`). Minting artifact
continuations into that family is exactly the mixing the family exists
to
prevent: **a token that resumes "artifacts 50..100" while carrying the
message
projection is readable by a reader that will compose messages with it.**

## The contract

`operations/evidence_window.py` declares a **second continuation family,
per
relation rather than per surface**. A family names three things and
nothing else:

- the `session.read` kind it pages,
- **its own projection token** — what makes a foreign continuation
refusable *by
  name* instead of silently resumable, and
- the stable order the relation is windowed in, because a continuation
is only
  meaningful against an order the reader guarantees.

It deliberately does **not** own the window arithmetic or the snapshot
binding.
`next_offset` / `complete` / token minting and the before-and-after
epoch check
come from `transcript_window`'s `window_result` / `bind_snapshot`, which
take a
transaction and know nothing about messages. **An off-by-one or a
missing epoch
revalidation therefore stays one defect across both families instead of
two
independent ones.** The separation that matters is the vocabulary.

The bound is declared and reported, never silent: `total` is the
relation's own
row count, `returned` is the page's, and a page that does not reach the
total
mints a continuation instead of claiming completeness.

## Anti-vacuity — executed

Make the events reader return the page length as the relation total
(`return rows, len(rows)`) and **both** new tests go red with `assert
None` on the
continuation — because a page that believes it is whole mints no token.
A `limit`
at or above the relation's row count cannot witness this, so the window
in the
test is strictly smaller.

The second test asserts the families refuse each other: a continuation
minted for
`events` is rejected when presented to `transcript`.

## Two doubles removed rather than repaired

`tests/unit/cli/test_messages.py` drove `run_raw` and
`run_session_events`
through a `_FakeApi` with `patch("polylogue.api.Polylogue.open")`. Those
functions no longer exist — both views route through the declared
operation — and
**per #5354's precedent a double could not have proven the route in any
case.**
Their subject is covered by the new contract tests and the existing
golden-parity suite.

## Landing window

**All changed production files measure `out`; the derived identity does
not move**
— this can land during a rebuild. That held because a new operation
declaration
goes in `read_contracts.py` (which exists precisely so it stays off the
boundary)
rather than in `surfaces/payloads.py`, which is **IN**.

## Verification

`devtools verify --quick` — exit 0, all gates. `devtools render all
--check` —
exit 0, zero `out of sync`. `devtools test` over the evidence readers,
the
execution-route ratchet, continuation-surface parity and the daemon
golden parity
— exit 0. The evidence-reader module runs 5 passed including the two new
contract tests.

## Residual

**Six views remain in-process, and each needs its own operation
declaration
rather than a `session.read` kind**: `dialogue`, `temporal` and
`chronicle`
accept query sets rather than one exact reference; `effective_context`
is a
compaction-aware replay with `--at-position`; `neighbors` and
`correlation` reach
different subsystems.

A harness note for anyone adding tests here: `tests/conftest.py`
rewrites any
nodeid over 100 characters into a digest form, so a long test name
becomes
**unselectable by id** and reports as `not found` while the module
imports fine.
Both new names are kept under the threshold.

Advances polylogue-r3cuz (8 of 11 moved).

🤖 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 added a commit that referenced this pull request Sep 22, 2026
`polylogue annotations import` was the last CLI-invisible durable writer:
it drove `OperationExecutor` against `user.db` from the CLI process via
`polylogue.annotations.importer.import_annotation_batch`, a module the
mutation-authority layering rule did not name until the rule was
extended to match by drive rather than by spelling (polylogue-gjwto).
That extension turned the hole into a reviewed baseline entry
(`docs/plans/layering-cli-mutation-authority-baseline.json`); this closes
it by declaring `mutation.annotation.import_batch`, giving it a daemon
handler that reuses the existing actuator plus the shared
`resolve_ref_against_archive` implementation (PR #5370) instead of a
second ref-resolution path, and rewiring the CLI command onto
`submit_cli_mutation` (polylogue-r29bv AC3).

The handler drives the actuator's `async def import_annotation_batch`
from a synchronous daemon handler. A bare `asyncio.run(...)` would mint a
new task and lose the write lease bound to the calling thread/task, so
the handler mints a `delegate_write_lease()` on the calling thread and
adopts it inside the new task -- the declared mechanism for exactly this
handoff (`polylogue/daemon/write_coordinator.py` uses the same pattern).

The CLI-side `polylogue.annotations.importer` import is gone, so the
baseline shrinks from three entries to two (the two `polylogue/api`
entries stay, blocked on decision D2 per the existing baseline reason).

Verification:
- devtools test tests/unit/cli/test_annotation_import_command.py -- 3 passed
- devtools test tests/unit/api/test_operation_executor_routes.py
  tests/unit/operations/test_cli_operation_binding_registry.py
  tests/unit/operations/test_operation_bindings.py
  tests/unit/cli/test_cli_storage_boundary.py
  tests/unit/devtools/test_layering_gates.py
  tests/unit/api/test_facade_contracts.py::test_facade_import_annotation_batch_persists_candidate_provenance
  tests/unit/api/test_facade_contracts.py::test_facade_import_annotation_batch_uses_default_registry
  tests/unit/cli/test_setting_command.py tests/unit/annotations/test_importer.py
  -- 87 passed, 9 failed, all 9 in test_layering_gates.py over an
  unrelated durable-write-census fixture gap (devtools/, zero diff here,
  reproduces identically against origin/master 6fa8440; not fixed by
  this lane)
- devtools gate layering, gate api-parity, gate declaration-bindings -- ok
- devtools verify --quick -- 25/25 gates ok
- devtools render all --check -- no "out of sync"
- devtools schema closure -- every changed file OUT of the derived
  schema identity closure
- Anti-vacuity (executed): reverted annotations.py to the pre-fix
  in-process writer, ran
  test_annotations_import_refuses_without_a_daemon -- failed with the
  row importing successfully with no daemon running
  (assert 0 != 0 / exit_code 0), then restored the fix and reran the
  full file -- 3 passed.

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

## Summary

Eight live P1 review findings closed across `cli/` and `operations/`,
from the same `git blame` triage of the review backlog. Every one
reproduced at head before it was fixed.

## Problem

The largest is a portability defect with a silent-disarm failure mode.
`resident_daemon_pid` in `polylogue/maintenance/offline_guard.py`
decided daemon residency by reading `/proc/{pid}/cmdline` and swallowing
`OSError`. On any platform without `/proc`, the write-authority boundary
armed **nothing** on every invocation — and said so to no one. The same
`/proc` probe had two further copies in `polylogue/cli/`, both failing
open: `_migrate_tier._daemon_pidfile_is_live` (durable migration beside
a live daemon) and `status_diagnostics._probe_stale_pidfile` (a live
daemon's pidfile reported stale).

## Solution

Residency is now decided by a failed non-blocking **shared** `flock` on
`daemon.pid` — the lock `polylogue/daemon/cli.py:1840 _acquire_pidfile`
already holds for the whole run. That is portable, and stronger than a
name match that a recycled pid can satisfy. A platform that cannot prove
ownership raises `DaemonResidencyUndecidableError` →
`ArchiveWriterOwnershipUndecidableError`: the boundary refuses loudly
instead of arming nothing.

The TOCTOU half is answered by the same design. Root is configuration
and resolves once; residency is volatile and is re-asked before every
writable archive-tier open via
`offline_guard.refuse_writable_tier_opens`. No invocation-wide
`write_lease` is taken.

The remaining seven:

- `read_view_handlers` — two tests patched
`polylogue.cli.read_views.events` (does not exist) and
`messages.run_raw` (does not exist), so `mock.patch` raised
`AttributeError` before any assertion ran. Retargeted at
`READ_VIEW_HANDLERS`, which `run_read_view` reads per invocation.
- `read_views/messages.py` — the export truncated the destination before
streaming; now a sibling temp file renamed over on success, mode
preserved, parent fsynced.
- `attachment_convergence` — `BlobStore.publish_prepared` returns early
when `dest.exists()`, discarding the staged payload. Publication is
refused before staging when the destination for the payload's own hash
exists and does not verify; the row stays `unfetched`/retryable and is
counted `contradicted`. Keyed on the candidate hash, so a provider
returning genuinely different bytes still acquires under its own hash.
- `daemon_reads` — an undeclared `SessionReadKind` was served; now
refused, with a companion test requiring every declared kind to answer
so the refusal cannot pass by refusing everything.
- `read_contracts` — `file-edits`/`web-content` graduated onto the
windowed-evidence contract with their own continuation families;
`hooks`/`agent-policies` stay whole. Membership is now decided by
whether a *row* is bounded. `_require_deliverable_window` stops
advertising a retry for a single oversized row, which paging cannot
deliver.
- `intake_adapters` — `schedulable_adapters` now reads
`polylogue.core.source_halts` and copies an observed structural halt
into the durable `HaltRegistry`, so it survives a pass and a restart.

## Verification

- `devtools verify --quick` → **exit 0, 25/25 gates green**. Two real
failures were caught and fixed en route: `gate layering` (a new `cli →
storage` edge) and `gate patterns` (`replace-without-parent-fsync`).
- `devtools render all --check` → exit 0, `grep -c "out of sync"` =
**0**.
- Focused selection, 21 files / 494 tests, receipt
`.cache/verify/runs/20260922T065853Z-focused-test-1330094-c720b511`: 6
non-passing, **all identical to the base**. Baseline established by
detaching at `9f450db36` and running the same files. **New-to-branch
failures: 0.**
- Schema closure: every changed file measured **out**. The derived
schema identity does not move.

### Anti-vacuity, executed

Mutations applied, run, reverted. Batch A (receipt
`…T065340Z-…-af0a695f`):

- restore the `/proc` confirmation →
`test_residency_is_proved_by_the_held_lock_not_a_command_line`: `assert
None == 1314863` — the macOS failure, reproduced on Linux.
`test_a_platform_that_cannot_prove_ownership_refuses_loudly`: `DID NOT
RAISE` — the silent disarm, verbatim. Five further coupled reds. The
opposite direction stayed green: offline init, unarmed-when-unowned,
reads-not-refused, unheld-pidfile-is-not-resident.
- restore the single retry message → `assert 'no retry can deliver it'
in '… retry with a smaller limit'`.

Batch B (receipt `…T065737Z-…-0f1c8a02`), all five red:

- entry-sampling only → `DID NOT RAISE ArchiveWriterOwnershipError`
- `out_path.open("w")` → destination is the truncated partial header,
not the previous export
- drop the contradicted refusal → `acquired=1` over the corrupt file
- drop the source-halt bridge → `assert [8, 6, 8] == []` (a structurally
halted source was planned again)
- `file-edits` back to whole → `ValueError: … 12584323 bytes … answered
whole and takes no window coordinates`

## Scope

Declared `write_scope` expansion:
`polylogue/maintenance/offline_guard.py`. It holds the `/proc` defect,
and it is the only seam that can host the revalidation without a
forbidden `cli → storage` edge. Two placement constraints were measured
rather than assumed: `install_archive_write_guard` is IN the
derived-schema closure, so a hook parameter there would move every
derived tier's identity; and a fresh `cli → storage` import turns `gate
layering` red. Hence the seam lives in `maintenance/` and imports
storage's own `guarded_archive_tier_path` rather than restating it.
`polylogue/api/archive.py` was not touched.

## Residuals

Stated in the module itself:

- A writable connection opened while no daemon was resident stays open
across a daemon start.
- The daemon's pre-pidfile window is uncovered (it takes
`.archive-ownership.lock` first), because flock cannot distinguish this
process's own ownership from a foreign holder. Closing it needs a public
local-ownership predicate in `storage/archive_identity.py`, an IN file.

Also unfixed and unrelated:

- The six inherited reds: five `test_migrate_tier_cli_*` on
`SchemaSkewError: user schema skew: expected 1, found 3`, and
`test_the_decided_classification_partitions_every_view`, whose expected
tuple is stale for `events`/`raw` from #5374/#5370 — a one-line
expectation fix owed by those PRs.
- Recovering a contradicted attachment blob needs a durable
quarantine-and-replace route in `BlobStore`; `iter_namespace` admits
only shard directories and `.staging`, so it is a storage decision with
GC/census consequences.
- `polylogue/daemon/cli.py:352 _verify_pidfile` still reads `/proc`. It
fails *closed* (flock, then refuses), so it is not a P1, but it is the
last copy of the non-portable probe.

🤖 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 added a commit that referenced this pull request Sep 22, 2026
The mutation-authority ratchet covered polylogue/cli and (since decision D1)
polylogue/api, but never polylogue/mcp. The writes finished moving there: at
eab6e85 all twenty surviving _execute_facade_mutation call sites in
polylogue/api/archive.py are reached from polylogue/mcp and none from
polylogue/cli, so the entire remaining in-process writer population sat behind
the one surface no rule watched. polylogue/mcp/server_cutover.py:2229 also
imports polylogue.annotations.importer directly -- the MCP twin of the CLI
writer #5310 recorded -- and passed every gate, because the existing
polylogue/mcp rule disallows only storage/pipeline/sources.

Adds the third mutation-authority rule and records that import in the
baseline with its reviewed reason (decision D2, still blocked:
_resolve_user_state_target remains on the facade at archive.py:6721; PR #5370
moved resolve_ref, not this).

An import rule cannot see the facade-routed spelling of the same write, so
tests/unit/api/test_facade_mutation_census.py pins the half it structurally
misses: the twenty caller methods, shrink-only, plus their surface reach. A
CLI command re-routed through Polylogue.add_tag goes red there while the
import ratchet stays green, since the CLI is allowed to import polylogue.api.

Verification:
  devtools gate layering -> exit 0, count:0, baselined_count:215
    (before the baseline entry: exit 1, violations:[polylogue/mcp/
     server_cutover.py -> polylogue.annotations.importer] -- the rule fires)
  devtools verify --quick -> PASSED
  devtools test tests/unit/api/test_facade_mutation_census.py
    tests/unit/devtools/test_layering_gates.py -> PASSED
  devtools render all --check -> 0 "out of sync"

Anti-vacuity, executed:
  planted polylogue/cli/commands/wave_t_probe.py calling poly.add_tag ->
    test_no_cli_module_reaches_a_facade_mutation FAILED naming the file.
    The probe was untracked and still detected (rglob, not git ls-files).
  dropped "add_mark" from _EXPECTED_FACADE_MUTATIONS ->
    test_the_facade_mutation_inventory_is_the_pinned_one FAILED naming it.

No production Python changed, so the derived schema identity cannot move.

Refs: polylogue-gjwto, polylogue-r29bv

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

`polylogue/mcp` had **no mutation-authority rule at all**, so an
in-process durable write from that surface passed every gate. Beads:
polylogue-gjwto, polylogue-r29bv (both advanced, neither closed).

## Problem

The only layering rule for `polylogue/mcp` disallows
`storage|pipeline|sources`. So `mcp/server_cutover.py:2229` importing
`polylogue.annotations.importer` — the module the CLI rule explicitly
names as an executor driver, driving `OperationExecutor` against
`user.db` **in-process** — passed cleanly.

That is the MCP twin of the CLI writer recorded in #5310: the same
defect, one surface over from where it was fixed.

## Premise corrections, by measurement

**`_execute_facade_mutation` has 20 call sites, not 9.** The figure I
briefed this lane with was the **first nine of twenty** — a truncated
scan reported as a complete population. A 2026-09-22 bead note saying
"twenty… +1" is also wrong. AST census at `eab6e8507`: 20 call sites in
20 distinct methods, 1:1 —

```
3794, 6526, 6553, 6615, 6652, 6698, 6864, 6901, 6986, 7058,
7083, 7122, 7388, 7431, 7503, 7548, 7594, 7643, 7663, 7722
```

**All 20 are MCP-reached; zero are CLI-reached.** The three r29bv CLI
writers (setting / note / annotations) landed before this base, and the
layering baseline shrank 3 -> 2 accordingly. The remaining work is an
MCP-side question, not a CLI one.

## Solution

1. `docs/plans/layering.yaml` — a third mutation-authority rule for
`polylogue/mcp`. **Proven to fire**: before baselining, `gate layering`
exited 1 with the exact violation.
2. A baseline entry with its reviewed reason (D2 is genuinely blocked —
`_resolve_user_state_target` is still on the facade at `archive.py:6721`
with 5 call sites; PR #5370 moved `resolve_ref`, *not* this).
3. `tests/unit/api/test_facade_mutation_census.py` — pins the 20-method
inventory shrink-only, plus surface reach. This covers the facade-routed
spelling that an import rule **structurally cannot see**.

## Verification

```
devtools verify --quick     ->  PASSED
gate layering               ->  exit 0, baselined_count: 215
devtools test tests/unit/api/test_facade_mutation_census.py  ->  PASSED
devtools render all --check ->  0 "out of sync"
```

Both mutations executed with real failures: a planted CLI caller failed
`test_no_cli_module_reaches_a_facade_mutation` naming the file; dropping
`add_mark` failed the inventory test naming it. The probe file was
**untracked and still caught**, because the census walks with `rglob`
rather than `git ls-files` — the exact failure mode that let a recent ui
ratchet stay green with a live violating file on disk.

No production Python changed, so the derived identity cannot move.

## Two AC-REWRITEs

**1. "Growing the baseline is refused by the ratchet" is false** (r29bv
AC6, gjwto AC2). `verify_layering.py:142-144` says so plainly: the count
shrinks *"without an explicit edit to this file (and that edit is the
thing code review looks at)."* It is a **review convention, not a
mechanical refusal** — confirmed by history (2 -> 3 -> 2) and by this
edit.

**2. gjwto AC2 contradicts gjwto item 1.** AC2 wants the baseline to
shrink to zero; item 1 wants the rule extended so facade writes become
visible. Making a previously-invisible write visible **necessarily adds
an entry** — D1 itself grew the baseline 0 -> 2, and this change grows
it 2 -> 3 for the same reason and by the same intent. Read as a
prohibition on growth, AC2 forbids the rule extension its own bead
demands. It should read: *no entry may be added for a write that was
already visible.*

## Residual

This covers the direct-import half at MCP. The 20 facade-routed writes
remain, gated on D2 — an MCP-owner decision about requiring a running
daemon — which both beads explicitly instruct a lane not to attempt.

🤖 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 added a commit that referenced this pull request Sep 29, 2026
…#5785)

## Summary

This PR salvages ChatGPT fleet worker 12's Codex-debt batch (beads
`polylogue-1tyq5.55`, `.56`, `.60`, `.62`; 72 findings) and turns it
into verified changes. Five fixes land with regression tests that fail
on master. The worker's sixth fix (a negative completion cache) was
dropped, and its health-check fix was replaced with a stricter version.

## Problem

- **55.05** `health_check()` raises `SchemaSkew` when a tier is on
another version. The tier probe opened the file with schema admission
but caught only `sqlite3.Error`, so the probe crashed instead of
reporting an error check.
- **55.10** `list_assertion_candidate_reviews(limit=10)` computed
`total` with a second, unbounded review read. That read ran the
per-candidate judgment lookup (N+1) across the whole candidate history.
- **60.01** `--stream --limit N` followed continuations with no limit.
The final page could therefore fetch rows past N, and the resulting
`result_too_large` refusal was re-raised for continuations instead of
narrowing the page.
- **60.20** `raw-authority-frontier` printed the all-state `plan_count`
as `obligations=`, including terminal `superseded` plans.
- **62.01** Named `analyze postmortem|portfolio|cost-outlook` computed
the inherited root format but rendered from the local `None` format, so
they printed text when JSON was requested.

## Solution

- `_archive_tier_readiness_check` keeps admission, passes `tier=`, and
reports any `SchemaRefusalError` as an ERROR check. The worker's
`validate_schema=False` version was replaced because it compared only
`user_version`, so a derived tier with a stale identity at the right
version was reported OK.
`test_health_check_reports_derived_identity_skew` fails on the worker's
version.
- `_archive_list_assertion_candidate_reviews` returns `(page, count)`
from one read transaction. The count comes from
`count_assertion_claims`, which now accepts `target_ref` and
`statuses=None`. The count includes expired claims, matching the review
read model.
- `_read_session_windows` sends the remaining bound with every
continuation. An oversized resumed page halves in place, and later pages
keep the narrowed bound, because `session.read` refuses a continuation
that widens its window.
- The plain frontier line says `plans=` (the neutral label the finding
offered).
- `analyze_verb` renders every branch from the effective format: the
local format if given, otherwise the root format, normalized with
`normalize_output_dialect`. An explicit local `--format` still wins.
- **62.16 dropped.** The deleted-candidate case was already fixed on
master in 8cb1133 (#5722): each successful answer, empty or not,
removes the cached matches for the refreshed prefix. The worker added a
cache of empty answers that offline completion would treat as
authoritative. Nothing invalidated it except a later contradicting
daemon answer or the 24h TTL, and an offline reader cannot tell whether
the archive changed without opening it. The cold-cache message on a miss
is displayed rather than inserted, and it is accurate.
- Two stale tests in `test_archive_query.py` expected `_emit_stats` to
exit 0 over a converging archive. #5700 made that outcome degraded with
a nonzero exit, so the tests now expect that. They failed on master
before this PR.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w12 --wait` → job 2374: `verify: PASSED exit=0`
(head 331a204ddd, pre-rebase; the rebase onto 4501f13 touched none of
these files). Earlier job 2368 failed on format and mypy in the worker's
commit; commit 3561647 fixes both.
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w12 --wait --
tests/unit/api/test_archive_health_tier_skew.py
tests/unit/api/test_assertion_candidate_review_count.py
tests/unit/cli/test_analyze_named_projection_format.py
tests/unit/cli/test_raw_authority_frontier_output.py
tests/unit/cli/test_session_window_continuation_bounds.py
tests/unit/cli/test_analyze_projections.py
tests/unit/cli/test_archive_query.py
tests/unit/cli/test_completion_daemon_boundary.py
tests/unit/api/test_assertion_candidate_queue_health.py` → job 2405 at
head 3561647: `devtools test: PASSED exit=0 diagnosis=pytest_passed`,
168 passed.
- Anti-vacuity: the new tests were run on an origin/master checkout (job
2351). Every fix test failed there (11 failures, plus the 2 stale stats
tests). The one exception is
`test_named_analysis_local_format_overrides_inherited_json`, a
precedence guard that should pass on both. Job 2355 ran the health tests
against the worker's `validate_schema=False` variant, and the
derived-identity case failed (status OK instead of ERROR).
- Inherited, not addressed here:
`tests/unit/api/test_facade_contracts.py::test_archive_facet_buckets_count_unique_sessions_for_duplicate_hits`
and `::test_no_undiscovered_async_methods` fail identically on master
4501f13 (job 2401).

## Self-review

- **Sibling sites.** The review count had one caller, and `judge.py`
consumes the facade's `total`. The daemon health endpoint has its own
tier checks and is out of scope. The other `validate_schema=False` opens
are reset, paths and export tools, not health reporting.
- **Cancellation and loops.** The window retry loop is bounded by
halving to 1 and then re-raising. No new loop reads without a bound.
- **Unbounded reads.** This PR removes one, the unbounded review read,
and adds none.
- **Fail-open fallbacks.** The health probe now reports refusals instead
of hiding them. The dropped completion change would have turned a cache
miss into an authoritative empty answer.
- **Compatibility shims.** None. `count_assertion_claims` gained
optional parameters, and its existing `annotations/join.py` callers are
unchanged.
- **Removed symbols.** No production symbol was removed. The
`test_codex_debt_w12.py` files were renamed by behaviour.
- **Production route.** The API tests go through
`Polylogue.health_check` and `list_assertion_candidate_reviews` on
bootstrapped archives. The CLI tests go through `cli` or the real
command with a mocked transport (`dispatch_read`) and the real
`lower_session_read`.

## Derived-identity closure

`polylogue/storage/sqlite/archive_tiers/user_write.py` is a member of
`docs/plans/schema-closure-baseline.json`, so this PR moves the
candidate derived identity. Closure membership does not grow (the
`schema-closure` gate passed). No other changed production file is a
member.

## Per-finding dispositions

Counts: 5 fixed, 60 fixed-already, 2 stale, 1 refuted, 4 not reached.
The not-reached findings (55.18, 55.22, 60.12, 62.08) stay open on their
beads.

| key | disposition | evidence | test |
| --- | --- | --- | --- |
| 55.01 #4326 `polylogue/api/__init__.py:51` | refuted |
`polylogue/api/parity.py:472–491`: The explicit context-pack exclusion
includes topic_pack; composed builders do not own a separate operation
identity under this contract. | — |
| 55.02 #5381 `polylogue/api/archive.py:410` | fixed-already |
`polylogue/api/archive.py::_read_session_transcript_page`: The
normalized offset is used for both the read and returned page
coordinates. | — |
| 55.03 #4287 `polylogue/api/archive.py:818` | fixed-already |
`polylogue/api/archive.py::_archive_list_summaries_with_post_filters`:
Effective specification pagination is restored after content filtering.
| — |
| 55.04 #4295 `polylogue/api/archive.py:871` | fixed-already |
`polylogue/api/archive.py::_archive_aggregate_facet_families / keyed`:
Repeated facet bucket counts are added across chunks rather than
overwritten. | — |
| 55.05 #4871 `polylogue/api/archive.py:1114` | fixed |
`_archive_tier_readiness_check` keeps admission and reports
`SchemaRefusalError` as ERROR | `api/test_archive_health_tier_skew.py` |
| 55.06 #4192 `polylogue/api/archive.py:1152` | fixed-already |
`polylogue/api/archive.py::_archive_list_assertion_claims`: Uses
_readable_user_tier rather than an index-backed query runner. | — |
| 55.07 #4794 `polylogue/api/archive.py:1546` | fixed-already |
`polylogue/storage/sqlite/connection_profile.py::_install_progress_handler`:
Read frames install an expiry/cancellation-aware SQLite progress
handler, including work using the bound connection. | — |
| 55.08 #4552 `polylogue/api/archive.py:1691` | fixed-already |
`polylogue/api/archive.py::_archive_list_assertion_candidates`: Calls
the canonical actionable queue reader rather than the expiry-retaining
review reader. | — |
| 55.09 #4295 `polylogue/api/archive.py:3066` | fixed-already |
`polylogue/api/archive.py::pathology_report`: replace(spec, limit=None,
offset=0) removes query pagination from the scope denominator. | — |
| 55.10 #4295 `polylogue/api/archive.py:3448` | fixed | one read
transaction; scalar `count_assertion_claims` replaces the second
unbounded review read | `api/test_assertion_candidate_review_count.py` |
| 55.11 #4552 `polylogue/api/archive.py:3453` | fixed-already |
`polylogue/api/archive.py::_readable_user_tier`: Missing/non-file and
unreadable durable-tier failures retain typed unavailability rather than
returning an empty list. | — |
| 55.12 #4295 `polylogue/api/archive.py:3503` | fixed-already |
`polylogue/cli/commands/judge.py::judge_command`: Preserves
authoritative review totals; additional client-side time filtering reads
the complete selection before recounting. | — |
| 55.13 #5302 `polylogue/api/archive.py:4021` | fixed-already |
`polylogue/operations/facade_writers.py::record_manual_continuation_product`:
Invokes _resolve_session_graph before committing the manual link,
refreshing topology projections. | — |
| 55.14 #5302 `polylogue/api/archive.py:4021` | fixed-already |
`polylogue/operations/facade_writers.py::record_manual_continuation_product`:
Invokes the canonical cycle/quarantine pass instead of leaving the
direct insert unchecked. | — |
| 55.15 #4180 `polylogue/api/archive.py:5081` | fixed-already |
`polylogue/api/archive.py::search_session_hits`: Passes unresolved
spec.to_plan() to failure-classifying search_hits_for_plan. | — |
| 55.16 #4180 `polylogue/api/archive.py:5512` | fixed-already |
`polylogue/api/archive.py::filter`: Constructs SessionFilter without
vector-provider initialization. | — |
| 55.17 #5362 `polylogue/api/archive.py:5557` | fixed-already |
`polylogue/api/archive.py::query_sessions`: Includes
title_is_synthesized from display_label_source. | — |
| 55.18 #5370 `polylogue/api/archive.py:5561` | not reached |
`polylogue/api/archive.py::read_transcript_window`: Anchor lookup and
transcript-window reading still have separate read lifetimes.
Single-snapshot implementation remains necessary; no fix written. | — |
| 55.19 #5370 `polylogue/api/archive.py:5563` | fixed-already |
`polylogue/api/archive.py::read_transcript_window`: Explicitly rejects
around combined with transcript filters. | — |
| 55.20 #4357 `polylogue/api/archive.py:6330` | fixed-already |
`polylogue/api/archive.py::get_effective_context`: Canonical ID
resolution plus read_summary replaces full transcript hydration for the
existence check. | — |
| 55.21 #4261 `polylogue/api/insights.py:753` | fixed-already |
`polylogue/api/insights.py::cost_outlook`: Restricts the cost query to
the selected cycle's since/until rather than the whole archive. | — |
| 55.22 #5007 `polylogue/api/insights.py:916` | not reached |
`polylogue/api/insights.py::get_ancestors/get_descendants/get_siblings/get_thread/get_logical_session`:
Exhaustive relationship helpers still consume the default topology page
without exhaustion. No implementation written. | — |
| 55.23 #5007 `polylogue/api/insights.py:927` | fixed-already |
`polylogue/api/insights.py::_resolve_for_topology`: Uses canonical
archive resolve_session_id, preserving native-ID resolution. | — |
| 55.24 #4799 `polylogue/api/insights.py:1030` | fixed-already |
`polylogue/api/insights.py::compact_lineage`: Both public page defaults
use DEFAULT_LINEAGE_PAGE_LIMIT. | — |
| 55.25 #4539 `polylogue/api/search_envelope_builder.py:138` |
fixed-already |
`polylogue/api/search_envelope_builder.py::build_search_envelope_for_spec;
polylogue/operations/authority.py::authority_for_config`: The envelope
delegates authority resolution to the owner that resolves the active
archive root. | — |
| 56.01 #4603 `polylogue/api/search_envelope_builder.py:148` |
fixed-already |
`polylogue/api/search_envelope_builder.py::build_search_envelope_for_spec`:
Reports matched=total and analyzed=len(hits). | — |
| 60.01 #5337 `polylogue/cli/archive_query.py:360` | fixed |
continuations carry the remaining bound; resumed pages halve in place,
never widen | `cli/test_session_window_continuation_bounds.py` |
| 60.02 #4402 `polylogue/cli/archive_query.py:390` | fixed-already |
`polylogue/surfaces/cursor_identity.py::search_cursor_request_identity`:
Presentation-only parameters are excluded from cursor identity. | — |
| 60.03 #4987 `polylogue/cli/archive_query.py:1913` | fixed-already |
`polylogue/cli/render/rows.py::project_payload`: Outcome is preserved
independently of selected result fields. | — |
| 60.04 #5249 `polylogue/cli/click_app.py:479` | fixed-already |
`polylogue/cli/query_contracts.py::QueryOutputSpec.from_params`:
Explicit file destination and path retain typed FILE identity even for
reserved-looking filenames. | — |
| 60.05 #4337 `polylogue/cli/click_app.py:554` | fixed-already |
`polylogue/cli/query_group.py::_asks_for_query_workflow_help`: The
advertised find help route is handled while respecting option arity. | —
|
| 60.06 #4340 `polylogue/cli/click_app.py:628` | fixed-already |
`polylogue/cli/click_app.py::main`: Runtime checks run inside
guarded_entry passed to run_machine_entry. | — |
| 60.07 #4651 `polylogue/cli/click_command_registration.py:192` |
fixed-already | `polylogue/cli/commands/insights_alias.py`: The existing
root group exposes only Fable, not the entire operational group. No
alias is introduced by this batch. | — |
| 60.08 #4580 `polylogue/cli/click_command_registration.py:192` |
fixed-already | `polylogue/cli/commands/insights_alias.py`: The existing
narrow route preserves the promised Fable-packet command. No alias is
introduced by this batch. | — |
| 60.09 #4550 `polylogue/cli/click_command_registration.py:192` |
fixed-already |
`polylogue/cli/commands/insights_alias.py::_register_fable_packet`:
Registers only the intended Fable command rather than the entire
operational group. | — |
| 60.10 #4698 `polylogue/cli/commands/check.py:41` | fixed-already |
`polylogue/scenarios/operational_surfaces.py`: Authored doctor scenarios
use current routes without the retired repair flags. | — |
| 60.11 #5349 `polylogue/cli/commands/diagnostics.py:992` |
fixed-already |
`polylogue/cli/commands/diagnostics.py::latency_command`: The
empty-bucket branch still renders incomplete-drop accounting. | — |
| 60.12 #5639 `polylogue/cli/commands/import_command.py:117` | not
reached |
`polylogue/cli/commands/import_command.py::_wait_for_demo_ingest`: Owner
completion accounting improved, but a degraded receipt still causes
immediate failure instead of waiting through the remaining convergence
budget. No implementation written. | — |
| 60.13 #5314 `polylogue/cli/commands/insights.py:147` | fixed-already |
`polylogue/scenarios/insight_surfaces.py;
tests/unit/cli/test_stdout_stderr_split.py`: Inventories use current
rather than retired commands. | — |
| 60.14 #4678 `polylogue/cli/commands/insights.py:224` | fixed-already |
`polylogue/cli/commands/insights.py::_render_status_plain`: Plain output
includes degraded counts and fallback reasons. | — |
| 60.15 #4292 `polylogue/cli/commands/insights.py:450` | fixed-already |
`polylogue/cli/commands/insights.py::_packet_json_document`: Dataclass
tuples are lowered to JSON-native arrays. | — |
| 60.16 #5311 `polylogue/cli/commands/judge.py:417` | fixed-already |
`polylogue/cli/commands/judge.py::judge_command`: Interactive approval
forwards the evidence digest and checks failed counts before printing
success. | — |
| 60.17 #4133 `polylogue/cli/commands/maintenance/_blob_gc.py:81` |
fixed-already |
`polylogue/cli/commands/maintenance/_blob_gc.py::blob_gc_command`:
Blocked previews set ok=false and exit nonzero in both formats. | — |
| 60.18 #4955 `polylogue/cli/commands/maintenance/_blob_gc.py:211` |
stale | `polylogue/cli/commands/maintenance/_blob_gc.py`:
gc_recover_command is gone; the remaining command is preview-only. | — |
| 60.19 #5345 `polylogue/cli/commands/maintenance/_blob_integrity.py:52`
| stale | `polylogue/cli/commands/maintenance/_blob_integrity.py`:
_submit_replace_from_source and its cited relative-output forwarding
route are gone. | — |
| 60.20 #5350 `polylogue/cli/commands/maintenance/_raw_identity.py:47` |
fixed | plain line labels the all-state count `plans=` |
`cli/test_raw_authority_frontier_output.py` |
| 60.21 #5301 `polylogue/cli/commands/maintenance/_raw_identity.py:59` |
fixed-already |
`polylogue/cli/commands/maintenance/_raw_identity.py::raw_authority_blockers_command`:
Paginated public blocker inspection exposes expected/observed evidence.
| — |
| 60.22 #4955 `polylogue/cli/commands/maintenance/_raw_identity.py:247`
| fixed-already |
`polylogue/cli/commands/maintenance/_raw_identity.py::raw_authority_blocker_resolve_command`:
Checks the affected count rather than presenting no-op resolution as an
applied mutation. | — |
| 60.23 #4824 `polylogue/cli/commands/maintenance/_verify_archive.py:85`
| fixed-already |
`polylogue/cli/commands/maintenance/_verify_archive.py::verify_archive_command`:
Source-frontier construction is conditional on selected
source-conservation work. | — |
| 60.24 #5491 `polylogue/cli/commands/paths.py:75` | fixed-already |
`polylogue/cli/commands/paths.py::_raw_materialization_readiness`:
Propagates the selected index path through
archive_debt_list(index_db_path=...). | — |
| 60.25 #5353 `polylogue/cli/commands/status.py:342` | fixed-already |
`polylogue/operations/daemon_status.py::produce_operation_status`:
Merges runtime collection metadata into pinned readiness components. | —
|
| 62.01 #5422 `polylogue/cli/query_verbs.py:2434` | fixed |
`analyze_verb` renders from the effective (normalized, inherited) format
| `cli/test_analyze_named_projection_format.py` |
| 62.02 #5007 `polylogue/cli/read_views/lineage.py:78` | fixed-already |
`polylogue/cli/read_views/lineage.py`: The replacement operation-backed
route uses the resolved target; the old _run path is gone. | — |
| 62.03 #5407 `polylogue/cli/read_views/messages.py:226` | fixed-already
| `polylogue/cli/read_views/messages.py::_write_messages_file`: Resolves
symlink output before choosing the staging sibling. | — |
| 62.04 #5407 `polylogue/cli/read_views/messages.py:227` | fixed-already
| `polylogue/cli/read_views/messages.py::_write_messages_file`: Flushes
and fsyncs the staged descriptor before replacement and synchronizes the
directory. | — |
| 62.05 #4291 `polylogue/cli/read_views/query_set.py:196` |
fixed-already |
`polylogue/cli/read_views/correlation.py::run_read_correlation`: Renders
a string and delivers it through deliver_content instead of an
uncaptured console-only renderer. | — |
| 62.06 #5374 `polylogue/cli/read_views/session_evidence.py:180` |
fixed-already |
`polylogue/cli/read_views/session_evidence.py::_read_evidence_window`:
Projection body coordinates take precedence before operation lowering. |
— |
| 62.07 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/cli/query_output.py::deliver_query_output`: File delivery
retains secret-candidate scanning. | — |
| 62.08 #5520 `polylogue/cli/read_views/standard.py:99` | not reached |
`polylogue/cli/read_views/standard.py::run_read_summary_or_transcript;
polylogue/cli/archive_query.py::_read_session_windows`: The standard
file path still accumulates the transcript and buffers its rendered
document. End-to-end operation-backed streaming is not implemented. | —
|
| 62.09 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
|
`polylogue/cli/read_views/standard.py::run_read_summary_or_transcript`:
Forwards a typed FILE QueryDeliveryTarget, preserving reserved-looking
filenames. | — |
| 62.10 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/operations/daemon_reads.py::_session_identity_projection;
polylogue/cli/archive_query.py::_session_message_text`: The operation
preserves tool_input; rendering includes structured tool input and omits
reasoning blocks. | — |
| 62.11 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/cli/archive_query.py::_read_session_windows`: Initial
oversized pages already halve their bound at the inspected base. This
batch additionally fixes resumed-page narrowing under 60.01. | — |
| 62.12 #5266 `polylogue/cli/session_rows.py:141` | fixed-already |
`polylogue/cli/session_rows.py::_query_page_with_authority`: Synthetic
missing-session selections explicitly include next_offset=None. | — |
| 62.13 #5426 `polylogue/cli/shared/machine_errors.py:233` |
fixed-already |
`polylogue/cli/shared/machine_errors.py::error_archive_writer_ownership`:
Undecidable ownership has a separate remedy that does not assert an
observed resident daemon. | — |
| 62.14 #5426 `polylogue/cli/shared/machine_errors.py:285` |
fixed-already |
`polylogue/cli/shared/machine_errors.py::extract_command`: Recognizes
--output-format as a value-bearing option. | — |
| 62.15 #5545 `polylogue/cli/shell_completion_values.py:117` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_cached_value_matches`:
Session IDs match native-ID and title substrings. | — |
| 62.16 #5545 `polylogue/cli/shell_completion_values.py:135` |
fixed-already | deleted-candidate case fixed by 8cb1133 (#5722):
every successful answer prunes the refreshed prefix; negative-answer
cache declined (see Solution) | — |
| 62.17 #5545 `polylogue/cli/shell_completion_values.py:145` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
A per-archive map retains more than the most recent archive. | — |
| 62.18 #5545 `polylogue/cli/shell_completion_values.py:157` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
Removes an existing value before reinsertion at the retention tail. | —
|
| 62.19 #5545 `polylogue/cli/shell_completion_values.py:178` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
Global serialized-byte eviction precedes publication. This batch
includes new empty observations in that accounting. | — |
| 62.20 #5545 `polylogue/cli/shell_completion_values.py:181` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
flock serializes the full cache read-modify-write sequence. | — |
| 62.21 #5382 `polylogue/cli/write_authority.py:104` | fixed-already |
`polylogue/storage/sqlite/write_lease.py::arm_write_lease_enforcement`:
Locked process-wide user/suppressor counts make arming overlap-safe. | —
|

## Residuals

- The four not-reached findings remain open.
- Changing `user_write.py` moves the derived identity, so this PR has to
land before a rebuild starts.
- The two `test_facade_contracts.py` failures are inherited from master.

🤖 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

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 ef10e59):

Resolving the fixed, stale and refuted threads; tracked threads stay open.

@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 64a9bd0):

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

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Fix record for Codex review threads on this PR (checked at master 5d56c3a):

These threads were already resolved by the triage post that assigned them to polylogue-9kemf; this comment records the fix.

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