Skip to content

refactor(storage): Delete session_phases and session_work_events - #5314

Merged
Sinity merged 1 commit into
masterfrom
fix/w11-retire-session-phases
Sep 21, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/w11-retire-session-phases

Conversation

@Sinity

@Sinity Sinity commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

Deletes session_phases and session_work_events — a heuristic session
segmentation whose structural half duplicates action_pairs and whose
inference half was already self-marked heuristic_label.

Problem

Both tables yield a single span covering the whole session for 82% (work
events) / 84% (phases) of sessions, and their index-synthesized endpoints
invert on 13,743 rows. action_pairs already carries the same file/tool
evidence at real per-call granularity. The heuristic_label marking in
inference_json was copied into top-level columns that dropped the marking,
so surfaces presented a heuristic as a measurement.

Solution

Removed together, so no surface advertises an insight with no relation behind
it: the two tables and session_work_events_fts, the
session_profiles.work_event_count/phase_count columns, the threads view's
work_event_breakdown_json, both materializers, the timeline read/write query
band, both registry descriptors (which regenerate the MCP tool contracts, the
CLI phases/work-events/timeline commands and the insight docs), both
rigor contracts, the readiness/status/workload-probe and export-bundle entries,
the resume-brief citations, the daemon insights-browser panels, and the
work_event/phase user-state target and ref kinds.

engaged_duration_ms was the one genuine consumer deriving value from the
phase intervals, so it is preserved exactly: compute_engaged_duration_ms in
archive/semantic/timing.py reproduces the same 5-minute-gap segmentation over
message timestamps (with the session-event fallback for the ~30% of the archive
whose messages carry none) without materializing a span table.
engaged_duration_source reports engagement_intervals where it previously
reported phase_sum.

INDEX_SCHEMA_VERSION 106 (master is at 105 after #5308 took 104 and #5311
took 105): semantic — an existing index.db must be rebuilt from source.db.
analysis/registry.py and storage/derived/session/{rebuild,profiles,threads}.py
are in the derived schema-identity closure, so this moves the identity stamp and
must land before any rebuild starts. No rebuild is running.

Verification

  • devtools test tests/unit/storage tests/unit/analysis — green
  • devtools render all --check — no out of sync
  • devtools verify --quick — static gates pass
  • Inherited reds per /realm/tmp/work/polylogue-known-red.md at f6f899c are
    unchanged by this branch.

Residuals

The commit message on 2f27200f3 says version 104; that prose predates the
restack onto 106. The code is correct — this PR body is the squash subject's
body and states 106.

Closes polylogue-cuxz.7.

🤖 Generated with Claude Code

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

polylogue-cuxz.7. Both tables stored a heuristic segmentation that yields a
single span covering the whole session for 82% (work events) / 84% (phases)
of sessions, with index-synthesized endpoints that invert on 13,743 rows.
Their structural half duplicates `action_pairs`, which carries the same
file/tool evidence at real per-call granularity; their inference half was
already marked `heuristic_label` in `inference_json` and then copied into
top-level columns that hid the marking.

Removed together, so no surface advertises an insight with no relation
behind it (AC1): the two tables and `session_work_events_fts`, the
`session_profiles.work_event_count`/`phase_count` columns, the `threads`
view's `work_event_breakdown_json` column, both materializers
(`archive/phase/extraction.py`, `archive/session/extraction.py`,
`storage/derived/session/timeline_rows.py`), the timeline read/write query
band, both registry descriptors (which is what regenerates the MCP tool
contracts, the CLI `phases`/`work-events`/`timeline` commands and the
insight docs), both rigor contracts, the readiness/status/workload-probe
entries, the export-bundle entries, the resume-brief citations, the daemon
insights-browser timeline/phases panels, and the `work_event`/`phase`
user-state target kinds and ref kinds.

`engaged_duration_ms` was the one genuine consumer deriving value from the
phase intervals, so it is preserved exactly: `compute_engaged_duration_ms`
in `archive/semantic/timing.py` reproduces the same 5-minute-gap
segmentation over message timestamps (with the session-event fallback for
the ~30% of the archive whose messages carry none) without materializing a
span table. `engaged_duration_source` reports `engagement_intervals` where
it previously reported `phase_sum`.

INDEX_SCHEMA_VERSION 104: semantic, an existing index.db must be rebuilt
from source.db. `polylogue/analysis/registry.py` and
`storage/derived/session/{rebuild,profiles,threads}.py` are in the derived
schema-identity closure, so this moves the identity stamp and must land
before any rebuild starts.

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

Important

Review skipped

Too many files!

This PR contains 153 files, which is 53 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 84bba2f8-60c4-4ada-89d2-6c9bcfbcb219

📥 Commits

Reviewing files that changed from the base of the PR and between 217e9e9 and 2f27200.

📒 Files selected for processing (153)
  • docs/api-parity.md
  • docs/architecture-hotspots.md
  • docs/design/daemon-core.md
  • docs/design/session-lineage-model.md
  • docs/insights-rigor-matrix.md
  • docs/insights.md
  • docs/internals.md
  • docs/library-api.md
  • docs/plans/layering.yaml
  • docs/plans/sqlite-degradation-baseline.json
  • docs/schema.md
  • docs/search.md
  • polylogue/analysis/archive.py
  • polylogue/analysis/archive_models.py
  • polylogue/analysis/export_bundles.py
  • polylogue/analysis/fallback.py
  • polylogue/analysis/readiness.py
  • polylogue/analysis/registry.py
  • polylogue/analysis/resume.py
  • polylogue/analysis/rigor.py
  • polylogue/analysis/timeline_renderer.py
  • polylogue/annotations/schema.py
  • polylogue/api/archive.py
  • polylogue/api/insights.py
  • polylogue/api/parity.py
  • polylogue/api/sync/insights.py
  • polylogue/api/user_state_resolver.py
  • polylogue/archive/phase/__init__.py
  • polylogue/archive/phase/extraction.py
  • polylogue/archive/semantic/timing.py
  • polylogue/archive/session/documents.py
  • polylogue/archive/session/extraction.py
  • polylogue/archive/session/models.py
  • polylogue/archive/session/runtime.py
  • polylogue/archive/session/session_summaries.py
  • polylogue/archive/session/threads.py
  • polylogue/cli/commands/insights.py
  • polylogue/core/refs.py
  • polylogue/core/user_state_targets.py
  • polylogue/daemon/convergence.py
  • polylogue/daemon/fts_status.py
  • polylogue/daemon/health.py
  • polylogue/daemon/http.py
  • polylogue/daemon/session_insight_maintenance.py
  • polylogue/daemon/status.py
  • polylogue/operations/daemon_insights.py
  • polylogue/operations/daemon_protocol.py
  • polylogue/operations/daemon_status.py
  • polylogue/operations/daemon_workload_probe.py
  • polylogue/operations/insight_acceptance.py
  • polylogue/operations/machine_receipts.py
  • polylogue/operations/specs.py
  • polylogue/pipeline/payload_types.py
  • polylogue/readiness/__init__.py
  • polylogue/sources/origin_specs.py
  • polylogue/storage/archive_readiness.py
  • polylogue/storage/derived/aggregate/records.py
  • polylogue/storage/derived/derived_status.py
  • polylogue/storage/derived/insights.py
  • polylogue/storage/derived/session/derivation.py
  • polylogue/storage/derived/session/profiles.py
  • polylogue/storage/derived/session/rebuild.py
  • polylogue/storage/derived/session/records.py
  • polylogue/storage/derived/session/refresh.py
  • polylogue/storage/derived/session/runtime.py
  • polylogue/storage/derived/session/status.py
  • polylogue/storage/derived/session/storage.py
  • polylogue/storage/derived/session/threads.py
  • polylogue/storage/derived/session/timeline_rows.py
  • polylogue/storage/derived/timeline/records.py
  • polylogue/storage/embeddings/support.py
  • polylogue/storage/fts/derivation.py
  • polylogue/storage/fts/fts_lifecycle.py
  • polylogue/storage/fts/pl_fold.py
  • polylogue/storage/fts/sql.py
  • polylogue/storage/runtime/__init__.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py
  • polylogue/storage/sqlite/archive_tiers/common.py
  • polylogue/storage/sqlite/archive_tiers/index.py
  • polylogue/storage/sqlite/archive_tiers/read_insights.py
  • polylogue/storage/sqlite/archive_tiers/session_annotations_write.py
  • polylogue/storage/sqlite/archive_tiers/user_overlay.py
  • polylogue/storage/sqlite/archive_tiers/write.py
  • polylogue/storage/sqlite/async_sqlite.py
  • polylogue/storage/sqlite/queries/__init__.py
  • polylogue/storage/sqlite/queries/mappers.py
  • polylogue/storage/sqlite/queries/mappers_insight_aggregates.py
  • polylogue/storage/sqlite/queries/mappers_insight_fallback.py
  • polylogue/storage/sqlite/queries/mappers_insight_profiles.py
  • polylogue/storage/sqlite/queries/mappers_insight_timelines.py
  • polylogue/storage/sqlite/queries/session_insight_timeline_reads.py
  • polylogue/storage/sqlite/queries/session_insight_timeline_writes.py
  • polylogue/storage/sqlite/query_store.py
  • polylogue/storage/sqlite/query_store_insight_timelines.py
  • tests/infra/archive_canonical_snapshot.py
  • tests/infra/convergence_harness.py
  • tests/infra/reindex_differential.py
  • tests/infra/sqlite_work_counter.py
  • tests/integration/test_ingest_pipeline_correctness.py
  • tests/property/test_convergence_property_mutations.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/api/test_parameter_conservation.py
  • tests/unit/archive/test_phase_extraction.py
  • tests/unit/archive/test_work_event_extraction.py
  • tests/unit/cli/test_insights.py
  • tests/unit/core/test_facade_api.py
  • tests/unit/core/test_insight_export_bundles.py
  • tests/unit/core/test_insight_readiness.py
  • tests/unit/core/test_refs.py
  • tests/unit/core/test_resume.py
  • tests/unit/core/test_semantic_facts.py
  • tests/unit/core/test_session_summaries.py
  • tests/unit/core/test_sync_surface_runtime.py
  • tests/unit/core/test_temporal_confidence.py
  • tests/unit/core/test_threads_runtime.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/daemon/test_fts_readiness_fallback.py
  • tests/unit/daemon/test_health_check_paths.py
  • tests/unit/daemon/test_insights_browser_endpoint.py
  • tests/unit/daemon/test_selected_session_parts.py
  • tests/unit/daemon/test_session_insight_maintenance.py
  • tests/unit/insights/test_fallback_markers.py
  • tests/unit/insights/test_portfolio_unpriced.py
  • tests/unit/insights/test_postmortem.py
  • tests/unit/insights/test_rigor_audit.py
  • tests/unit/insights/test_temporal_source_taxonomy.py
  • tests/unit/insights/test_timeline_renderer.py
  • tests/unit/operations/test_daemon_workload_probe.py
  • tests/unit/operations/test_operation_audit.py
  • tests/unit/pipeline/test_ingest_batch.py
  • tests/unit/sources/test_compaction.py
  • tests/unit/storage/test_archive_tiers_common.py
  • tests/unit/storage/test_archive_tiers_user_overlay.py
  • tests/unit/storage/test_archive_tiers_write.py
  • tests/unit/storage/test_derived_status.py
  • tests/unit/storage/test_embedding_stats.py
  • tests/unit/storage/test_fts_escape_in_insights.py
  • tests/unit/storage/test_insight_materialization_laws.py
  • tests/unit/storage/test_lineage_normalization.py
  • tests/unit/storage/test_pl_fold.py
  • tests/unit/storage/test_schema_policy_contracts.py
  • tests/unit/storage/test_session_insight_mapper_fallbacks.py
  • tests/unit/storage/test_session_insight_parallel_fanout.py
  • tests/unit/storage/test_session_insight_rebuild_progress.py
  • tests/unit/storage/test_session_insight_refresh.py
  • tests/unit/storage/test_session_insight_status_descriptors.py
  • tests/unit/storage/test_session_insight_timeline_rows.py
  • tests/unit/storage/test_session_partition_convergence.py
  • tests/unit/storage/test_session_profile_derivation.py
  • tests/unit/storage/test_user_state_target_kinds.py
  • tests/unit/storage/test_work_event_phase_time_window.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

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 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-21T01:00:48.127315Z 2f27200 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.

@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: 2f27200f33

ℹ️ 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/annotations/schema.py Resolved
Comment thread polylogue/cli/commands/insights.py Resolved
Comment thread polylogue/analysis/archive_models.py Resolved
@Sinity
Sinity merged commit dafcfc6 into master Sep 21, 2026
3 checks passed
@Sinity
Sinity deleted the fix/w11-retire-session-phases branch September 21, 2026 01:52
Sinity added a commit that referenced this pull request Sep 21, 2026
…urface (#5370)

## 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 #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.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 22, 2026
#5314 (dafcfc6) deleted session_phases/session_work_events and their
CLI phases/work-events/timeline commands but left several test files
naming the deleted surfaces. Remove the dead references so the CLI
command table, MCP status-surface, and confidence-vocab tests describe
what the CLI actually exposes:

- test_json_output.py / test_stdout_stderr_split.py: drop the
  phases/work-events/timeline entries from the hand-maintained command
  tables (the anti-vacuity check at test_json_output.py:229-261 is what
  caught this; it is untouched).
- test_status.py (TestArchiveStatusSurfaces): _archive_status_surfaces
  no longer emits timeline_work_events/timeline_phases; keep the
  threads-readiness coverage the same test also carried and drop the
  now-dead work_event/phase count keys from the other fixtures in this
  class.
- test_confidence_vocab.py: profile_support_level lost its confidence
  input (#5314 rewired it to support_level(0.0, ...)); rewrite the test
  double for the real SessionProfile shape and assert the current WEAK
  invariant instead of the old phase-confidence scenario.
- test_session_insight_profiles.py: enrichment_support_signals no
  longer emits heuristic_work_events; drop it from the expected tuple.
- test_session_projection_table.py: separately, #5374 (fb84ba1, not
  #5314) moved run_read_events from cli/read_views/events.py into
  cli/read_views/session_evidence.py without updating this test's
  import path; point it at the new module.

Verified test_plain_cli_snapshots.py's 7 failures and
test_session_insight_profiles.py's
test_session_enrichment_maps_goal_outcome_from_terminal_state do NOT
reproduce as #5314 fallout (unrelated diffs: a #5362 field addition,
session-ordering/wallclock drift, and a pre-existing goal_outcome gap);
left untouched.

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
…rfaces (#5392)

## Summary

`polylogue-9srtz` — cluster 4 of the corpus-failure analysis. #5314
(`dafcfc612`, 2026-09-21) deleted
`session_phases`/`session_work_events`, their CLI commands, and rewired
`profile_support_level`. Tests still naming them were left behind.

**14 of the cluster's 21 fixed. 7 refused — they are a different
cause.** And one genuine production omission found.

## Fixed (14 + 1)

| file | n | change |
|---|---|---|
| `test_json_output.py` | 5 | dropped `phases`/`work-events` from
`_COMMANDS`, stale `timeline` from `_EXCLUDED` |
| `test_stdout_stderr_split.py` | 3 | dropped the three from
`_ALL_COMMANDS` |
| `commands/test_status.py` | 3 | `TestArchiveStatusSurfaces` only —
removed `timeline_work_events`/`timeline_phases`, cleaned dead row-count
keys |
| `test_confidence_vocab.py` | 1 | `_Profile` double rewritten to the
current `SessionProfile` shape (`engaged_duration_ms`) |
| `test_session_insight_profiles.py` | 1 | dropped
`heuristic_work_events` from expected `support_signals` |
| `test_session_projection_table.py` | 1 | **different cause** —
`ModuleNotFoundError: polylogue.cli.read_views.events` comes from #5374
(01:20, *after* #5314) moving `run_read_events` into
`session_evidence.py` without updating the import |

`TestArchiveTableCounts` was deliberately not touched — that's
`polylogue-1t5b5`'s collision class in the same file.

## Refused: 7 tests are not this cluster

`test_plain_cli_snapshots.py`'s 7 failures are inherited red at master
with **mixed, unrelated causes** — a `title_is_synthesized` field added
by #5362 never folded into the snapshot, plus wallclock-span and
session-ordering drift in the postmortem/portfolio snapshots. **None of
the diffs mention phases, work-events or timeline.** Making them green
would mean fixing unrelated regressions under this bead's name.

So `9srtz`'s acceptance ("green for all 19") does **not** hold, and that
is reported rather than manufactured.

Also found in the same file and not in the bead's list:
`test_session_enrichment_maps_goal_outcome_from_terminal_state` fails
because the `/goal`-session `match profile.terminal_state` has no case
for `"clean_finish"`/`"agent_hanging"` — a pre-existing gap,
unconnected.

## A production omission #5314 missed

`polylogue/scenarios/insight_surfaces.py` (~:36-66) **still declares
live `CliSurfaceFamily` entries** for `slug="work-events"` and
`slug="phases"`, invoking commands that no longer exist. It is only
reachable via `devtools scenario`/`devtools smoke`, not the pytest
corpus — which is exactly why the corpus-failure clustering could not
see it. Out of this lane's declared scope, so not fixed here; filed
separately.

## Anti-vacuity — executed

Diff saved as a patch, all 6 files reverted with `git checkout --`,
selection re-run, real red captured: `_COMMANDS lists 'analyze insights
phases'…`, `ModuleNotFoundError: No module named
'polylogue.cli.read_views.events'`, `AttributeError: '_Profile' object
has no attribute 'engaged_duration_ms'`, `Extra items in the right set:
'timeline_work_events' 'timeline_phases'`, `'assistant_outcome_text' !=
'heuristic_work_events'`. The unrelated `test_session_enrichment_…`
failure recurred **identically**, confirming it is inherited and not
introduced by the revert. Patch reapplied and diff confirmed
byte-identical.

## Verification

```
pytest_focused (pre-fix,  job 419)   15 failed (14 target + 1 unrelated)
pytest_focused (post-fix, job 402)   245 collected, 234 passed, 11 failed
                                       -> 3 are 1t5b5's, 7 are snapshots, 1 unrelated; none mine
verify_quick (job 432)               exit 0
devtools render all --check          exit 0, no 'out of sync'
devtools schema closure (6 files)    all 'out' — no identity movement
```

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

This lands the worker-13 batch on current master. The batch covers beads
polylogue-1tyq5.77, .110, .63, .53, .54 and .88. I checked each of the
worker's 24 proposed fixes against master and kept 22. CTX-07 was
dropped because #5778 already fixed it, and SURF-03 was dropped after
master merged #5793, which fixes it the same way. Of the 74 findings, 22
are fixed here, 39 were already fixed on master, and 13 were not
reached.

## Problem

All 22 kept defects still reproduce on master (re-checked after merging
master at 1beb2e5):

- MCP search resumed from a continuation alone reported `query: ""` and
lost `sort`. It also sent the default limit, which the continuation
guard refuses as widening.
- Personal-state pages that exceeded the response budget came back with
no continuation.
- Reference pipelines, list read views and completions ignored `offset`.
- `read(view="messages")` for a missing session returned
`internal_error`.
- Discovery did not advertise the `messages` view, the `precompact`
intent, the `clear_corrections` confirmation or the single-candidate
evidence digest.
- Compaction had three defects:
  - it invented a text-only hash when the archive gave none;
  - `pack_ref` hashed only the kept anchor refs;
  - the Markdown rendering showed only the aggregate drop counts.
- Read overrides used `bool("false")`, so `"false"` meant true.
JSON-only views also defaulted to Markdown.
- Windows working-directory paths were not shortened on POSIX hosts.
- Envelopes built from domain sessions had no relative time.
- Orchestration `children` could point at nodes removed by topology
truncation.
- Excision had three defects:
- marker tombstones used an `excision-marker:` ref, which fails
ObjectRef validation;
  - excising a watch baseline left its watch enabled;
- `INSERT OR IGNORE` hid ledger CHECK failures, and the content was
deleted anyway.

## Solution

The worker's commit is cherry-picked, with these corrections:

- The compaction identity is moved into #5758's fixed-point budget loop.
A fixed-width placeholder means filling in `pack_ref` does not change
the measured size.
- `message_transcript_window` already raises the typed
`SessionNotFoundError` on master (#5728), so `read(view="messages")`
maps it to `not_found`. The now-dead string-matching translation in
`get_messages_paginated` is removed.
- The query-excision ledger keeps only `ON CONFLICT(ledger_id) DO
NOTHING`. The schema CHECKs already refuse bad rows, so the worker's
extra checks before and after the insert are removed.
- Repo basenames now split on both path separators, the same as working
directories.
- A list view's outcome now counts the whole collection, not only the
returned page.
- After #5793 made orchestration children a streamed section, the
truncation filter narrows `children.rows`, and its test uses the new
builder signature.
- The worker's tests are corrected:
- the relative-time and tombstone tests could not pass as written and
are fixed;
  - the test file is renamed;
  - tests that only checked prose are narrowed.

## Verification

After merging master at 1beb2e5 (merge commit 88afebc):

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w13` (job 2474): `verify: PASSED exit=0 ...
head=88afebc6e16e`.
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w13 --
tests/unit/mcp/test_capability_pointer_routes.py
tests/unit/mcp/test_privileged_tools.py
tests/unit/mcp/test_session_orchestration.py
tests/unit/mcp/test_session_projection_table.py
tests/unit/mcp/test_tool_discovery_contracts.py
tests/unit/security/test_excision.py
tests/unit/security/test_query_excision_scope.py
tests/unit/surfaces/test_compaction.py
tests/unit/surfaces/test_read_contract.py
tests/unit/surfaces/test_session_envelope_derivation.py
tests/unit/operations/test_read_view_compact.py
tests/unit/agent_integration` (job 2475): after the isolated rerun, `1
failed, 7 passed`. The one failure,
`test_published_examples_use_live_operation_vocabularies_and_preconditions`,
fails the same way on origin/master 1beb2e5 (job 2530: `1 failed`).

Before the merge, on 967e01e:

- verify_quick (job 2071) passed; pytest_focused (job 2070) had 4
failures that also failed on the base (job 2056).
- Anti-vacuity (job 2028): with every production file in this PR
reverted to the base and the new tests kept, `36 failed`. Every new test
case failed without its fix. The merge changes only the orchestration
filter's target (`children.rows`), and that test still checks the same
condition.

## Self-review

- **Sibling sites:** the repo basename had the same separator bug as the
working directory and is fixed too. The MCP `not_found` relies on the
typed error master's transcript-window owner now raises (#5728). The
`get` list projections are still unpaged, but no finding covers them.
- **Cancellation and loops:** no new loops. In the compaction loop, only
the identity assigned at return changes.
- **Unbounded reads:** list views, reference members and completions now
page. The facade calls behind them still load whole lists (see
Residuals).
- **Fail-open:** boolean overrides with an unknown spelling are refused,
and a ledger CHECK failure now raises before any deletion.
- **Compatibility shims:** none added. The `ValueError` string-match
translation is removed.
- **Removed symbols:** `_PERSONAL_STATE_PROJECTIONS` moved to
`query_contracts.PERSONAL_STATE_PROJECTIONS`, with every reference
updated. `session_list_projection_names` is still used elsewhere.
- **Production route:** the MCP tests call the registered tools, and the
excision and compaction tests call the real functions.

## Findings

| key | disposition | evidence | test |
|---|---|---|---|
| MCP-01 / #4580:polylogue/mcp/archive_support.py:436 | fixed-already |
polylogue/mcp/archive_support.py:439-483 | — |
| MCP-02 / #4353:polylogue/mcp/declarations/registry.py:178 |
fixed-already | polylogue/mcp/declarations/registry.py:208-233 | — |
| MCP-03 / #4698:polylogue/mcp/declarations/registry.py:236 |
fixed-already | polylogue/mcp/declarations/registry.py:270-285;
polylogue/agent_integration/spec.py:683-710 | — |
| MCP-04 / #4786:polylogue/mcp/query_contracts.py:154 | fixed-already |
polylogue/mcp/server_cutover.py:325-391 | — |
| MCP-05 / #5480:polylogue/mcp/server_cutover.py:87 | fixed-already |
polylogue/mcp/server_cutover.py:90-92 | — |
| MCP-06 / #5480:polylogue/mcp/server_cutover.py:95 | fixed-already |
polylogue/mcp/server_cutover.py:100-108 | — |
| MCP-07 / #4996:polylogue/mcp/server_cutover.py:326 | fixed | this PR |
`tests/unit/mcp/test_privileged_tools.py::test_search_continuation_preserves_query_sort_and_omitted_limit`
|
| MCP-08 / #4410:polylogue/mcp/server_cutover.py:583 | not reached |
polylogue/mcp/server_cutover.py:839-979 | — |
| MCP-09 / #4295:polylogue/mcp/server_cutover.py:770 | fixed | this PR |
`tests/unit/mcp/test_tool_discovery_contracts.py::test_personal_state_byte_budget_continuation_advances_from_nonzero_offset`
|
| MCP-10 / #4777:polylogue/mcp/server_cutover.py:830 | fixed | this PR |
`tests/unit/mcp/test_privileged_tools.py::test_reference_relation_query_advances_requested_offset`
|
| MCP-11 / #4297:polylogue/mcp/server_cutover.py:856 | not reached |
polylogue/mcp/server_cutover.py:1402-1404 | — |
| MCP-12 / #4424:polylogue/mcp/server_cutover.py:879 | fixed | this PR |
`tests/unit/mcp/test_capability_pointer_routes.py::test_capability_discovery_includes_messages`
|
| MCP-13 / #4424:polylogue/mcp/server_cutover.py:885 | fixed-already |
polylogue/mcp/server_cutover.py:1317-1390 | — |
| MCP-14 / #4424:polylogue/mcp/server_cutover.py:885 | fixed | this PR |
`tests/unit/mcp/test_privileged_tools.py::test_missing_messages_session_is_not_found`
|
| MCP-15 / #4190:polylogue/mcp/server_cutover.py:926 | fixed-already |
polylogue/agent_integration/spec.py:453-475 | — |
| MCP-16 / #4190:polylogue/mcp/server_cutover.py:959 | not reached |
polylogue/mcp/server_cutover.py:1585 | — |
| MCP-17 / #4190:polylogue/mcp/server_cutover.py:959 | not reached |
polylogue/mcp/server_cutover.py:1585 | — |
| MCP-18 / #4256:polylogue/mcp/server_cutover.py:1035 | fixed | this PR
|
`tests/unit/mcp/test_tool_discovery_contracts.py::test_precompact_is_in_the_published_context_contract`
|
| MCP-19 / #4256:polylogue/mcp/server_cutover.py:1036 | fixed-already |
polylogue/mcp/server_cutover.py:1680;
polylogue/mcp/server_cutover.py:1007 | — |
| MCP-20 / #4419:polylogue/mcp/server_cutover.py:1119 | not reached |
polylogue/mcp/server_cutover.py:1702-1711 | — |
| MCP-21 / #4362:polylogue/mcp/server_cutover.py:1251 | not reached |
polylogue/mcp/server_cutover.py:1830-1867; polylogue/config.py:79-175 |
— |
| MCP-22 / #5248:polylogue/mcp/server_cutover.py:1273 | fixed | this PR
|
`tests/unit/mcp/test_session_projection_table.py::test_read_list_views_honor_limit_offset_and_next_page`
|
| MCP-23 / #5355:polylogue/mcp/server_cutover.py:1467 | fixed | this PR
|
`tests/unit/mcp/test_capability_pointer_routes.py::test_completions_page_against_shared_owner`
|
| MCP-24 / #4213:polylogue/mcp/server_cutover.py:2219 | fixed | this PR
|
`tests/unit/mcp/test_tool_discovery_contracts.py::test_clear_corrections_confirmation_is_discoverable_and_enforced`
|
| MCP-25 / #5311:polylogue/mcp/server_cutover.py:2811 | fixed | this PR
|
`tests/unit/mcp/test_privileged_tools.py::TestJudgeTool::test_single_candidate_shorthand_builds_a_one_item_bulk_call`
|
| SURF-01 / #4539:polylogue/surfaces/authority.py:65 | not reached |
polylogue/surfaces/authority.py:65;
polylogue/mcp/server_cutover.py:1382-1385 | — |
| SURF-02 / #4197:polylogue/surfaces/compaction.py:150 | fixed | this PR
|
`tests/unit/surfaces/test_compaction.py::test_compaction_does_not_invent_canonical_content_hashes`
|
| SURF-03 / #4197:polylogue/surfaces/compaction.py:223 | fixed-already |
#5793 (d1abc18): polylogue/surfaces/compaction.py:273-275; covered by
tests/unit/operations/test_read_view_compact.py | — |
| SURF-04 / #4197:polylogue/surfaces/compaction.py:263 | not reached |
polylogue/surfaces/compaction.py:271-331 | — |
| SURF-05 / #4197:polylogue/surfaces/compaction.py:276 | not reached |
polylogue/surfaces/compaction.py:276-299 | — |
| SURF-06 / #4197:polylogue/surfaces/compaction.py:292 | fixed | this PR
|
`tests/unit/surfaces/test_compaction.py::test_compaction_identity_commits_to_content_projection_and_provenance`
|
| SURF-07 / #4197:polylogue/surfaces/compaction.py:331 | fixed | this PR
|
`tests/unit/surfaces/test_compaction.py::test_compaction_markdown_preserves_fidelity_manifest_and_omission_anchors`
|
| SURF-08 / #4201:polylogue/surfaces/payloads.py:1064 | not reached |
polylogue/surfaces/payloads.py:1172-1176 | — |
| SURF-09 / #4201:polylogue/surfaces/payloads.py:1196 | fixed | this PR
|
`tests/unit/surfaces/test_session_envelope_derivation.py::test_domain_session_rows_keep_relative_time`
|
| SURF-10 / #4539:polylogue/surfaces/payloads.py:3947 | fixed-already |
polylogue/daemon/http.py:4805-4807 | — |
| SURF-11 / #4201:polylogue/surfaces/query_rows.py:106 | fixed | this PR
|
`tests/unit/surfaces/test_session_envelope_derivation.py::test_session_row_shortens_windows_and_posix_working_directories`
|
| SURF-12 / #4321:polylogue/surfaces/read_contract.py:65 | fixed | this
PR |
`tests/unit/surfaces/test_read_contract.py::test_read_boolean_false_overrides_are_not_truthy_strings`
|
| SURF-13 / #5515:polylogue/surfaces/read_contract.py:78 | fixed | this
PR |
`tests/unit/surfaces/test_read_contract.py::test_read_github_correlation_false_stays_disabled`
|
| SURF-14 / #4321:polylogue/surfaces/read_contract.py:100 | fixed | this
PR |
`tests/unit/surfaces/test_read_contract.py::test_default_read_formats_belong_to_their_profile`
|
| SURF-15 / #4321:polylogue/surfaces/read_contract.py:156 | not reached
| polylogue/surfaces/read_contract.py:100-117;
polylogue/surfaces/read_contract.py:159-170 | — |
| CTX-01 / #4329:polylogue/context/compiler.py:263 | fixed-already |
polylogue/context/compiler.py:265-284 | — |
| CTX-02 / #4329:polylogue/context/compiler.py:272 | fixed-already |
polylogue/context/compiler.py:292-295 | — |
| CTX-03 / #4385:polylogue/context/configuration_evidence.py:84 |
fixed-already | polylogue/context/configuration_evidence.py:94-96 | — |
| CTX-04 / #4385:polylogue/context/configuration_evidence.py:132 |
fixed-already | polylogue/context/configuration_evidence.py:137 | — |
| CTX-05 / #4385:polylogue/context/configuration_evidence.py:141 |
fixed-already | polylogue/context/configuration_evidence.py:144-176 | —
|
| CTX-06 / #4385:polylogue/context/configuration_evidence.py:159 |
fixed-already | polylogue/context/configuration_evidence.py:171 | — |
| CTX-07 / #4385:polylogue/context/configuration_evidence.py:180 |
fixed-already | #5778 (3e9ec3d): declared-name mapping with own-name
fallback; worker change dropped | — |
| CTX-08 / #4385:polylogue/context/configuration_evidence.py:204 |
fixed-already | polylogue/context/configuration_evidence.py:216-266 | —
|
| CTX-09 / #4385:polylogue/context/configuration_evidence.py:234 |
fixed-already | polylogue/context/configuration_evidence.py:248-261 | —
|
| CTX-10 / #4256:polylogue/context/preamble.py:80 | fixed-already |
polylogue/context/preamble.py:74-87; polylogue/api/archive.py:3429-3441
| — |
| CTX-11 / #4634:polylogue/context/preamble.py:83 | fixed-already |
polylogue/operations/facade_writers.py:415-427 | — |
| CTX-12 / #4799:polylogue/context/preamble.py:371 | fixed-already |
polylogue/context/preamble.py:588-601 | — |
| CTX-13 / #4256:polylogue/context/scheduler.py:240 | fixed-already |
polylogue/context/scheduler.py:349 | — |
| CTX-14 / #4256:polylogue/context/scheduler.py:289 | fixed-already |
polylogue/context/scheduler.py:425-437 | — |
| AGENT-01 /
#4266:polylogue/agent_integration/data/tool-contracts.json:132 |
fixed-already | polylogue/agent_integration/spec.py:378-392 | — |
| AGENT-02 /
#4266:polylogue/agent_integration/data/tool-contracts.json:189 |
fixed-already | polylogue/agent_integration/spec.py:416-421 | — |
| AGENT-03 /
#4266:polylogue/agent_integration/data/tool-contracts.json:288 |
fixed-already | polylogue/agent_integration/spec.py:453-475 | — |
| AGENT-04 /
#4266:polylogue/agent_integration/data/tool-contracts.json:382 |
fixed-already | polylogue/agent_integration/spec.py:511-516 | — |
| AGENT-05 /
#4266:polylogue/agent_integration/data/tool-contracts.json:502 |
fixed-already | polylogue/agent_integration/data/tool-contracts.json | —
|
| AGENT-06 /
#4266:polylogue/agent_integration/data/tool-contracts.json:631 |
fixed-already | polylogue/agent_integration/spec.py:663-675 | — |
| AGENT-07 / #5449:polylogue/agent_integration/spec.py:411 |
fixed-already | polylogue/agent_integration/spec.py:410 | — |
| AGENT-08 / #5449:polylogue/agent_integration/spec.py:411 |
fixed-already | polylogue/agent_integration/spec.py:410 | — |
| ANALYSIS-01 / #5314:polylogue/analysis/archive_models.py:109 |
fixed-already | polylogue/analysis/archive_models.py:12 | — |
| ANALYSIS-02 /
#5608:polylogue/analysis/delegation_work_evidence_materializer.py:48 |
fixed-already |
polylogue/analysis/delegation_work_evidence_materializer.py:79-90 | — |
| ANALYSIS-03 /
#5608:polylogue/analysis/delegation_work_evidence_materializer.py:106 |
fixed-already |
polylogue/analysis/delegation_work_evidence_materializer.py:97-114 | — |
| ANALYSIS-04 / #4678:polylogue/analysis/export_bundles.py:77 |
fixed-already | polylogue/analysis/export_bundles.py:28 | — |
| ANALYSIS-05 / #4864:polylogue/analysis/orchestration_evidence.py:362 |
fixed | this PR |
`tests/unit/mcp/test_session_orchestration.py::test_truncated_orchestration_children_belong_to_retained_topology`
|
| ANALYSIS-06 / #4985:polylogue/analysis/pathology.py:192 |
fixed-already | polylogue/analysis/pathology.py:51 | — |
| ANALYSIS-07 / #4678:polylogue/analysis/readiness.py:45 | fixed-already
| polylogue/analysis/readiness.py:43 | — |
| SEC-01 / #4320:polylogue/security/excision.py:574 | not reached |
polylogue/security/excision.py:1091-1092;
polylogue/security/excision.py:1382-1426 | — |
| SEC-02 / #5452:polylogue/security/excision.py:1281 | fixed | this PR |
`tests/unit/security/test_excision.py::TestApplySessionExcision::test_apply_tombstones_marker_assertions_without_retaining_content`
|
| SEC-03 / #4200:polylogue/security/query_excision.py:170 | fixed | this
PR |
`tests/unit/security/test_query_excision_scope.py::test_relation_excision_disables_only_watches_whose_baseline_was_removed`
|
| SEC-04 / #4200:polylogue/security/query_excision.py:176 | not reached
| polylogue/security/query_excision.py:227-235 | — |
| SEC-05 / #4200:polylogue/security/query_excision.py:176 | fixed | this
PR |
`tests/unit/security/test_query_excision_scope.py::test_a_refused_tombstone_aborts_before_any_deletion`
|

## Derived-identity closure

`devtools schema closure` (scratch job 1963) reports three changed files
inside the closure:

- `polylogue/security/query_excision.py`
- `polylogue/surfaces/payloads.py`
- `polylogue/surfaces/query_rows.py`

All other changed production files are outside it. Land this before the
next rebuild starts.

## Residuals

- 13 findings were not reached: MCP-08, 11, 16, 17, 20, 21; SURF-01, 04,
05, 08, 15; SEC-01, 04.
- Compaction `pack_ref` values change.
- The facade list methods behind the paged MCP views still load the full
list before slicing it.

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

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Oct 1, 2026
## Summary

Register the five changed built-in seed annotation definitions at
version 2. Ordinary USER opens retain their existing version 1
definitions, labels and batch provenance without rewriting history.

## Problem

The phase/work-event retirement in
[PR5314](#5314) changed five
definitions while retaining version 1. USER bootstrap replays packaged
definitions, while durable annotation registration correctly refuses an
occupied version with different canonical bytes. An ordinary supported
predecessor reopen therefore refuses. Historical declarations containing
retired target grains also failed live-only decoding before they could
be inspected.

## Solution

Ship current version 2 definitions for seed activity, goal event,
outcome evidence, knowledge artifact and reusability. Preserve whichever
supported version 1 definition an archive already holds, including
definitions from the public commits immediately before and after PR5314.
Historical decoding keeps declared provenance target strings and
fingerprints; new registration, writes and imports retain live target
admission. Retired structural targets produce explicit missing-target
diagnostics. Conflicting occupied versions still refuse.

The existing versioned registry stores these vocabulary rows without
changing USER DDL. Update the current CLI, MCP and daemon fixture
consumers and document the current grains. Regressions use exact public
historical definitions and neutral synthetic labels, with real
facade-to-daemon import coverage on fresh and both historical archive
variants.

## Verification

Candidate `95514b47bf7493043a86288168caf091ca60d290`, integrated with
master `4dff4cf2b594bd6f9a3ded8f7dbf7bffa8fafb0c`:

```sh
agentctl job start polylogue pytest_focused --workspace /realm/worktrees/polylogue-annotation-versions --json -- tests/unit/annotations tests/unit/storage/test_user_annotations_import.py tests/unit/storage/test_archive_tiers_user_write.py tests/unit/storage/test_archive_tiers_assertions.py tests/unit/storage/test_archive_tiers_archive.py tests/unit/storage/test_tier_bootstrap_transaction.py tests/unit/storage/test_archive_tiers_ddl.py tests/unit/core/test_schema_annotation_contracts.py tests/unit/core/test_operator_annotations.py tests/unit/cli/test_annotation_import_command.py tests/unit/cli/test_annotation_join_command.py tests/unit/cli/test_cli_operation_authority.py tests/unit/mcp/test_embedded_writer_boundary.py tests/unit/daemon/test_daemon_operation_route.py -p no:randomly
```

Job 5409: `493 passed in 114.66s`; 493 selected = 493 terminal, one
step, no retry. Receipt `20261001T051940Z-focused-test-4015920-2931845c`
records the same clean start and final head.

```sh
agentctl job start polylogue verify_quick --workspace /realm/worktrees/polylogue-annotation-versions --json
```

Job 5410: all 12 gates passed, exit 0; receipt
`20261001T051942Z-quick-4016064-7beb3be8` binds the same clean head.

```sh
nix develop --accept-flake-config --command devtools schema closure --json polylogue/annotations/schema.py polylogue/annotations/batch.py polylogue/annotations/join.py polylogue/storage/sqlite/archive_tiers/user_annotations.py
```

Exit 0: schema, batch and user_annotations are inside the derived
identity closure; join is outside. No new closure member. No live
reconvergence was run.

## Self-review

The author reread the project, storage, daemon and generic checklists
and the whole 13-path diff. The final fourth author pass and integration
delta are clean. All 12 non-overlapping owned blobs were preserved
exactly during integration; the shared daemon test retains the upstream
read-lifetime tests and the current seed version.

✓ **Project 1 — siblings and owners**. The five changed seeds share the
existing schema registry and bootstrap persistence owner. Census covered
schema/batch decoding, immutable persistence, joins, upsert writes,
API/daemon imports, CLI and MCP consumers; four fixed seed-version
fixture consumers now request v2. Historical target decoding has one
schema-module owner.

✓ **Project 2 — fix itself**. Historical declaration decoding accepts
only the two declared retired grains; registry registration and
insertion call require_live_targets. Existing occupied rows still
compare exact canonical bytes before an idempotent return. Live
ObjectRef validation remains unchanged.

✓ **Project 3 — memory and limits**. The change introduces no
archive-sized buffer, cap, timeout or truncation. Vocabulary sets
contain the declared kinds; fixture snapshots contain five neutral seed
records.

✓ **Project 4 — cost per unit**. Bootstrap still iterates the six
packaged builtins. Only five new v2 rows are inserted once; reopen uses
indexed schema_id/version lookups. Join adds constant-size kind and
value validation per selected row.

✓ **Project 5 — interruption**. No transaction/lifecycle ownership
changes. Existing bootstrap and daemon writer transactions own insertion
and rollback; restarting twice is covered without altering recorded
historical rows.

✓ **Project 6 — ordering and races**. No new check/use resource
lifetime. Immutable schema comparison and insertion use the existing
connection/transaction; no separately cached historical definition
replaces durable evidence.

✓ **Project 7 — failure classification**. Unknown declarations,
malformed target refs and occupied-version conflicts remain
AnnotationSchemaError/AnnotationBatchError. New retired-target API
imports are visibly DaemonOperationRejectedError; historical joins
produce missing_target diagnostics.

✓ **Project 8 — silent outcomes**. Historical retired targets increment
missing_target_count and carry an assertion/target diagnostic; they
never enter live resolution or silently disappear. Invalid values and
absent required evidence continue through invalid_value accounting.

✓ **Project 9 — cleanup on failure**. New production logic acquires no
resource. Existing archive/context managers close connections; real
daemon import tests inspect that rejected retired batches were not
persisted.

✓ **Project 10 — identity and keys**. Only five current version numbers
change. Definition JSON/fingerprint rules, batch/assertion references
and producer fields are preserved. Fixtures pin exact public commits and
assert byte/hash equality on both supported v1 variants.

✓ **Project 11 — lossless transforms**. Read DTOs preserve historical
phase/work_event strings without relabeling. Raw schema, batch and
assertion tuples are equal before and after two ordinary USER opens;
explicit v1 references remain v1 while current writes stamp v2.

✓ **Project 12 — degenerate inputs**. Unknown target kinds and empty
retired identities are refused. Historical decoder matches the public
predecessor opaque colon grammar, including rejection of trailing empty
identity qualifiers. Current schema validation remains unchanged for
fields, evidence and abstention.

✓ **Project 13 — consumers**. Repository census of all five seed IDs
found fixed-version daemon, MCP and two CLI fixture consumers, all
updated. Production import requires an explicit version; current
registry selects highest packaged v2. Unchanged delegation v1 remains
v1; docs show current grains and historical contract.

✓ **Project 14 — tests and stubs**. Ordinary
initialize_archive_database/ArchiveStore reopen and real
Polylogue-to-daemon imports exercise production routes. Historical
occupied-version mutations now use explicit
open_existing(read_only=False) after the ordinary read-only block
closes; all intentional fixture writes were censused against their
actual authority. Reverting packaged versions to v1 makes historical
open fail; removing retired admission guards makes registration/import
refusal fail; removing immutable comparison makes occupied-version tests
fail.

✓ **Project 15 — trust boundaries**. Tracked fixtures contain only
canonical public definitions and neutral synthetic labels. No operator
archive, capture, private receipt, secret or paid-provider call enters
the diff.

✓ **Storage 1 — derived migration**. N/A: no index/ops DDL or migration
change. Exact-head closure reports schema.py, batch.py and
user_annotations.py inside the conservative derived identity closure;
join.py is outside. No live reconvergence was run.

✓ **Storage 2 — purchased vectors**. N/A: no embeddings DDL, provider,
vector or tier operation changes.

✓ **Storage 3 — durable enum checks**. N/A: USER DDL is unchanged; new
versioned vocabulary rows use the existing annotation_schemas table and
immutable write boundary.

✓ **Storage 4 — writer authority**. Production writes retain bootstrap
or daemon writer ownership. SQL fixture setup is confined to synthetic
test roots; no live archive mutation occurs.

✓ **Storage 5 — durable authority**. The existing durable schema row
remains authority for historical reads and batch interpretation. A
current global definition is never used to reinterpret an occupied v1
row.

✓ **Daemon 1 — progress timeout**. N/A: daemon product code and deadline
semantics are unchanged; only its seed fixture version is updated and
full operation-route coverage is selected.

✓ **Daemon 2 — writer authority**. Real facade imports continue through
mutation.annotation.import_batch and the resident writer; no bypass is
introduced. Embedded MCP and CLI authority tests are selected.

✓ **Generic 1 — acceptance**. Reproduction established ordinary
USER-open refusal before edits. Both exact historical variants, fresh
archives, restart, current writes/imports and immutable drift are
covered. Final behavioral receipt records493 selected=493 terminal
passed on the clean head; Independent local review is accepted;
protected publication is required before landing.

✓ **Generic 2 — exhaustive defect classes**. Searched all annotation
ObjectRef parsing, accepts_target_kind, registration and persistence
consumers, and all five seed IDs. Corrected every fixed seed-version
fixture found, plus both typing defects and the unnecessary
closure-growing helper module in one batch.

✓ **Generic 3 — replacement and consumers**. Only current v2 seeds ship.
No competing historical v1 definition is reinserted; the separate helper
predecessor was deleted and every consumer imports the existing schema
owner.

✓ **Generic 4 — visible failures**. Admission remains strict for new
operations; historical decoding is provenance only. Drift and malformed
evidence refuse visibly; retired structural targets report a named gap
without fabricating a live target.

✓ **Generic 5 — anti-vacuity**. Tests name their mutants: reverting
current seed versions fails ordinary supported reopen; overwriting
historical rows fails raw tuple/fingerprint checks; permitting retired
registration/write/import fails refusal assertions; bypassing immutable
comparison fails current and historical occupied-version tests.

✓ **Generic 6 — public boundary**. Full diff reviewed against
master4dff4cf2: 13 owned paths, neutral fixture data and public
historical constructor definitions. Receipts, reproduction scripts and
narrated evidence remain private scratch/Beads state.


Independent local review is clean and accepted at the exact candidate
head. It independently compared all ten historical definitions against
their public source commits and verified the final receipt boundaries.
Hosted Codex review requests are disabled by the operator.

## Residuals

Historical phase/work-event targets remain provenance and cannot be
structurally resolved or newly written. No live archive operation, paid
call, corpus run, USER DDL migration or host change was performed. The
historical PR5314 finding remains held until accepted default-branch
evidence.
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

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

  • 68.F041 / P1: refuted at the checked revision: AGENTS.md:74-77 requires earlier archive state to remain salvage evidence only, with no migration or readback. Preserving retired historical receipt fields or adding a dual-version decoder solely to read pre-change archive state contradicts that fresh-format policy.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant