fix(daemon): persist judgment scheduler receipts (#3896) by Sinity · Pull Request #3896 · Sinity/polylogue · GitHub
Skip to content

fix(daemon): persist judgment scheduler receipts (#3896) - #3896

Merged
Sinity merged 19 commits into
masterfrom
feature/fix/judgment-scheduler-receipts
Aug 9, 2026
Merged

Sinity merged 19 commits into
masterfrom
feature/fix/judgment-scheduler-receipts

Conversation

@Sinity

@Sinity Sinity commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Repair judgment scheduler receipts and their daemon, API, and CLI projections. The change keeps one authoritative receipt per committed operation, makes durable outbox recovery bounded and failure-atomic, and exposes fresh queue health through the production status routes.

Problem

The scheduler could lose operation identity during receipt coalescing, accept malformed durable receipt evidence, append a competing failure after an acknowledgement failure, use an ambient archive root instead of an explicit one, and report stale or incomplete queue health. Direct CLI fallback also omitted the configured interval.

Solution

  • Thread operation identity through receipt persistence and reject cross-operation receipt contexts. Operation-owned receipts are not telemetry-coalesced.
  • Validate receipt status, reason, retry metadata, batch limit, persistence flags, and sweep counters before acknowledging events or markers.
  • Preserve the user-tier marker until its ops receipt is durable and recover markers oldest-first in bounded batches.
  • Serialize scheduler receipt writes through the coordinator and preserve the marker when acknowledgement fails.
  • Reload scheduler configuration after the post-sleep boundary, recover the resolved root before applying a malformed reload, and keep explicit roots authoritative.
  • Use the configured interval in daemon and direct fallback status, with bounded resolver failure containment.
  • Render receipt status, ISO timestamp, age, and reason through daemon and CLI status payloads.

No durable schema migration or production archive mutation is part of this change.

Verification

  • POLYLOGUE_PYTEST_WORKERS=1 PATH="$PWD/.venv/bin:$PATH" devtools test tests/unit/daemon/test_judgment_automation.py tests/unit/daemon/test_daemon_status.py tests/unit/cli/test_status.py tests/unit/api/test_assertion_candidate_queue_health.py -k 'not archive_facade_route_catalog_covers_public_async_facade': 230 passed.
  • PATH="$PWD/.venv/bin:$PATH" devtools test tests/unit/daemon/test_judgment_automation.py -k 'operation_owned_receipts or receipt_context_rejects or semantically_invalid_counter or replays_receipt_markers': 4 passed.
  • Independent cold review reran the scheduler and queue/status production-route selections: 31 and 26 passed, with no legitimate code findings.
  • PATH="$PWD/.venv/bin:$PATH" devtools verify --quick: all 24 steps passed, including mypy, layering, policy, lint, and generated-surface checks.
  • git diff --check origin/master...HEAD: passed.

The unfiltered focused selection also exposed one inherited repository baseline failure in tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade: the current origin/master from Ref #3902 has the public route without the catalog entry. That unrelated route catalog was not changed; the affected selection above excludes only that test.

Whole-Bead disposition

Bead Disposition Evidence Successors
polylogue-5bxpy satisfied Current repair commits, focused production-route tests, and devtools verify --quick in the structured carrier below none

Review disposition

The six requested review dimensions and the exact-head recovery findings are covered by the commits and tests above. The final carrier binds this body to the rebased PR head. The PR remains non-draft and is not being merged by this change.

Loading
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