Skip to content

feat: normalize session lineage and correct cross-provider cost accounting - #2469

Merged
Sinity merged 20 commits into
masterfrom
feature/operator-dogfood-hardening
Jun 28, 2026
Merged

Sinity merged 20 commits into
masterfrom
feature/operator-dogfood-hardening

Conversation

@Sinity

@Sinity Sinity commented Jun 28, 2026 •

Copy link
Copy Markdown
Owner

PR: operator-dogfood hardening — correct cost accounting + session-lineage substrate

Draft squash-merge body for feature/operator-dogfood-hardening. Title candidate:
feat: normalize session lineage and correct cross-provider cost accounting
(≤72 chars, conventional, describes what changed). NOT yet pushed — scoping
(one PR vs split into a cost PR and a substrate PR) is an operator decision.

Summary

Dogfooding polylogue against the live 37 GB / 16.4K-session / 5.7M-message archive
surfaced two classes of correctness bug — mis-billed tokens and mis-modeled session
lineage — and one data-loss bug (attachments). This branch fixes all three so the
archive's counts, costs, and transcripts are trustworthy.

Problem

Solution

Cost (already validated against state_5.sqlite / stats-cache.json):

  • Disjoint billing lanes for Codex (fresh_input = input_with_cached - cache_read);
    vendored full LiteLLM price catalog so every provider/model is priced; runnable
    cross-verification demo.

Substrate (index schema v11 → v13, deletes-then-defines; rebuild from source):

  • Parsers detect Codex forked_from_id + source.subagent.thread_spawn
    (FORK/SUBAGENT) and reclassify agent-acompact-* as compaction.
  • session_links gains branch_point_message_id + inheritance. The writer
    aligns a child against its parent's composed transcript by per-message content
    signature (conservative contiguous prefix-alignment) and stores only the
    divergent tail; reads (get_messages + read_archive_session_envelope) compose
    the parent prefix back. Out-of-order ingest is handled by deferred re-extraction
    on edge resolution.
  • Codex compaction summary is materialized as a message (parity with Claude).
  • attachments.blob_hash is nullable + real SHA-256 when acquired; new
    acquisition_status; inline export bytes are written to the blob store; the
    fabricated hash is gone.

Verification

  • devtools verify --quick: whole-repo mypy --strict (1679 files) + ruff +
    render all --check — green.
  • Behavioral suites green: lineage normalization incl. out-of-order
    (tests/unit/storage/test_lineage_normalization.py), keyset ordering invariant,
    MCP envelope/server-surface contracts, provider-usage report, attachment
    acquisition, plus topology/insights/convergence/repair (93 passed) and
    archive-tier write/self-verify/DDL.
  • Real-corpus proof: 80 Codex fork families → 898,222 naive message rows →
    64,072 stored (92.9% eliminated), 25/25 children compose correctly; the
    019ccbf9 subagent reconstructs its full 180-message transcript exactly.

Migration / re-ingest

Schema-touching: there is no in-place upgrade. On deploy the operator runs
polylogue ops reset --database && polylogued run — source.db and user.db
are untouched, so this is a derived-index rebuild. Expected effect: message-row
count drops materially as fork replays collapse; per-thread Codex token ratios
move toward 1.00 vs state_5.sqlite.

Follow-ups (tracked, non-blocking)

  • Compaction boundary-range columns + effective-context derivation.
  • Attachment acquisition for non-inline sources (Drive OAuth, export-zip, local
    path sanitizer redesign); surface acquisition_status in read payloads.

Ref #2467, Ref #2468

Summary by CodeRabbit

  • New Features

    • Added a read-only archive forensics report with charts and a demo cost-accounting script.
    • Introduced a minimum-message filter for embedding backfills and preflight estimates.
    • Improved session history handling so forked/resumed/compacted conversations display more accurately.
  • Bug Fixes

    • Fixed token and cost rollups to avoid double-counting cached input and reasoning output.
    • Improved attachment handling to store real file bytes when available and preserve acquisition status.
    • Added more flexible archive session lookup, including native-id suffix matching.

Sinity and others added 19 commits June 27, 2026 16:40
Problem: both pending-session selectors in storage/embeddings/
materialization.py ordered ASC (oldest-first) — select_pending_session_window
by updated_at_ms, select_pending_archive_session_window (used by the operator
ops embed backfill command) by sort_key_ms. When the embedding budget is
smaller than the corpus — the common case, since a full embed of a large
archive can exceed a provider's free-token allotment — oldest-first spends the
entire window on the least query-relevant sessions, which in practice are
empty/near-empty stubs (sort_key_ms=0, 0-3 messages) at the bottom of the
archive.

What changed: both selectors now order newest-first (DESC, nulls last). This
maximizes the value of a partial embed and is also correct for the daemon's
ambient catch-up, which should cover just-ingested sessions promptly.

Verification: ops embed backfill against the 16,410-session production archive
now selects today's active sessions (841/453/124 msgs) instead of empty stubs
and embeds them via real Voyage calls. 59 affected tests pass
(test_embedding_contracts, test_embed, test_embed_activation); equal-timestamp
test fixtures keep their session_id tiebreak so expectations are unchanged.

Co-Authored-By: Claude <[email protected]>
…dows

Problem: READ_DB_TIMEOUT was 1 second — the busy_timeout for every read
connection (CLI open_read_connection, daemon open_readonly_connection, async
reads, readiness probes). WAL readers normally don't block on a writer, but the
brief window where a writer holds an exclusive lock (commit + TRUNCATE
checkpoint) can exceed a second on a multi-GiB archive. When it does, a read
fails hard with "database is locked" instead of waiting. Observed intermittently
on `polylogue find` against the 36 GiB production archive while the daemon was
ingesting — a hard failure on the primary query surface.

What changed: READ_DB_TIMEOUT 1 → 5. Reads now wait out a transient checkpoint
window and succeed, while staying far below the 30 s writer timeout so they
remain responsive. Reads that are merely bandwidth-bound (not lock-blocked)
are unaffected — they already succeed, just slowly.

Verification: mypy clean; tests/unit/storage/test_wal_journal_size_limit.py
passes (8); `polylogue find` against the live archive returns results.

Co-Authored-By: Claude <[email protected]>
Problem: `polylogue ops embed enable` wrote the user polylogue.toml
unconditionally and let a write failure surface as a raw
"unexpected error: OSError: [Errno 30] Read-only file system". On a
Nix/Home-Manager-managed deployment the user config is a read-only store
symlink, so the documented activation flow (#1217) dead-ends with an opaque
traceback instead of telling the operator what to do.

What changed: _write_embedding_section now translates OSError into a
click.ClickException explaining the config is read-only and offering the three
real paths forward — point POLYLOGUE_CONFIG at a writable file, set
[embedding] enabled in the managed config, or skip enable entirely since
`ops embed backfill` reads VOYAGE_API_KEY from the environment. Both enable and
disable benefit.

Verification: mypy clean; tests/unit/cli/test_embed_activation.py passes (37);
`ops embed enable` on this HM deployment now prints the guidance instead of a
traceback.

Co-Authored-By: Claude <[email protected]>
Problem: resolve_session_id matched exact ids, provider:native forms, and
session_id *prefixes*, but a bare native id resolves to the stored
"<origin>:<native_id>" — so the native id is a suffix, not a prefix. Passing
the UUID that appears as a Claude Code session's source filename
("1944721d-...") returned "session not found", forcing the operator to know the
"claude-code-session:" prefix that no other surface shows them.

What changed: when exact/prefix resolution misses and the token has no colon,
fall back to a "%:<token>" suffix match. Provider native ids are globally
unique, so a single match resolves; multiple matches raise the same ambiguity
error as the prefix path rather than guessing. LIKE wildcards in the token are
escaped.

Verification: `polylogue read <bare-uuid>` against the production archive now
resolves (was "session not found"); extended
test_archive_tiers_archive_facade_resolves_exact_and_prefix_session_ids covers
the suffix case (11 passed in the file).

Co-Authored-By: Claude <[email protected]>
Problem: a full embed of a large archive far exceeds an embedding provider's
free-token allotment (e.g. 2.86B tokens vs ~200M free), so real users must
embed a subset. The backfill offered only budget bounds (--max-sessions,
--max-messages, --max-cost-usd) and newest-first ordering, but no quality
floor — so even a budget-bounded window still spent tokens on trivial sessions
(provider smoke tests, 2-message stubs) that gain nothing from semantic search.

What changed:
- `ops embed backfill --min-messages N` skips sessions below a message-count
  floor. Threaded through select_pending_archive_session_window (the WHERE
  clause), the preflight, and the cost estimate; the floor is shown in the
  preflight's "Window limit" line.
- Unified the preflight's pending-window selection onto the canonical
  select_pending_archive_session_window. It had kept a divergent oldest-first
  copy, so the preflight previously estimated a different (oldest, often
  empty-stub) window than the newest-first window the backfill actually
  embedded. Now they match.

Verification: against the 16,410-session production archive,
`backfill --max-sessions 10 --min-messages 200` selects 10 substantial sessions
(21,228 messages, no stubs) and prints "≥200 msgs/session". mypy clean;
78 embedding tests pass incl. a new min-messages selection contract test.

Co-Authored-By: Claude <[email protected]>
A reproducible, dependency-free capability that turns a Polylogue archive into a
longitudinal findings report (Markdown + standalone SVG charts): corpus scale,
temporal rhythm, token economy, cost, model evolution, and workflow shape. The
kind of analysis only a full personal AI-session archive can produce.

scripts/agent_forensics.py is pure standard library, reads the archive
read-only, and writes nothing to it. It runs against any archive and is
verified against the synthetic demo archive (a stranger can reproduce it).

Accuracy (red-teamed against real 16,410-session / 5.7M-message data):
- Token sums use per-event deltas (last_*), not cumulative running totals
  (total_*), which over-count by orders of magnitude.
- Cost is split by provenance: only 'priced' rows (Claude Code) carry a real
  cost_usd; 'origin_reported' rows have token counts but no cost.
- Surfaces cache amplification (cache-read vs fresh input) — the dominant
  cost/volume driver in agentic loops.
- Adds a subscription-reality view: on Claude Max/Pro plans cache reads are
  free and usage is metered in credits (rates per she-llac.com analysis), so
  the API-list-equivalent cost overstates actual spend by ~13-37x.

connect_ro fails with clear guidance (not a raw traceback) when the archive has
a hot journal / uncheckpointed WAL, and never writes to roll it back.

Docs: docs/agent-forensics.md + a README "Mining the archive" section.

Verification: ran against the production archive (real report delivered
privately) and against a clean `polylogue demo seed` archive (report.md +
6 charts); all 9 SVG charts are well-formed XML; ruff clean.

Co-Authored-By: Claude <[email protected]>
Problem: the embedding filter only skipped system messages and a handful of
trivial tool strings, so large tool-call results, injected runtime
context/protocol, and generated packs were all embedded. tool_result alone is
~38% of all messages — embedding them is expensive (wasted token budget) and
pollutes semantic search with non-conversational noise.

What changed: _should_embed_archive_message now filters on messages.material_
origin (#1743), skipping the known non-prose origins — tool_result,
runtime_context, runtime_protocol, generated_analysis_pack,
generated_context_pack. Authored prose (assistant_authored, human_authored) and
ambiguous/unknown origins (e.g. non-Claude providers that don't tag
material_origin) are still embedded, so no provider's prose is dropped.

Impact: on the 5.72M-message production archive, embeddable messages drop from
5,695,069 to 3,520,414 (-38%) — proportional token-budget savings with
higher-signal vectors.

Verification: mypy clean; tests/unit/storage/test_embedding_contracts.py passes
(23). Impact measured directly against the production index.db.

Co-Authored-By: Claude <[email protected]>
Problem: PRICING was a frozen ~30-model hand-curated subset (Claude +
Gemini + GPT-4/o1/o3) effective 2026-04-24. Every recent OpenAI/Codex
model — gpt-5.x, gpt-5-codex, deepseek — fell through to
cost_provenance=origin_reported / uncosted. On the real archive that is
the whole "$89K Claude-only number" gap: gpt-5.4 alone is 231.6B tokens
with no list price attached.

What changed:
- Vendor LiteLLM's model_prices_and_context_window.json (~3.5K models)
  at archive/semantic/data/litellm_model_prices.json and build a
  ModelPricing catalog from it (_load_litellm_catalog), converting
  per-token costs to per-1M. Keys stored both fully-qualified
  (openai/gpt-5.4) and bare (gpt-5.4); on a bare collision a non-Azure
  provider wins so generic lookups get list pricing.
- Hand-verified entries (_CURATED_PRICING, e.g. Anthropic cache rates)
  override the vendored base, so checked numbers stay exact if upstream
  drifts. Provider-reported exact archive costs still win over both.
- Skip the blank/sample_spec meta key — an empty key is a prefix of
  every model name and would silently price unknown models as non-null.
- _normalize_model strips trailing date snapshots (gpt-4o-2024-08-06 ->
  gpt-4o, claude-opus-4-8-20260101 -> claude-opus-4-8) so cost rollups
  don't fragment by release date.
- cost_compute._PRICE_SNAPSHOT_VERSION now derives from the canonical
  CATALOG_PROVENANCE/CATALOG_EFFECTIVE_DATE in pricing.py instead of
  hardcoding a stale duplicate, so re-priced rows carry the right tag.

Not a schema change: the pricing seed derives catalog_id from the
provenance+date, so it inserts a new catalog version idempotently at the
next daemon start; existing archives keep their old catalog row and pick
up the new one without a reset. Cost recompute happens through the normal
insight-rebuild path.

Verification:
- pytest tests/unit/core/test_pricing.py
  tests/unit/storage/test_pricing_chain_roundtrip.py
  tests/unit/insights/test_cost_basis_split.py
  tests/unit/cost/test_contract_suite.py
  tests/unit/daemon/test_cost_panel_endpoint.py
  tests/unit/mcp/test_cost_outlook_tool.py tests/unit/mcp/test_tool_contracts.py
  tests/unit/core/test_semantic_facts.py tests/unit/core/test_session_semantics.py
  -> 200 passed
- mypy + ruff clean on changed files
- Spot-checked: gpt-5.4, gpt-5-codex, deepseek-chat now priced; unknown
  models stay unpriced (not silent-zero); dated variants canonicalize.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
…oning

Problem: the Codex token_count rollup folded provider totals into
session_model_usage with two token-accounting bugs that inflated cost:

1. Cached double-count. Codex (OpenAI) reports input_tokens INCLUSIVE of
   cached_input_tokens (verified: cached <= input on 100% of 1.84M real
   token_count events). The rollup stored input_tokens=total_input AND
   cache_read_tokens=total_cached separately, and the cost model
   (pricing._cost_components) bills input and cache_read as separate
   additive lanes. So the cached tokens were billed twice — once at the
   full input rate, once at the cache-read rate. On the real archive
   cached is ~96% of Codex input, so this inflated Codex API-list-equiv
   cost ~7.7x ($77K -> $591K).

2. Reasoning double-count. output_tokens was stored as
   total_output + total_reasoning, but Codex output already includes
   reasoning (total == input + output on 98.9% of rows; reasoning is a
   subset of output, not an additional term). Adding it again
   over-counted output.

What changed:
- New _provider_usage_disjoint_lanes() centralizes the corpus-verified
  Codex token semantics in one documented place: fresh_input =
  input - cached (clamped at 0), output passed through (reasoning already
  inside), cache_read and cache_write unchanged. After the fix
  fresh_input + cache_read reconstructs the provider's input exactly, so
  each token is billed on one lane only.
- Applied at all four rollup call sites in both the full and
  append-incremental aggregators (archive_tiers/write.py).
- storage/usage.py's drift-check (_expected_provider_model_rollups)
  reuses the same helper so its "expected" rollup matches the corrected
  rows instead of reporting false drift.

This is the truth-layer gate for cross-provider cost reporting: cost
claims over the archive were Codex-inflated ~7.7x until this fix.

Verification:
- pytest tests/unit/storage/test_archive_tiers_write.py
  tests/unit/storage/test_provider_usage_report.py
  tests/unit/sources/test_parsers_codex.py
  tests/unit/sources/test_codex_event_stream_contract.py
  tests/unit/insights/test_cost_rollup_summary_path.py
  tests/unit/insights/test_cost_basis_split.py
  tests/unit/insights/test_no_metadata_cost_reads.py
  tests/unit/storage/test_pricing_chain_roundtrip.py
  tests/unit/operations/test_archive_debt.py
  tests/unit/storage/test_archive_tiers_self_verify.py
  tests/unit/cli/test_insights.py tests/unit/mcp/test_envelope_contracts.py
  -> 218 passed (3 fixtures that encoded the old buggy formula updated
  with explanatory comments; added a focused helper regression test).
- mypy --strict + ruff clean on all four files.
- Reconciliation harness over the real 37GB archive: corrected Codex
  cost $76,856 vs buggy $591,103 (7.69x). Cross-checked against
  authoritative ~/.codex/state_5.sqlite (139.34B tokens); polylogue's
  provider total 199.58B is 1.43x, a separate definitional/dedup residual
  tracked for follow-up.

Note: existing archives carry rollups computed under the old formula.
The corrected lanes apply to new ingests; re-materialization of the
current archive is a separate operator step.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
Problem: the Codex double-billing fix (commit 3938bc6) is correct but
invisible — there was no artifact a stranger could run to see that
Polylogue's cross-provider cost accounting is real, nor an operator path
to validate it against ground truth.

Solution: scripts/cost_accounting_demo.py drives the accounting end to end
with no mocks. It ingests a crafted Codex session through the real writer
(write_parsed_session_to_archive), reads the materialized session_model_usage
rollup back, prices it with the real catalog, and prints the corrected
disjoint billing lanes next to what the pre-fix code charged — all from
hand-checkable token numbers. The readback assertion
(fresh_input + cache_read == provider input) makes the demo self-guarding:
it fails if the double-count regresses.

Operator mode (--archive --codex-state) cross-verifies the real archive
against Codex's authoritative ~/.codex/state_5.sqlite: per-thread ratio
median 1.000, with the aggregate higher only because the archive retains
36B tokens across 96 threads the live tool has pruned.

docs/cost-model.md gains a "Codex disjoint billing lanes" section
explaining the token semantics (input includes cached ~96%; output includes
reasoning) and the 7.69x corpus inflation the fix removes; a captured
synthetic run is committed at docs/examples/cost-accounting-demo.txt
(no private data). README "Mining the archive" points at both.

Verification:
- uv run python scripts/cost_accounting_demo.py -> synthetic 7.10x,
  invariant holds; --archive/--codex-state -> median 1.000 over 2110 threads.
- ruff + mypy clean on the script; devtools verify doc-commands (77 files,
  no stale commands); devtools render all --check (all sync OK).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
…n dedup

Problem: physical-session-per-artifact ingestion double-counts content shared
across Codex resume/fork families and Claude auto-compaction. Measured on the
live archive: 16,414 physical vs 8,807 logical sessions (1.86x), ~32% of message
rows duplicate-bearing, Codex token total 189.7B physical vs 139.3B authoritative
(state_5.sqlite). Lineage is detected (logical_session_id) but storage and nearly
all aggregates ignore it. Real Task subagents (7,383) are legitimate distinct
work, not duplication — the bug is narrow (Codex forks + 187 acompact).

Adds docs/design/session-lineage-model.md: measured taxonomy, the content-
addressed correct model, and a phased plan (P0 acompact misclassification, P1
read-time lineage-aware aggregates, P2 structural content-addressing). Tracks
the architectural decisions in Ref #2467. Design-before-implementation per
operator direction; no code behavior change in this commit.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
…rhaul

Tracing attachments end-to-end (Ref #2468) found they are metadata-only by
construction: attachments.blob_hash is a synthetic metadata hash
(bytes.fromhex(attachment_id)), not bytes; download_assets is accepted then
del'd in api/ingest.py; parsers set path=None and the real path is hashed then
discarded; pasted text is marker-only; fork/duplicate-message attachments are
silently dropped. Live archive: 8,425 rows claim 8.4 GB, 0 blobs present, 56%
zero-byte.

Same root shape as the fork/lineage duplication (Ref #2467): no real
content-addressed store. Extends docs/design/session-lineage-model.md with an
attachment-preservation section so the structural overhaul covers blocks,
messages, AND attachment bytes in one content-addressed substrate with a real
ingest acquisition step and per-attachment status.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
…p content-addressing

The earlier draft proposed content-addressing messages/blocks, which is wrong:
it would merge coincidentally-identical-but-unrelated text ("continue", a bare
`git status`) into one entity. Dedup must be by LINEAGE, not content.

Replaces it with the verified two-concept model: prefix-inheritance (fork/resume)
and context-discontinuity (compaction) are each one concept that providers merely
encode differently (Codex denormalizes/copies via thread_spawn; Claude threads via
uuid; Codex marks compaction explicitly via `compacted`/`replacement_history`;
Claude inline via `isCompactSummary`; Claude `agent-acompact-*` is a compaction
implemented as a 100%-copy, n=5 sampled). We model both once: store every real
message once, represent copies as lineage edges (not rows), keep the compaction
summary as a real message at a boundary, derive effective context from log +
edges + boundaries. Fresh Task subagents stay whole (real unique work).

Includes the attachment-preservation work (Ref #2468) and explicit anti-goals
(no content-addressing, no storing copies, no per-provider downstream branches,
no deleting physical artifacts). Ref #2467.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014pcNXbmmzXHFrpARz48gN6
Problem: Two real lineage relationships were mis-modeled at parse time, which
is the upstream cause of the session-duplication audited in #2467.

- Codex fork/subagent rollouts copy the parent's context as a leading prefix
  and record it explicitly via session_meta.payload.forked_from_id (plus a
  source.subagent.thread_spawn block for spawned subagents). The parser ignored
  both markers and only inferred a parent from a second embedded session_meta,
  labelling every such session a generic CONTINUATION. Verified against the live
  ~/.codex corpus: 226 rollouts carry forked_from_id; e.g. child 019ccbf9 is a
  subagent of 019ccbf8 sharing a 6-message prefix, previously seen as a plain
  continuation.
- Claude Code auto-compaction sessions (agent-acompact-*) are a 100% copy of the
  parent plus a summary, but matched the generic agent- subagent prefix and were
  counted as distinct subagent work (187 such sessions).

What changed:
- codex.py reads forked_from_id and source.subagent.thread_spawn from the child's
  own session_meta and sets branch_type to SUBAGENT (spawned) or FORK (user fork),
  preferring the explicit marker over the legacy second-meta heuristic.
- code_parser.py distinguishes agent-acompact-* from real subagents: it keeps the
  parent link and composed id but classifies the relationship as CONTINUATION
  (a post-compaction continuation), not SUBAGENT.

This is the first slice of the lineage-model work (Ref #2467); it records the
correct edge type. Tail extraction (storing only the divergent tail + branch
point) and read composition follow in the schema-bumping slice. No schema change.

Verification: devtools test on tests/unit/sources/test_parsers_codex.py,
test_compaction.py, test_assembly.py, test_codex_event_stream_contract.py,
test_parsed_session_typed_context.py, test_provider_completeness.py — all green;
parsed the real 019ccbf9 rollout → branch_type=subagent, parent=019ccbf8.

Ref #2467

Co-Authored-By: Claude <[email protected]>
… on read

Problem: a Codex fork/resume/subagent and a Claude auto-compaction child rollout
physically replay the parent's leading context, so polylogue stored that prefix
N times. Measured on the live archive: 16,414 physical vs 8,807 logical sessions,
~32% duplicate-bearing message rows, Codex 189.7B tokens physical vs 139.3B
authoritative (state_5.sqlite) — the excess is fork replay (#2467).

What changed (index schema v11 → v12, deletes-then-defines, rebuild from source):

- Schema: session_links gains `branch_point_message_id` (the last parent message
  the child inherited) and `inheritance` ('prefix-sharing' | 'spawned-fresh').
- Ingest (write.py): when a prefix-sharing child's parent is already in the
  archive, align the child's messages against the parent's *composed* transcript
  by a per-message content signature (role + ordered block content), using
  conservative contiguous prefix-alignment — a message is inherited only inside
  the matching leading run, so a genuinely-new block that happens to equal a
  parent block is never dropped. Only the divergent tail is stored, at its
  original positions; the branch point + inheritance kind are recorded on the
  edge. A child that shares no prefix (fresh Task subagent) is stored whole as
  'spawned-fresh'.
- Reads: both read paths compose the parent transcript up to the branch point +
  the child's own tail — the async `get_messages` query and the sync
  `read_archive_session_envelope` used by MCP `get_session` / CLI `read`.
  Composition is recursive (a subagent of a fork resolves correctly).
- get_messages composes in strict position order; a non-lineage session keeps the
  historical sort-key order that the keyset streamer (iter_messages) mirrors, so
  the keyset/canonical/offset invariant is preserved.

Derived tables (FTS, model usage, work events, phases, embeddings) read the
once-stored messages, so they stop double-counting by construction; the inherited
prefix's tokens are no longer re-billed to the child.

Remaining (tracked): deferred re-extraction when a child is ingested before its
parent (stored whole until the parent arrives); compaction-boundary range columns
and attachment bytes land in the next slices.

Verification:
- New tests/unit/storage/test_lineage_normalization.py: prefix-sharing child
  stores only its tail (positions preserved), message_count excludes the prefix,
  edge records branch point + 'prefix-sharing' resolved to the parent, and both
  read paths compose parent prefix + tail; spawned-fresh child is stored whole.
- Real-corpus round-trip: Codex subagent 019ccbf9 (forked from 019ccbf8) shares
  an 18-message prefix; parent keeps 110 rows, child stores its 162-message tail
  (was 180), composed read reconstructs all 180 exactly.
- Green: test_iter_messages_keyset, test_message_query_reads, test_archive_tiers_*,
  test_archive_tiers_self_verify, mcp envelope/server-surface contracts,
  provider_usage_report (111 passed); render all --check, verify topology
  (843=843), verify manifests, verify test-infra-currency, lab policy
  schema-versioning all pass; mypy --strict clean on changed files.

Ref #2467

Co-Authored-By: Claude <[email protected]>
…sage

Problem: Codex records a `compacted` rollout event but, unlike Claude Code, never
materialized the summary as a message — so a Codex compacted session's transcript
silently dropped the summary text the model actually saw, and the two providers
modeled the same concept (context discontinuity) differently (#2467).

What changed: the Codex parser now appends a SYSTEM / `summary` message at the
compaction boundary carrying the `compacted.message` text, in addition to the
existing session event — mirroring the Claude Code inline-compaction path. The
pre-compaction messages stay stored once; the summary message marks where context
discontinues. With the lineage normalization already landed, the auto-compaction
copy case (Claude `agent-acompact-*`) is deduplicated as a prefix-sharing child,
so all three compaction encodings now present a uniform summary message.

Also removes a redundant function-local `from .base import ParsedContentBlock`
that shadowed the module-level import.

Verification: tests/unit/sources/test_compaction.py updated to assert the Codex
summary message is emitted between surrounding messages with role=system /
message_type=summary; test_compaction.py + test_parsers_codex.py green (82
passed); ruff + mypy --strict clean.

Ref #2467

Co-Authored-By: Claude <[email protected]>
…hashes

Problem: attachments were metadata-only by construction (#2468). The writer wrote
a synthetic 32-byte "hash" derived from the attachment id into
attachments.blob_hash and never stored any bytes — the live archive had 8,425
attachment rows claiming 8.4 GB but 0 blobs. The hash was a lie: it implied a
content-addressed blob existed when none did.

What changed (index schema v12 → v13, deletes-then-defines, rebuild from source):

- Schema: attachments.blob_hash is now nullable and CHECK-constrained to a real
  32-byte SHA-256 when present; a new acquisition_status column records
  'acquired' / 'unavailable' / 'unfetched'.
- ParsedAttachment gains a transport-only `inline_bytes` field (excluded from
  serialization). The Gemini/Drive inline-file parser now decodes the base64
  payload into it instead of computing a size and discarding the bytes.
- Ingest acquires bytes when available: `_acquire_attachment_blob` writes
  inline bytes to the content-addressed blob store and records the true SHA-256 +
  byte count + status 'acquired'; with no recoverable bytes it writes NULL hash +
  status 'unfetched' (source_url / provider file id stay for later
  re-acquisition). The fabricated-hash helper is gone.

This makes attachment state honest now and lays the acquisition seam for the
remaining sources (Drive OAuth fetch, export-zip members, local repo tarballs),
which are tracked follow-ups — most browser-capture attachment bytes are simply
not present in the source polylogue holds and are correctly marked 'unfetched'.

Verification: new tests/unit/storage/test_attachment_acquisition.py — inline bytes
round-trip through the blob store with the true SHA-256 and 'acquired' status; a
byte-less attachment is 'unfetched' with NULL hash (no fabricated hash). Green:
test_archive_tiers_write, test_archive_tiers_ddl, test_reader_attachments path
(69 passed) + the 2 new tests; ruff + mypy --strict clean.

Ref #2468

Co-Authored-By: Claude <[email protected]>
Two strict-mode errors surfaced only under the full `mypy --strict` repo pass
(the per-file checks during development did not include them):
- _read_texts returns list[str | None] (block text is nullable), not list[str].
- drop a redundant `branch_type != SUBAGENT` assertion that mypy flags as a
  non-overlapping equality once branch_type is known to be CONTINUATION.

Behavior unchanged; both files green.

Co-Authored-By: Claude <[email protected]>
Problem: lineage normalization (#2467) could only drop a child's inherited prefix
when the parent was already in the archive at child-write time. A child ingested
before its parent (out-of-order batches during a full re-ingest) was stored whole,
leaving the duplication in place even after the parent landed and the edge resolved.

What changed: when `_resolve_session_graph` resolves an inbound prefix-sharing edge
(parent now present), `_reextract_prefix_tail_db` aligns the child's already-stored
messages against the parent's composed transcript by the same per-message content
signature used at write time, deletes the inherited-prefix message rows (FK cascade
removes their blocks; FTS triggers are live on this path so the index stays in
sync), records `branch_point_message_id` + `inheritance`, and refreshes the child's
counts. A child with no shared prefix is marked `spawned-fresh`. Runs only while the
edge is still un-extracted (`inheritance` NULL), so it is idempotent.

Verification: new tests/unit/storage/test_lineage_normalization.py
::test_child_before_parent_is_reextracted_on_resolution — child written first is
stored whole (4 rows, edge inheritance NULL), then after the parent arrives only the
2-row tail remains with the edge recorded, and both read paths compose the full
4-message transcript. All 3 lineage tests green; ruff + mypy --strict clean.

Ref #2467

Co-Authored-By: Claude <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 28 minutes and 19 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5064ca96-63a3-4a71-b810-73c204936195

📥 Commits

Reviewing files that changed from the base of the PR and between 75fcf8f and e22c4fc.

📒 Files selected for processing (5)
  • docs/internals.md
  • polylogue/storage/sqlite/archive_tiers/index.py
  • polylogue/storage/sqlite/archive_tiers/write.py
  • polylogue/storage/sqlite/queries/message_query_reads.py
  • tests/unit/storage/test_lineage_normalization.py
📝 Walkthrough

Walkthrough

This PR implements a session lineage normalization model (schema v12/v13) that stores each message once and composes transcripts via typed session_links edges. It fixes Codex token double-billing with disjoint billing lanes, replaces fabricated attachment hashes with true SHA-256 acquisition, adds an embedding --min-messages filter, upgrades pricing to a LiteLLM-backed catalog, and ships read-only forensics and cost-accounting demo scripts.

Changes

Session Lineage Normalization, Cost Accounting, Attachment Acquisition, and Forensics

Layer / File(s) Summary
Schema DDL v12/v13 and lineage design docs
polylogue/storage/sqlite/archive_tiers/index.py, docs/design/session-lineage-model.md, docs/internals.md
INDEX_SCHEMA_VERSION bumped to 13; session_links gains branch_point_message_id and inheritance columns; attachments.blob_hash becomes nullable with a new acquisition_status constraint. Design and internals docs specify the full lineage model semantics, ingest rules, read composition, and attachment-preservation plan.
Codex and Claude Code lineage marker detection
polylogue/sources/parsers/codex.py, polylogue/sources/parsers/claude/code_parser.py, tests/unit/sources/test_parsers_codex.py, tests/unit/sources/test_compaction.py
Codex parser reads explicit forked_from_id / subagent.thread_spawn markers from the first session_meta to set parent_session_provider_id and branch_type, overriding the legacy second-session_meta heuristic; compaction events now emit a real SYSTEM/summary ParsedMessage. Claude Code parser maps agent-acompact-* to CONTINUATION and other agent-* to SUBAGENT.
Lineage normalization write path and deferred resolution
polylogue/storage/sqlite/archive_tiers/write.py, polylogue/storage/sqlite/connection_profile.py, tests/unit/storage/test_lineage_normalization.py
write_parsed_session_to_archive extracts the child's prefix-divergent tail, stores only the tail, and records branch_point_message_id + inheritance in session_links. _reextract_prefix_tail_db handles out-of-order ingest. read_archive_session_envelope gains depth-limited recursive prefix-sharing composition. Read timeout increased to 5 s.
Lineage-aware async message query and session-ID suffix resolution
polylogue/storage/sqlite/queries/message_query_reads.py, polylogue/storage/sqlite/archive_tiers/archive.py, tests/unit/storage/test_archive_tiers_archive.py
get_messages follows _prefix_sharing_edge recursively (bounded by _MAX_LINEAGE_DEPTH) to compose parent prefix with child tail. resolve_session_id adds suffix-fallback for bare native-ID tokens without an origin prefix.
Inline attachment acquisition with true SHA-256
polylogue/sources/parsers/base_models.py, polylogue/sources/parsers/drive_support_attachments.py, polylogue/storage/sqlite/archive_tiers/write.py, tests/unit/storage/test_attachment_acquisition.py
ParsedAttachment gains a transport-only inline_bytes field; the drive-support parser base64-decodes inline file data into it; the write path stores bytes via _acquire_attachment_blob with real SHA-256 blob_hash and acquisition_status, removing fabricated hash derivation.
Disjoint token billing lanes and LiteLLM-backed pricing catalog
polylogue/storage/sqlite/archive_tiers/write.py, polylogue/storage/usage.py, polylogue/archive/semantic/pricing.py, polylogue/archive/semantic/cost_compute.py, tests/unit/storage/test_archive_tiers_write.py, tests/unit/storage/test_provider_usage_report.py
_provider_usage_disjoint_lanes maps Codex token_count fields into non-overlapping fresh_input/output/cache_read/cache_write lanes used in all model-usage aggregation and audit paths. pricing.py loads a vendored LiteLLM JSON catalog as base, merges curated overrides, and strips date-snapshot suffixes during normalization.
Embedding backfill --min-messages filter end-to-end
polylogue/storage/embeddings/materialization.py, polylogue/storage/embeddings/preflight.py, polylogue/cli/commands/embed.py, tests/unit/storage/test_embedding_contracts.py
select_pending_archive_session_window gains a min_messages floor filter and descending sort_key_ms ordering; _should_embed_archive_message switches to _NON_PROSE_MATERIAL_ORIGINS allow/deny; PreflightReport, build_preflight_report, and embed backfill CLI wired with --min-messages; _write_embedding_section gains OSError handling.
Forensics and cost-accounting scripts with docs
scripts/agent_forensics.py, scripts/cost_accounting_demo.py, docs/agent-forensics.md, docs/cost-model.md, docs/examples/cost-accounting-demo.txt, README.md
agent_forensics.py: stdlib-only read-only archive analysis producing a Markdown report and SVG charts. cost_accounting_demo.py: end-to-end synthetic demo and optional cross-verification of disjoint billing lanes vs Codex authoritative state. Docs and README updated with usage and committed demo output.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related issues

Possibly related PRs

  • Sinity/polylogue#1531: Directly related — both touch the same embed backfill/preflight windowing code paths to add bounded session-selection parameters, just with different filter dimensions (min_messages here vs max-* there).

Suggested labels

area:pipeline, area:storage, area:schema, area:parser

Poem

🐇 Hop hop, the archive grows wise,
Each session stored just once — no disguise!
Fresh inputs, cache lanes, no double-count pain,
Forked tails now branch where they came.
The rabbit checks SHA-256 with glee,
Report.md blooms for all to see! 🌸

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and directly describes the two main changes: lineage normalization and cross-provider cost accounting.
Description check ✅ Passed The description is detailed and covers summary, problem, solution, verification, and follow-ups, but it lacks an explicit Changelog section.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/operator-dogfood-hardening

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.

github-actions Bot pushed a commit that referenced this pull request Jun 28, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 14

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
polylogue/storage/embeddings/preflight.py (1)

63-70: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Honor min_messages on the non-archive preflight path.

read_pending_message_count() accepts the new filter, but the fallback path only windows on max_sessions/max_messages. A min_messages-only report is marked windowed later while these counts still include every pending session. Extend the legacy selector/count path to apply the same floor.

Also applies to: 95-103

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/storage/embeddings/preflight.py` around lines 63 - 70, The
non-archive fallback in read_pending_message_count() is ignoring min_messages,
so the legacy path still counts all pending sessions even when a floor is
requested. Update the non-archive selector/count logic in
read_pending_message_count() to apply the same min_messages threshold used
elsewhere, alongside the existing max_sessions/max_messages handling, and keep
the behavior consistent for any min_messages-only preflight.
polylogue/storage/embeddings/materialization.py (1)

425-460: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Record processed message count, not only embedded prose count.

select_pending_archive_session_window() treats message_count_embedded < s.message_count as pending. After this new non-prose filter, any session with skipped rows records len(embeddable) and will be selected again forever. Record the total rows processed for freshness, while keeping the outcome’s embedded count as len(embeddable).

Proposed fix
         if not embeddable:
             _record_archive_embedding_success(
-                embeddings_conn, session_id=session_id, origin=str(session["origin"]), message_count=0
+                embeddings_conn, session_id=session_id, origin=str(session["origin"]), message_count=len(rows)
             )
             return EmbedSessionOutcome(
@@
         _record_archive_embedding_success(
             embeddings_conn,
             session_id=session_id,
             origin=str(session["origin"]),
-            message_count=len(embeddable),
+            message_count=len(rows),
         )

Also applies to: 519-544

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/storage/embeddings/materialization.py` around lines 425 - 460,
`materialize_archive_session_window` is recording the embedded count as the
session’s processed count, which leaves sessions with skipped non-prose rows
perpetually pending. Update the success recording around
`_record_archive_embedding_success` to use the total rows processed from `rows`
for freshness, while keeping `EmbedSessionOutcome` and any embedded-message
counters based on `len(embeddable)`. Make the same adjustment in the matching
archive-session path referenced by the review so
`select_pending_archive_session_window()` stops reselecting completed sessions.
polylogue/sources/parsers/drive_support_attachments.py (1)

131-149: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Preserve zero-byte inline files.

Line 135 skips decoding when data == "", but an empty string is valid base64 for a zero-byte file. Combined with the truthiness check in polylogue/storage/sqlite/archive_tiers/write.py:_acquire_attachment_blob, those attachments are persisted as unfetched with no blob/hash even though the export already contains the bytes. Please distinguish None from b"" in both places.

Possible fix
-    inline_bytes: bytes | None = None
-    if isinstance(data, str) and data:
+    inline_bytes: bytes | None = None
+    if isinstance(data, str):
         try:
             inline_bytes = base64.b64decode(data, validate=True)
         except (ValueError, binascii.Error):
             inline_bytes = None
# polylogue/storage/sqlite/archive_tiers/write.py
if attachment.inline_bytes is not None:
    ...
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/sources/parsers/drive_support_attachments.py` around lines 131 -
149, Preserve zero-byte inline files by treating an empty base64 payload as
valid bytes instead of falsy. In drive_support_attachments.py, update the inline
file decode path in the ParsedAttachment flow so only None means “unfetched,”
while "" should decode to b"" and be kept in inline_bytes. In
polylogue/storage/sqlite/archive_tiers/write.py, adjust _acquire_attachment_blob
to test inline_bytes against None rather than relying on truthiness, so b"" is
still persisted with a blob/hash.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@polylogue/archive/semantic/pricing.py`:
- Around line 249-252: The vendored price map loader currently swallows
OSError/ValueError and returns an empty dict, which lets PRICING fall back
silently to the small override set. Update the price-map loading path in
pricing.py to fail fast by raising a clear exception (or returning an explicit
unavailable state that callers must handle) instead of defaulting to {}. Make
the change in the helper that reads the JSON via path.read_text/json.loads, and
ensure the PRICING initialization path does not proceed as if pricing data were
valid when the catalog cannot be loaded.

In `@polylogue/sources/parsers/codex.py`:
- Around line 591-593: The subagent detection in the parser is too broad because
the `source.subagent` object alone is treated as a spawned subagent. Update the
`session_meta` check in the `is_subagent_spawn` logic to require the explicit
`thread_spawn` marker under `source.subagent` instead of just testing for a
dict, so the later branch selection that labels `SUBAGENT` only triggers for
real spawned subagent sessions.

In `@polylogue/storage/embeddings/preflight.py`:
- Line 31: `PreflightReport` now includes `min_messages`, but
`preflight_payload()` still drops it from the serialized JSON. Update the
payload construction in `preflight_payload()` to include `min_messages`
alongside the other window-related fields so consumers of `PreflightReport` and
the JSON contract preserve this filter.

In `@polylogue/storage/sqlite/archive_tiers/archive.py`:
- Around line 1386-1406: The search helpers still use the raw session_id token,
so bare native ids resolved by resolve_session_id() will not match in search
paths. Update search_summaries(), count_search_sessions(), and
semantic_summaries() to apply the same session-id resolution before binding the
query, mirroring the existing resolve_session_id() behavior and preserving their
current empty-result defaults (return [], return 0, return []).

In `@polylogue/storage/sqlite/archive_tiers/index.py`:
- Around line 324-325: The DDL for the archive tier table allows invalid
combinations of branch_point_message_id and inheritance, so encode the lineage
state machine directly in the schema. Update the CREATE TABLE definition in
index.py by adding a row-level CHECK that permits only the valid states handled
by the read paths: both NULL for unresolved, non-NULL branch_point_message_id
with 'prefix-sharing', and NULL branch_point_message_id with 'spawned-fresh'.
Keep the existing branch_point_message_id and inheritance columns, but tighten
their combined constraint so impossible states are rejected at insert/update
time.
- Around line 463-465: The archive_tiers table definition currently allows
inconsistent attachment state between acquisition_status and blob_hash. Update
the schema in the archive tier initialization/migration logic to add a CHECK
constraint tying these fields together: rows marked acquired must have a
non-null 32-byte blob_hash, and non-acquired rows must not carry a blob_hash.
Apply the fix where the table DDL is defined so the constraint is enforced at
the database level alongside the existing blob_hash and acquisition_status
checks.

In `@polylogue/storage/sqlite/archive_tiers/write.py`:
- Around line 3307-3313: The attachment handling in the inline-bytes branch
currently treats empty payloads as missing because `if inline:` skips `b""`, so
update the logic in the `attachment.inline_bytes` flow to explicitly distinguish
`None` from an empty byte string. In the relevant function, keep zero-byte
inline payloads on the acquired path by writing them through
`get_blob_store().write_from_bytes(...)` and returning the resulting hash/size,
while reserving the unfetched path only for truly absent inline bytes.
- Around line 1735-1742: The upsert logic in the attachment conflict handling is
letting `byte_count` drift from the retained acquired blob because
`attachment_id` conflicts always assign `excluded.byte_count` even when
`blob_hash` and `acquisition_status` stay on the existing acquired record.
Update the conflict branch in the `attachments` write path so `byte_count`
follows the same retention rules as `blob_hash` and `acquisition_status` in the
same SQL statement, keeping the acquired row’s byte count unchanged unless the
incoming row actually replaces the blob.

In `@README.md`:
- Around line 359-365: The README description under the cost accounting demo is
too narrow and does not match the script’s actual scope. Update the wording in
the demo blurb that references scripts/cost_accounting_demo.py so it reflects
that the demo ingests two crafted sessions and demonstrates cross-provider
accounting; use plural language or explicitly name the second provider alongside
Codex, keeping the summary aligned with the demo’s real behavior.

In `@scripts/agent_forensics.py`:
- Around line 636-644: The subscription comparison text in the forensics summary
is mixing priced-only credits with an all-provider cache-read count, which can
overstate the Claude Max value claim. Update the paragraph in the
summary-building logic around the credits/plan-months calculation to scope the
cache-read usage to the same priced/Claude subset as `subscription_credits` (or
omit it if that filtered metric is unavailable). Keep the narrative consistent
with the `cost_provenance='priced'` data used in this section, and use the
existing `_fmt_num`, `_fmt_usd`, and `f.get(...)` access pattern only on the
correctly filtered aggregate.
- Around line 529-543: The summary table in the report builder is mixing
provider-wide token totals with a priced-only cost in the `all` row. Update the
aggregation logic in `agent_forensics.py` so the final row in the markdown table
uses only totals that apply across all providers, and keep `total_cost` out of
the `all` row. Use the existing `econ`, `f.get('total_cost', 0)`, and the
table-building block around the `prov` loop to locate the fix.

In `@scripts/cost_accounting_demo.py`:
- Around line 119-128: `run_synthetic_demo()` and `run_cross_verify()` leave
SQLite handles open, causing cleanup failures and descriptor leaks. Explicitly
close the connection(s) created via `_connect()` after the query/work is done,
and ensure both the writable `conn` in `run_synthetic_demo()` and the read-only
handles in `run_cross_verify()` are closed deterministically, ideally using
`try/finally` or context-managed cleanup around the existing
`write_parsed_session_to_archive()` and query logic.

In `@tests/unit/sources/test_parsers_codex.py`:
- Around line 190-207: The test for fork precedence is not actually proving the
precedence rule because the explicit fork target and the second session_meta
currently resolve to the same parent id. Update the payload in
test_forked_from_id_beats_legacy_second_meta_heuristic so the second
session_meta has a different id than forked_from_id, then keep the assertion on
parse and BranchType.FORK to verify that the parser in parse correctly prefers
forked_from_id over the legacy second-meta heuristic.

In `@tests/unit/storage/test_attachment_acquisition.py`:
- Around line 55-106: The attachment acquisition tests currently cover non-empty
inline bytes and missing bytes, but not the empty-bytes edge case that can be
misclassified by truthiness checks. Add a regression test alongside
test_inline_attachment_bytes_are_stored_with_true_hash and
test_attachment_without_bytes_is_marked_unfetched_not_faked that uses
ParsedAttachment with inline_bytes=b"" (or data="") and asserts
write_parsed_session_to_archive records the attachment as acquired with a real
blob_hash and byte_count of 0, so zero-byte inline attachments are not treated
as unfetched.

---

Outside diff comments:
In `@polylogue/sources/parsers/drive_support_attachments.py`:
- Around line 131-149: Preserve zero-byte inline files by treating an empty
base64 payload as valid bytes instead of falsy. In drive_support_attachments.py,
update the inline file decode path in the ParsedAttachment flow so only None
means “unfetched,” while "" should decode to b"" and be kept in inline_bytes. In
polylogue/storage/sqlite/archive_tiers/write.py, adjust _acquire_attachment_blob
to test inline_bytes against None rather than relying on truthiness, so b"" is
still persisted with a blob/hash.

In `@polylogue/storage/embeddings/materialization.py`:
- Around line 425-460: `materialize_archive_session_window` is recording the
embedded count as the session’s processed count, which leaves sessions with
skipped non-prose rows perpetually pending. Update the success recording around
`_record_archive_embedding_success` to use the total rows processed from `rows`
for freshness, while keeping `EmbedSessionOutcome` and any embedded-message
counters based on `len(embeddable)`. Make the same adjustment in the matching
archive-session path referenced by the review so
`select_pending_archive_session_window()` stops reselecting completed sessions.

In `@polylogue/storage/embeddings/preflight.py`:
- Around line 63-70: The non-archive fallback in read_pending_message_count() is
ignoring min_messages, so the legacy path still counts all pending sessions even
when a floor is requested. Update the non-archive selector/count logic in
read_pending_message_count() to apply the same min_messages threshold used
elsewhere, alongside the existing max_sessions/max_messages handling, and keep
the behavior consistent for any min_messages-only preflight.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a0f518fe-6509-4999-aaf2-691467552288

📥 Commits

Reviewing files that changed from the base of the PR and between 2eee22a and 75fcf8f.

📒 Files selected for processing (32)
  • README.md
  • docs/agent-forensics.md
  • docs/cost-model.md
  • docs/design/session-lineage-model.md
  • docs/examples/cost-accounting-demo.txt
  • docs/internals.md
  • polylogue/archive/semantic/cost_compute.py
  • polylogue/archive/semantic/data/litellm_model_prices.json
  • polylogue/archive/semantic/pricing.py
  • polylogue/cli/commands/embed.py
  • polylogue/sources/parsers/base_models.py
  • polylogue/sources/parsers/claude/code_parser.py
  • polylogue/sources/parsers/codex.py
  • polylogue/sources/parsers/drive_support_attachments.py
  • polylogue/storage/embeddings/materialization.py
  • polylogue/storage/embeddings/preflight.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/index.py
  • polylogue/storage/sqlite/archive_tiers/write.py
  • polylogue/storage/sqlite/connection_profile.py
  • polylogue/storage/sqlite/queries/message_query_reads.py
  • polylogue/storage/usage.py
  • scripts/agent_forensics.py
  • scripts/cost_accounting_demo.py
  • tests/unit/sources/test_compaction.py
  • tests/unit/sources/test_parsers_codex.py
  • tests/unit/storage/test_archive_tiers_archive.py
  • tests/unit/storage/test_archive_tiers_write.py
  • tests/unit/storage/test_attachment_acquisition.py
  • tests/unit/storage/test_embedding_contracts.py
  • tests/unit/storage/test_lineage_normalization.py
  • tests/unit/storage/test_provider_usage_report.py

Comment on lines +249 to +252
try:
raw = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError):
return {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Fail fast when the vendored price map cannot be loaded.

Returning {} here silently collapses PRICING to the small curated override set, so many models will start pricing at $0 while the archive still materializes seemingly valid cost rows. This should surface as a hard failure or an explicit “catalog unavailable” state instead of silently underbilling.

Suggested fix
     try:
         raw = json.loads(path.read_text(encoding="utf-8"))
-    except (OSError, ValueError):
-        return {}
+    except (OSError, ValueError) as exc:
+        raise RuntimeError(f"Failed to load vendored LiteLLM price map: {path}") from exc
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try:
raw = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError):
return {}
try:
raw = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise RuntimeError(f"Failed to load vendored LiteLLM price map: {path}") from exc
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/archive/semantic/pricing.py` around lines 249 - 252, The vendored
price map loader currently swallows OSError/ValueError and returns an empty
dict, which lets PRICING fall back silently to the small override set. Update
the price-map loading path in pricing.py to fail fast by raising a clear
exception (or returning an explicit unavailable state that callers must handle)
instead of defaulting to {}. Make the change in the helper that reads the JSON
via path.read_text/json.loads, and ensure the PRICING initialization path does
not proceed as if pricing data were valid when the catalog cannot be loaded.

Comment on lines +591 to +593
source_val = session_meta.get("source")
if isinstance(source_val, dict) and isinstance(source_val.get("subagent"), dict):
is_subagent_spawn = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Gate subagent classification on thread_spawn itself.

This marks every session with a source.subagent object as a spawned subagent. The later branch selection at Lines 658-660 will therefore mislabel plain forks/resumes as SUBAGENT whenever that metadata is present. The explicit marker in this PR is session_meta.source.subagent.thread_spawn, so check that field instead.

Proposed fix
                     source_val = session_meta.get("source")
-                    if isinstance(source_val, dict) and isinstance(source_val.get("subagent"), dict):
-                        is_subagent_spawn = True
+                    if isinstance(source_val, dict):
+                        subagent_val = source_val.get("subagent")
+                        if isinstance(subagent_val, dict):
+                            is_subagent_spawn = bool(subagent_val.get("thread_spawn"))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
source_val = session_meta.get("source")
if isinstance(source_val, dict) and isinstance(source_val.get("subagent"), dict):
is_subagent_spawn = True
source_val = session_meta.get("source")
if isinstance(source_val, dict):
subagent_val = source_val.get("subagent")
if isinstance(subagent_val, dict):
is_subagent_spawn = bool(subagent_val.get("thread_spawn"))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/sources/parsers/codex.py` around lines 591 - 593, The subagent
detection in the parser is too broad because the `source.subagent` object alone
is treated as a spawned subagent. Update the `session_meta` check in the
`is_subagent_spawn` logic to require the explicit `thread_spawn` marker under
`source.subagent` instead of just testing for a dict, so the later branch
selection that labels `SUBAGENT` only triggers for real spawned subagent
sessions.

max_sessions: int | None = None
max_messages: int | None = None
max_cost_usd: float | None = None
min_messages: int | None = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Serialize min_messages in the preflight payload.

PreflightReport now carries this filter and the text renderer shows it, but preflight_payload() still omits it from the JSON contract. Add it beside the other window fields so machine consumers do not lose the floor.

Proposed fix
         "max_sessions": report.max_sessions,
         "max_messages": report.max_messages,
         "max_cost_usd": report.max_cost_usd,
+        "min_messages": report.min_messages,
         "pricing": {

Also applies to: 320-341

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/storage/embeddings/preflight.py` at line 31, `PreflightReport` now
includes `min_messages`, but `preflight_payload()` still drops it from the
serialized JSON. Update the payload construction in `preflight_payload()` to
include `min_messages` alongside the other window-related fields so consumers of
`PreflightReport` and the JSON contract preserve this filter.

Comment on lines +1386 to +1406
# Suffix fallback: a bare native id (e.g. the UUID that appears as
# the session's source filename, ``1944721d-...``) resolves to the
# stored ``<origin>:<native_id>``. Provider native ids are globally
# unique, so a single suffix match is unambiguous; multiple matches
# raise just like the prefix path rather than guessing.
if ":" not in token:
like_token = token.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
suffix_rows = self._conn.execute(
"""
SELECT session_id
FROM sessions
WHERE session_id LIKE '%:' || ? ESCAPE '\\'
ORDER BY session_id
LIMIT 2
""",
(like_token,),
).fetchall()
if len(suffix_rows) == 1:
return str(suffix_rows[0]["session_id"])
if len(suffix_rows) > 1:
raise ValueError(f"session id suffix {token!r} is ambiguous")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply the new session-id resolution to the search helpers too.

resolve_session_id() now accepts bare native ids, but Lines 3244-3246, 3364-3366, and 3457-3459 still bind the raw session_id token directly. A token like "codex-resolve-1" will resolve in list_summaries()/count_sessions() but return no rows from these search paths.

Suggested fix pattern
-        if session_id is not None:
-            where = f"{where} AND s.session_id = ?"
-            filter_params.append(session_id)
+        if session_id is not None:
+            try:
+                resolved_session_id = self.resolve_session_id(session_id)
+            except KeyError:
+                return []
+            where = f"{where} AND s.session_id = ?"
+            filter_params.append(resolved_session_id)

Use the same pattern in:

  • search_summaries() with return []
  • count_search_sessions() with return 0
  • semantic_summaries() with return []
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/storage/sqlite/archive_tiers/archive.py` around lines 1386 - 1406,
The search helpers still use the raw session_id token, so bare native ids
resolved by resolve_session_id() will not match in search paths. Update
search_summaries(), count_search_sessions(), and semantic_summaries() to apply
the same session-id resolution before binding the query, mirroring the existing
resolve_session_id() behavior and preserving their current empty-result defaults
(return [], return 0, return []).

Comment on lines +324 to +325
branch_point_message_id TEXT REFERENCES messages(message_id) ON DELETE SET NULL,
inheritance TEXT CHECK(inheritance IN ('prefix-sharing', 'spawned-fresh') OR inheritance IS NULL),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Encode the lineage edge state machine in the CHECKs.

branch_point_message_id and inheritance are now a coupled contract, but the DDL still allows impossible states like 'prefix-sharing' with a null branch point. The read paths only compose when both arrive together, so a malformed row silently degrades into “no lineage”. Add a row-level CHECK for the only valid states: unresolved (NULL, NULL), prefix-sharing (non-NULL, 'prefix-sharing'), and spawned-fresh (NULL, 'spawned-fresh').

Proposed fix
     branch_point_message_id TEXT REFERENCES messages(message_id) ON DELETE SET NULL,
     inheritance             TEXT CHECK(inheritance IN ('prefix-sharing', 'spawned-fresh') OR inheritance IS NULL),
+    CHECK (
+        (inheritance IS NULL AND branch_point_message_id IS NULL) OR
+        (inheritance = 'prefix-sharing' AND branch_point_message_id IS NOT NULL) OR
+        (inheritance = 'spawned-fresh' AND branch_point_message_id IS NULL)
+    ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
branch_point_message_id TEXT REFERENCES messages(message_id) ON DELETE SET NULL,
inheritance TEXT CHECK(inheritance IN ('prefix-sharing', 'spawned-fresh') OR inheritance IS NULL),
branch_point_message_id TEXT REFERENCES messages(message_id) ON DELETE SET NULL,
inheritance TEXT CHECK(inheritance IN ('prefix-sharing', 'spawned-fresh') OR inheritance IS NULL),
CHECK (
(inheritance IS NULL AND branch_point_message_id IS NULL) OR
(inheritance = 'prefix-sharing' AND branch_point_message_id IS NOT NULL) OR
(inheritance = 'spawned-fresh' AND branch_point_message_id IS NULL)
),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@polylogue/storage/sqlite/archive_tiers/index.py` around lines 324 - 325, The
DDL for the archive tier table allows invalid combinations of
branch_point_message_id and inheritance, so encode the lineage state machine
directly in the schema. Update the CREATE TABLE definition in index.py by adding
a row-level CHECK that permits only the valid states handled by the read paths:
both NULL for unresolved, non-NULL branch_point_message_id with
'prefix-sharing', and NULL branch_point_message_id with 'spawned-fresh'. Keep
the existing branch_point_message_id and inheritance columns, but tighten their
combined constraint so impossible states are rejected at insert/update time.

Comment on lines +529 to +543
md.append("| provenance | input | output | cache read | cache write | cost |")
md.append("|---|---|---|---|---|---|")
for prov in ("priced", "origin_reported"):
v = econ.get(prov)
if not v:
continue
cost_cell = _fmt_usd(float(v["cost"])) if float(v["cost"]) > 0 else "—"
md.append(
f"| {prov} | {_fmt_num(int(v['input']))} | {_fmt_num(int(v['output']))} | "
f"{_fmt_num(int(v['cache_read']))} | {_fmt_num(int(v['cache_write']))} | {cost_cell} |"
)
md.append(
f"| **all** | {_fmt_num(ci)} | {_fmt_num(co)} | {_fmt_num(cr)} | {_fmt_num(cw)} | "
f"**{_fmt_usd(float(f.get('total_cost', 0)))}** |"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Don’t put priced-only cost in the all row.

The paragraph above says priced cost must stay separate from all-provider token totals, but this row combines aggregate tokens with total_cost, which only exists for the priced subset. That will misstate any blended interpretation once origin_reported rows contribute large Codex volumes.

Suggested fix
-        md.append(
-            f"| **all** | {_fmt_num(ci)} | {_fmt_num(co)} | {_fmt_num(cr)} | {_fmt_num(cw)} | "
-            f"**{_fmt_usd(float(f.get('total_cost', 0)))}** |"
-        )
+        md.append(
+            f"| **all** | {_fmt_num(ci)} | {_fmt_num(co)} | {_fmt_num(cr)} | {_fmt_num(cw)} | — |"
+        )
+        md.append("")
+        md.append(f"Priced-subset cost: **{_fmt_usd(float(f.get('total_cost', 0)))}**.")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
md.append("| provenance | input | output | cache read | cache write | cost |")
md.append("|---|---|---|---|---|---|")
for prov in ("priced", "origin_reported"):
v = econ.get(prov)
if not v:
continue
cost_cell = _fmt_usd(float(v["cost"])) if float(v["cost"]) > 0 else "—"
md.append(
f"| {prov} | {_fmt_num(int(v['input']))} | {_fmt_num(int(v['output']))} | "
f"{_fmt_num(int(v['cache_read']))} | {_fmt_num(int(v['cache_write']))} | {cost_cell} |"
)
md.append(
f"| **all** | {_fmt_num(ci)} | {_fmt_num(co)} | {_fmt_num(cr)} | {_fmt_num(cw)} | "
f"**{_fmt_usd(float(f.get('total_cost', 0)))}** |"
)
md.append("| provenance | input | output | cache read | cache write | cost |")
md.append("|---|---|---|---|---|---|")
for prov in ("priced", "origin_reported"):
v = econ.get(prov)
if not v:
continue
cost_cell = _fmt_usd(float(v["cost"])) if float(v["cost"]) > 0 else "—"
md.append(
f"| {prov} | {_fmt_num(int(v['input']))} | {_fmt_num(int(v['output']))} | "
f"{_fmt_num(int(v['cache_read']))} | {_fmt_num(int(v['cache_write']))} | {cost_cell} |"
)
md.append(
f"| **all** | {_fmt_num(ci)} | {_fmt_num(co)} | {_fmt_num(cr)} | {_fmt_num(cw)} | — |"
)
md.append("")
md.append(f"Priced-subset cost: **{_fmt_usd(float(f.get('total_cost', 0)))}**.")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agent_forensics.py` around lines 529 - 543, The summary table in the
report builder is mixing provider-wide token totals with a priced-only cost in
the `all` row. Update the aggregation logic in `agent_forensics.py` so the final
row in the markdown table uses only totals that apply across all providers, and
keep `total_cost` out of the `all` row. Use the existing `econ`,
`f.get('total_cost', 0)`, and the table-building block around the `prov` loop to
locate the fix.

Comment on lines +636 to +644
plan_months = credits / _MAX20_CREDITS_PER_MONTH
md.append(
f"At the Max-20× cap (~{_fmt_num(_MAX20_CREDITS_PER_MONTH)} credits/month, $200/mo), "
f"that is **~{plan_months:.0f} plan-months** of capacity — but cache reads, which "
f"dominate the token volume ({_fmt_num(int(f.get('tok_cache_read', 0)))} read), cost "
f"**zero** credits. The same workload on the API would bill "
f"**{_fmt_usd(api_cost)}** (list-equivalent), so the subscription captures the bulk of "
f"that as value: the free-cache-read effect is exactly why plan pricing beats the API "
f"by ~13–37× for agentic, cache-heavy use."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the subscription narrative scoped to the priced/Claude subset.

subscription_credits is derived from WHERE cost_provenance='priced', but this paragraph pulls tok_cache_read from the all-provider aggregate. After the Codex lane fix, that can fold non-Claude cache reads into a Claude Max value claim.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/agent_forensics.py` around lines 636 - 644, The subscription
comparison text in the forensics summary is mixing priced-only credits with an
all-provider cache-read count, which can overstate the Claude Max value claim.
Update the paragraph in the summary-building logic around the
credits/plan-months calculation to scope the cache-read usage to the same
priced/Claude subset as `subscription_credits` (or omit it if that filtered
metric is unavailable). Keep the narrative consistent with the
`cost_provenance='priced'` data used in this section, and use the existing
`_fmt_num`, `_fmt_usd`, and `f.get(...)` access pattern only on the correctly
filtered aggregate.

Comment on lines +119 to +128
with tempfile.TemporaryDirectory(prefix="polylogue-cost-demo-") as td:
conn = _connect(Path(td) / "index.db")
session_id = write_parsed_session_to_archive(conn, codex)
row = conn.execute(
"""
SELECT model_name, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens
FROM session_model_usage WHERE session_id = ?
""",
(session_id,),
).fetchone()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Close the SQLite connections explicitly.

run_synthetic_demo() leaves index.db open when the temp directory is torn down, and run_cross_verify() never closes either read-only handle. That is a deterministic cleanup failure on Windows and a file-descriptor leak everywhere.

Suggested fix
     with tempfile.TemporaryDirectory(prefix="polylogue-cost-demo-") as td:
         conn = _connect(Path(td) / "index.db")
-        session_id = write_parsed_session_to_archive(conn, codex)
-        row = conn.execute(
-            """
-            SELECT model_name, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens
-            FROM session_model_usage WHERE session_id = ?
-            """,
-            (session_id,),
-        ).fetchone()
+        try:
+            session_id = write_parsed_session_to_archive(conn, codex)
+            row = conn.execute(
+                """
+                SELECT model_name, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens
+                FROM session_model_usage WHERE session_id = ?
+                """,
+                (session_id,),
+            ).fetchone()
+        finally:
+            conn.close()
...
     idx = sqlite3.connect(f"file:{archive / 'index.db'}?mode=ro", uri=True)
     st = sqlite3.connect(f"file:{state}?mode=ro", uri=True)
-    poly = {}
-    for sid, tt in idx.execute(
-        "SELECT session_id, MAX(total_tokens) FROM session_provider_usage_events "
-        "WHERE provider_event_type='token_count' GROUP BY session_id"
-    ):
-        uuid = sid.split(":", 1)[1] if ":" in sid else sid
-        poly[uuid] = tt or 0
-    auth = {row[0]: (row[1] or 0) for row in st.execute("SELECT id, tokens_used FROM threads")}
-    common = [u for u in poly if u in auth and auth[u] > 0]
-    ratios = sorted(poly[u] / auth[u] for u in common)
-    med = ratios[len(ratios) // 2] if ratios else float("nan")
-    within10 = sum(1 for r in ratios if 0.9 <= r <= 1.1)
-    only_poly_tok = sum(poly[u] for u in poly if u not in auth)
+    try:
+        poly = {}
+        for sid, tt in idx.execute(
+            "SELECT session_id, MAX(total_tokens) FROM session_provider_usage_events "
+            "WHERE provider_event_type='token_count' GROUP BY session_id"
+        ):
+            uuid = sid.split(":", 1)[1] if ":" in sid else sid
+            poly[uuid] = tt or 0
+        auth = {row[0]: (row[1] or 0) for row in st.execute("SELECT id, tokens_used FROM threads")}
+        common = [u for u in poly if u in auth and auth[u] > 0]
+        ratios = sorted(poly[u] / auth[u] for u in common)
+        med = ratios[len(ratios) // 2] if ratios else float("nan")
+        within10 = sum(1 for r in ratios if 0.9 <= r <= 1.1)
+        only_poly_tok = sum(poly[u] for u in poly if u not in auth)
+    finally:
+        idx.close()
+        st.close()

Also applies to: 180-181

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/cost_accounting_demo.py` around lines 119 - 128,
`run_synthetic_demo()` and `run_cross_verify()` leave SQLite handles open,
causing cleanup failures and descriptor leaks. Explicitly close the
connection(s) created via `_connect()` after the query/work is done, and ensure
both the writable `conn` in `run_synthetic_demo()` and the read-only handles in
`run_cross_verify()` are closed deterministically, ideally using `try/finally`
or context-managed cleanup around the existing
`write_parsed_session_to_archive()` and query logic.

Comment on lines +190 to +207
def test_forked_from_id_beats_legacy_second_meta_heuristic(self) -> None:
# When the explicit marker is present, the embedded parent meta (second
# session_meta = the copied parent's header) must not override it.
payload = [
{
"type": "session_meta",
"payload": {
"id": "child-3",
"forked_from_id": "real-parent",
"timestamp": "2024-01-01",
},
},
{"type": "session_meta", "payload": {"id": "real-parent", "timestamp": "2024-01-01"}},
]
result = parse(payload, "fallback")
assert result.parent_session_provider_id == "real-parent"
assert result.branch_type == BranchType.FORK

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the precedence assertion observable.

If the parser still preferred the second session_meta, this test would still pass because both branches resolve to "real-parent". Give Line 202 a different id so the forked_from_id precedence is actually exercised.

Suggested change
         payload = [
             {
                 "type": "session_meta",
                 "payload": {
                     "id": "child-3",
                     "forked_from_id": "real-parent",
                     "timestamp": "2024-01-01",
                 },
             },
-            {"type": "session_meta", "payload": {"id": "real-parent", "timestamp": "2024-01-01"}},
+            {"type": "session_meta", "payload": {"id": "legacy-parent", "timestamp": "2024-01-01"}},
         ]
         result = parse(payload, "fallback")
         assert result.parent_session_provider_id == "real-parent"
         assert result.branch_type == BranchType.FORK
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_forked_from_id_beats_legacy_second_meta_heuristic(self) -> None:
# When the explicit marker is present, the embedded parent meta (second
# session_meta = the copied parent's header) must not override it.
payload = [
{
"type": "session_meta",
"payload": {
"id": "child-3",
"forked_from_id": "real-parent",
"timestamp": "2024-01-01",
},
},
{"type": "session_meta", "payload": {"id": "real-parent", "timestamp": "2024-01-01"}},
]
result = parse(payload, "fallback")
assert result.parent_session_provider_id == "real-parent"
assert result.branch_type == BranchType.FORK
def test_forked_from_id_beats_legacy_second_meta_heuristic(self) -> None:
# When the explicit marker is present, the embedded parent meta (second
# session_meta = the copied parent's header) must not override it.
payload = [
{
"type": "session_meta",
"payload": {
"id": "child-3",
"forked_from_id": "real-parent",
"timestamp": "2024-01-01",
},
},
{"type": "session_meta", "payload": {"id": "legacy-parent", "timestamp": "2024-01-01"}},
]
result = parse(payload, "fallback")
assert result.parent_session_provider_id == "real-parent"
assert result.branch_type == BranchType.FORK
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/sources/test_parsers_codex.py` around lines 190 - 207, The test
for fork precedence is not actually proving the precedence rule because the
explicit fork target and the second session_meta currently resolve to the same
parent id. Update the payload in
test_forked_from_id_beats_legacy_second_meta_heuristic so the second
session_meta has a different id than forked_from_id, then keep the assertion on
parse and BranchType.FORK to verify that the parser in parse correctly prefers
forked_from_id over the legacy second-meta heuristic.

Comment on lines +55 to +106
def test_inline_attachment_bytes_are_stored_with_true_hash(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
store = BlobStore(tmp_path / "blob")
monkeypatch.setattr("polylogue.storage.blob_store.get_blob_store", lambda: store)

payload = b"hello attachment bytes"
conn = _connect(tmp_path / "index.db")
write_parsed_session_to_archive(
conn,
_session_with_attachment(
ParsedAttachment(
provider_attachment_id="att-1",
message_provider_id="m0",
name="note.txt",
mime_type="text/plain",
inline_bytes=payload,
)
),
)

row = conn.execute("SELECT blob_hash, byte_count, acquisition_status FROM attachments").fetchone()
assert row["acquisition_status"] == "acquired"
assert row["byte_count"] == len(payload)
assert bytes(row["blob_hash"]) == hashlib.sha256(payload).digest()
# The bytes actually round-trip through the content-addressed store.
assert store.read_all(hashlib.sha256(payload).hexdigest()) == payload


def test_attachment_without_bytes_is_marked_unfetched_not_faked(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
store = BlobStore(tmp_path / "blob")
monkeypatch.setattr("polylogue.storage.blob_store.get_blob_store", lambda: store)

conn = _connect(tmp_path / "index.db")
write_parsed_session_to_archive(
conn,
_session_with_attachment(
ParsedAttachment(
provider_attachment_id="att-2",
message_provider_id="m0",
name="remote.pdf",
mime_type="application/pdf",
size_bytes=4096,
source_url="https://drive.example/remote.pdf",
)
),
)

row = conn.execute("SELECT blob_hash, byte_count, acquisition_status FROM attachments").fetchone()
assert row["acquisition_status"] == "unfetched"
assert row["blob_hash"] is None
assert row["byte_count"] == 4096

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a zero-byte inline-attachment regression.

These tests cover non-empty bytes and missing bytes, but not the data="" / inline_bytes=b"" case. That edge is where the current truthiness checks can flip an acquired file into unfetched, so a targeted assertion here would lock down the new storage contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/storage/test_attachment_acquisition.py` around lines 55 - 106, The
attachment acquisition tests currently cover non-empty inline bytes and missing
bytes, but not the empty-bytes edge case that can be misclassified by truthiness
checks. Add a regression test alongside
test_inline_attachment_bytes_are_stored_with_true_hash and
test_attachment_without_bytes_is_marked_unfetched_not_faked that uses
ParsedAttachment with inline_bytes=b"" (or data="") and asserts
write_parsed_session_to_archive records the attachment as acquired with a real
blob_hash and byte_count of 0, so zero-byte inline attachments are not treated
as unfetched.

…ascade

An adversarial audit of the lineage normalization (#2467) surfaced correctness
bugs that would bite during the live re-ingest and ongoing daemon operation:

- **Parent re-ingest broke every child's composition (top bug).**
  `session_links.branch_point_message_id` was a FK with `ON DELETE SET NULL`. A
  parent's full-replace re-ingest (`DELETE FROM messages` then re-INSERT) nulled
  the child's branch point during the DELETE step — permanently reverting the
  child to tail-only, since deferred re-extraction is gated on `inheritance IS
  NULL`. `message_id` is deterministic, so the column is now plain TEXT (no FK):
  the reference survives the re-create. Index schema v13 → v14.
- **Web constructs were not sliced to the tail.** `_write_web_constructs` still
  iterated `session.messages` (full list) after messages/blocks were sliced, so a
  web construct on an inherited-prefix message would FK-violate and abort the
  session's ingest. It now takes the sliced `messages`.
- **Read composition could over-include on a dangling branch point.** Both read
  paths (`get_messages`, `read_archive_session_envelope`) now return the child's
  own tail rather than splicing the entire parent if the branch point is ever
  absent from the parent's composed transcript.
- **Signature mismatch on scalar tool_input.** The parsed-side signature now
  serializes `tool_input` through the same `_json_dumps` storage uses before
  canonicalizing, so it matches the DB-side signature (the previous path
  mis-handled scalar-string tool inputs, weakening dedup).
- **Missing index.** Adds `idx_messages_session_sortkey` so keyset/paginated
  message reads stop doing a per-chunk temp B-tree sort.

Remaining audit findings are tracked as issues #2470–#2483 (read-surface
composition, acompact-subagent disambiguation, logical-session cost basis, MCP
limit-capping, parser data loss, composition memoization, concurrency, etc.).

Verification: tests/unit/storage/test_lineage_normalization.py adds
test_parent_reingest_keeps_child_composing (re-ingesting the parent keeps the
child composing the full transcript); lineage + archive-tier write/DDL tests green
(76 passed); ruff + mypy --strict clean; render all --check clean.

Ref #2467

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jun 28, 2026

Copy link
Copy Markdown
Owner Author

Post-open: a 20-agent adversarial audit of this branch surfaced and fixed deploy-blocking bugs in the lineage code (commit e22c4fc, schema now v14):

  • parent re-ingest no longer nulls a child's branch point (dropped the ON DELETE SET NULL FK; deterministic message_id survives re-create)
  • web constructs sliced to the tail (was an FK-violation crash risk on forked sessions with constructs)
  • read composition bails to own-tail on a dangling branch point instead of splicing the whole parent
  • scalar tool_input signature alignment; added idx_messages_session_sortkey

Remaining audit findings tracked as #2470–#2483 (read-surface composition, acompact-subagent disambiguation, logical-session cost basis, MCP limit-capping, parser data loss, perf, concurrency) + build-ready designs for #2478–#2483.

github-actions Bot pushed a commit that referenced this pull request Jun 28, 2026
@Sinity
Sinity merged commit 7412b69 into master Jun 28, 2026
15 checks passed
@Sinity
Sinity deleted the feature/operator-dogfood-hardening branch June 28, 2026 10:42
@github-actions github-actions Bot mentioned this pull request Jul 5, 2026
Sinity pushed a commit that referenced this pull request Jul 11, 2026
Automated release PR opened by release-please. See
[docs/release.md](docs/release.md).
---


## [0.2.0](https://github.com/Sinity/polylogue/compare/v0.1.0...v0.2.0)
(2026-07-11)


### Added

* **analytics:** delegation enabling primitive + view (1vpm.1 phases
1-2) ([#2607](https://github.com/Sinity/polylogue/issues/2607))
([09dc46c](https://github.com/Sinity/polylogue/commit/09dc46c26648e7b90de3acf03e3efbf82f10dafc))
* **analyze:** add corpus-wide sanitized portfolio report
([#2437](https://github.com/Sinity/polylogue/issues/2437))
([#2451](https://github.com/Sinity/polylogue/issues/2451))
([d101a37](https://github.com/Sinity/polylogue/commit/d101a37c989177dc9d8a2b49a241a7a4818697ac))
* **archive:** preserve structured session evidence
([#2496](https://github.com/Sinity/polylogue/issues/2496))
([e55c675](https://github.com/Sinity/polylogue/commit/e55c675aaeee8c565c7cd1bb7276af7fccc2866d))
* **browser-capture:** add gated post commands
([#2494](https://github.com/Sinity/polylogue/issues/2494))
([79a8ac0](https://github.com/Sinity/polylogue/commit/79a8ac097aa68304bdb5b3e53ef1c1a7d6556afd))
* **browser-extension:** capture retry queue, receiver health probe,
popup outcomes
([#2671](https://github.com/Sinity/polylogue/issues/2671))
([67f522b](https://github.com/Sinity/polylogue/commit/67f522bd54762ad9a387ab4eadde1850806b4059))
* **capture:** acquire assistant-produced file bytes at capture time
([#2669](https://github.com/Sinity/polylogue/issues/2669))
([8db8d60](https://github.com/Sinity/polylogue/commit/8db8d60b34565f23ced411b786b252b6a4473b00))
* **cli:** add full message read export
([0d63cd6](https://github.com/Sinity/polylogue/commit/0d63cd6cc2c3aac5055535c7f9e30fe8a273a356))
* converge dogfood branch state
([#2504](https://github.com/Sinity/polylogue/issues/2504))
([d40d00a](https://github.com/Sinity/polylogue/commit/d40d00a312e5530a76e3e1ba29f3ddc37ce89d82))
* **coordination:** render subagent exchanges
([#2545](https://github.com/Sinity/polylogue/issues/2545))
([a35bd6d](https://github.com/Sinity/polylogue/commit/a35bd6d97eafef647cf016998437c49d5aca98bc))
* **cost:** price current Opus 4.7/4.8 flagships
([#2445](https://github.com/Sinity/polylogue/issues/2445))
([fbb8f09](https://github.com/Sinity/polylogue/commit/fbb8f09187ae013b6a27db01e2961440f507cacb))
* **demo:** enrich demo cost and fix profile token-lane round-trip
([#2446](https://github.com/Sinity/polylogue/issues/2446))
([05f8c98](https://github.com/Sinity/polylogue/commit/05f8c980c5c516bec358abcdd841edbf742c1e07))
* **demo:** give demo session a canonical repo for repos_touched
([#2447](https://github.com/Sinity/polylogue/issues/2447))
([b73f01d](https://github.com/Sinity/polylogue/commit/b73f01db8e2f008bee5801f17a297d80867a105d))
* **demo:** Incident 14:32 constructs — source outage, cross-material
duplicate, compaction omission
([#2674](https://github.com/Sinity/polylogue/issues/2674))
([8c15e86](https://github.com/Sinity/polylogue/commit/8c15e86127ba15454c667ccae0c7c1318d0050cc))
* **demo:** materialize session insights in no-daemon seed
([#2439](https://github.com/Sinity/polylogue/issues/2439))
([21951de](https://github.com/Sinity/polylogue/commit/21951de986200babb056d1f9c77ad17758ec4fad))
* **demo:** one-command receipts proof, enforced public-claims gate,
corpus v2 ([#2662](https://github.com/Sinity/polylogue/issues/2662))
([529fc43](https://github.com/Sinity/polylogue/commit/529fc43979d7e3292252529925ba2009a4ddfa23))
* **demo:** package claim evidence reproduction
([678f3d6](https://github.com/Sinity/polylogue/commit/678f3d6805b664ef47b1d8350ed81549a01bb9e0))
* **devtools:** accept bead: owners in coverage-manifest gap records
([#2611](https://github.com/Sinity/polylogue/issues/2611))
([10a1212](https://github.com/Sinity/polylogue/commit/10a1212f4b17b9359494949dccb032456f26c4ef))
* **devtools:** add bench ingest-throughput wall-clock benchmark
([#2490](https://github.com/Sinity/polylogue/issues/2490))
([d415412](https://github.com/Sinity/polylogue/commit/d415412d7d68008a92296f6f6dd29f53b4cb7a10))
* **devtools:** add claim-vs-evidence demo report
([af4915d](https://github.com/Sinity/polylogue/commit/af4915d11bea6c81eda0da5521932a9c7d150890))
* **devtools:** add cost reconciliation probe
([153dab3](https://github.com/Sinity/polylogue/commit/153dab3eaf721b82ffce37ac14174d12e91abc1d))
* **devtools:** add full-body read package projection
([0e83712](https://github.com/Sinity/polylogue/commit/0e837125aa425a8c6f8015cbeeb1b5231a01ebb6))
* **devtools:** catch subcommand/flag drift in verify doc-commands
([#2442](https://github.com/Sinity/polylogue/issues/2442))
([0d5a3bb](https://github.com/Sinity/polylogue/commit/0d5a3bb6ee3c18e1abc4690a249aa465d0ce5e9d))
* **devtools:** classify affordance surface usage
([fb4eab8](https://github.com/Sinity/polylogue/commit/fb4eab84989d6eee4aaab86f8eb0e05d7dcfba95))
* **devtools:** compare Claude usage grains
([2abe147](https://github.com/Sinity/polylogue/commit/2abe1478401ffe117df71e0c019a62f7a2152945))
* **devtools:** Demo Finding Packet contract + registry lint
([#2589](https://github.com/Sinity/polylogue/issues/2589))
([4e49b6c](https://github.com/Sinity/polylogue/commit/4e49b6ccd03a63ffed2b50a878a882131f79801e))
* **devtools:** enforce production writer ownership
([#2682](https://github.com/Sinity/polylogue/issues/2682))
([f314e81](https://github.com/Sinity/polylogue/commit/f314e812ec64b43bd50be04a8f825fc9402f7c14))
* **devtools:** expose cost probe residual metadata
([a6ecbaf](https://github.com/Sinity/polylogue/commit/a6ecbaf0a6d3aa7eba2da525cad14dca056a6a4c))
* **devtools:** instrument ingest with cpu/memory/io/stage metrics
([#2491](https://github.com/Sinity/polylogue/issues/2491))
([52b5bc0](https://github.com/Sinity/polylogue/commit/52b5bc038a0bd959563cf61db4a1e0fd15001ea3))
* **devtools:** show Claude lineage in cost residuals
([76f56a4](https://github.com/Sinity/polylogue/commit/76f56a46263278ec089d389dae54769e5854c702))
* **devtools:** show logical usage grain in cost probe
([77543d4](https://github.com/Sinity/polylogue/commit/77543d449515b036954216cb6349b5c6ed5eb7ee))
* **devtools:** summarize Codex state outlier flags
([ab72066](https://github.com/Sinity/polylogue/commit/ab72066dc528bedc06b1e1b6da01554ac0dec629))
* **devtools:** timestamp-doctrine lint for durable-tier DDL
([#2601](https://github.com/Sinity/polylogue/issues/2601))
([6c12e92](https://github.com/Sinity/polylogue/commit/6c12e92348d6e67db212462573ff939110996395))
* **export:** add fail-closed sanitized shareable export
([#2381](https://github.com/Sinity/polylogue/issues/2381))
([#2433](https://github.com/Sinity/polylogue/issues/2433))
([f5ab219](https://github.com/Sinity/polylogue/commit/f5ab2195558823fd01d6db432a32e1768d6ba930))
* **export:** add sanitized spans-jsonl bundle leg
([#2434](https://github.com/Sinity/polylogue/issues/2434))
([#2455](https://github.com/Sinity/polylogue/issues/2455))
([c4b6771](https://github.com/Sinity/polylogue/commit/c4b677181847375d9636cb9448e3accbf4688595))
* **export:** redact Windows paths and emails in sanitized export
([#2444](https://github.com/Sinity/polylogue/issues/2444))
([c05e83e](https://github.com/Sinity/polylogue/commit/c05e83ee9d1c2a8605f48f2d640749c0ddae62db))
* **forensics:** price origin-reported usage
([f859356](https://github.com/Sinity/polylogue/commit/f859356a56dde0229e846c6aa838b21e60ecd74c))
* **insights:** add usage timeline read model
([56f38ef](https://github.com/Sinity/polylogue/commit/56f38ef6653f9e2937983d9554270188ef1adae8))
* **insights:** deterministic agent-workflow pathology detectors
([#2448](https://github.com/Sinity/polylogue/issues/2448))
([72d0623](https://github.com/Sinity/polylogue/commit/72d0623ea331f5348ceb7c6fde61e7c6ce41d200))
* **insights:** expose pathology distribution via API + MCP tool
([#2383](https://github.com/Sinity/polylogue/issues/2383))
([#2449](https://github.com/Sinity/polylogue/issues/2449))
([e7a39b3](https://github.com/Sinity/polylogue/commit/e7a39b37fb0de39ba103bb4633bce8d4ba90da23))
* install and monitor harness hooks
([#2644](https://github.com/Sinity/polylogue/issues/2644))
([7e6123c](https://github.com/Sinity/polylogue/commit/7e6123cac3e5ed3c365ff9abb4fafe04deec3b9c))
* integrate archive convergence and capture platform
([#2534](https://github.com/Sinity/polylogue/issues/2534))
([3498981](https://github.com/Sinity/polylogue/commit/349898106783020294e52e30d3a2296021094940))
* **lineage:** surface a completeness signal on composed reads
([#2603](https://github.com/Sinity/polylogue/issues/2603))
([c06ca60](https://github.com/Sinity/polylogue/commit/c06ca601c3e35eae8408425c3c6b27092aab3ea4))
* **maintenance:** bound index replay selections
([d98f126](https://github.com/Sinity/polylogue/commit/d98f1262c6df6b3c274d723a80850fe56594cffa))
* **maintenance:** replay source rows into index tier
([a549285](https://github.com/Sinity/polylogue/commit/a549285140be52fde995ff826cd9d8b1073d9589))
* **mcp:** add filtered message tail paging
([f64920f](https://github.com/Sinity/polylogue/commit/f64920f22bc8234af2bb506130c6bf5c418f0da9))
* **mcp:** expose postmortem bundle and sanitized export as agent tools
([#2443](https://github.com/Sinity/polylogue/issues/2443))
([66fb40a](https://github.com/Sinity/polylogue/commit/66fb40af5c4a7aeb8cde44b6b605414602e0d60c))
* normalize session lineage and correct cross-provider cost accounting
([#2469](https://github.com/Sinity/polylogue/issues/2469))
([7412b69](https://github.com/Sinity/polylogue/commit/7412b69a9b64863a1bf4df11d7feeb99f61262ff))
* **parsers:** capture Claude server_tool_use web request counts
([#2486](https://github.com/Sinity/polylogue/issues/2486))
([badd731](https://github.com/Sinity/polylogue/commit/badd73180f1e33db3bcf26db02800f4648e4a965))
* **query:** add Terminal pipeline stage; route verbs through one
executor ([#2006](https://github.com/Sinity/polylogue/issues/2006))
([#2463](https://github.com/Sinity/polylogue/issues/2463))
([fb9073c](https://github.com/Sinity/polylogue/commit/fb9073cfc801a6b4d8150e6998c96b966e39047c))
* **query:** attach evidence units to session results
([f76e700](https://github.com/Sinity/polylogue/commit/f76e7006f3d6fcda7206ff7bc67b572421f15e59))
* **query:** attach related units to session queries
([#2495](https://github.com/Sinity/polylogue/issues/2495))
([4a9c7a0](https://github.com/Sinity/polylogue/commit/4a9c7a07a12787a2b71a13f588b1b4dc835747a5))
* **query:** expose action followup classification
([c68c278](https://github.com/Sinity/polylogue/commit/c68c278ef9c5f212ca49c4a9d70215910aca1f4c))
* **query:** expose action outcome predicates
([8b0595d](https://github.com/Sinity/polylogue/commit/8b0595dcc29f88c04679f8da307a66d5a43b462c))
* **query:** expose projection unit completions
([03f9ffb](https://github.com/Sinity/polylogue/commit/03f9ffb727072ed87fd6b576dcf41784134f0682))
* **query:** select fields for attached projection units
([867b1d0](https://github.com/Sinity/polylogue/commit/867b1d0482aca870053b188648b2a1d92170efc0))
* **read-package:** expose handoff freshness metadata
([d7aa9e8](https://github.com/Sinity/polylogue/commit/d7aa9e81a5a662236f86d938a06f750f9e9a7b57))
* **read:** add projection render specs
([#2503](https://github.com/Sinity/polylogue/issues/2503))
([ce2f62a](https://github.com/Sinity/polylogue/commit/ce2f62ac65e6e7c29558a74f1dd10ba78d0999e2))
* **storage:** block content-hash citation anchors with typed resolver
([#2588](https://github.com/Sinity/polylogue/issues/2588))
([6974706](https://github.com/Sinity/polylogue/commit/6974706611cb18695a1b85924193724c8b3f93dd))
* **storage:** classify attachment acquisition debt separately from
source blobs ([#2586](https://github.com/Sinity/polylogue/issues/2586))
([b536fc3](https://github.com/Sinity/polylogue/commit/b536fc3aa57ed92b3b6ec2300e97d7bb3b0af247))
* **storage:** persist raw revision authority evidence
([#2681](https://github.com/Sinity/polylogue/issues/2681))
([2032b2c](https://github.com/Sinity/polylogue/commit/2032b2cb26c6000b2f7db7d07efb4a2176546bf1))
* **usage:** expose all-origin logical token rollups
([8ca374e](https://github.com/Sinity/polylogue/commit/8ca374e59b7863e7414b473a85bb73886e98eb92))
* **usage:** label logical model rollup grain
([a336b86](https://github.com/Sinity/polylogue/commit/a336b864c670397b941a757ede80ac1df430692d))
* **usage:** report pricing provenance lanes
([57263f9](https://github.com/Sinity/polylogue/commit/57263f9c8831221ad44842259b68f9a5ab012292))
* **web:** evidence-cockpit IA — four-verb navigation, landing view,
session evidence strip
([#2675](https://github.com/Sinity/polylogue/issues/2675))
([79fb50d](https://github.com/Sinity/polylogue/commit/79fb50d9450f24a52cb84c7d060265c6ca70f2cd))


### Fixed

* **agent:** align quick raw-debt status
([28db963](https://github.com/Sinity/polylogue/commit/28db9636e2843cdd6ebcd43de73259a2c233e096))
* **agent:** allow active devloop backlog
([5816a75](https://github.com/Sinity/polylogue/commit/5816a7599067cb5347cedf16b25a9d801c3cf039))
* **agent:** include raw debt in quick devloop status
([d5589c4](https://github.com/Sinity/polylogue/commit/d5589c418635a8cfcf3525419b54857e0d6ba722))
* **agent:** keep devloop probes on quick status
([7bd0440](https://github.com/Sinity/polylogue/commit/7bd044094b22e6d98eeb4bc0ec4fc1d20383f8ee))
* **agent:** keep quick status off raw debt scans
([2743c46](https://github.com/Sinity/polylogue/commit/2743c46fd680349060154e26b1b008eb51afac4b))
* **agent:** resolve devloop repo roots dynamically
([#2505](https://github.com/Sinity/polylogue/issues/2505))
([79290e6](https://github.com/Sinity/polylogue/commit/79290e6e6ea718aad5de0bb5d015eeb91c42699a))
* **archive:** report evidence and convergence honestly
([#2502](https://github.com/Sinity/polylogue/issues/2502))
([7120bde](https://github.com/Sinity/polylogue/commit/7120bde619a1ffaaef6a82afcba13de904adf80f))
* **attachments:** acquire Claude extracted payloads
([60d93b6](https://github.com/Sinity/polylogue/commit/60d93b618e2d8cbd73dce8176ee2c9267fdfb8af))
* batch deep-read defects — convergence probes, conn leaks, reset gate,
parser ([#2543](https://github.com/Sinity/polylogue/issues/2543))
([9ed21a6](https://github.com/Sinity/polylogue/commit/9ed21a613d3f5c036434bc44a7f953321c240a17))
* **beads:** add timestamp-aware guard against post-checkout/post-merge
revert
([209c9db](https://github.com/Sinity/polylogue/commit/209c9db223286a70667c6a1fc64063d9d704df28))
* bound daemon HTTP archive-query concurrency, add per-request timeout
([#2628](https://github.com/Sinity/polylogue/issues/2628))
([f6c1da9](https://github.com/Sinity/polylogue/commit/f6c1da997bea64bc6cd9670d9cbb8f7e7439ec51))
* **browser-capture:** bound the outbound post-command queue (gnie
[#4](https://github.com/Sinity/polylogue/issues/4))
([#2568](https://github.com/Sinity/polylogue/issues/2568))
([28a263f](https://github.com/Sinity/polylogue/commit/28a263fcd217a4b611824edab6649d6705e4be56))
* **browser-capture:** report stale archived captures
([c972c84](https://github.com/Sinity/polylogue/commit/c972c843400b3fde9504f409fbebe9295bd64123))
* **browser-capture:** require an auto-minted bearer token by default
([#2571](https://github.com/Sinity/polylogue/issues/2571))
([f39a7fb](https://github.com/Sinity/polylogue/commit/f39a7fb6c19899a8a134c8db846723fc276c0861))
* **browser-extension:** bound asset acquisition by wall-clock and
failure streaks
([#2672](https://github.com/Sinity/polylogue/issues/2672))
([73a0654](https://github.com/Sinity/polylogue/commit/73a0654aa115ae6e6af597f122dfbaa35c950507))
* **chatgpt:** strip inline citation markers; keep injected context
messages ([#2668](https://github.com/Sinity/polylogue/issues/2668))
([9f54f7f](https://github.com/Sinity/polylogue/commit/9f54f7faf6e06d4da95e387f69588629fbb90056))
* classify blockless thinking messages as reasoning
([#2634](https://github.com/Sinity/polylogue/issues/2634))
([bdc7b73](https://github.com/Sinity/polylogue/commit/bdc7b73ad8500319cf2c8c9084856be9a3beb840))
* **cli:** bound daemon fast-path probes
([f458002](https://github.com/Sinity/polylogue/commit/f458002985838c379074cd6f1e321395f581eddb))
* **cli:** bound root find row output
([54dd217](https://github.com/Sinity/polylogue/commit/54dd217a0b9733d8c050a5b306c578eae09143c4))
* **cli:** compact ops status JSON by default
([62862df](https://github.com/Sinity/polylogue/commit/62862dfaabbd4b3ef1c425a6a963332932b9a8cd))
* **cli:** count queried analyze results from search scope
([2726f5a](https://github.com/Sinity/polylogue/commit/2726f5a5a186299b336d3bb49cbc5c6fbcc6ae47))
* **cli:** honor JSON format for select
([#2517](https://github.com/Sinity/polylogue/issues/2517))
([3baa238](https://github.com/Sinity/polylogue/commit/3baa238f87b2e2f12be1f5aaa24093dcd208470a))
* **cli:** mark analyze totals as partial during convergence
([37e192b](https://github.com/Sinity/polylogue/commit/37e192b346e5ce45f1d2e00f73a4580b5ffabf54))
* **cli:** resolve exact refs before root search
([08d3a5b](https://github.com/Sinity/polylogue/commit/08d3a5b8867f70f7e4acd16a9ece60fc69eb122e))
* **cli:** route structured queries without FTS
([c58f93e](https://github.com/Sinity/polylogue/commit/c58f93e2b7b63612d0766585277ae933ae32436e))
* **cli:** warn when empty results may be partial
([41b7e74](https://github.com/Sinity/polylogue/commit/41b7e7409573cdb5fbe11b303e082a6b1aff856a))
* **codex:** omit inline image data from tool text
([6d3871f](https://github.com/Sinity/polylogue/commit/6d3871f871d9b592981ad758bbaec57cb7c675c3))
* **context:** coerce non-user assertion authors to candidate at one
chokepoint ([#2572](https://github.com/Sinity/polylogue/issues/2572))
([39f0765](https://github.com/Sinity/polylogue/commit/39f0765a536a1268f64890aae49d5c5576641423))
* **context:** enforce assertion guidance trust boundary
([#2677](https://github.com/Sinity/polylogue/issues/2677))
([ce65396](https://github.com/Sinity/polylogue/commit/ce65396c2c80da8a652feaf71748cec6f5a15549))
* **convergence:** classify stale raw parse failures
([884efb5](https://github.com/Sinity/polylogue/commit/884efb5f92d76b065bedc1d22cf8dc836fe31201))
* **convergence:** restore append-only raw blob spans
([cbb27fb](https://github.com/Sinity/polylogue/commit/cbb27fbd030ca78ff03b7947860ed106243ac081))
* **coordination:** compact agent status projections
([#2656](https://github.com/Sinity/polylogue/issues/2656))
([#2656](https://github.com/Sinity/polylogue/issues/2656))
([de7f2b9](https://github.com/Sinity/polylogue/commit/de7f2b90960f6fc9af2733c2625ed6af81280aa8))
* **coordination:** resolve logical caller identity
([#2665](https://github.com/Sinity/polylogue/issues/2665))
([#2665](https://github.com/Sinity/polylogue/issues/2665))
([cfa0839](https://github.com/Sinity/polylogue/commit/cfa0839d2b7d34dc7673f7d0cd777b1f2523d37e))
* **core:** consolidate 6 divergent _parse_archive_datetime copies
([#2567](https://github.com/Sinity/polylogue/issues/2567))
([f54e87e](https://github.com/Sinity/polylogue/commit/f54e87ea123bf89ae7a9c52be0fefc04d338ee7e))
* **cost:** bill subscription output credits at 5x input rate
([#2484](https://github.com/Sinity/polylogue/issues/2484))
([3c1bbb3](https://github.com/Sinity/polylogue/commit/3c1bbb3f3248a2013edb3d8933539add2587723c))
* **cost:** count Codex cumulative tokens per session, not per model
([#2489](https://github.com/Sinity/polylogue/issues/2489))
([22d8bb5](https://github.com/Sinity/polylogue/commit/22d8bb50789d6ebec0fe59ae26eec16920c506d0))
* **cost:** flag paid models missing a catalog cache rate instead of $0
([#2487](https://github.com/Sinity/polylogue/issues/2487))
([e851b33](https://github.com/Sinity/polylogue/commit/e851b33deed3a79f560704c00104349098fcd6e1))
* **cost:** keep Codex message token lanes disjoint
([#2647](https://github.com/Sinity/polylogue/issues/2647))
([8c9dfbb](https://github.com/Sinity/polylogue/commit/8c9dfbb0044ea73a1629731b14347d2ac56d3388))
* **daemon:** align browser capture spool watching
([3b90e9e](https://github.com/Sinity/polylogue/commit/3b90e9e33eb1e66f50e019a822a18622bc4f57ca))
* **daemon:** back off filtered retry paths
([c92ecd5](https://github.com/Sinity/polylogue/commit/c92ecd5f99588d3d4ac0ddf780d71343dbde759c))
* **daemon:** back off no-op catch-up chunks
([95fe147](https://github.com/Sinity/polylogue/commit/95fe1475b1012ac5b301e7a728b2cd2cb081a94e))
* **daemon:** back off no-op retry batches
([c982135](https://github.com/Sinity/polylogue/commit/c982135f96f41169651aac7f29fa8a5c9cf673fa))
* **daemon:** bound ordinary revision replay
([#2689](https://github.com/Sinity/polylogue/issues/2689))
([8030555](https://github.com/Sinity/polylogue/commit/803055541011a3057477d9a4ac9c6396b06890c8))
* **daemon:** close two stored-XSS bug classes in the web shell (2n39)
([#2569](https://github.com/Sinity/polylogue/issues/2569))
([7002c9f](https://github.com/Sinity/polylogue/commit/7002c9f2e818a96b82b5681bcf90bc23c8b84b41))
* **daemon:** decode session route ids
([42c3ed6](https://github.com/Sinity/polylogue/commit/42c3ed6fd4f01cfa1c8962d310a19ba2131647e2))
* **daemon:** default /api/provider-usage to headline detail, not full
([#2560](https://github.com/Sinity/polylogue/issues/2560))
([3306866](https://github.com/Sinity/polylogue/commit/33068663ab6c4e6ce10ada7f94881bb017e989e6))
* **daemon:** enable authority-safe raw convergence
([#2688](https://github.com/Sinity/polylogue/issues/2688))
([df559d8](https://github.com/Sinity/polylogue/commit/df559d8b3047f3db096a01e5c6b0ee6d7a2937ba))
* **daemon:** Host-admission gate, receiver hardening, spool governor
([#2559](https://github.com/Sinity/polylogue/issues/2559))
([bfd247d](https://github.com/Sinity/polylogue/commit/bfd247d5646c66786eacb8351874625eb2ba9b3a))
* **daemon:** mark active index rebuilds not ready
([cc4698a](https://github.com/Sinity/polylogue/commit/cc4698a885c84be2956e2ede650c0dd4870232e3))
* **daemon:** route web facets through facade
([2e02aa8](https://github.com/Sinity/polylogue/commit/2e02aa8e1fe794219b72b3257989e3fc9cab9138))
* **daemon:** serialize archive writers across runtime loops
([#2676](https://github.com/Sinity/polylogue/issues/2676))
([29e5b45](https://github.com/Sinity/polylogue/commit/29e5b45524b850d4bbdb28e1ba9731ab82377317))
* **daemon:** share bounded embedding readiness
([19e493b](https://github.com/Sinity/polylogue/commit/19e493b5785f62b570d71c8c3f8ae456abd6eadc))
* **debt:** classify empty Claude raw artifacts
([16c42ef](https://github.com/Sinity/polylogue/commit/16c42efb0d5ec2062749feabd0f1dd5c665cbf9c))
* **debt:** mark parsed raw materialization repairable
([3afc6e1](https://github.com/Sinity/polylogue/commit/3afc6e15ffe10c62ce65f30ff34637e5a8bd6f3b))
* **demo:** add acknowledgment-window sensitivity
([8a12256](https://github.com/Sinity/polylogue/commit/8a12256ad9f22939e6d86740a8a2b927f8f9bc98))
* **demo:** calibrate failure acknowledgment markers
([ca76f2d](https://github.com/Sinity/polylogue/commit/ca76f2df1071c71d93cce0a63e35195f35cc9695))
* **demo:** explain claim classifier decisions
([b4bb351](https://github.com/Sinity/polylogue/commit/b4bb351147880f7a650b1e8a168e6e05b6f3183b))
* **demo:** expose claim evidence samples by origin
([c75dc47](https://github.com/Sinity/polylogue/commit/c75dc4737e8dddcf863f81701ccba08c9ef2e62b))
* **demos:** close generated shelf over repository inputs
([#2651](https://github.com/Sinity/polylogue/issues/2651))
([#2651](https://github.com/Sinity/polylogue/issues/2651))
([c6aa6a0](https://github.com/Sinity/polylogue/commit/c6aa6a05d2a64309a2dbed52bbdda75d495e1441))
* **demo:** show claim evidence follow-up previews
([aef35bf](https://github.com/Sinity/polylogue/commit/aef35bfbb5340d015c9eae555f2adcf306d2978d))
* **demo:** split ambiguous failure follow-ups
([1d9187d](https://github.com/Sinity/polylogue/commit/1d9187d532b6fcafdfe33bfe41113e20f4eb24b8))
* **demo:** split failure outcomes by handler class
([6e35892](https://github.com/Sinity/polylogue/commit/6e35892a1d5b32f50b00cfdc0ad0d1cf73b5e042))
* **demo:** state claim sample frames explicitly
([4640501](https://github.com/Sinity/polylogue/commit/46405011f667290b3b2a5cdcb719805453f457d8))
* **demo:** stratify claim evidence samples by origin
([2ce5e2f](https://github.com/Sinity/polylogue/commit/2ce5e2f433bcfc677eb64053cfb5b9b0e0ffb6dd))
* **devloop:** enforce demo shelf currentness
([943aebd](https://github.com/Sinity/polylogue/commit/943aebd8945d6d5928c45c9397f4e0687173d618))
* **devtools:** align Claude cost probe to cache horizon
([e5d39c0](https://github.com/Sinity/polylogue/commit/e5d39c08f6b38e4edcda0ad4d82de1e85cd52e14))
* **devtools:** detect squash-equivalent worktrees
([#2501](https://github.com/Sinity/polylogue/issues/2501))
([f41e078](https://github.com/Sinity/polylogue/commit/f41e078903edd6327459a609364aeb9755f6a6ac))
* **devtools:** generate demo shelf navigation
([7aba1c8](https://github.com/Sinity/polylogue/commit/7aba1c8bf9d8765b948d198d20b30624e6ae93de))
* **devtools:** keep dev-loop daemon source-only
([c37cb0d](https://github.com/Sinity/polylogue/commit/c37cb0dc390c539e0a121993d1e970d7977c9587))
* **devtools:** key verify's stall detector off test-event progress
([#2581](https://github.com/Sinity/polylogue/issues/2581))
([85fa450](https://github.com/Sinity/polylogue/commit/85fa4505585b46c37b6c03c10121babf201e0e77))
* **docs:** repair generated pages links
([#2500](https://github.com/Sinity/polylogue/issues/2500))
([a9985f4](https://github.com/Sinity/polylogue/commit/a9985f4115d057c7de0842c1a23414492b3c1efe))
* **embed:** account for skipped catchup sessions
([f316d4b](https://github.com/Sinity/polylogue/commit/f316d4b10f9cd2ecd08b37a0128587dd61fea13f))
* **embed:** align status text fields
([6a4b4ca](https://github.com/Sinity/polylogue/commit/6a4b4ca4bba681f9177e72bc580e0f4eddb4e9e3))
* **embed:** avoid false zero cost in status detail
([510fe18](https://github.com/Sinity/polylogue/commit/510fe188f8ecf90cb77c1b1084c4a8303a692f68))
* **embed:** bound archive backfill windows
([1963a01](https://github.com/Sinity/polylogue/commit/1963a0129022162b1ea519fcb4e48e52483f2017))
* **embed:** bound archive pending windows after eligibility
([47cb6f9](https://github.com/Sinity/polylogue/commit/47cb6f9fcd1e509b03ab16d77104596ded6d49e8))
* **embed:** bound default archive status counts
([2562cd4](https://github.com/Sinity/polylogue/commit/2562cd4dc343bbe9091ac6811ea4d8ceffa080d2))
* **embed:** bound exact archive detail status
([d7403e2](https://github.com/Sinity/polylogue/commit/d7403e2ad6e1735a193035337be872dc90437e0d))
* **embed:** count only prose in embedding stats
([#2519](https://github.com/Sinity/polylogue/issues/2519))
([4601922](https://github.com/Sinity/polylogue/commit/46019227d125ae113d5bdad8fc7496d28ace082d))
* **embeddings:** count exact prose in pending windows
([6ae15a9](https://github.com/Sinity/polylogue/commit/6ae15a909ed107bb1d75f251f05d0c6a27f335b9))
* **embeddings:** detect same-count message edits
([d07627e](https://github.com/Sinity/polylogue/commit/d07627ebeffb41100d4da82a1390dd8645d4dcae))
* **embeddings:** preserve unknown status counts
([#2661](https://github.com/Sinity/polylogue/issues/2661))
([69990dc](https://github.com/Sinity/polylogue/commit/69990dcc873c2fc0a9c900861bb10db94b75f434))
* **embeddings:** report manual backfill progress
([3eb5efa](https://github.com/Sinity/polylogue/commit/3eb5efaa4fa7f53960a1fd50386c505f6bde1275))
* **embeddings:** reselect stale clean archive sessions
([b998ec4](https://github.com/Sinity/polylogue/commit/b998ec4cfc28cde2606c89631a451b3b0133fd47))
* **embeddings:** stop retrying terminal provider errors
([108d71f](https://github.com/Sinity/polylogue/commit/108d71f3e5abe826fd2f937b3010a3679ff7b002))
* **embed:** distinguish session and prose coverage
([c1c1b1a](https://github.com/Sinity/polylogue/commit/c1c1b1a4144cc6c27164e8ef56884fe0cec4897c))
* **embed:** emit structured backfill results
([#2518](https://github.com/Sinity/polylogue/issues/2518))
([2993141](https://github.com/Sinity/polylogue/commit/299314105b0747a3d16a9d1b187ab3b6cc4b3df4))
* **embed:** expose preflight min-message floor
([#2506](https://github.com/Sinity/polylogue/issues/2506))
([12e7cdf](https://github.com/Sinity/polylogue/commit/12e7cdfd2fa877b8c094d5a4560c68e3ceb7dc94))
* **embed:** keep backfill windows under message cap
([#2516](https://github.com/Sinity/polylogue/issues/2516))
([18df4c4](https://github.com/Sinity/polylogue/commit/18df4c457445c016d29c7a1ceecbcfcfa1c4624c))
* **embed:** keep bounded backfill windows cheap
([3441570](https://github.com/Sinity/polylogue/commit/344157058cab0eb23a64b1a74324d2b9e9cfee6b))
* **embed:** keep partial vectors retrieval-ready
([#2515](https://github.com/Sinity/polylogue/issues/2515))
([aa13e1f](https://github.com/Sinity/polylogue/commit/aa13e1f73f85eefe347d9f8869d0a2e98825c25b))
* **embed:** keep status responsive during backfill
([33dae38](https://github.com/Sinity/polylogue/commit/33dae38e0e39a86a4b7ab01f0c097a8f3fe940f3))
* **embed:** make status backfill actions executable
([9ec46c8](https://github.com/Sinity/polylogue/commit/9ec46c89dcaccecff10892961472e3ab77d23891))
* **embed:** persist archive backfill runs in ops
([093fd81](https://github.com/Sinity/polylogue/commit/093fd814455174299f0a7718b7485b30bcf3bf68))
* **embed:** report archive catchup session counts
([7eb514e](https://github.com/Sinity/polylogue/commit/7eb514e955006da5f9ead6db307f20338542dec4))
* **embed:** report archive embedding metadata fast
([b187f5d](https://github.com/Sinity/polylogue/commit/b187f5d1f65c14d969506853cc7ee501909416ba))
* **embed:** report archive embedding timestamp bounds
([1f0d6b8](https://github.com/Sinity/polylogue/commit/1f0d6b80f75f882da6ce56378770af4b0c69ad7c))
* **embed:** summarize uniform archive metadata fast
([6d3a84d](https://github.com/Sinity/polylogue/commit/6d3a84d3069247e6ca9bc79023ea98be73a4284c))
* **embed:** surface material catchup progress
([fc24f58](https://github.com/Sinity/polylogue/commit/fc24f58b53560c21074d6b40dc766244ea6a7c27))
* **embed:** treat completed sessions as embedded
([#2514](https://github.com/Sinity/polylogue/issues/2514))
([6cd054d](https://github.com/Sinity/polylogue/commit/6cd054d652cffcdf27860e769e9a15451cddd08b))
* **extension:** make capture popup readable
([1bfb0a3](https://github.com/Sinity/polylogue/commit/1bfb0a3138da769fc62a7c274321c29331afa62e))
* **extension:** stop automatic page capture
([a35d521](https://github.com/Sinity/polylogue/commit/a35d5210110b6df6a5adfdbee93ce35c4f79387f))
* **fts:** chunk missing-row repair
([6406558](https://github.com/Sinity/polylogue/commit/6406558618b2a0e216b5e131bfbc5f83a1b8f3d1))
* harden cloud bootstrap for sandbox lanes
([#2631](https://github.com/Sinity/polylogue/issues/2631))
([c68585b](https://github.com/Sinity/polylogue/commit/c68585b8bf3a8e83f57faa364fff108a23ed504a))
* **hermes:** make state database imports reproducible
([#2639](https://github.com/Sinity/polylogue/issues/2639))
([#2639](https://github.com/Sinity/polylogue/issues/2639))
([9e92b6b](https://github.com/Sinity/polylogue/commit/9e92b6b6d7656f315dd491b8f5f59049d104e868))
* **import:** keep newer session body on stale reimport
([9beac9a](https://github.com/Sinity/polylogue/commit/9beac9a5300125eb0f4362d8c8ce41ab033db6ac))
* **ingest:** finalize live raw parse state
([#2663](https://github.com/Sinity/polylogue/issues/2663))
([938c671](https://github.com/Sinity/polylogue/commit/938c671e5c5c68454b77592d84c0c726f53819e7))
* **ingest:** preserve richer browser captures
([c907759](https://github.com/Sinity/polylogue/commit/c9077590a279037c530dd309f37b886f9052c594))
* **ingest:** publish full results after raw completion
([#2664](https://github.com/Sinity/polylogue/issues/2664))
([0cccef1](https://github.com/Sinity/polylogue/commit/0cccef1df3b8618c6e6dbe3e3a4b6860ab8cebc3))
* **insights:** add text_derived provenance markers to forensic payloads
([#2579](https://github.com/Sinity/polylogue/issues/2579))
([90d3e31](https://github.com/Sinity/polylogue/commit/90d3e31747de58f3a7cd354866504ca4ec49ea2c))
* **insights:** audit every registered product, not just contracted ones
([#2573](https://github.com/Sinity/polylogue/issues/2573))
([7b5f846](https://github.com/Sinity/polylogue/commit/7b5f846f57073d931737962dcabc17d5ef962dc0))
* **insights:** render None, not 0.0, for averages over empty backing
rows ([#2585](https://github.com/Sinity/polylogue/issues/2585))
([f8f3e40](https://github.com/Sinity/polylogue/commit/f8f3e40a5b7f548e6a9530d3e9f48c9964345e79))
* **insights:** scope run-projection row refs
([#2539](https://github.com/Sinity/polylogue/issues/2539))
([b9d01d7](https://github.com/Sinity/polylogue/commit/b9d01d7aa34a9ee106c5122dbb8f4d2f1a8bd457))
* **insights:** stop laundering weak temporal provenance into
provider_ts ([#2558](https://github.com/Sinity/polylogue/issues/2558))
([89b14e5](https://github.com/Sinity/polylogue/commit/89b14e5876749fdc66f26745ce507ba76ebc788a))
* **insights:** treat run projections as optional cache
([40f22dd](https://github.com/Sinity/polylogue/commit/40f22dd804ab9dbfa610a8111ce0c5cd981b3dd0))
* **insights:** upsert run-projection rows on cross-session ref
collisions ([#2464](https://github.com/Sinity/polylogue/issues/2464))
([15f4f21](https://github.com/Sinity/polylogue/commit/15f4f21b63f662f13fb4f16b5379d7dfaad17627))
* **lineage:** hold one read transaction across composition
([#2594](https://github.com/Sinity/polylogue/issues/2594))
([0861717](https://github.com/Sinity/polylogue/commit/0861717015066fe602d363df2440afadec7deea3))
* **lineage:** iterative transcript composition, remove effective depth
cap ([#2542](https://github.com/Sinity/polylogue/issues/2542))
([1e4a694](https://github.com/Sinity/polylogue/commit/1e4a694382a7a76ec7b2391f9309d02ab1a595cf))
* **logging:** forward exc_info/extra in stdlib logger shim
([#2548](https://github.com/Sinity/polylogue/issues/2548))
([ee1a51c](https://github.com/Sinity/polylogue/commit/ee1a51cb69bb9bfcba7fd577a843c655a42e1e7a))
* **maintenance:** clear session insight debt
([5ab2352](https://github.com/Sinity/polylogue/commit/5ab23525d17df4ef5f5e295b90aeae3fcfa1f982))
* **maintenance:** ignore parsed raw sidecars
([#2511](https://github.com/Sinity/polylogue/issues/2511))
([1d5d112](https://github.com/Sinity/polylogue/commit/1d5d1126943648d18bfcb2c55520942e0f807347))
* **maintenance:** make index rebuilds plannable and FK-clean
([#2522](https://github.com/Sinity/polylogue/issues/2522))
([41d4bb4](https://github.com/Sinity/polylogue/commit/41d4bb4a7be28376c1ace1e46e3ca31f0962c879))
* **maintenance:** replay parsed raw rows after index reset
([#2508](https://github.com/Sinity/polylogue/issues/2508))
([d1bbb3e](https://github.com/Sinity/polylogue/commit/d1bbb3e02bfb09d55ba0e2ef6a1f69be5db37408))
* **maintenance:** resume interrupted raw materialization
([#2510](https://github.com/Sinity/polylogue/issues/2510))
([b55ea52](https://github.com/Sinity/polylogue/commit/b55ea528e9c3d856c9ef2bf144b8ccba5a1e01b3))
* make partial resume profiles explicit
([#2635](https://github.com/Sinity/polylogue/issues/2635))
([186daf2](https://github.com/Sinity/polylogue/commit/186daf287ae2b04994f7f6afe5b0564b6f947584))
* **mcp:** report split-tier embedding stats
([c70081b](https://github.com/Sinity/polylogue/commit/c70081b69728b678a66371bf43e24d00eb6c267b))
* **mcp:** stop silently capping aggregate totals
([29c020d](https://github.com/Sinity/polylogue/commit/29c020d4b2f3dd58f3135c8ce5ff810a45d3a020))
* **ops:** point index resets at source replay
([e84c2ae](https://github.com/Sinity/polylogue/commit/e84c2aef8a75f8ae196643b2364e869f234350f6))
* parse ChatGPT recipient-addressed tool calls as TOOL_USE, not raw text
([#2629](https://github.com/Sinity/polylogue/issues/2629))
([7688d10](https://github.com/Sinity/polylogue/commit/7688d103d5393e9bc3d6b249bcd6daa656eee58a))
* **parsers:** keep asset-only chat turns
([607d79b](https://github.com/Sinity/polylogue/commit/607d79bddcff4f95eb046f0f80857d2ca656a515))
* **read:** degrade bounded reads to content
([4eb337b](https://github.com/Sinity/polylogue/commit/4eb337b36d139e806ccd1feacba904b6eb60141f))
* **readiness:** classify explained raw join gaps
([d9bc786](https://github.com/Sinity/polylogue/commit/d9bc786b8619e2d7a0ea3c80fdecbbb4a838cda3))
* **readiness:** close verifier failures
([#2547](https://github.com/Sinity/polylogue/issues/2547))
([4b9389d](https://github.com/Sinity/polylogue/commit/4b9389d752b53742fc70df5364d221b16a292f9d))
* **readiness:** expose fast archive convergence state
([c9ded08](https://github.com/Sinity/polylogue/commit/c9ded089ca53d61baa883e5915a3b2248c621250))
* **readiness:** report materialization progress counts
([f5d848e](https://github.com/Sinity/polylogue/commit/f5d848e87cf8946e3d981cede9ff58401cdf7cb8))
* **read:** use session links for streaming lineage checks
([29ed6ea](https://github.com/Sinity/polylogue/commit/29ed6ea87a9f3df390b5f9987c0dbfcd43f0c4e9))
* repair 3 flagship CLI query bugs found in prod smoke test
([#2626](https://github.com/Sinity/polylogue/issues/2626))
([5d5edaf](https://github.com/Sinity/polylogue/commit/5d5edaf496d70b9372c7c2123c2e70a6ed4d34e6))
* restore deterministic archive contracts
([#2641](https://github.com/Sinity/polylogue/issues/2641))
([f6b396b](https://github.com/Sinity/polylogue/commit/f6b396bf63cbe43b6e7645e94b8aafa88a2fd0b0))
* route ops reset --session/--source through the mutation contract
([#2627](https://github.com/Sinity/polylogue/issues/2627))
([a075ce2](https://github.com/Sinity/polylogue/commit/a075ce290837f68af678f093b02f39fe42286d11))
* **search:** keep default find lexical
([faba5f3](https://github.com/Sinity/polylogue/commit/faba5f3950b308658dbbbfe9067488f65b606fcc))
* **search:** make FTS readiness cheap in fresh indexes
([a46be16](https://github.com/Sinity/polylogue/commit/a46be16d2b3a74241fe9f063f1052f4743493198))
* **security:** harden blob hash validation, drop misleading symlink
check ([#2599](https://github.com/Sinity/polylogue/issues/2599))
([b6b9fef](https://github.com/Sinity/polylogue/commit/b6b9fef2a05ed7d5a1272188ce852f74a133b637))
* **sources:** close CursorStore get-&gt;modify-&gt;put lost-update race
([#2615](https://github.com/Sinity/polylogue/issues/2615))
([fac493c](https://github.com/Sinity/polylogue/commit/fac493cb3cc37edfa58e939b367c78e069730304))
* **sources:** merge Claude Code stream sessions
([#2520](https://github.com/Sinity/polylogue/issues/2520))
([a651bb9](https://github.com/Sinity/polylogue/commit/a651bb95f1fc3595cff8f545ec3768831b858daf))
* **sources:** restrict append planning to JSONL streams
([#2691](https://github.com/Sinity/polylogue/issues/2691))
([fae9e0b](https://github.com/Sinity/polylogue/commit/fae9e0bb580caaac18f94b28674f104c5b9ca6b8))
* stamp focused test runs with git head
([#2632](https://github.com/Sinity/polylogue/issues/2632))
([4dabc85](https://github.com/Sinity/polylogue/commit/4dabc85dd05f6c0d710e6755853a2bf70b4b0a2f))
* **status:** gate readiness on raw materialization
([91bf2d7](https://github.com/Sinity/polylogue/commit/91bf2d7fb8a43601f5b046ccddb974f29c6b2beb))
* **status:** ignore stale rebuild attempts for readiness
([f2f1a21](https://github.com/Sinity/polylogue/commit/f2f1a2156dbcfc1bc6e4f23ed449dfb16d37cac5))
* **status:** preserve unknown embedding pending messages
([36446ec](https://github.com/Sinity/polylogue/commit/36446ecbf0c79497712f3149509d1e8ae1e65b03))
* **status:** project durable raw authority into readiness
([#2695](https://github.com/Sinity/polylogue/issues/2695))
([93af1a5](https://github.com/Sinity/polylogue/commit/93af1a53a8b68d6500c69ddfc6060d542c6d0d8d))
* **status:** show SQLite maintenance state
([f7d2539](https://github.com/Sinity/polylogue/commit/f7d2539a4380c8e7b3d86499f6eb9d248af70726))
* **status:** use fast materialization readiness
([80dd748](https://github.com/Sinity/polylogue/commit/80dd748cce2c4b0e86927605f1cf605fc57ad490))
* **status:** validate actions view readiness
([#2687](https://github.com/Sinity/polylogue/issues/2687))
([9018d58](https://github.com/Sinity/polylogue/commit/9018d5861a699d595da42a56d9df95ad5d4fdd24))
* **storage:** add offline index generation promotion
([#2685](https://github.com/Sinity/polylogue/issues/2685))
([a2bbd25](https://github.com/Sinity/polylogue/commit/a2bbd25d6a315791430e11191c3b2070cdfdbe2f))
* **storage:** compose forks on paginated, batch, and streaming reads
([#2485](https://github.com/Sinity/polylogue/issues/2485))
([8664ee8](https://github.com/Sinity/polylogue/commit/8664ee872286811f5094e125cbcf78559c6b7499)),
closes [#2470](https://github.com/Sinity/polylogue/issues/2470)
* **storage:** contain authority-ambiguous raw replay
([#2670](https://github.com/Sinity/polylogue/issues/2670))
([#2670](https://github.com/Sinity/polylogue/issues/2670))
([202a09c](https://github.com/Sinity/polylogue/commit/202a09c240bc56a74c7d078663aafc7c7f97e59c))
* **storage:** contain conflicting archive index identities
([#2680](https://github.com/Sinity/polylogue/issues/2680))
([36147f2](https://github.com/Sinity/polylogue/commit/36147f29c7255474071bce869e6942c02ce3e348))
* **storage:** enforce monotonic raw revision replay
([#2684](https://github.com/Sinity/polylogue/issues/2684))
([6a579d0](https://github.com/Sinity/polylogue/commit/6a579d09021c9b0ed128287ace51cdff077cd5b7))
* **storage:** gate embedding success write against config-change race
([#2616](https://github.com/Sinity/polylogue/issues/2616))
([16fdb0f](https://github.com/Sinity/polylogue/commit/16fdb0fcacba55f9640222a3e0e52984f6c414aa))
* **storage:** include timeless sessions in search --since filters
([#2578](https://github.com/Sinity/polylogue/issues/2578))
([97459e6](https://github.com/Sinity/polylogue/commit/97459e61d4fae716594eb871381f865a4f79593e))
* **storage:** include timeless work-events/phases in since/until
windows ([#2577](https://github.com/Sinity/polylogue/issues/2577))
([1b29fa5](https://github.com/Sinity/polylogue/commit/1b29fa52460cbeca78656be4536531cf66cb6d1f))
* **storage:** pair actions view by transcript rank, not tool_id
equality ([#2597](https://github.com/Sinity/polylogue/issues/2597))
([7b5a5aa](https://github.com/Sinity/polylogue/commit/7b5a5aa0589772ed9d7eb9632af1591cf22cdd33))
* **storage:** preserve semantic replay frontiers
([#2692](https://github.com/Sinity/polylogue/issues/2692))
([7d300a5](https://github.com/Sinity/polylogue/commit/7d300a59628742cf739706bd5ebe225daf9b4825))
* **storage:** preserve source evidence during reset
([#2537](https://github.com/Sinity/polylogue/issues/2537))
([1f629c9](https://github.com/Sinity/polylogue/commit/1f629c9d2d923789f0dbf7167ffb021b13b3707d))
* **storage:** remove unreachable blob-GC lease mechanism
([#2617](https://github.com/Sinity/polylogue/issues/2617))
([a263612](https://github.com/Sinity/polylogue/commit/a2636120495d1b87a8e5170c7d108144c3bc7f4b))
* **storage:** reserve blobs until durable references commit
([#2660](https://github.com/Sinity/polylogue/issues/2660))
([a0ef2fa](https://github.com/Sinity/polylogue/commit/a0ef2fa8d479a0168db36fe09f3752de6311b26e))
* **storage:** retire governed bundle raws
([#2693](https://github.com/Sinity/polylogue/issues/2693))
([304b840](https://github.com/Sinity/polylogue/commit/304b84019d7dfa0474a8db4685166849af16d297))
* **storage:** route ops-doctor orphan-blob repair through the safe GC
planner ([#2564](https://github.com/Sinity/polylogue/issues/2564))
([8e4efb7](https://github.com/Sinity/polylogue/commit/8e4efb72379f458d23524c00fb2de29346ce0e0b))
* **storage:** single-source FTS freshness DDL
([c769ea7](https://github.com/Sinity/polylogue/commit/c769ea7b7cd6b04da1d54314809d5a093a62471c))
* **storage:** slice provider usage on prefix-sharing forks
([4628cd3](https://github.com/Sinity/polylogue/commit/4628cd30f24ea72546ed2d53512d093e2aea8501))
* **storage:** stop epoch-pinning timeless rows in the query CLI unit
engine ([#2576](https://github.com/Sinity/polylogue/issues/2576))
([c67fd45](https://github.com/Sinity/polylogue/commit/c67fd45392a693428d504c95359c7e4bdfcd9a53))
* **storage:** stop replaying terminal raw revisions
([#2690](https://github.com/Sinity/polylogue/issues/2690))
([90cf639](https://github.com/Sinity/polylogue/commit/90cf639b151c0c16dbb74ff70f7132c09297f6e7))
* **storage:** stop scheduling governed replay debt
([#2694](https://github.com/Sinity/polylogue/issues/2694))
([63a6c75](https://github.com/Sinity/polylogue/commit/63a6c756326ba43238bee48b8de24eab657bfb17))
* **storage:** stop usage_timeline silently dropping timeless-session
usage ([#2575](https://github.com/Sinity/polylogue/issues/2575))
([a31d096](https://github.com/Sinity/polylogue/commit/a31d0968581d108fba5a6261d41e939e3e4907ab))
* **storage:** surface SQLite maintenance drift
([e50b923](https://github.com/Sinity/polylogue/commit/e50b923168de1e2ec8a7c81a4f11f30cc0c724de))
* **storage:** trigram-index the affordance-usage CLI-detection
substring scan
([#2622](https://github.com/Sinity/polylogue/issues/2622))
([f5c35e7](https://github.com/Sinity/polylogue/commit/f5c35e7021dceebfb2836e4c84377fe8e0bbd457))
* **storage:** trust stale FTS readiness rows
([05a30c0](https://github.com/Sinity/polylogue/commit/05a30c0a8c652669305675fc29f0bd4cf55ea808))
* **test:** repair full-verify baseline drift from 2026-07-05 commit
batch ([#2556](https://github.com/Sinity/polylogue/issues/2556))
([a836e4b](https://github.com/Sinity/polylogue/commit/a836e4bfc9d8830d30b0995efbee4e2ada71e3cd))
* **topology:** integrate hook service placement
([#2658](https://github.com/Sinity/polylogue/issues/2658))
([#2658](https://github.com/Sinity/polylogue/issues/2658))
([a8eb1bf](https://github.com/Sinity/polylogue/commit/a8eb1bf1a8af6fdf3257f022b49935b07ad5dc73))
* **types:** restore quick verification gate
([87ce471](https://github.com/Sinity/polylogue/commit/87ce4718768abe247bc54bc03fda7f0db7a78752))
* **usage:** reconcile Codex tokens from disjoint rollups
([cae61ed](https://github.com/Sinity/polylogue/commit/cae61ed8ad5006e83374b72bfde7a252d82889bb))
* **verify:** restore quick gate currency
([3216c02](https://github.com/Sinity/polylogue/commit/3216c020660acef86db68f51239c343816c35a93))
* **web-shell:** correct total_sessions path, clear stuck status notice
([#2562](https://github.com/Sinity/polylogue/issues/2562))
([8506792](https://github.com/Sinity/polylogue/commit/850679209c6a551106d31104b640c728f70295f1))
* **web:** render truthful loading/stale/error states, not false
emptiness ([#2673](https://github.com/Sinity/polylogue/issues/2673))
([5479bea](https://github.com/Sinity/polylogue/commit/5479beabcb300049d9a2bbb50859d70b3742639d))
* word-boundary anchor the work-event text-signal keyword matcher
([#2630](https://github.com/Sinity/polylogue/issues/2630))
([7806b26](https://github.com/Sinity/polylogue/commit/7806b26e76f9307931d0150ca2bed35bd1d34566))


### Changed

* **cli:** avoid select setup on bounded output
([01e592e](https://github.com/Sinity/polylogue/commit/01e592e3db300e1420b7d209e68e9744c60d9f7b))
* **cli:** delegate session pages to daemon
([01847a3](https://github.com/Sinity/polylogue/commit/01847a36d52879bfef79d404413bf4d1a09b0102))
* **demo:** bound claim evidence report scans
([9045330](https://github.com/Sinity/polylogue/commit/90453304c1cf7e737459e1a83ea4ec8240d2d7b4))
* **demo:** bound claim evidence sampling before pairing
([8112fa2](https://github.com/Sinity/polylogue/commit/8112fa24373c5c8e8bbf64c69affd6686fa4b5d7))
* **devtools:** bound affordance detail reports
([898a6d1](https://github.com/Sinity/polylogue/commit/898a6d1868925a44a603fede6dc73e28379705a9))
* **embed:** avoid exact scans during window selection
([#2512](https://github.com/Sinity/polylogue/issues/2512))
([ba4655a](https://github.com/Sinity/polylogue/commit/ba4655afc2040bf0f59e015331032a487511cba5))
* **embed:** constrain archive block text lookup
([#2513](https://github.com/Sinity/polylogue/issues/2513))
([da18955](https://github.com/Sinity/polylogue/commit/da18955963ac32bc0c4f88443a0926d7a4abdb82))
* **embeddings:** batch archive vector writes
([660d01d](https://github.com/Sinity/polylogue/commit/660d01dbb9ceef95daff4b4613a05aecad1c7385))
* **embeddings:** stream pending prose windows
([ff6c4f9](https://github.com/Sinity/polylogue/commit/ff6c4f950960ee1848033e9faea1c99f5e3432a5))
* **embed:** index authored prose selection
([#2507](https://github.com/Sinity/polylogue/issues/2507))
([cdd0081](https://github.com/Sinity/polylogue/commit/cdd008167b4cfe03d08231b0200420b4353df957))
* **ingest:** batch commits by accumulated message count
([#2492](https://github.com/Sinity/polylogue/issues/2492))
([eaa4ad7](https://github.com/Sinity/polylogue/commit/eaa4ad7e23ac9238291b9d1902f9c13ec7963432)),
closes [#2391](https://github.com/Sinity/polylogue/issues/2391)
* **ingest:** batch session event writes
([6e681ff](https://github.com/Sinity/polylogue/commit/6e681ff40534daaac2479641d665c380cf560910))
* **ingest:** log slow write stage timings
([5da0be3](https://github.com/Sinity/polylogue/commit/5da0be374074fe6ad1fd46d911f3c5f1c38c549c))
* **ingest:** skip current root graph refreshes
([452f051](https://github.com/Sinity/polylogue/commit/452f051db880ad4d17156c981644b8b08f0241bd))
* **ingest:** skip unchanged thread refreshes
([cf6b41e](https://github.com/Sinity/polylogue/commit/cf6b41ef7a344e4577d37ba7158dadef1ddc1f33))
* **insights:** aggregate cost rollups from usage rows
([bb2f84f](https://github.com/Sinity/polylogue/commit/bb2f84ff871fb6717c94c733ddd3b963570509b1))
* **insights:** bound async giant-session rebuilds
([#2540](https://github.com/Sinity/polylogue/issues/2540))
([3de0079](https://github.com/Sinity/polylogue/commit/3de00794ef058d68ec8707c6a977f391504b8f95))
* **insights:** bound insight-rebuild WAL via per-chunk commits (Ref
[#2458](https://github.com/Sinity/polylogue/issues/2458))
([#2466](https://github.com/Sinity/polylogue/issues/2466))
([2eee22a](https://github.com/Sinity/polylogue/commit/2eee22a9fbfe9f177bc895f64c3271917044a91b))
* **insights:** bound usage timeline event scans
([b9f4253](https://github.com/Sinity/polylogue/commit/b9f4253cae00dfdd621281ef5ce3e1ebedbb8862))
* **maintenance:** batch raw materialization replay
([#2509](https://github.com/Sinity/polylogue/issues/2509))
([4a39c0c](https://github.com/Sinity/polylogue/commit/4a39c0c31fa07d76e314773cf69a7e191ff474d9))
* **maintenance:** replay rebuild rows source-first
([#2524](https://github.com/Sinity/polylogue/issues/2524))
([4a0ab58](https://github.com/Sinity/polylogue/commit/4a0ab5883a8fbcda0b558779d8066af04fc318d6))
* **maintenance:** report weighted rebuild run size
([#2529](https://github.com/Sinity/polylogue/issues/2529))
([ad1bf4e](https://github.com/Sinity/polylogue/commit/ad1bf4e177eafde709f0bc63f627b2d01bec2a90))
* **maintenance:** scope targeted index materialization
([90f1c5a](https://github.com/Sinity/polylogue/commit/90f1c5a493e1f583149fbf60ed78cdd1467e8532))
* **maintenance:** weight rebuild planning by raw payload
([#2528](https://github.com/Sinity/polylogue/issues/2528))
([3954534](https://github.com/Sinity/polylogue/commit/39545347c89f66e9e97ab63f59cbc206f625a185))
* **pipeline:** report raw ingest batch starts
([#2530](https://github.com/Sinity/polylogue/issues/2530))
([e15eda2](https://github.com/Sinity/polylogue/commit/e15eda24e6118ce7c1631da3b618c07666f1205a))
* **read-package:** run artifacts in process
([ed7cafb](https://github.com/Sinity/polylogue/commit/ed7cafbf4e8bff88a94089bf4629355a3af7651f))
* **read:** avoid full-session pagination loads
([a17e3af](https://github.com/Sinity/polylogue/commit/a17e3af95dd601f07ca0aa2b946f8efaa750b2c5))
* **read:** bound exact-session temporal handoffs
([478d6a7](https://github.com/Sinity/polylogue/commit/478d6a77cf1cea1d63c180701d49099ad2cfacc3))
* **read:** stream exact markdown file exports
([a9dc3f2](https://github.com/Sinity/polylogue/commit/a9dc3f274abb92c10830b5d2dcd82f5e291cb905))
* **read:** stream messages file exports
([177523a](https://github.com/Sinity/polylogue/commit/177523aab8c9407f319eed77361fad965f0ac56b))
* **status:** keep full status off exact scans
([4399db6](https://github.com/Sinity/polylogue/commit/4399db6360c27cb1e87e316fac6604470588f576))
* **storage:** append thread membership suffixes
([adc2541](https://github.com/Sinity/polylogue/commit/adc25412e5d57865e5325fc4cef9274e100bac2f))
* **storage:** avoid redundant thread refresh churn
([af0c1cc](https://github.com/Sinity/polylogue/commit/af0c1cc1c48c37f2ba37f80fd525ad934ff3142e))
* **storage:** bound revision census memory
([#2686](https://github.com/Sinity/polylogue/issues/2686))
([3fe7837](https://github.com/Sinity/polylogue/commit/3fe7837c83377017341958d544c62f79587bff0b))
* **storage:** cache composed lineage during graph repair
([51ddf75](https://github.com/Sinity/polylogue/commit/51ddf75a82adf1b248fdda287c12b4f5eb962043))
* **storage:** clean empty lineage tails by session
([#2525](https://github.com/Sinity/polylogue/issues/2525))
([b2936ba](https://github.com/Sinity/polylogue/commit/b2936ba8dddd90b94c5c708f8be4569e16171344))
* **storage:** reduce graph resolve refresh churn
([#2526](https://github.com/Sinity/polylogue/issues/2526))
([7b9f4e0](https://github.com/Sinity/polylogue/commit/7b9f4e0419875801d7cc26653b6f4858e7e3a2d4))
* **storage:** time delayed prefix re-extraction
([#2527](https://github.com/Sinity/polylogue/issues/2527))
([04ecfe0](https://github.com/Sinity/polylogue/commit/04ecfe0ec26910fa6abb3221aa4607ede15d81e9))
* **storage:** use session-scoped block lookup for signatures
([#2532](https://github.com/Sinity/polylogue/issues/2532))
([89b20c3](https://github.com/Sinity/polylogue/commit/89b20c33584a2a8aebef8798b1a425a1ce4d5ad9))
* **usage:** add headline detail for usage reports
([c1067fb](https://github.com/Sinity/polylogue/commit/c1067fb45cc1cf93fb6a9dd5ccd6bc03c79477a7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sinity added a commit that referenced this pull request Aug 2, 2026
… raw evidence

Problem: 7,376 of 9,289 attachments (79%, polylogue-pfdf/polylogue-7r6u)
sit at acquisition_status='unfetched'. PR #2469 and 60d93b6 fixed real
attachment-byte acquisition going forward (ParsedAttachment.inline_bytes
propagation), but the historical backlog was never backfilled: an
attachment ingested before a parser fix landed still has no blob_hash,
even though its owning session's raw payload is durable in source.db and
today's parser may already extract it. Separately, 'unfetched' was the
only acquisition_status a genuinely gone attachment (e.g. ChatGPT Code
Interpreter sandbox output, which chatgpt.py's own comments document as
never carrying bytes) could ever reach -- indistinguishable from "not yet
tried".

What changed: new polylogue/storage/attachment_reacquisition.py, following
the same read-only-classifier + operator-gated-actuator architecture as
attachment_relink.py (ref-linkage backfill) and blob_integrity.py's raw
actuators:
- plan_attachment_reacquisition() classifies every unfetched attachment
  into reacquirable (re-parsing its still-durable raw_sessions payload
  with today's parser, via the real ingest_record entry point, reproduces
  its content-identity hash with inline bytes), unrecoverable (a static
  source_url='sandbox:...' signature -- no reparse needed, matches
  chatgpt.py's own documented semantics), or undetermined (left unfetched,
  honestly not-yet -- most commonly Drive/OAuth attachments needing a live
  authenticated fetch this module never performs, see polylogue-ck5v).
- apply_attachment_reacquisition() acts on the safe verdicts only: dry-run
  by default; --apply requires an immutable JSONL manifest of every row
  acted on plus a verified backup manifest for the index tier (the same
  gate durable-tier migrations use). Reacquired bytes are published through
  the same content-addressed blob store and ArchiveBlobPublisher every
  other acquisition path uses; the schema's existing but previously-unused
  acquisition_status='unavailable' value is what marks unrecoverable
  attachments distinctly from 'unfetched', with no schema change needed.
- Two devtools commands wire this into the control plane:
  `devtools workspace attachment-reacquisition` (report) and
  `...-apply` (actuator), mirroring the raw-live-source-reconciliation
  report/apply pair.

Never touched: acquisition for Drive-hosted/OAuth attachments needing a
live network fetch (polylogue-ck5v is the separate, larger follow-on for
that); this module performs zero network I/O.

Verification: `devtools test tests/unit/storage/test_attachment_reacquisition.py`
(7 passed) exercises real ingest_record parsing against a real source.db/
blob store and real index.db mutation -- proves a historically-unfetched
attachment with recoverable extracted_content bytes is reacquired, a
sandbox-output attachment is marked unavailable without any reparse, a
genuinely unmatched ("ghost") attachment stays undetermined/unfetched, and
--apply refuses without a manifest path or a verified backup manifest.
`devtools verify --quick` clean (added a degrade-loudly log call and a
hash-boundary-census registry entry for the new hashlib.sha256 call site).
Ran the new read-only report against the live production archive
(/realm/db/polylogue, read-only) as a real-world sanity check.

Ref polylogue-pfdf, polylogue-7r6u

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
… raw evidence (#3590)

## Summary

Adds a read-only classifier plus an operator-gated actuator that
backfills historically-unfetched `attachments` rows where the source
payload still contains the bytes, and marks the genuinely unrecoverable
ones distinctly instead of leaving them ambiguously `'unfetched'`
forever.

## Problem

7,376 of 9,289 attachments (79%, polylogue-pfdf / polylogue-7r6u) sit at
`acquisition_status='unfetched'`. PR #2469 and commit 60d93b6
("acquire Claude extracted payloads") fixed real attachment-byte
acquisition going forward, but the historical backlog was never
backfilled: an attachment ingested before a parser fix landed still has
no `blob_hash`, even though its owning session's raw payload is durable
in `source.db` and today's parser may already extract it
(`ParsedAttachment.inline_bytes`). Separately, `'unfetched'` was the
only `acquisition_status` a genuinely gone attachment could ever reach
(e.g. ChatGPT Code Interpreter sandbox output — `chatgpt.py`'s own
comments document these as never carrying bytes at all) —
indistinguishable from "not yet tried".

## Solution

`polylogue/storage/attachment_reacquisition.py` follows the same
read-only-classifier + operator-gated-actuator architecture already
established by `attachment_relink.py` (ref-linkage backfill) and
`blob_integrity.py`'s raw-side actuators:

- `plan_attachment_reacquisition()` classifies every unfetched
attachment into:
- **reacquirable**: re-parsing its still-durable `raw_sessions` payload
with today's parser (via the real `ingest_record` entry point)
reproduces its content-identity hash (`write.py:_attachment_id`,
independent of session/message) with inline bytes.
- **unrecoverable**: a static `source_url='sandbox:...'` signature — no
reparse needed, matches `chatgpt.py`'s own documented "nothing local to
fetch" semantics for Code Interpreter output.
- **undetermined**: left exactly as `unfetched` — most commonly
Drive/OAuth attachments that would need a live authenticated fetch (the
separate, larger polylogue-ck5v follow-on); this module performs zero
network I/O and never guesses.
- `apply_attachment_reacquisition()` acts on the safe verdicts only.
Dry-run by default; `--apply` requires an immutable JSONL manifest of
every row acted on plus a verified backup manifest for the `index` tier
(the same gate durable-tier migrations use,
`validate_migration_backup_manifest`). Reacquired bytes are published
through the same content-addressed blob store/`ArchiveBlobPublisher`
every other acquisition path uses. The schema's existing but
previously-unused `acquisition_status='unavailable'` value is what marks
unrecoverable attachments distinctly — no schema change needed.
- Two devtools commands wire this into the control plane: `devtools
workspace attachment-reacquisition` (report) and `...-apply` (actuator),
mirroring the `raw-live-source-reconciliation` report/apply pair.

Never attempted: acquisition for Drive-hosted/OAuth attachments needing
a live network fetch — that is polylogue-ck5v's scope, not this bead's.

## Verification

- `devtools test tests/unit/storage/test_attachment_reacquisition.py` —
7 passed. Exercises real `ingest_record` parsing against a real
`source.db`/blob store and real `index.db` mutation: proves a
historically-unfetched attachment with recoverable `extracted_content`
bytes is reacquired, a sandbox-output attachment is marked `unavailable`
with zero reparse, a genuinely unmatched ("ghost") attachment stays
undetermined/unfetched, and `--apply` refuses without a manifest path or
a verified backup manifest.
- `devtools verify --quick` clean (added a `degrade-loudly` log call and
a `hash-boundary-census` registry entry for the new `hashlib.sha256`
call site).
- Ran the new read-only report against the live production archive
(`/realm/db/polylogue`, read-only, no mutation) as a real-world sanity
check; full-corpus timing is dominated by real per-row parse cost on
large session payloads (some multi-MB/GB Claude Code JSONL files), so a
bounded `--raw-row-limit` is the intended operator dial for a first-pass
classification before deciding on `--apply` scope.

Ref polylogue-pfdf, polylogue-7r6u

---------

Co-authored-by: Claude <[email protected]>
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