Repository navigation
Name the missing document in the one-buffer turn refusal - #255
Conversation
Unload the loaded set down to the outline, press Send, and the route
refused with "the turn request is malformed" -- correct in class, and
naming nothing a human can act on. The actionable half sat a few pixels
away in the selector's ratified empty state. Recorded as follow-up (1)
in add-doxbench-editing-phase-b's Amendment 2, which ruled that this act
refuses AT SEND rather than being made unreachable; this is the
send-side half of that ruling.
The note assumed improving the sentence meant changing a published
failure envelope. It does not. The released `message` is free-form
(minLength 1, maxLength 500 -- no const, no enum, no pattern) on both
`failure` and `failure_v2`, the `error` field is a pattern rather than a
closed enum, and no promoted requirement or contract table ratifies the
string: it lived in exactly one place, serve.py. So this is realization
detail. Both schema files and `SCHEMA_DIGESTS` are byte-untouched and no
contract release is involved.
What the route now says for this one violation:
the turn carries no document beside the outline — use a docs tile's
load verb to work on one
-- deliberately echoing `LOADED_SELECTOR_EMPTY_NOTE` so the two surfaces
name the same remedy for the same state. The code, the 400, and the
envelope key set are unchanged, so the client needs no change at all:
the rail already renders the route's message verbatim.
Two conditions gate it, each ruling out a different way of lying. The
buffer set must be outline-only, so the sentence describes the set the
caller actually sent -- zero buffers, or a lone document with no
outline, keep the catch-all because it is true of them and the specific
one would not be. And the released schema must fault nothing else, so
acting on the sentence is ENOUGH; an outline-only turn that also carries
a blank message keeps the catch-all rather than sending the human round
a loop.
The chooser is asked at all three statements of the floor -- the
schema's `minItems: 2`, the delegated parse, and the pairing rule --
because the cause is a fact about the request, not about which gate
noticed it. It reads only a jsonschema error's `validator` keyword and
`absolute_path`, never `error.message` (which can quote instance
content), and nothing it reads reaches the wire: the verdict only picks
between two fixed module-level constants.
Tests bind the released validators where the hermetic fixture cannot
express the rule -- it declares `"buffers": {}` -- and skip where the
pin is unreadable, so the suite keeps its no-checkout-required promise.
The browser probe injects serve.py's own constant so the rail and the
route cannot drift.
Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
Pull request overview
This PR refines doxBench chat-turn refusal handling to make the outline-only buffer-floor failure actionable by naming the missing document (while keeping the same error code/envelope), and adds tests to pin both the new message and its non-leakage to other refusal cases.
Changes:
- Introduces a dedicated fixed server message for the outline-only (
buffersfloor) invalid turn case, and threads an optional message override through the chat-turn failure envelope builder. - Adds server-side logic to select the cause-naming message only when the request is outline-only and no other schema violations are present.
- Expands test coverage (route-level and browser-probe) to assert the new message appears only for the intended violation and reaches the rail verbatim.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/ideation_dashboard/serve.py | Adds a fixed cause-naming message and conditional selection logic; allows overriding the failure-envelope message for this one scenario. |
| tests/ideation-dashboard/test_doxbench_routes.py | Adds route-level tests and harness updates to assert the specific message for outline-only and ensure other refusals keep the generic catalog text. |
| tests/ideation-dashboard/test_doxbench_chat_view.py | Adds an end-to-end Node/browser probe asserting the rail renders the server’s message verbatim (injected from serve.py). |
| openspec/changes/add-doxbench-editing-phase-b/proposal.md | Documents discharge of the Amendment 2 follow-up and records the rationale for message-only evolution without a contract release. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "schema_version": DOXBENCH_WIRE_SCHEMA_VERSION, | ||
| "kind": str(kind), | ||
| "client_turn_id": str(client_turn_id), | ||
| "error": code, | ||
| "message": message, | ||
| "message": catalog_message if message is None else str(message), |
1. `_doxbench_violation_beside_the_buffers_floor` materialized every validation error only to ask whether ONE of them disqualified the specific message. Now it streams and returns on the first non-floor violation -- identical semantics, no list built, and a large invalid request stops costing work after error number one. The reviewer also asked whether the double iteration could go, since `_doxbench_wire_conforms` already walked the same errors. Deliberately not: carrying them out would mean that seam RETURNING them, and its whole posture is that it discards them so a jsonschema message -- which can quote instance content -- has nowhere to leak to. Two cheap walks of an already-failing request beats widening that contract. 2. The `message` override was coerced with `str(message)`. THIS BRANCH ADDED THAT COERCION -- on origin/main the message came from the catalog and was assigned directly, so only `kind` and `client_turn_id` carried pre-existing `str()` casts. It was mine, and it was wrong: a future caller passing an exception, a validation error, or a response wrapper would have had its `__str__` -- request content and all -- spliced into a published refusal, while the docstring two lines up promised refusals disclose nothing. Now only a genuine non-empty `str` overrides; anything else falls back to the catalog string. QUIETLY, matching the neighbouring fail-closed seams (`_wire_valid_turn_id` answers a bad type with None, `_doxbench_wire_conforms` with False) rather than raising: this is the response path of a refusal, where an exception drops the connection and strands the turn lease -- the exact failure the reserved-key test forbids with "the connection must carry an envelope, never drop". Empty strings fall back too, for a different reason: the released envelope requires `minLength: 1`, so an empty override would fail `_refuse_turn`'s self-validation and cost the refusal its `client_turn_id`, the browser's only correlation handle. Six new tests: five wrong-typed overrides (an object whose `__str__` carries the human's prose, bytes, a list, an int, and the empty string) each falling back to the catalog string with the prose absent from the serialized body and the envelope still conformant, plus the negative half pinning that a real constant still overrides -- so the hardening cannot quietly revert the feature it guards. Mutation: restoring `str(message)` kills all five wrong-type cases while the real-string test keeps passing. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
scripts/ideation_dashboard/serve.py:571
- The
doxbench_turn_failure_bodydocstring claims “Today every caller reaches this through_refuse_turn…”, butserve.pyalso callsdoxbench_turn_failure_body(...)directly (e.g. for dispatch/finalization failures). This makes the documentation inaccurate and could mislead future edits around themessageoverride behavior.
of the callers, not of the schema. Today every caller reaches this through
`_refuse_turn`, and all of them pass `_doxbench_invalid_turn_message`'s
verdict -- one of exactly two module-level constants; see
`_DOXBENCH_MSG_TURN_HAS_NO_DOCUMENT` for the full record. `None` means the
catalog's own message, so every other refusal is byte-identical to before.
tests/ideation-dashboard/test_doxbench_routes.py:1029
_post_turntakes aschema_validator_factorycallable (it’s passed through to_serving/build_server), but this docstring says released-schema tests “pass_require_released_validatorsoutput”. In practice the tests wrap that output in a factory (lambda: dict(released)), so the wording here is misleading about the expected type.
`schema_validator_factory` defaults to the hermetic fixture, exactly as
`_serving` does; the released-schema tests pass `_require_released_validators`
output so a value-level rule can be exercised as the release states it."""
Discharges the follow-up recorded in phase-b's Amendment 2: a turn sent with the loaded set emptied to the outline was refused with the fixed "the turn request is malformed" — correct in class, naming nothing actionable.
Built, not proposed — the pin analysis says the string is realization detail: the failure envelopes'
messageis{type: string, minLength: 1, maxLength: 500}(no const/enum/pattern), theerrorfield is pattern-validated rather than a closed enum,SCHEMA_DIGESTShashes schema file bytes only (the message lives inserve.py, so no v1.38 machinery), no promoted requirement quotes the string, and the tests assert through the error catalog, never a literal. The error CODE deliberately staysinvalid_turn_request— the class is unchanged, the judgement-call code set is deliberately closed, and acausefield is impossible underadditionalProperties: false.The new message — "the turn carries no document beside the outline — use a docs tile's load verb to work on one" — echoes the selector's own empty-state remedy so both surfaces name one fix. It fires only when the buffer set is outline-only and nothing else is faulted; every other violation keeps the generic message (pinned). A design finding shaped the implementation: the floor is stated at three gates (released schema, hermetic fixture path, the pairing rule), so the cause-chooser runs at all three, reading only
error.validator/error.absolute_path— never message text that could quote instance content.11 new tests including the end-to-end browser probe (unload to outline-only → send → the route's own sentence surfaces in the rail, injected constant so the halves can't drift) and one proving the named remedy actually makes the turn sendable. Mutations: 9 kills across three mutation shapes, with the envelope-never-malformed property asserted before every message assertion.
Gates:
tests/ideation-dashboard3864 passed, exit 0; doc-health exactly the four known location artifacts;openspec validate --all --strict65/65;contracts/byte-untouched (verified). No client change needed — the rail already renders the message verbatim.🤖 Generated with Claude Code