Repository navigation
fix(cli): Type the kernel's daemon-absent refusal in the machine envelope - #5474
Conversation
…lope test_cli_operation_authority.py had 8 red on master: a daemon-down CLI mutation emitted code "runtime_error" instead of "daemon_required". OperationUnavailableError is a RuntimeError, not a ClickException, so it missed the DaemonRequiredError branch and reached the generic handler -- the exact flattening that branch's own comment says it exists to prevent, arriving by the other door once the CLI stopped executing in-process (polylogue-3eexy). machine_main now maps it, carrying `operation` as an envelope field, and the refusal message names the operation so the terminal format -- which has no field to read -- says which route refused. 8 red -> 4 red. The remaining 4 are a separate, pre-existing question: a `mark` refuses at the cli.query that resolves its target, so the message names cli.query while the test expects the mutation the operator asked for. That is a decision about which operation a compound verb should name, not this mapping. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 12 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 (2)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b7bca44ee
ℹ️ 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".
…essors (#5479) ## Summary Third single-wave batch: **12 `gpt-5.6-luna` workers, 24 beads**. Eight write lanes produced commits, four wrote to the tracker rather than the tree. **Zero merge conflicts across eight worktrees**, third wave running. ## What landed | commit | bead | |---|---| | `test(cli): retire direct-read expectations` | `3eexy` AC5 — the last blocker; AC1–4 were already proven | | `fix(status): attach sibling tiers for embed fast path` | `gqkae` — the bead filed earlier today | | `fix(storage): fail closed on unknown revision authority` | `sze30` AC1–3, `3szyi` AC1–3 | | `fix(daemon): settle failed admission telemetry` | `8qm4k` AC2–AC5 | | `fix(polylogue-wzgpf): preserve split identity fallback reasons` | `wzgpf` AC2/4/5/7 | | `test(api): prove bounded attachment page delegation` | `q54dt` — all five ACs now satisfied | | `fix(polylogue-bp12n.5): validate halted-unit status evidence` | `bp12n.5` AC2 | | `perf(test): defer pilot resource imports` | `1xc.14.1`, `016xl` | | `fix(test): type the api facade double…` | coordinator integration fixes | `gqkae` is the notable one: I filed it this session after diagnosing that `embed.py`'s fast path performs no `ATTACH`, so ops and embeddings state read as *absent* rather than *not consulted*. A wave-3 lane picked it up and fixed it — the tiers are now attached explicitly, with a missing tier remaining a measured absence. ## Tracker work — the part that actually moves the closure Four lanes changed bead records, not code: - **Three unbounded epics split into nine dispatchable successors** (`tar1n` ×4, `va9vx` ×2, `a7xr.27` ×3), each with real acceptance criteria naming its anti-vacuity mutation, wired with dependency edges. `bd dep cycles` clean. This *raises* the nonclosed count, correctly: undispatchable epics became workable beads. - **Five beads moved `specification-required` → `implementation-residual`** (`016xl`, `pnxl6`, `uty2s`, `4wqi2`, `xul7`). Wave 2 measured that their premises were false; wave 3 applied the rewritten criteria. `016xl` now requires ≤22.3 KiB/item instead of a 430 MiB target derived from a node-id length that measures 119.6, not 242. - **`k8wv` dispositioned** `final-build-evidence` — it was the only unblocked campaign record without a token. - **`gd9i1` measured**: warm status **3288.8 ms against a 400/800 ms target**, mixed load **3552.66 ms against 250/500** — roughly an order of magnitude over budget, both baselines `rounds=1` and informational. A stale "identical reads" claim was refuted against `test_daemon_operation_profile.py:147-168`. ## Verification — once, over the integrated result ``` devtools verify --quick -> PASSED exit=0 devtools test <11 touched test files> -> 1 pre-existing failure, rest green ``` ## Residual, stated honestly - `test_daemon_and_direct_status_share_zero_head_unavailable_ops_semantics` fails. **Confirmed failing on clean `origin/master`** in a detached worktree, so it is not from this branch. It expects direct status to work without a daemon, which `#5474` made refuse typed. - `test_status_json_reports_ready_next_action` and `test_status_json_includes_latest_catchup_run` still fail. The attach now happens, but the non-pinned path reads `root / "ops.db"` directly and the fixture's `root` resolution is not settled. These fixtures hand-build tier shapes; the ops tier is now seeded from production DDL here, which is strictly better but not sufficient. Tracked on `gqkae`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
## Problem ``` $ polylogue --plain --no-daemon facets $ echo $? 1 ``` Exit 1, and **no output at all**. Not an error message, not a hint — a blank screen. The kernel's `OperationUnavailableError` is a `RuntimeError`, not a `ClickException`, so it escaped the command and Click printed nothing. This is the same flattening #5474 fixed for the machine envelope, arriving on the human-facing path. The delete route already handles it correctly, converting to `DaemonRequiredError` at `archive_query.py:1590`. `facets` was the read-side gap. It matters because the project's rule is that a missing daemon must refuse *typed*, never break — and "exit 1, say nothing" is the worst version of breaking. ## Fix `facets` converts the refusal the same way delete does, carrying the operation name: ``` $ polylogue --plain --no-daemon facets Error: start polylogued run to serve this operation: facets ``` ## The three red tests `TestCliTerminalOutcomes` asserted `exit 0` and an `outcome` from an in-process facets read over an empty and a populated archive. `polylogue-3eexy` retired the CLI's direct-read execution mode, so no such route exists to produce one — these have been red on master since, unnoticed while the pytest pool sat paused. They now pin the refusal, and specifically that it is **not silent**. That is deliberate: a zero-output render is the same "answer nothing, say nothing" defect the original tests were written against, so the replacement guards the same property on the route that actually exists. Their outcome semantics stay pinned closer to the data, where they are stronger: - `FacetsResponse` refuses construction without an outcome (`test_facets_response_refuses_construction_without_one`) - the daemon facets route is covered in `tests/unit/operations/test_daemon_reads.py` Anti-vacuity: drop the handler in `cli/commands/facets.py` and the output is empty again, failing the message assertion. ## Verification ``` devtools test tests/unit/surfaces/test_terminal_outcomes.py -> PASSED exit=0 devtools verify --quick -> PASSED exit=0 ``` Red before this change (3 failed), green after. Confirmed pre-existing on clean `origin/master` at `97215a437` before fixing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
## Problem `polylogue-tar1n.2` (wave 4) routed MCP privileged writes through the daemon, which is correct. But its refusal said only: ``` start polylogued run to serve this operation ``` The MCP error payload carries no separate field for the operation name, so a client is told that *something* privileged refused, without being told which route. `test_rebuild_insights_with_confirm_names_its_sealed_owner` asserts the message names `maintenance.insights.rebuild`. The lane that wrote this never saw the failure: its focused run was still queued in the shared pytest pool when it handed off, and it reported `MCP-4 BLOCKED-ON shared pytest pool result` honestly rather than claiming a pass. I ran it during closure review. ## Fix Both refusal sites interpolate the operation, as the CLI machine envelope already does since #5474. ## Verification ``` devtools test tests/unit/mcp/test_privileged_tools.py -> PASSED exit=0 devtools verify --quick -> PASSED exit=0 ``` Red before this change, green after. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…5486) ## What this fixes A full-corpus `verify --all` at master `2df6e2fa9` returned **259 failures**, dominated by one cause. `polylogue-3eexy` retired the CLI's direct-read execution mode: the daemon is the required executor and the CLI is a thin client, so a CLI command with no daemon returns a typed daemon-required refusal and exits 1. Every test invoking a CLI surface in-process failed with `cli surface failed (1) for '<expression>'`. Four instances were fixed piecemeal earlier today (#5474, #5476, #5481, #5484). They were samples, not the population. ## The fix was already in the repo `tests/infra/daemon_operations.py:194` — **`cli_daemon_archive`** runs a real `DaemonOperationRuntime` behind a real UDS listener and points the CLI at it. Its docstring states the rule: *"A CLI test that wants to observe what a mutation actually does therefore has to supply the daemon the command requires."* **Nine test files already used it**; every failing file used it zero times. So this is a mechanical migration onto an established pattern, not a redesign. Each test got one of two treatments: - **FIXTURE** — the test observes CLI behaviour → take `cli_daemon_archive` - **REFUSAL-ASSERT** — the test pins daemon-*absent* behaviour → assert non-zero exit, a message naming the operation, and non-empty output (the shape #5481 established for `facets`) No assertion was weakened and no test deleted to reduce the count. ## Result | lane | files | before | after | |---|---|---|---| | m1 | documented query corpus, query route differential | 36 | 0 | | m2 | messages, plain CLI snapshots | 30 | 0 | | m3 | status ×2, json envelope contract | 25 | 3 | | m4 | reference/query-law differentials, basic usage CLI | 26 | 4 | | m5 | query mutation authority, expression, contextual errors, pagination | 22 | 0 | | m6 | plain output contract, interactive, output schemas, operation authority | 16 | 0 | | m7 | product query workflows (+ source cache reuse) | 13 | 8 | | **total** | | **168** | **15** | **All 15 remaining failures are pre-existing**, each verified by exact test name in the pre-migration corpus log: 3 `TestArchiveTableCounts` archive-count assertions, 4 query-law census plan-classification cases, 8 `test_source_cache_reuse` cache-semantics failures unrelated to the CLI. ## Verification ``` devtools verify --quick -> PASSED exit=0 devtools test <18 migrated files> -> 3 failed (all pre-existing), rest green ``` ## Coordinator notes Three of seven lanes (`m1`, `m2`, `m5`) completed correct work and left it **uncommitted** in their worktrees; committed here after `ruff` import-order and format fixes. A secret-scan candidate in `test_complete_selection_pagination.py` was reviewed and is a false positive — it matches the parameter name `row_key` and a query-token constant, not a credential. `polylogue-3eexy` was closed earlier today on a lane's report that its AC5 ("no tests exercise the retired direct path") held over the three files that lane owned. The corpus showed hundreds still did. That premature close is recorded on the bead, with `n57xe` as its successor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Behavior Changes** * CLI operations that require archive access now report a typed status refusal when the daemon is unavailable, rather than presenting a successful direct-archive fallback. * Status-related errors are checked for clear messages and nonzero exit results. * **Testing** * Expanded coverage of CLI, query, transcript, usage, and MCP workflows using daemon-backed archives, including multi-page selections and cross-origin search. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
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. |
Summary
tests/unit/cli/test_cli_operation_authority.pyhad 8 failures on master: a daemon-down CLI mutation emittedcode: "runtime_error"instead of the typeddaemon_required. 8 red -> 4 red.Root cause
OperationUnavailableErroris aRuntimeError, not aClickException, so it missedmachine_main'sDaemonRequiredErrorbranch and reached the generic handler. That branch's own comment states exactly what this breaks:The flattening arrived by the other door once #5453 stopped the CLI executing operations in-process (polylogue-3eexy). The guard existed; the new path went around it.
Fix
machine_mainmapsOperationUnavailableError, emittingerror_daemon_requiredwithoperationcarried as an envelope field so a client need not parse it from the message (polylogue-re6s3 AC4). The refusal message also names the operation, because the terminal format has no field to read it from — an operator told only "start polylogued run" cannot tell which route refused.Verification
The remaining 4 are a different question, not this mapping
A
markrefuses at thecli.querythat resolves its target, so the message truthfully namescli.querywhile the test expectsmutation.annotation.save.That is a decision about which operation a compound verb should name — the one that actually refused, or the one the operator asked for. Both are defensible and the tests encode the second. Forcing them green here would mean naming an operation that did not fail, so they are left red with the reason recorded rather than papered over.
How it was found
A
gpt-5.6-lunaworker checking whether polylogue-d02y8 was close-ready reported these as inherited baseline failures. It is the third time this session a worker with no stake in a file surfaced a regression on master thatverify --quickcannot see — none of these suites are in the quick set.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy