Repository navigation
fix: Stop reporting an unreachable daemon as running and a guess as a verdict - #5047
Conversation
Problem: `polylogue ops status` rejected any daemon URL other than the built-in one, which is exactly what `_default_daemon_url` exists to produce from site/user TOML and `POLYLOGUE_DAEMON_URL`. The refusal was then rendered as "Daemon: running" with `daemon_liveness: true` and a `daemon_reachable` route attribute of True, on a workspace where no daemon existed at all. Reproduced without pytest on one empty workspace: `POLYLOGUE_DAEMON_URL=http://127.0.0.1:1` gave "Daemon: running", the same command with the variable unset gave "Daemon: not running". Solution: accept every URL the resolver can produce. This route reads through the configured archive route, so the URL selects nothing here and an address no daemon answers simply yields the direct fallback. A failed status read now records `daemon_reachable = False`, renders "Daemon: unreachable", and publishes `daemon_liveness: false`. The direct renderer also names the daemon state it actually observed and keeps the convergence-debt reason instead of collapsing an unread ledger and a healthy empty one into the same line. Anti-vacuity: reinstating the `daemon_url not in (None, _BUILTIN_DAEMON_URL)` refusal turns `TestStatusOperationUrlPolicy::test_configured_override_url_is_not_refused` red; restoring the refusal-to-True liveness mapping turns `test_status_command_reports_operation_unavailable_without_claiming_liveness` red. Verification: devtools test tests/unit/cli/commands/test_status.py, tests/unit/cli/test_init.py, tests/integration/test_basic_usage_cli.py, tests/unit/cli/test_json_envelope_contract.py — all PASSED. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
…r measured
Problem: `polylogue ops status --json --full` published a self-contradictory
verdict on a pristine, empty archive: `converged: {value: false, reason:
"ready"}`. `raw_materialization` was the one derived domain whose `ready`
came from a different predicate than its `summary` —
`raw_materialization_ready` versus the component projection — and the two
disagree whenever the stricter predicate's preconditions (parser census,
raw-authority frontier, debt classifier) were never inspected. It also
omitted `determinate`, so an uninspected domain produced a `false` the
third claim state exists to prevent (#5027).
Solution: derive `ready` and `summary` from the one component projection on
both the direct and the daemon-serving path, and classify the stricter
predicate's never-run preconditions with
`raw_materialization_unmeasured_reason`. An uninspected precondition
withholds certification (`determinate=False`, value `None`, reason naming
the gap); it never masks a projection that already found the domain wanting,
which stays a determinate refutation. `raw_frontier_integrity` and
`embeddings` now pass `determinate` like their siblings.
The helper lives in `readiness/claim_guard.py` rather than
`storage/archive_readiness.py`: that module is inside the derived-schema
identity closure (`devtools schema closure`), the predicate it mirrors is
unchanged, and classifying a claim is not a storage concern. No changed file
is in the closure, so no reconvergence is required.
Anti-vacuity: deriving `ready` and `summary` from different predicates again
restores the `value: false` / `reason: "ready"` pair and turns
`test_status_subprocess_malformed_ingest_attempts_json_keeps_convergence_healthy`
red; dropping `determinate` from the raw domains turns
`test_direct_operation_fails_closed_for_missing_ops_frontier_authority` red.
Verification: devtools test tests/unit/daemon/test_daemon_status.py,
tests/unit/cli/test_status.py (one inherited failure, identical at
f84dd3b), tests/unit/storage/test_archive_readiness.py;
devtools verify --quick exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 32 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (7)
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. Comment |
## Summary
Two stacked causes, both in the test. The brief's diagnosis named the
first
and is correct as far as it goes; fixing the fixture alone is **not**
sufficient, and this records the second cause honestly.
## Problem
**First, a short fixture.** `_malformed_convergence_debt_archive`
(`tests/unit/cli/test_status.py:851`) created SOURCE, INDEX, EMBEDDINGS,
USER
and OPS but **not AUDIT**, while its sibling
`_malformed_ingest_attempts_archive` creates all six. With AUDIT absent,
`ops status --json --full` correctly reports
`claim_guard.openable=false, reason="missing archive tier(s): audit"`.
**Second, with the fixture complete the surviving assertion is itself
stale.**
`assert payload["claim_guard"]["converged"]["value"] is True` is what a
complete six-tier fixture now fails on. Reproduced directly at head with
the
fixture repaired:
```
"openable": {"value": true, "determinate": true}
"converged": {"value": null, "determinate": false,
"reason": "inspection incomplete for raw_materialization: ...",
"signal": "derived_domain_readiness.raw_materialization"}
```
PR #5047 (`1809cb9ee`, `polylogue-kjy0a`, "Stop reporting an unreachable
daemon as running and a guess as a verdict") made the claim **withheld**
for
an archive whose raw-authority frontier was never inspected. That PR
updated
this file's sibling test to the new shape -- it asserts exactly
`converged["value"] is None` and `determinate is False` -- but left this
one
alone, because this test was already red on the missing AUDIT tier and
so the
stale assertion was never exposed.
The test's first four assertions -- its actual subject, malformed debt
stays
explicitly visible without replacing readiness -- pass at head
throughout.
## Solution
- Add `ArchiveTier.AUDIT` to the helper, matching its sibling, and
record in
the docstring why every tier must be present.
- Replace the single `converged.value is True` with the shape the
sibling
already pins, plus the assertion that carries this test's real subject:
the
gap the withheld claim names must be `raw_materialization`, **never**
the
debt ledger.
## Verification
```
devtools test tests/unit/cli/test_status.py
(receipt 20260914T164537Z-focused-test-3168362-d6463354)
-> 40 passed / 40 collected
devtools verify --quick -> exit 0, 15/15 gates
```
## Anti-vacuity
Let the debt-read failure propagate into the convergence claim and
`signal`/`reason` start naming convergence debt; report a guess as a
verdict
again and `determinate` goes True. Either turns this red.
## Residuals
Test-only change. No other archive-building helper in this file is short
a
tier -- the two were checked.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Closes
polylogue-2d8oqandpolylogue-kjy0a. Both are instances of the defectshape this campaign has now hit six times: a refusal or an unmeasured state
collapsed into a positive claim.
Bug 1 — the URL policy
I accepted what
_default_daemon_urlproduces and deleted the refusal. Itcould not be justified:
_default_daemon_urlexists precisely so site/user TOMLand
POLYLOGUE_DAEMON_URLcan point the CLI away from the built-in address, and_status_operation_resultrefused exactly those values. Correcting_default_daemon_urlto agree was the wrong direction — this route reads throughthe configured archive route, so the URL selects nothing here, and an address no
daemon answers must simply yield the direct fallback. The corpus already agreed:
test_status_json_daemon_not_runningpasses--daemon-url <unreachable>andasserts
source == "direct".Separately, and regardless of the URL: a failed status read now records
daemon_reachable = False/daemon_path = "unreachable", rendersDaemon: unreachable, and publishesdaemon_liveness: falsewith reasonstatus_read_failed.Reproduced without pytest at the tip: with
POLYLOGUE_DAEMON_URL=http://127.0.0.1:1and with it unset, the same workspace now produces byte-identical output, and
no
Daemon: runningappears anywhere.Bug 2 — ready / summary / determinate now agree
readyandsummarycome from one component projection, on the direct path(
operations/daemon_status.py) and on the daemon-serving path(
daemon/status.py) — which carried the identical defect and which the bead didnot mention. The stricter predicate's extra preconditions (parser census,
authority frontier, debt classifier) are classified by a new
raw_materialization_unmeasured_reason.One refinement mattered. The first version withheld the claim whenever any
precondition was unmeasured, which masked genuine debt refutations —
test_build_daemon_status_claim_guard_reports_openable_but_not_convergedcaughtit. The rule is now: an uninspected precondition withholds certification only
(a
readyprojection drops todeterminate=False); a projection that alreadyfound the domain wanting stays a determinate
false.On a pristine empty archive:
{"value": null, "determinate": false, "reason": "inspection incomplete for raw_materialization: raw authority frontier inspection not completed"}Placement: no reconvergence required
storage/archive_readiness.pyis IN the derived-schema identity closure. Thefirst draft edited it, which would have moved the schema identity and forced a
full reconvergence for a status-surface fix. That file is reverted to base and
the helper lives in
readiness/claim_guard.py(out). Every changed fileconfirmed
out.The seven tests
Five pass untouched:
test_basic_usage_cli.py×3,test_json_envelope_contract.py×2, plus
test_terminal_snapshots.pyandtest_convergence_surface_contract.py.Two caveats, stated plainly:
test_basic_usage_clitests did not go green on the URL fixalone. Getting past the refusal exposed that
_render_direct_status_payloadnever named the daemon state and printed
Convergence debt: 0 failed, 0 deferred, 0 retry duefor a healthy empty ledger — and a bareunavailableforan unread one, discarding the reason the reader had already computed. Same
defect family; the renderer was fixed, not the tests.
test_json_status_snapshotis still red for an unrelated pre-existingreason: the direct read takes an exclusive ownership
flockand the seededlease is a sealed read-only directory. Evidence it is not mine:
test_plain_read_all_snapshot, touching none of this code, fails identically onunmodified
f84dd3b0c. (PR fix: Read verbs no longer take the exclusive maintenance-writer lease #5043 addresses that producer.)Tests changed, and why
Four assertions encoded the bugs: two asserted
daemon_liveness is Trueon afailed read;
..._keeps_convergence_healthypinnedreason == "ready"withoutasserting
value— i.e. it pinned exactly thefalse/"ready" contradiction;..._missing_ops_frontier_authoritydemandedvalue is Falsefrom a domainreporting unknown. Two
test_inittests asserted exit 1 + "Status snapshot:unavailable", reachable only via the refusal.
Anti-vacuity
test_configured_override_url_is_not_refusedred.Trueliveness →test_status_command_reports_operation_unavailable_without_claiming_livenessred.ready/summaryfrom different predicates →..._keeps_convergence_healthyred.determinatefrom the raw domains →..._missing_ops_frontier_authorityred...._reports_openable_but_not_convergedred. This one already fired during development.Sweep: 11 more live instances, filed not fixed
Highest severity:
archive_readiness.py:1764publishesarchive_sessionsreadiness as the literal
True;daemon_status.py:217hardcodesactive_archive_root_matches_configured = Truewhile the honest comparisonalready exists at
cli/commands/paths.py:102;daemon/fts_status.py:131is aliteral
except sqlite3.Error: return {"session_work_events_ready": True}whereevery sibling key returns
False.Structurally the important one:
build_daemon_status's_v()substitutesoptimistic model defaults for components whose collector timed out, so a
timed-out raw-materialization probe renders
state: ready, summary: "ready"withall-zero counts. That single root cause drives four findings — including
perf_measurablecertified from a summary object carrying noavailable/errorfield at all, while the direct path handles the same case correctly. Two producers
of one claim, drifted apart, exactly as in bug 2.
Also:
capability.py:665has no branch for an unavailable embeddings tier, so aprobe that never ran emits
determinate=True, ready=False— a certifiedrefutation from an unmeasured domain, the inverse-polarity twin of bug 2. And
daemon/status.py:2742hardcodescomponent_state.api = "running", sopolylogued statuswith no daemon listening printsdaemon_liveness: falseanddaemon_api: runningin one payload.Confirmed correct:
surfaces/outcome.py,operations/status_workload.py, severalreadiness predicates.
Verification
devtools testacross nine status/init/readiness/integration selectors — allPASSED except the two reds described above.
devtools verify --quickexit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK