Skip to content

fix: route daemon collection through operations owners - #5867

Merged
Sinity merged 3 commits into
masterfrom
fix/daemon-layering
Oct 1, 2026
Merged

Sinity merged 3 commits into
masterfrom
fix/daemon-layering

Conversation

@Sinity

@Sinity Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner

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:

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.

Sinity added 3 commits October 1, 2026 03:53
Remove the conventional-index fallback after active-generation acquisition
fails. Preserve the diagnostic and actual exception, with promoted-index and
absent-tier regressions. Repair the deliberately damaged-column fixture by
removing dependent triggers before dropping its column.

Finding | Disposition | Evidence
F756 | fixed by f823d48 and this correction | operations owns actual collection,
workflow publication, membership, FTS acquisition and publication; all 15
adapter exemptions and eight obsolete degradation anchors are removed.
The former fts_convergence direct import was fixed later by 14e1d82;
its stale exemption was removed by 9d33b52.

Focused verification remains pending on this corrected candidate.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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
🔒 Security Review ✅ Completed 2026-10-01T03:00:39.518402Z cc9d913 PR opened
ℹ️ About Codex in GitHub

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

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

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

@Sinity
Sinity enabled auto-merge (squash) October 1, 2026 02:57
@Sinity
Sinity merged commit 07e6bb5 into master Oct 1, 2026
3 checks passed
@Sinity
Sinity deleted the fix/daemon-layering branch October 1, 2026 02:59
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