Repository navigation
fix: repair live-archive runtime semantics and session products - #184
Merged
Merged
Conversation
This was referenced Apr 16, 2026
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
## Summary PR 3/9. Stacked on `feature/fix/stack-02-cli-contracts`. Runtime semantic repair wave triggered by real-archive rebuilds against the default XDG root. Schema baseline reset, session-product freshness, repo attribution tightening, and the start of the memory/perf wave. ## Problem Live rebuilds surfaced a tangle of product-correctness defects that had accumulated on the real archive: - The archive schema had drifted to a version that failed to bootstrap cleanly; live rebuilds couldn't proceed against a default XDG root without a manual reset. - Session-profile rows carried polluted payloads (inferred repo names like `projects`, `root`, `blob-repository`) sourced from transcript-store paths, temp task outputs, snapshot paths, `.config/claude/projects`, `.codex/`, and Nix store paths. - Repo attribution was willing to synthesize repo and file attribution from arbitrary dialogue text paths, contaminating rollups on `polylogue stats --by repo`. - `session_product_status` knew rows were incomplete, yet reads served them anyway; repair was silent while running, making the command look hung. - The repo-identity helper probed `(candidate / ".git").exists()` on arbitrary archived absolute paths and raised `PermissionError` on unreadable admin paths like `/boot/.git`. - `polylogue doctor --json` took 40+ seconds on large archives because exact `messages_fts_docsize` counting and exact orphan counts ran on every default call. - `doctor --runtime --json` still executed the full archive-health path and timed out. - `polylogue --plain --format json project --limit 3` returned `no_results` silently on archives where `messages_fts` existed but was not populated — the search backend swallowed exceptions and degraded without surfacing the incomplete index. - `update_index_for_conversations()` filtered changed conversation ids through `action_event_repair_candidates_sync()`, so content-block mutations with unchanged materializer version were skipped and stale `action_events_fts` rows persisted. - Archive stats attachment counts confused `attachment_refs` with distinct attachments in the structured payload, leaked unrelated archive totals under an `embeddings` key. - Early perf regressions: latest-query memory on large archives, sqlite read-path memory pressure, archive stats and retrieval-band status running together. ## Solution - Reset the archive schema baseline to `v1` with legacy inline-raw detection; harden live archive reads and overwrites; align live provider ingestion with archive payloads. - Invalidate stale session-product rows on materializer version bump; expose repair progress; reject incomplete session-product surfaces before repair with an actionable error envelope (`session_profiles` / enrichments / work events / phases / threads / tag rollups / day / week summaries). - Normalize repo attribution: promote `provider_meta["working_directories"]` to first-class evidence; reject dialogue-derived repo/file guessing; filter transcript-store paths, `.config/claude/projects`, `.claude/`, `.codex/`, snapshot/Nix-store paths, and temp task output paths. - Harden `normalize_repo_path()` against unreadable git admin paths. - Switch `doctor` to probe-mode by default: no exact `messages_fts_docsize` counting, no exact orphan counting, presence-only derived `messages_fts` status. Keep exact counts for `--deep`/`--repair`. - Make `doctor --runtime --json` runtime-only when no archive/debt/schema/proof/maintenance work was requested. - Surface incomplete search indexes explicitly: `fts_lifecycle.py` and `search_runtime.py` now check that FTS is populated, not just that the table exists; retrieval candidates stop swallowing backend search exceptions. - Rebuild action-event rows for every conversation explicitly passed to `update_index_for_conversations()`; keep candidate filtering only for full rebuilds. - Return explicit `attachment_refs` and `distinct_attachments` from archive stats; restrict the nested `embeddings` object to embedding-state fields. - Early perf cuts: archive stats on single read snapshot; stats off retrieval-band status; cut latest-query memory on large archives; sqlite read-path memory pressure reduction. ## Verification - `pytest -q --ignore=tests/integration` - `pytest -q tests/unit/storage/test_action_event_artifacts.py tests/unit/storage/test_derived_status.py tests/unit/storage/test_repair.py tests/unit/storage/test_fts5.py tests/unit/cli/test_check.py tests/unit/cli/test_products.py tests/unit/core/test_query_retrieval_candidates.py tests/unit/core/test_repo_identity.py tests/unit/core/test_semantic_facts.py tests/unit/storage/test_store_ops.py tests/unit/storage/test_session_product_profiles.py` - `pytest -q tests/integration/test_health.py tests/integration/test_workflows.py` - `ruff check polylogue tests devtools` - Live manual probes on default archive root. Commits on this branch: 35 (delta against `feature/fix/stack-02-cli-contracts`). ## Stack Base: `feature/fix/stack-02-cli-contracts`. Next: `feature/perf/stack-04-parse-hardening`.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
… unification (#186) ## Summary Combined arc covering the remainder of the `feature/chore/repo-cleanup-governance` branch work. Arcs 1–3 landed in PRs #174, #183, #184. This PR covers arcs 4–9: - **Perf** (arc 4): materialize rebuild bounds, single-record inline ingest, worker throttling, session refresh by message volume, default doctor probe slimming, JSONL lone-surrogate tolerance, malformed-line reporting, reparse preview/scope safety, acquisition heartbeats, site progress. - **Artifact graph + storage bootstrap** (arc 5): shared action-event and raw-ingest artifact semantics, explicit artifact graph, unified schema bootstrap. - **Scenario substrate wave 1** (arc 6): ScenarioMetadata, OperationSpec, typed QA requests, catalog extractions, runtime coverage maps. - **Scenario execution + corpus roots** (arc 7): CorpusSpec as single input, ExecutionSpec unification, showcase exercise collapse, runtime path modeling, memory-budget lane compilation. - **Final unification** (arc 8): AssertionSpec, ValidationLaneFamily, CorpusProfile, MaintenanceTargetSpec, CliSurfaceFamily, SQLite runtime collapse. - **Runtime fixes** (arc 9): parse-vs-validation failure split, action-event orphan readiness, verifier decode-error preservation. ## Problem The 244-commit branch introduced tightly-coupled architectural unifications across scenario, verification, storage, and runtime surfaces. Splitting these into 6 independently-functional PRs proved impractical — cherry-picking individual arcs onto an intermediate master created semantic drift that broke test consistency. ## Solution Cherry-pick the remaining 161 commits (positions 84–244 of the original branch) onto the current master (which already has arcs 1–3 merged). Three conflicts resolved during cherry-pick: CLAUDE.md transclusion paths (`.claude/` → `.agent/`), `async_sqlite_schema.py` (format drift), `schema_upgrade.py` (deletion accepted). Followed by a ruff format pass, snapshot refresh, showcase baseline update, and xfail removal. ## Verification - `pytest -q --ignore=tests/integration` → 4881 passed (7 test-isolation artifacts pass individually) - `ruff check polylogue/ tests/ devtools/` → all checks passed - `ruff format --check polylogue/ tests/ devtools/` → all formatted - `devtools verify-showcase --update` → 43 exercises, baselines current - `pytest tests/unit/cli/test_terminal_snapshots.py --snapshot-update` → 10 passed
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
Live rebuilds against the default XDG archive root surfaced a tangle of product-correctness defects: schema drift blocking bootstrap, polluted session-profile payloads, repo attribution synthesized from arbitrary dialogue text paths, stale session-product rows served while repair ran silently, and a 40+-second doctor probe on large archives. Reset the archive schema baseline to v1 with legacy inline-raw detection. Session-product rows invalidate on materializer version bump; incomplete surfaces reject reads with an actionable error envelope instead of leaking stale data. Repo attribution promotes `provider_meta["working_directories"]` to first-class evidence and rejects dialogue-derived guessing — transcript-store paths, `.config/claude/projects`, `.claude/`, `.codex/`, snapshot and Nix store paths, and temp task output paths stop contaminating `polylogue stats --by repo`. `normalize_repo_path()` tolerates unreadable git admin paths (e.g., `/boot/.git`) without raising `PermissionError`. `doctor` shifts to probe-mode by default: no exact `messages_fts_docsize` counting, no exact orphan counts, presence-only `messages_fts` status. Exact counts stay behind `--deep`/`--repair`. `doctor --runtime --json` stays runtime-only when no archive/debt/schema/proof/maintenance work is requested. Empty-result query paths surface incomplete search indexes explicitly — `fts_lifecycle.py` and `search_runtime.py` check that FTS is populated, not just present, and retrieval candidates stop swallowing backend exceptions. Content-block mutations rebuild action-event rows for every explicitly-passed conversation instead of filtering through repair-candidate gating. Archive stats returns explicit `attachment_refs` and `distinct_attachments` and scopes the nested `embeddings` object to embedding-state only. Early perf wave: archive stats on a single read snapshot, stats off retrieval-band status, smaller latest-query memory, reduced sqlite read-path pressure. Verification: focused pytest over storage/core/cli suites plus integration health and workflow tests; live probes on default archive root.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
… unification (#186) Completes the `feature/chore/repo-cleanup-governance` architectural wave, landing arcs 4-9 of the 244-commit branch (arcs 1-3 merged as PRs #174 / #183 / #184). Splitting the remaining 161 commits into independently-functional PRs proved impractical — the arcs are cross-coupled enough that cherry-picking individual ones onto intermediate master produced semantic drift that broke test consistency. Merged as one coherent step. Arc 4 (perf): materialize rebuild bounds, single-record inline ingest, worker throttling, session refresh keyed to message volume, default doctor probe slimming, JSONL lone-surrogate tolerance, malformed-line reporting, reparse preview/scope safety, acquisition heartbeats, site progress reporting. Arc 5 (artifact graph + storage bootstrap): shared action-event and raw-ingest artifact semantics, explicit artifact graph, unified schema bootstrap. Arc 6 (scenario substrate wave 1): `ScenarioMetadata`, `OperationSpec`, typed QA requests, catalog extractions, runtime coverage maps. Arc 7 (scenario execution + corpus roots): `CorpusSpec` as single input, `ExecutionSpec` unification, showcase exercise collapse, runtime path modeling, memory-budget lane compilation. Arc 8 (final unification): `AssertionSpec`, `ValidationLaneFamily`, `CorpusProfile`, `MaintenanceTargetSpec`, `CliSurfaceFamily`, SQLite runtime collapse. Arc 9 (runtime fixes): parse-vs-validation failure split, action-event orphan readiness, verifier decode-error preservation. Three conflicts during cherry-pick: CLAUDE.md transclusion paths (`.claude/` → `.agent/`), `async_sqlite_schema.py` format drift, `schema_upgrade.py` deletion accepted. Followed by ruff format pass, snapshot refresh, showcase baseline update, xfail removal. Verification: 4881 pytest (ignoring integration), ruff clean, showcase baselines current across 43 exercises, terminal snapshot baselines refreshed.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
Live rebuilds against the default XDG archive root surfaced a tangle of product-correctness defects: schema drift blocking bootstrap, polluted session-profile payloads, repo attribution synthesized from arbitrary dialogue text paths, stale session-product rows served while repair ran silently, and a 40+-second doctor probe on large archives. Reset the archive schema baseline to v1 with legacy inline-raw detection. Session-product rows invalidate on materializer version bump; incomplete surfaces reject reads with an actionable error envelope instead of leaking stale data. Repo attribution promotes `provider_meta["working_directories"]` to first-class evidence and rejects dialogue-derived guessing — transcript-store paths, `.config/claude/projects`, `.claude/`, `.codex/`, snapshot and Nix store paths, and temp task output paths stop contaminating `polylogue stats --by repo`. `normalize_repo_path()` tolerates unreadable git admin paths (e.g., `/boot/.git`) without raising `PermissionError`. `doctor` shifts to probe-mode by default: no exact `messages_fts_docsize` counting, no exact orphan counts, presence-only `messages_fts` status. Exact counts stay behind `--deep`/`--repair`. `doctor --runtime --json` stays runtime-only when no archive/debt/schema/proof/maintenance work is requested. Empty-result query paths surface incomplete search indexes explicitly — `fts_lifecycle.py` and `search_runtime.py` check that FTS is populated, not just present, and retrieval candidates stop swallowing backend exceptions. Content-block mutations rebuild action-event rows for every explicitly-passed conversation instead of filtering through repair-candidate gating. Archive stats returns explicit `attachment_refs` and `distinct_attachments` and scopes the nested `embeddings` object to embedding-state only. Early perf wave: archive stats on a single read snapshot, stats off retrieval-band status, smaller latest-query memory, reduced sqlite read-path pressure. Verification: focused pytest over storage/core/cli suites plus integration health and workflow tests; live probes on default archive root.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
… unification (#186) Completes the `feature/chore/repo-cleanup-governance` architectural wave, landing arcs 4-9 of the 244-commit branch (arcs 1-3 merged as PRs #174 / #183 / #184). Splitting the remaining 161 commits into independently-functional PRs proved impractical — the arcs are cross-coupled enough that cherry-picking individual ones onto intermediate master produced semantic drift that broke test consistency. Merged as one coherent step. Arc 4 (perf): materialize rebuild bounds, single-record inline ingest, worker throttling, session refresh keyed to message volume, default doctor probe slimming, JSONL lone-surrogate tolerance, malformed-line reporting, reparse preview/scope safety, acquisition heartbeats, site progress reporting. Arc 5 (artifact graph + storage bootstrap): shared action-event and raw-ingest artifact semantics, explicit artifact graph, unified schema bootstrap. Arc 6 (scenario substrate wave 1): `ScenarioMetadata`, `OperationSpec`, typed QA requests, catalog extractions, runtime coverage maps. Arc 7 (scenario execution + corpus roots): `CorpusSpec` as single input, `ExecutionSpec` unification, showcase exercise collapse, runtime path modeling, memory-budget lane compilation. Arc 8 (final unification): `AssertionSpec`, `ValidationLaneFamily`, `CorpusProfile`, `MaintenanceTargetSpec`, `CliSurfaceFamily`, SQLite runtime collapse. Arc 9 (runtime fixes): parse-vs-validation failure split, action-event orphan readiness, verifier decode-error preservation. Three conflicts during cherry-pick: CLAUDE.md transclusion paths (`.claude/` → `.agent/`), `async_sqlite_schema.py` format drift, `schema_upgrade.py` deletion accepted. Followed by ruff format pass, snapshot refresh, showcase baseline update, xfail removal. Verification: 4881 pytest (ignoring integration), ruff clean, showcase baselines current across 43 exercises, terminal snapshot baselines refreshed.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
Live rebuilds against the default XDG archive root surfaced a tangle of product-correctness defects: schema drift blocking bootstrap, polluted session-profile payloads, repo attribution synthesized from arbitrary dialogue text paths, stale session-product rows served while repair ran silently, and a 40+-second doctor probe on large archives. Reset the archive schema baseline to v1 with legacy inline-raw detection. Session-product rows invalidate on materializer version bump; incomplete surfaces reject reads with an actionable error envelope instead of leaking stale data. Repo attribution promotes `provider_meta["working_directories"]` to first-class evidence and rejects dialogue-derived guessing — transcript-store paths, `.config/claude/projects`, `.claude/`, `.codex/`, snapshot and Nix store paths, and temp task output paths stop contaminating `polylogue stats --by repo`. `normalize_repo_path()` tolerates unreadable git admin paths (e.g., `/boot/.git`) without raising `PermissionError`. `doctor` shifts to probe-mode by default: no exact `messages_fts_docsize` counting, no exact orphan counts, presence-only `messages_fts` status. Exact counts stay behind `--deep`/`--repair`. `doctor --runtime --json` stays runtime-only when no archive/debt/schema/proof/maintenance work is requested. Empty-result query paths surface incomplete search indexes explicitly — `fts_lifecycle.py` and `search_runtime.py` check that FTS is populated, not just present, and retrieval candidates stop swallowing backend exceptions. Content-block mutations rebuild action-event rows for every explicitly-passed conversation instead of filtering through repair-candidate gating. Archive stats returns explicit `attachment_refs` and `distinct_attachments` and scopes the nested `embeddings` object to embedding-state only. Early perf wave: archive stats on a single read snapshot, stats off retrieval-band status, smaller latest-query memory, reduced sqlite read-path pressure. Verification: focused pytest over storage/core/cli suites plus integration health and workflow tests; live probes on default archive root.
Sinity
added a commit
that referenced
this pull request
Apr 22, 2026
… unification (#186) Completes the `feature/chore/repo-cleanup-governance` architectural wave, landing arcs 4-9 of the 244-commit branch (arcs 1-3 merged as PRs #174 / #183 / #184). Splitting the remaining 161 commits into independently-functional PRs proved impractical — the arcs are cross-coupled enough that cherry-picking individual ones onto intermediate master produced semantic drift that broke test consistency. Merged as one coherent step. Arc 4 (perf): materialize rebuild bounds, single-record inline ingest, worker throttling, session refresh keyed to message volume, default doctor probe slimming, JSONL lone-surrogate tolerance, malformed-line reporting, reparse preview/scope safety, acquisition heartbeats, site progress reporting. Arc 5 (artifact graph + storage bootstrap): shared action-event and raw-ingest artifact semantics, explicit artifact graph, unified schema bootstrap. Arc 6 (scenario substrate wave 1): `ScenarioMetadata`, `OperationSpec`, typed QA requests, catalog extractions, runtime coverage maps. Arc 7 (scenario execution + corpus roots): `CorpusSpec` as single input, `ExecutionSpec` unification, showcase exercise collapse, runtime path modeling, memory-budget lane compilation. Arc 8 (final unification): `AssertionSpec`, `ValidationLaneFamily`, `CorpusProfile`, `MaintenanceTargetSpec`, `CliSurfaceFamily`, SQLite runtime collapse. Arc 9 (runtime fixes): parse-vs-validation failure split, action-event orphan readiness, verifier decode-error preservation. Three conflicts during cherry-pick: CLAUDE.md transclusion paths (`.claude/` → `.agent/`), `async_sqlite_schema.py` format drift, `schema_upgrade.py` deletion accepted. Followed by ruff format pass, snapshot refresh, showcase baseline update, xfail removal. Verification: 4881 pytest (ignoring integration), ruff clean, showcase baselines current across 43 exercises, terminal snapshot baselines refreshed.
Owner
Author
Owner
Author
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9249c6764d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Owner
Author
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 3/9. Stacked on
feature/fix/stack-02-cli-contracts.Runtime semantic repair wave triggered by real-archive rebuilds against the default XDG root. Schema baseline reset, session-product freshness, repo attribution tightening, and the start of the memory/perf wave.
Problem
Live rebuilds surfaced a tangle of product-correctness defects that had accumulated on the real archive:
projects,root,blob-repository) sourced from transcript-store paths, temp task outputs, snapshot paths,.config/claude/projects,.codex/, and Nix store paths.polylogue stats --by repo.session_product_statusknew rows were incomplete, yet reads served them anyway; repair was silent while running, making the command look hung.(candidate / ".git").exists()on arbitrary archived absolute paths and raisedPermissionErroron unreadable admin paths like/boot/.git.polylogue doctor --jsontook 40+ seconds on large archives because exactmessages_fts_docsizecounting and exact orphan counts ran on every default call.doctor --runtime --jsonstill executed the full archive-health path and timed out.polylogue --plain --format json project --limit 3returnedno_resultssilently on archives wheremessages_ftsexisted but was not populated — the search backend swallowed exceptions and degraded without surfacing the incomplete index.update_index_for_conversations()filtered changed conversation ids throughaction_event_repair_candidates_sync(), so content-block mutations with unchanged materializer version were skipped and staleaction_events_ftsrows persisted.attachment_refswith distinct attachments in the structured payload, leaked unrelated archive totals under anembeddingskey.Solution
v1with legacy inline-raw detection; harden live archive reads and overwrites; align live provider ingestion with archive payloads.session_profiles/ enrichments / work events / phases / threads / tag rollups / day / week summaries).provider_meta["working_directories"]to first-class evidence; reject dialogue-derived repo/file guessing; filter transcript-store paths,.config/claude/projects,.claude/,.codex/, snapshot/Nix-store paths, and temp task output paths.normalize_repo_path()against unreadable git admin paths.doctorto probe-mode by default: no exactmessages_fts_docsizecounting, no exact orphan counting, presence-only derivedmessages_ftsstatus. Keep exact counts for--deep/--repair.doctor --runtime --jsonruntime-only when no archive/debt/schema/proof/maintenance work was requested.fts_lifecycle.pyandsearch_runtime.pynow check that FTS is populated, not just that the table exists; retrieval candidates stop swallowing backend search exceptions.update_index_for_conversations(); keep candidate filtering only for full rebuilds.attachment_refsanddistinct_attachmentsfrom archive stats; restrict the nestedembeddingsobject to embedding-state fields.Verification
pytest -q --ignore=tests/integrationpytest -q tests/unit/storage/test_action_event_artifacts.py tests/unit/storage/test_derived_status.py tests/unit/storage/test_repair.py tests/unit/storage/test_fts5.py tests/unit/cli/test_check.py tests/unit/cli/test_products.py tests/unit/core/test_query_retrieval_candidates.py tests/unit/core/test_repo_identity.py tests/unit/core/test_semantic_facts.py tests/unit/storage/test_store_ops.py tests/unit/storage/test_session_product_profiles.pypytest -q tests/integration/test_health.py tests/integration/test_workflows.pyruff check polylogue tests devtoolsCommits on this branch: 35 (delta against
feature/fix/stack-02-cli-contracts).Stack
Base:
feature/fix/stack-02-cli-contracts. Next:feature/perf/stack-04-parse-hardening.