Skip to content

Fix daemon and surface test failures at their owners - #6688

Merged
Sinity merged 9 commits into
integrate-20261101from
pl-daemon-surfaces
Nov 1, 2026
Merged

Sinity merged 9 commits into
integrate-20261101from
pl-daemon-surfaces

Conversation

@Sinity

@Sinity Sinity commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • Change feed: the changes unit reports stored assertions as kind assertion, but the after: condition, the declared kind values, the feed's component check, the web client and several tests still said note, so an assertion written after a position was never delivered. All now say assertion.
  • CLI read states the format it prints (the daemon defaults an unnamed format to JSON for its own callers) and styles the terminal heading through the client.
  • Takeover counts assertions by other authors that the operator has not accepted and names the query that lists them (as the brief does); a dead empty notes list and its writer were deleted.
  • Selection note: removed a redundant conversation membership check that refused a captured message; the recorded-membership check after it remains.
  • Tests aligned with current behavior: Python client compares resolved archive paths, reads the typed item shape and accepts the per-run time and archive position each continuation records (docs/query.md, clocks); web permission test renames the assertion table; read-limit test propagates the reader deadline error; morrow fixture gives messages origin-qualified IDs; import test uses a preserved tool layout (docs/capture.md, Import); tour test expects the counted assertion (docs/agents.md, Brief); browser host test reads the answer envelope, waits for an idle daemon, and has a deadline.

Deleted: the redundant membership check, the unused takeover notes list and write_notes.

Verification: fast job 174 (fmt, boundaries, clippy) passed on the rebased head. Focused job 175 on that head: 223 of 227 passed. Failing: saved_relation_errors_reach_the_query_error_path and an_assertion_reference_names_the_current_revision_or_one_revision (other lanes), and the two selection-note tests below.

Not fixed: browser_host::a_native_selection_note_is_readable_by_cli_after_daemon_restart and browser::tests::notes::selected_passage_notes_survive_restart_and_identical_retries. The daemon query messages where id:"chatgpt:native-message" active:* duplicate:* hidden:* selects 0 rows through the prepared selection although the message and session exist (a CLI listing with the same filters shows them); the error now reports the selected row count. Cause not found yet.

Not fixed (other lanes): daemon::query::tests::composition::saved_relation_errors_reach_the_query_error_path and references::an_assertion_reference_names_the_current_revision_or_one_revision. docs/capture.md lists import --format, which the CLI does not declare.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em

Sinity and others added 8 commits November 1, 2026 10:01
The Python client resolves the archive path before passing it to the
command, so the test compares resolved paths. Settings are stored as
assertions, so the unavailable-permission test renames that table. A read
waiting for the write lock fails while acquiring its reader, so the test
propagates that error instead of unwrapping it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
The change feed's own query reports stored assertions as kind assertion;
the declared values, the feed's component check, the web client and the
tests still said note, so a stored assertion was never delivered. The CLI
read states the format it prints instead of inheriting the daemon's JSON
default. The Python client tests read the typed item shape and accept the
new run time and archive position each continuation records. The morrow
fixture gives every message its origin-qualified identity.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
The after: condition of the changes unit still named the old kind, so
assertions written after a position were never delivered. The CLI read in a
terminal now styles its heading through the client; the takeover tour test
expects the held assertion the docs describe; the import test uses a preserved
tool layout; the browser host test reads the answer envelope.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
…ish the capture

A takeover dropped assertions by other authors without a word. It now
counts them as the brief does and names the query that lists them. The
browser host test waits for the daemon to be idle, as the unit test does,
before it writes a note.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
The recorded message membership check that follows already proves the
message belongs to the supplied conversation. The earlier check judged
membership by the session's own active messages and refused a captured
message. The browser host test now passes the query as the positional
argument.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-01T09:31:17.395114Z
We couldn’t complete this review. Comment @codex security review to try again.
1eadcfb 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

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@Sinity
Sinity merged commit c0195c9 into integrate-20261101 Nov 1, 2026
@Sinity
Sinity deleted the pl-daemon-surfaces branch November 1, 2026 10:40
Sinity added a commit that referenced this pull request Nov 1, 2026
The daemon now returns one typed answer, `command_surface::Answer`, to
every surface. Before this change it answered with its own `Response`
enum. That enum turned empty and degraded answers into plain ok, dropped
notes and next actions, and stored the failure kind as a string plus an
untyped `detail` object. The edges then worked the outcome back out from
payload fields (`pending`, `state`, `/user_state/pending`, `currency`,
`incomplete`, `empty`, `outcome`) and rebuilt failures by reading fields
out of `detail`.

Builds on Sinity/polylogue-sinex-common#68, merged as `149e9e2`, which
adds a typed `candidates` list to the shared `Failure`. Cargo.lock is
moved to that commit here.

## What changed

- **Deleted:** `daemon::Response`, both `From` conversions,
`Response::answer`, `protocol::answer` (the code that worked out the
outcome from fields), the `detail`-parsing `protocol::failure(code,
message, detail)`, `query::response`, `execution::exit_code`, the
`daemon::query::Failure` that held a string kind and detail, the
per-module duplicate error mappings (`read::failure`, `language_error`,
`cursor_failure`, page `failure`), and `SelectionError::detail`.
- **Where the outcome is decided:** each answer's outcome is set by the
code that builds it.
- A write that Sinex has not confirmed yet is degraded, with a note.
This covers user writes, context deliveries, assertion queries, and
`StoreError::PrimaryPending`, which is now a degraded receipt.
  - An import whose user state is still pending is degraded.
- Queries return their computed outcome (`QueryAnswer { value, outcome,
notes }`). An incomplete part makes the answer degraded and names the
part in its notes.
- Status and read pages over an index that is not current are degraded,
with a note.
  - SQL, completion and resumable lists that match nothing are empty.
- **Failures:**
- The daemon has one internal error, `daemon::Failure`, which wraps the
shared failure. It exists only so `?` can convert into it. Store,
selection, query and query-language errors convert into it once, at the
owner, with typed position, correction, hint and candidates.
- The kind is the shared `FailureKind`. The product code stays in
`Failure::code`, classified once in `FAILURE_CLASSES`. `invalid_cursor`,
`attachment_unavailable`, `embeddings_off` and `confirm` are now
registered.
- Store selection refusals keep their code in a new
`StoreError::Selection`. An ambiguous ID prefix is now the typed
`StoreError::Ambiguous`, and its matches become `candidates`.
- **Timeouts:** a timeout refusal names its stage from the typed request
instead of serializing the request and reading `text` back. It sets the
narrower query as the suggestion and gives the stage and SQLite step
count in a note.
- **Edges:**
- The socket, HTTP, web pages and browser routes pass the answer through
unchanged. The browser routes keep their JSON body and take their status
from the failure kind.
- MCP structured output passes the answer through unchanged. MCP text
stays JSON for values; for a failure it lists the candidates and notes.
- CLI `--json` passes the answer through unchanged. On a terminal the
CLI prints notes and candidates on stderr.
  - The CLI output handlers receive the whole answer.
- **Docs:** `interfaces.md` says who decides the outcome and notes, and
names `candidates` in the JSON error. `query.md` lists `candidates`.

## Tests

- New test
`cli::query_surfaces::a_degraded_answer_keeps_its_outcome_and_notes_on_every_surface`
sends a degraded query (`similar:` with embeddings off) through CLI
`--json`, the socket and MCP `structuredContent`. On each surface it
checks outcome `degraded`, exit 5, the rows, and the same notes naming
the missing part. On the old code the notes were empty, so this test
fails there.
- `protocol::tests` were rewritten around the explicit constructors.
- **Owned tests:**
- `a_name_two_saved_queries_share_is_refused` and
`saved_relation_errors_reach_the_query_error_path` now check that
ambiguity is refused as `ambiguous` and lists both roots, through
`candidates` (references.md "Ambiguity is an error").
- `an_assertion_reference_names_the_current_revision_or_one_revision`:
`page:` and `file:` references now answer `not_built` (query.md,
references.md) instead of `unknown_field`.
- `every_surface_refuses_command_words_and_values_outside_a_set`: `"test
output"` is refused because a field name is never a search word (common
query-language README). The quoted form still searches.
- `native_hook_failures_reach_ordinary_mcp_reads_and_budgeted_pages`:
the previous commit's update identifies a message header by its
reference. `Source.message` is the containing message of a block, and a
header built by `Source::record` leaves it unset. Checked against the
model and kept.

## Verification

These checks ran on head `f541cca917`, rebased on `ee5b55eddb`.
Cargo.lock is at common `149e9e2`, which contains #68, and is no longer
linked to a local checkout.

- **`fast` (AgentCTL job 262):** passed. It runs fmt, boundaries and
clippy in both configurations.
- **`focused -p polylogue -p polylogue-store` (job 263):** 1455 tests,
1420 passed, 34 failed, 1 timed out, 9 skipped.
- **Against the coordinator's baseline** (job 213, the unmodified
integration head `93da945931`, 58 failures):
  - 32 of this run's 35 failures are baseline failures.
- 26 baseline failures pass here. They include four of the five assigned
tests:
`an_assertion_reference_names_the_current_revision_or_one_revision`,
`every_surface_refuses_command_words_and_values_outside_a_set`,
`a_name_two_saved_queries_share_is_refused` and
`native_hook_failures_reach_ordinary_mcp_reads_and_budgeted_pages`.
  - The new degraded-answer test passes.
- **Three failures are not in the baseline:**
- `cli::tests::literal_read_envelope_is_not_expanded_with_cli_defaults`:
a page read through the CLI now sends the restated call
(`write_out::call(&request, accepted)`) instead of the literal envelope.
That line came in with #6688 after the baseline commit; this PR does not
touch it.
-
`mcp::tests::generated_ready_mcp_call_executes_its_exact_typed_envelope`:
timed out after more than 90 seconds while the host was heavily loaded.
Not yet reproduced.
-
`daemon::service::read::object::tests::actual_no_effect_request_read_records_one_object_run_and_roundtrips_through_directory_import`:
the run outcome is not yet visible when the test reads it
(`object/tests.rs:115`). In earlier runs a sibling test failed at the
same line and then passed again, and `record` is mechanically unchanged
here. It looks like a race between the finish write and the next read,
but this is not confirmed.
- `saved_relation_errors_reach_the_query_error_path` is still a baseline
failure. It now passes the ambiguity check and fails later, where
`sessions where cost > nonsense` is not refused at plan preparation;
that is outside this change.

`rg '\bResponse\b' crates --type rust` finds only HTTP response types,
the operation trait's associated `Response`, the Claude Code parser's
own `Response` struct, comments and fixture text. No outcome is worked
out from payload fields any more.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sinity added a commit that referenced this pull request Nov 1, 2026
… commit run outcomes before answering (#6694)

## What changed

- **CLI read sends a literal call exactly as written.** #6688 made the
page path rebuild the call from the parsed request so the CLI could
state its print format; that also expanded a `--request` call with CLI
defaults. The stream command handlers now receive how the call arrived
(`CallForm::Literal` or `CallForm::Flags`). A literal call is sent
unchanged; a call built from flags still states the format and delivery
the client uses (docs/interfaces.md, "Ready calls are complete
requests"). Fixes
`cli::tests::literal_read_envelope_is_not_expanded_with_cli_defaults`.
- **Query preparation refuses values a numeric field cannot take.**
`sessions where cost > nonsense` prepared successfully and failed only
at SQL compilation, so a historical saved definition with that text got
a semantic identity. Preparation now checks each value compared with a
catalog number, amount or duration field, using the bound query's typed
operands. The value rule moved to its owner, `polylogue-query`
(`fields::Kind::scalar`, `time::money_nusd`), and store compilation uses
the same rule; the store's copy of `money_nusd` is now a re-export.
Fixes `composition::saved_relation_errors_reach_the_query_error_path`.
- **A run's outcome is committed before its answer returns.**
`execution::record` sent the outcome to the writer and dropped the
receipt without waiting, so a read right after the answer could find the
run (begin is synchronous) without its outcome. The answer cites
`run:<id>`, so the record now waits for the outcome receipt. This adds
one writer round trip per execution; begin already costs one. Fixes
`object::tests::actual_no_effect_request_read_records_one_object_run_and_roundtrips_through_directory_import`.

Deleted: the store's own `money_nusd` body and the duplicate scalar
parsing in `conditions.rs`.

## MCP timeout


`mcp::tests::generated_ready_mcp_call_executes_its_exact_typed_envelope`
passes alone in 0.67 s (job 300). I did not find what made it take more
than 90 s under load, so that part is not fixed. The waits in that path
that have no deadline are `TestDaemon::wait_for` (it polls until status
is idle), the `Deadline::None` client call, and the writer round trip on
begin.

## Verification

- compile `-p polylogue -p polylogue-store -p polylogue-query --tests`:
job 296 passed.
- focused, the four target tests: job 300, 4/4 passed.
- focused `-p polylogue -p polylogue-store`: job 305 (results in a
comment).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em

Co-authored-by: Claude Opus 5.5 <[email protected]>
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