Skip to content

fix: make archive readiness and resume evidence truthful - #5531

Merged
Sinity merged 19 commits into
masterfrom
feat/readiness-integration
Sep 25, 2026
Merged

Sinity merged 19 commits into
masterfrom
feat/readiness-integration

Conversation

@Sinity

@Sinity Sinity commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bind FTS and session readiness to measured input state, keep degraded and missing evidence explicit, and bound session read probes.
  • Classify resume context from recorded delivery evidence, repair labels and CLI/schema fixtures, and prune stale layering declarations.
  • Add a production-route duplicate-marker readiness test using a real user tier.

Problem

The stopped campaign left readiness and query fixes in separate unfinished edits. Archive-size scans made status slow, missing FTS state could appear as an ordinary empty result, and duplicate marker delivery lacked a production-route readiness assertion. A skewed session read also needed an indexed page bound.

Solution

Domain-local FTS binding avoids repeat full inspection while invalidating on relevant writes. Missing or unreadable evidence is carried explicitly. The bounded read test exercises a 6,000-message skewed session: the old ranking query used about 392,000 SQLite VM steps, while the indexed route uses about 48,000 for the same 206 IDs. The marker test sends duplicate accepted markers through production derivations and verifies one durable assertion plus valid profile readiness.

Verification

  • devtools test on the 19 changed test modules — 1,032 of 1,033 passed initially; the sole stale v3 schema fixture expectation was corrected and its focused test passed, receipt 20260925T160715Z-focused-test-2094993-87659bf2.
  • devtools test tests/unit/storage/test_accepted_marker_consumer.py tests/unit/storage/test_session_profile_derivation.py — 44 passed, receipt 20260925T161607Z-focused-test-2121063-8aca70fb.
  • devtools gate mypy — no issues in 3,058 files after test type narrowing.
  • devtools gate layering — passed with no violations; the changed FTS SQLite fallback anchor was updated and three obsolete import exceptions removed.
  • devtools verify --quick — passed, AgentCTL job 1797 at the rebased candidate; all static gates, no pytest.

Residual

This PR does not rebuild the live archive or settle unrelated campaign blockers. The marker transport itself already landed on master in PR #5493; this adds the remaining production duplicate-marker proof.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 13 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c269a3ea-7ab8-4a4e-b843-3fd4f6516665

📥 Commits

Reviewing files that changed from the base of the PR and between ca25740 and 23da2bc.

📒 Files selected for processing (34)
  • devtools/verify_layering.py
  • docs/plans/layering-surface-baseline.json
  • docs/plans/sqlite-degradation-baseline.json
  • polylogue/analysis/resume.py
  • polylogue/analysis/session_label.py
  • polylogue/api/archive.py
  • polylogue/archive/query/attached_units.py
  • polylogue/cli/commands/judge.py
  • polylogue/daemon/fts_status.py
  • polylogue/daemon/health.py
  • polylogue/daemon/status.py
  • polylogue/operations/archive_debt.py
  • polylogue/scenarios/cli_surfaces.py
  • polylogue/scenarios/insight_surfaces.py
  • polylogue/surfaces/payloads.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/archive/test_with_units_projection.py
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/cli/test_assertion_candidates.py
  • tests/unit/core/test_operator_inference.py
  • tests/unit/core/test_schema_annotation_contracts.py
  • tests/unit/core/test_schema_generation.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/daemon/test_fts_readiness_binding.py
  • tests/unit/daemon/test_health_check_paths.py
  • tests/unit/devtools/test_layering_gates.py
  • tests/unit/insights/test_resume_context_evidence.py
  • tests/unit/insights/test_session_label.py
  • tests/unit/operations/test_archive_debt.py
  • tests/unit/scenarios/test_insight_surfaces.py
  • tests/unit/schemas/test_promote_cluster_privacy_config.py
  • tests/unit/storage/test_bounded_partition_reads.py
  • tests/unit/storage/test_durable_change_train.py
  • tests/unit/storage/test_session_profile_derivation.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T16:37:02.381899Z 23da2bc PR opened
🔒 Security Review ✅ Completed 2026-09-25T16:33:15.852109Z 23da2bc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23da2bcc5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/verify_layering.py Resolved
Comment thread polylogue/cli/commands/judge.py Resolved
Comment thread polylogue/analysis/session_label.py Resolved
@Sinity
Sinity enabled auto-merge (squash) September 25, 2026 16:40
@Sinity
Sinity merged commit 9d33b52 into master Sep 25, 2026
3 checks passed
@Sinity
Sinity deleted the feat/readiness-integration branch September 25, 2026 16:40
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):

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

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):

  • P1 devtools/verify_layering.py:1370: Fixed on master (checked at 64a9bd0): Without --prune-baselines the gate no longer rewrites the baseline; each stale entry is reported as a layering_baseline_stale violation (devtools/verify_layering.py:1583-1607).

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

Sinity added a commit that referenced this pull request Oct 1, 2026
## Summary

Move daemon metrics collection and convergence acquisition into their
operations owners. Remove fifteen surface-to-substrate exemptions and
eight retired SQLite degradation anchors.

## Problem

Historical F756 on PR #4308 remains real for
`daemon/convergence_stages.py` and `daemon/metrics.py`: both acquired
substrate state directly while their baseline exemptions made the
ratchet accept it. The FTS convergence import was already corrected in
#5027 and its stale exemption removed in #5531. The connected source
membership route also fell back to a readable conventional shadow when
the promoted index could not be acquired; workflow publication followed
the promoted generation directory instead of the configured durable
root.

## Solution

Operations owns metric acquisition, complete collector groups and
exposition; the HTTP adapter publishes the product result. Workflow
materialization and its ordered current receipt, source-to-session
membership, and Sinex configured publication/barrier composition have
substantive product owners. Existing FTS operations owns binding
inspection and transactional publication. Every connected caller follows
those owners, and unused predecessor helpers are deleted.

Required membership faults propagate; optional metric probe failures
retain their typed evidence and existing diagnostic outcome. The
ops-only corruption probe uses the canonical query-only diagnostic
reader, preserves the schema-cookie check and closes its handle. Process
collectors retain their lifecycle owners and the metric/HTTP contract is
unchanged.

| Finding | Disposition | Evidence |
| --- | --- | --- |
| F756 / CX56.F080, remaining stage and metric adapters | fixed |
cc9d913 plus f823d48 and 3845fb4; zero corresponding direct
imports or baseline exemptions; anti-vacuity regression covers restoring
either |
| F756, FTS convergence import | fixed-later | 14e1d82 (#5027); stale
exemption removed by 9d33b52 (#5531) |

## Verification

`agentctl job start polylogue pytest_focused --workspace
<candidate-worktree> --` followed by this exact selection:

```text
tests/integration/test_claude_workflow_admission.py
tests/unit/core/test_sqlite_lock_classification.py
tests/unit/daemon/test_convergence_debt_alert.py
tests/unit/daemon/test_convergence_final_state.py
tests/unit/daemon/test_convergence_restart_law.py
tests/unit/daemon/test_convergence_stages.py
tests/unit/daemon/test_daemon_cli.py
tests/unit/daemon/test_daemon_ops_lease_boundary.py
tests/unit/daemon/test_diagnostic_metrics.py
tests/unit/daemon/test_embedding_convergence_progress.py
tests/unit/daemon/test_fts_readiness_binding.py
tests/unit/daemon/test_hook_liveness.py
tests/unit/daemon/test_maintenance_read_profiles.py
tests/unit/daemon/test_metrics_endpoint.py
tests/unit/daemon/test_selected_session_parts.py
tests/unit/daemon/test_session_profile_composition.py
tests/unit/daemon/test_standing_queries_default_evaluator.py
tests/unit/daemon/test_unmeasured_observations.py
tests/unit/devtools/test_layering_gates.py
tests/unit/devtools/test_verify_rebuild_routes.py
tests/unit/insights/test_claude_workflow_evidence.py
tests/unit/operations/test_session_source_membership.py
tests/unit/sinex/test_convergence.py
tests/unit/sources/test_live_ingest_ops_work.py
tests/unit/storage/test_archive_readiness.py
tests/unit/storage/test_raw_observation_derivation.py
tests/unit/storage/test_write_lease.py
```

Job 5242, head `cc9d913464231f24c0e46830733b1df358b7cee4`, receipt
`20261001T022107Z-focused-test-3540546-6877456b`: `495 passed, 3
warnings`; exit 0, 495 unique selected/terminal nodes, no retry.

`agentctl job start polylogue verify_quick --workspace
<candidate-worktree>`: job 5243, same head, receipt
`20261001T022113Z-quick-3540667-b9396fbd`: `verify: PASSED exit=0`, all
twelve gates pass.


A fresh independent local review of exact head cc9d913 found no
remaining scoped defect. Hosted Codex reviews are disabled by operator
direction; no manual hosted request was made.

The selector covers 27 connected modules. No complete-corpus claim.
Schema closure inspection found all eleven changed production files
outside the derived identity closure; the final schema-closure gate also
passes.

## Self-review

Author reviewed the whole diff against base 81fff68, including
transferred bodies, all connected callers and the retired inventories.
Three correction passes; final pass after verification found no
remaining scoped defect.

1. ✓ **Siblings and owners.** The complete census covers both remaining
F756 adapters, the source membership consumer in session-profile
convergence, all three barrier consumers, the workflow receipt and
existing FTS owner. All 15 adapter exemptions and eight predecessor
anchors are removed.

2. ✓ **The fix itself.** Reviewed the acquisition changes and the
transferred functions against their original bodies. The final metrics
AST census proves 48 function/class bodies unchanged and isolates seven
typed refusal rewrites plus the canonical ops-only probe acquisition;
their original fallback values and finally-close blocks remain.
Hot-source capture is restricted to the original attachment failure
branch.

3. ✓ **Memory and limits.** No new limit, cache, timeout or archive
enumeration is added. The existing scoped source/session join and
collector buffers are retained. Existing sampling policies are
unchanged.

4. ✓ **Cost per unit.** The product retains its SQL parameters and
indexed ordering. Membership now opens the active generation once
instead of probing then reopening or falling back to a shadow. Source
membership joins every selected path once. No per-row bootstrap or new
archive-wide scan is introduced.

5. ✓ **Interruption.** FTS publication retains BEGIN IMMEDIATE, rollback
on refusal/exception, commit on certified binding and finally-close.
Existing stage admission and derivation scheduling remain the
cancellation/restart owners.

6. ✓ **Ordering and races.** Workflow current receipts retain pass-start
ordering and rejection of older failures. FTS binds within the existing
admitted transaction. The configured root remains distinct from active
index authority.

7. ✓ **Failure classification.** Seven metrics readers and the
hot-source attachment project existing Measured/Unavailable evidence
with original event tokens and fallback behavior. Required source join
and active-generation acquisition faults propagate; only a genuinely
absent index remains empty. The existing index-probe diagnostic is
retained before re-raising. Schema skew remains outside sqlite capture.

8. ✓ **Silent outcomes.** No stage is retired without a replacement. FTS
absence retains empty success, an invalid surface retains pending
refusal, and collector failures retain availability evidence and process
counters.

9. ✓ **Cleanup on failure.** Transferred readers retain finally-close,
including the ops-only schema-cookie probe now acquired through the
canonical query-only diagnostic profile; FTS retains rollback and close.
New authorizer-based fault regressions check that actual acquired metric
connections close. Synthetic membership connections use explicit
closing.

10. ✓ **Identity and keys.** No durable DDL or ID partition changes.
Workflow retains its stable current receipt key. The active generation
still comes from ArchiveLocation; workflow materialization and ops
receipt now keep the configured root.

11. ✓ **Lossless transforms.** Metrics family names, labels, samples and
process collectors are unchanged. The moved scalar SQL declaration names
the same function and argument at its new owner. No public serialized
schema changes.

12. ✓ **Degenerate inputs.** Existing metrics coverage includes
missing/malformed archives and measured/unmeasured groups. Source
regression covers duplicate paths, an absent path, multiple matching
sessions and a malformed required join. Empty stages retain their
existing outcomes.

13. ✓ **Consumers.** Repository search found and updated metrics
imports, workflow direct tests, receipt callers and all barrier
consumers. Unused archive writer and transient-lock wrappers are
deleted, as is the sole-consumer active-index probe/fallback. Retired
helper-name search has zero hits in the connected production/test/docs
paths; the independent embedding orphan helper does not fall back after
a failed read. The HTTP adapter retains only
responder/content-type/handler responsibilities. The existing query-only
reader census now covers all relocated owners.

14. ✓ **Tests and stubs.** New regressions name restoring substrate
imports or exemptions, following the promoted generation parent,
swallowing a required join fault, losing typed metric diagnostics, or
omitting finally-close as their failing mutations. The unchanged
complete selector covers 27 connected modules. First candidate 5206 had
490 passes and one fixture setup failure; corrected 5234 had 492 passes
and one real direct-open census failure, both reproduced by automatic
diagnostic retry. Third candidate 5242 passed all 495 selected tests
with three inherited lifecycle warnings; no diagnostic retry was needed.
The damaged-column fixture removes its two dependent triggers before
damaging the column, retaining all unavailable assertions.

15. ✓ **Trust boundaries.** Only neutral synthetic database fixtures
were added. No operator archive, transcript, original capture or private
evidence enters Git. Diagnostic event policy is unchanged; metric
payloads retain their existing bounded reason tokens.

16. ✓ **Assigned criteria.** F756 implementation and regression are
present; focused verification and twelve static gates pass on
cc9d913; default-branch disposition remains pending independent local
review, enforced checks and merge proof. Hosted Codex reviews were
disabled by the operator. Neither the parent task nor the other nine
F179 findings is claimed complete.

17. ✓ **Defect census.** Search covers every old helper name, daemon
metric import and configured barrier consumer. JSON baselines shrink
only, with no replacements at the new operations paths.

18. ✓ **Complete interface changes.** New owners replace the old
definitions in the same batch. Direct workflow test consumers import
operations, the three daemon composition sites import the new barrier
owner, and HTTP still publishes the same response.

19. ✓ **Typed visible failures.** capture_sqlite_read owns SQLite
acquisition refusal; events retain original reasons. Required joins
still raise, collector groups still expose availability, and
unsuccessful FTS publication remains pending.

20. ✓ **Regression mutations.** Restoring any adapter substrate import
or exemption fails the gate regression. Returning the active generation
parent fails workflow root/receipt assertions. Swallowing malformed
joins, serving a stale conventional index after promoted acquisition
failure, or retaining a metric reader fails the new production boundary
tests.

21. ✓ **Public evidence.** The patch contains code, current ownership
docs and synthetic tests only. Scratch patch, AST census, selector and
review remain outside Git under the task scratch directory.


## Residuals

Inherited coroutine and writer-lifecycle warnings were handed to the
active writer custody owner with their full immutable traces. This
ownership change neither suppresses them nor claims their production
fix. Historical task acceptance remains pending gated merge and
default-branch proof; unrelated F179 findings are outside this batch.
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