Skip to content

Realize doxbench Phase B §13: co-resident chat-turn v2 family, contract-v1.34, N4 dissolved - #210

Merged
brettheap merged 22 commits into
mainfrom
change/doxbench-b-s13-chat-wire
Aug 19, 2026
Merged

brettheap merged 22 commits into
mainfrom
change/doxbench-b-s13-chat-wire

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Realizes §13 of the ratified add-doxbench-editing-phase-b — the contract release
its "chat-turn contract release carries the bound buffer and the model"
requirement names — and dissolves the N4 interim posture that release was always
meant to end.

The release: contract-v1.34

schemas/xfactory-workbench-chat-turn.schema.yaml gains a co-resident second
envelope family
— workbench-chat-turn-v2, -v2-success, -v2-failure —
added to the file's top-level oneOf and discriminated by kind, exactly as the
three v1 envelopes already discriminate each other. It carries what the v1 shape
had no room for: the outline plus every loaded document (buffers
maxItems 2 → 25, the declared 24-document loaded-set bound plus the reserved
outline), the DECLARED bound_buffer on both request and durable record,
observed_hashes keyed by buffer key, typed_proposal.target as a buffer key
with the proposal list bounded by the buffer set, and selected_model metadata
beside the model that answered. The v2 request carries no
active_document_path: the binding is declared, never inferred from an adjacent
field that answers a different question.

Change class: ADDITIVE (minor) plus a DEPRECATION (minor). The v1
request/success/failure blocks are byte-identical to their contract-v1.31 bytes
and keep validating and being served; the v1 family is deprecated here with
removal target contract-v2.0, recorded machine-readably in the schema's own
deprecated_envelopes (placed outside every envelope precisely so the deprecated
bytes do not move), in the CHANGELOG migration note, and in the versioning
policy's deprecations list.

Task status

Task Status
13.1 co-resident family done — including the widened delegated-validator rules and three packaged examples
13.2 deprecation + removal target done — and no longer inert: see below
13.3 version allocated at realization half landed, box deliberately open
13.4 runtime repin, digest-checked done — both lanes served, no refusal weakened
13.5 F2 obligation discharged done — record names the DECLARED binding; both negatives proven

13.3 stays open until the tag exists. Allocation, the atomic release-surface
commit and the digest inventory landed here; the annotated tag is published
against the commit that actually lands, per the versioning policy. Its box
follows §5/§7/§9's own convention for a task with a step outstanding: unticked,
with a stated half-landed note.

The N4 dissolution

Task 8.6 recorded, with Brett, a stated interim reduction: under the v1 envelope
the chat's document binding was pinned to the mount-time reserved slot, no route
re-pointed it, and Send was gated with a visible reason. That record said it would
end with §13's widened envelope, and it does — removed, not left unreachable:

  • the chat binds to the SELECTED buffer through the existing single state
    authority (state.active_buffer), declared on the request and echoed in the
    record;
  • the pre-flight binding refusal, its stated reason, the send-gate branch in the
    render, and the shell's narrowing to the reserved slot's path are all gone,
    along with the no_active_document refusals and the outline-only precondition
    that existed only because the v1 wire forced one declared active-document path;
  • the unsettled-identity pre-flight now reads every buffer the state holds, and a
    proposal's target is a buffer key drawn from the record's own
    observed_hashes, so a proposal against a third loaded document routes instead
    of being silently dropped.

Proven through the REAL mount in test_doxbench_composition.py — load a
document, select it, send, and read the declared binding and the whole loaded set
off the wire — because PR #207's lesson was that stubbed seams hid three broken
flows behind 3050 green tests.

Two adversarial review rounds

Nineteen findings across two rounds, every one fixed or adjudicated, each fix
carrying the reviewer's own reproduction as its test:

  • Reserved-key collision (F2) — a document buffer at path outline derived
    the reserved key and was then filtered out of the document enumeration: its
    hash went unverified, its bytes uncounted, and the v1 success builder died with
    an uncaught IndexError that dropped the connection with no envelope and
    stranded the turn-store lease. One refusal in require_outline_and_documents,
    before identity verification and before any port, mirroring the browser's own
    LOAD_REFUSED_RESERVED_KEY for both reserved spellings.
  • v1 byte guard (F1) — extended from the three envelope blocks to the
    computed $ref closure, because buffer_state.kind and
    typed_proposal.target are shared $defs and mutating either changed v1's
    meaning while the guard stayed green.
  • The deprecation now warns (F3) — the delegated validator reads the schema's
    own deprecated_envelopes and emits one warning per deprecated instance while
    still accepting it, which is the deprecating change class the policy defines by
    behaviour. Consequence documented for consumers: --strict exits 1 on a v1
    instance.
  • Plus: the reserved-slot unload guard's reason restated for the wire that
    replaced it, the widened lane driven end to end with two path-backed documents,
    the selected-model metadata derived from the catalog entry in one place (with
    task 11.7's own contract obligation recorded), the buffer-key ordering rule
    pinned across every home, and the gate-order assertions strengthened from "no
    dispatch" to "no port touch at all".

Gates

Full ideation suites, openspec validate --all --strict (61 passed), doc-health
pre/post with zero new findings, the dashboard validator (0 errors, 4 deprecation
warnings, exit 0), and validate-contract-release.py build reproducing the
committed inventory byte-for-byte with verify-commit passing. origin/main is
merged in at cd9f683; the merge was clean and the availability recheck still
finds contract-v1.34 absent from the CHANGELOG, the manifest, contracts/releases/
and the remote tags.

Land-time plan

  1. Squash-merge this PR.
  2. Re-run every gate against the exact commit that lands on origin/main —
    the versioning policy's realization step 4: if promotion creates a different
    commit, that commit is the new candidate.
  3. Publish and verify the annotated contract-v1.34 tag against that commit,
    from an independently refreshed checkout.
  4. Land the follow-up commit replacing doxbench_contracts.CONTRACT_REF's
    unpublished:contract-v1.34 sentinel with the published commit. The sentinel
    is a value no stack.yaml can declare, so until then a consumer comparing
    against it refuses rather than matching by accident.
  5. Only then does task 13.3 tick.

🤖 Generated with Claude Code

brettheap and others added 19 commits August 18, 2026 19:22
…mily

add-doxbench-editing-phase-b tasks 13.1-13.3. The chat-turn schema gains a
SECOND envelope family beside the existing one, discriminated by `kind` exactly
as the file already discriminates its three v1 envelopes: the outline plus every
loaded document buffer (maxItems 25 = the declared 24-document loaded-set bound
plus the reserved outline), the DECLARED bound-buffer key on both request and
record, observed hashes keyed by buffer key, a buffer-key proposal target, and
the selected-model metadata beside the model that answered.

The v1 request/success/failure blocks are BYTE-IDENTICAL to their contract-v1.31
bytes; the committed baseline fixture is what a test compares them against.
The v1 family is DEPRECATED here with removal target contract-v2.0, recorded
machine-readably in the schema's own top-level `deprecated_envelopes` block --
placed outside every envelope precisely so the deprecated bytes do not move.

Version ALLOCATED AT REALIZATION per docs/contract-versioning-policy.md: fetched
origin, branch already on origin/main (a4a6f6e), rechecked availability
(contract-v1.33 present in the CHANGELOG, contract-v1.34 absent from CHANGELOG,
manifest and remote tags), then allocated. Manifest, CHANGELOG, README, the
policy's deprecations-in-force list and the digest inventory move atomically
with the schema in this one commit. No tag is published here: publication and
verification happen post-merge against the exact landed commit.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ope families

add-doxbench-editing-phase-b task 13.4, first half. The digest moves because the
release widens the chat-turn schema itself; the fail-closed chain is unchanged
and still refuses byte-exactly. The three widened kinds join the per-kind
mapping beside the three deprecated ones, which stay dispatchable -- a
deprecation that stopped resolving would break the clients it exists to keep
working. CONTRACT_REF is the unresolved-until-published sentinel, because the
release commit does not exist on a realization branch and a consumer comparing
against it must refuse rather than match by accident.

Co-Authored-By: Claude Fable 5 <[email protected]>
add-doxbench-editing-phase-b task 13.1, the semantics half. The family's declared
owner now judges the v2 kinds: one outline plus one or more DISTINCTLY KEYED
documents, a DECLARED bound_buffer that names a buffer the same request supplied,
per-buffer hash recompute over a set instead of a pair, and -- on the record --
a proposal target that names an observed buffer, a proposal count bounded by that
buffer count rather than by a literal 2, a bound buffer the record itself
observed, and a non-routing catalog entry that cannot resolve to another model.
Three packaged examples carry it: the loaded-set request, its record, and the
negative whose binding names no supplied buffer.

Co-Authored-By: Claude Fable 5 <[email protected]>
add-doxbench-editing-phase-b tasks 13.1/13.4/13.5, the server half. The route
reads which family a turn arrived in off the payload's own `kind` and answers in
that family: the widened request DECLARES `bound_buffer` and carries the loaded
set, and the widened record states that declared key, every buffer's observed
identity by key, and the selected-model metadata beside the model that answered.

Nothing in the refusal chain moved: the gate order, the fixed codes and the
redaction are unchanged, and every refusal is now emitted in the family it
answers. Identity verification and the request-byte bound run over EVERY loaded
document rather than the first, the declared binding joins the widened lane's
canonical digest (two turns bound to different documents are different requests),
and G-1's narrowing is restated per buffer: an unbacked buffer names no document,
so it is not a proposal target.

The widened lane reads no `active_document_path`: its parser records none and
the closed envelope carries none, so there is nothing left for any step to infer
a binding from.

Co-Authored-By: Claude Fable 5 <[email protected]>
add-doxbench-editing-phase-b tasks 13.1/13.4/13.5, the browser half. The rail
sends the widened envelope: every buffer the canvas holds, and a DECLARED
bound_buffer read off `state.active_buffer` -- the one selection authority --
rather than an activeDocumentPath the shell handed it.

The interim posture ends WITH the wire that forced it (task 8.6, recorded with
Brett): the pre-flight binding refusal, its stated reason, the send-gate branch
in the render, and the shell's narrowing to the reserved slot's path are all
REMOVED rather than left unreachable. The `no_active_document` refusals and the
outline-only precondition go with them, for the same reason: both existed only
because the v1 envelope made a turn declare ONE active document path.

Two things widen beside it: the unsettled-identity pre-flight now reads EVERY
buffer the state holds, and a proposal's target is a buffer key -- the permitted
set read from the record's own observed_hashes, which is the request's buffer
set, so a proposal against a third loaded document routes instead of being
silently dropped.

Tests: the F1 composition scenario is re-pinned to the dissolved posture and
drives the REAL mount (load a document, select it, send, read the wire); a new
test_doxbench_bound_buffer.py proves the two F2 negatives against the source and
the released schema; the route suite gains the widened family end to end; every
re-pinned test states what it supersedes.

Co-Authored-By: Claude Fable 5 <[email protected]>
Records what landed, what is deferred and to where: the allocation landed and
tag publication is post-merge (13.3), and every judgement call the design did not
settle is stated in the task rather than left in a commit message.

Co-Authored-By: Claude Fable 5 <[email protected]>
They were ignored options after the widened wire landed, and an ignored option in
a harness reads as a seam that still exists. The privacy probe selects the
document it was already carrying and its failure payload moves to the family the
rail now sends.

Co-Authored-By: Claude Fable 5 <[email protected]>
… yet

The section's own convention for a task with a step still outstanding is an
UNTICKED box carrying a stated half-landed note (5.4, 7.2, 9.2, 9.5 all read that
way). The allocation, the atomic release-surface commit and the digest inventory
landed here; publishing and verifying the annotated tag happen against the commit
that lands on origin/main, so the box stays open until it exists.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ditions

The examples index called itself "this index" while listing none of the doxBench
wire family -- twelve files, added after the tree was written. The widened
family's request, record and negative join it rather than extending the
omission, and the schema-to-example map gains the three rows it never had, with
the v1 family marked deprecated where a reader will look for it.

Co-Authored-By: Claude Fable 5 <[email protected]>
… lanes

Review finding F2. A document buffer at path `outline` derived the RESERVED
outline key, which `ordered_document_keys` then filtered out of the document
enumeration -- so the buffer passed the kind requirement and vanished from every
later step: its declared content hash was never verified, its bytes were never
counted against the request bound, and the v1 success builder indexed an empty
document list, dying with an uncaught IndexError that dropped the connection with
NO envelope and stranded the turn-store lease. On the widened lane it reached the
provider and came back mislabelled `response_invalid`.

ONE raise in `require_outline_and_documents`, before identity verification and
before any port, mirroring the browser's own LOAD_REFUSED_RESERVED_KEY -- which
refuses both reserved spellings, and so does this: a path-backed `document`
would silently occupy the slot the create flow reserves.

Tests: unit refusals for both spellings plus the still-legal unbacked slot;
route tests on BOTH lanes asserting the fixed refusal ENVELOPE (a passing status
alone cannot tell a refusal from a dropped connection) and that no dispatch
happened; and the stranded-lease half measured by using the conversation again
after the refusal. They run against a second fixture snapshot where the claimed
path is genuinely in scope and editable, so scope confinement cannot answer first
and hide the hole -- the same fixture F5's widened-lane tests needed.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ccepts

Review finding F3. `deprecated_envelopes` was read by nothing but its own test,
and the validator printed 0 warnings on the four packaged v1 examples -- so the
CHANGELOG's "starts the clock" sentence described a class the policy defines by
behaviour ("the conformance validator emits warnings but still accepts it") that
nothing performed.

The family's declared owner now READS the schemas' own deprecation blocks and
warns once per deprecated instance, naming the superseding kind and the removal
target. It carries no list of its own: a second copy here would be a second
authority that could disagree with the bytes consumers pin.

Tests: the per-instance warn-and-accept, the replacement NOT warning (or the
signal means nothing), the read-from-the-schema negative, and the end-to-end
count -- 4 warnings, 0 errors -- so a deprecation that stopped warning, or one
that started refusing, fails here.

Co-Authored-By: Claude Fable 5 <[email protected]>
…s alone

Review finding F1. The v1 envelopes $ref into six shared $defs the baseline did
not contain -- including buffer_state.kind and typed_proposal.target, the exact
two-value enums D15 contemplates widening. The reviewer mutated both and the
guard stayed green: a change to v1's MEANING wearing the appearance of byte
identity.

The baseline now carries the transitive closure of local $refs from
request/success/failure, and the test COMPUTES that closure rather than listing
it, so a v1 envelope that grows a ref to a new shared definition pulls it under
the guard instead of escaping it. The widened family's own definitions are
asserted OUT of the closure: they are new bytes this release adds, and the
promise is about the old shape.

Revert-tested both ways the reviewer found: adding a third member to
buffer_state.kind, and to typed_proposal.target, each fails the guard.

Co-Authored-By: Claude Fable 5 <[email protected]>
Review finding F7. The guard is still load-bearing and stays; its stated reason
had retired with the v1 envelope it cited, and a guard resting on a retired
reason is one the next reader deletes. All three sites now name the live reason:
a turn needs the outline AND at least one document -- request_v2.buffers
minItems: 2, and the server's own require_outline_and_documents -- so a session
holding only the outline and the reserved slot has nothing to spare. The N3
composition test carries the same restatement and no longer asserts the retired
sentence.

Co-Authored-By: Claude Fable 5 <[email protected]>
… pin the order rule, correct the CHANGELOG

F4 — a proposal against a PATH-KEYED third document now runs the whole chain
(adoption -> card model -> Apply -> currency re-score), plus the unroutable
target that must be dropped rather than rendered. Every previous fixture targeted
a reserved key, which the retired two-name literal served just as well, so
judgment call 9's failure mode was claimed and not measured. Revert-tested:
restoring the literal permitted set fails it.

F6 — the selected-model metadata is DERIVED from the catalog entry in ONE place
(`doxbench_selected_model`), read duck-typed with honest defaults, so task 11.7
changes that function rather than three literals; a stand-in routing entry proves
the route already reports one. And 11.7 now RECORDS its own obligation: the
record can state a routing rule, but the model-catalog envelope is a closed
seven-field entry with nowhere to declare one, so that task needs its own
additive catalog release before its ratified scenario can be claimed.

F8 — the buffer-key ordering rule STRING is now spelled identically in the three
homes §13 added and the cross-home pin test covers them.

F10a — the CHANGELOG said "one file changes" while the cut also moved
docs/contract-versioning-policy.md, a release-surface member; corrected, and the
inventory rebuilt over the corrected bytes.

Co-Authored-By: Claude Fable 5 <[email protected]>
Under --strict (opt-in, 'treat warnings as errors') a deprecated instance now
fails, which is what strict mode means and what a consumer asking for it wants.
The default invocation -- what this repository's gates run -- still exits 0.
Recorded where a reader meets the warning rather than left to be discovered.

Co-Authored-By: Claude Fable 5 <[email protected]>
The browser owns the human-facing load refusal and the server owns the wire one;
if the two ever name different keys, one is refusing a load the other accepts.
Asserted rather than assumed.

Co-Authored-By: Claude Fable 5 <[email protected]>
…r pins bite

N1 — my earlier flag was WRONG: examples/ideation-dashboard/README.md documents
`--strict` as THE self-test command, and the four packaged v1 fixtures now warn
by design, so that command exits 1 permanently until contract-v2.0 retires them
with the family. The self-test line is the default invocation again, and
`--strict` is documented beside it for what it is now good for -- FINDING
deprecated and otherwise-warned shapes. The contract-v1.34 migration note states
the same consequence, so a consumer plans for it rather than discovering it.
The CHANGELOG is a release-surface member: inventory rebuilt and confirmed to
reproduce byte-for-byte.

N2 — `assert "dispatch" not in fake.calls` did not pin the gate order its
docstring claimed: a loop that verified only the first document and then went on
to consult the catalog satisfied it. The four genuinely pre-port refusals now
assert `fake.calls == []`; the byte-bound refusal asserts `== ["catalog"]`,
because that bound is the selected ENTRY's and consulting the catalog to read it
is correct -- said out loud so nobody tightens it into a false pin.
Revert-tested: degrading the identity loop to `document_keys[:1]` now fails.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 19, 2026 01:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR realizes the doxBench “chat-turn” contract widening in contract-v1.34 by introducing a co-resident v2 envelope family that can carry the full loaded buffer set and a declared binding (bound_buffer), while deprecating (but continuing to serve) the v1 envelopes. It also removes the interim “N4” UI/runtime posture that previously prevented sending when the selected buffer wasn’t representable in the v1 wire shape.

Changes:

  • Adds workbench-chat-turn-v2* request/success/failure envelopes to the chat-turn schema, and records v1 deprecation + removal target (contract-v2.0) in machine-readable deprecated_envelopes.
  • Updates the ideation-dashboard runtime and web views to send/handle the widened envelope (declared bound buffer; N-buffer loaded set), including v2 refusal-kind handling and v2 success record fields (selected_model, keyed observed_hashes).
  • Expands/repins the test suite, examples, and the delegated validator to cover the widened lane end-to-end and enforce byte-identity of v1 envelope bytes.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/ideation-dashboard/test_doxbench_view.py Updates view-composition assertions to reflect removal of v1-era rail seams/options.
tests/ideation-dashboard/test_doxbench_turns.py Adds regression tests for reserved-key refusal and order-rule pinning across homes.
tests/ideation-dashboard/test_doxbench_tile_verbs.py Removes the obsolete activeDocumentPath seam from tile verb tests.
tests/ideation-dashboard/test_doxbench_routes.py Adds v2 envelope fixture schemas and v2 refusal assertion helper; adds widened-lane route tests.
tests/ideation-dashboard/test_doxbench_proposals.py Repins proposal-map expectations to keyed-by-buffer-key behavior.
tests/ideation-dashboard/test_doxbench_privacy.py Updates privacy/redaction probes for v2 failure kinds and declared binding.
tests/ideation-dashboard/test_doxbench_contracts.py Repins to contract-v1.34, adds v1 byte-baseline guard and v2 envelope presence/deprecation assertions.
tests/ideation-dashboard/test_doxbench_composition.py Converts the “N4 posture” composition test into an end-to-end proof that v2 sends with declared binding + loaded set.
tests/ideation-dashboard/test_doxbench_chat_view.py Updates chat view fixtures and assertions to v2 kinds, declared binding, and keyed proposal targets.
tests/ideation-dashboard/test_doxbench_bound_buffer.py New: proves “bound buffer” obligation is discharged and no inference/server-only binding remains.
tests/ideation-dashboard/fixtures/chat-turn-v1-envelopes.baseline.yaml New: committed baseline bytes for v1 $defs closure to enforce byte identity.
tests/ideation_dashboard/test_validate_ideation_dashboard_contracts.py Extends validator self-test expectations for deprecation warnings and v2 behavior.
scripts/validate-ideation-dashboard-contracts.py Adds v2 kind routing, semantic checks for v2 request/success, and deprecation warning emission.
scripts/ideation_dashboard/web/views/staging-workbench.js Removes v1-era rail narrowing and document-candidate seams; keeps reserved-slot path as load logic only.
scripts/ideation_dashboard/web/views/doxbench-chat.js Switches rail to v2 kinds, sends full buffer set + declared bound_buffer, removes N4 gate and no-active-document logic.
scripts/ideation_dashboard/web/views/doxbench-chat-model.js Moves proposal target set to be record-derived (keyed), adds deterministic ordering helper for proposal targets.
scripts/ideation_dashboard/serve.py Serves both families, parses v1/v2 separately, answers refusals in the request’s family, builds v2 success record with selected-model metadata.
scripts/ideation_dashboard/doxbench_turns.py Adds reserved-buffer-key refusal in require_outline_and_documents to prevent reserved-key path collisions.
scripts/ideation_dashboard/doxbench_contracts.py Repins runtime contract tag/ref and expands kind dispatch to include the co-resident v2 family (v1 deprecated).
openspec/changes/add-doxbench-editing-phase-b/tasks.md Marks §13 tasks as landed/repinned and documents the remaining tag publication step for 13.3.
examples/ideation-dashboard/workbench-chat-turn-v2-success.example.yaml New: packaged positive example for v2 success record shape.
examples/ideation-dashboard/workbench-chat-turn-v2-loaded-set.example.yaml New: packaged positive example for v2 request carrying loaded set + declared binding.
examples/ideation-dashboard/README.md Updates example inventory and guidance for validator strict mode with deprecation warnings.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-unbound-buffer.negative.yaml New: packaged negative example for v2 bound-buffer membership violation.
docs/contract-versioning-policy.md Records v1 chat-turn family deprecation + removal target in the policy list.
contracts/schemas/xfactory-workbench-chat-turn.schema.yaml Adds v2 family + deprecated_envelopes; defines v2 keyed types (buffer_key, keyed_observed_hashes, etc.).
contracts/README.md Notes chat-turn widening at contract-v1.34 and v1 deprecation/removal target.
contracts/manifest.yaml Bumps bundle version to contract-v1.34 and updates schema digest.
contracts/CHANGELOG.md Adds contract-v1.34 release notes including change class, migration note, and validator warning behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +906 to +913
buffers = [b for b in doc.get("buffers") or [] if isinstance(b, dict)]
outlines = [b for b in buffers if str(b.get("kind")) == "outline"]
documents = [b for b in buffers if str(b.get("kind")) == "document"]
if len(outlines) != 1 or not documents:
f.error("buffers", f"{label}: exactly one outline buffer and at least "
f"one document buffer required, got "
f"{len(outlines)} outline(s) and "
f"{len(documents)} document(s)")

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b876b1b85

ℹ️ 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".

Comment on lines +625 to +627
if buffer.path in RESERVED_BUFFER_KEYS:
raise TurnBufferKindError(
"a document buffer's path claims a reserved buffer key")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve valid v1 requests for the path document

Do not apply this reserved-path rejection to the deprecated v1 family. A v1 request whose editable repository-root file is literally document conforms to the byte-identical v1 schema and was previously dispatchable, but the shared require_outline_and_documents now rejects it as invalid_turn_request. This violates the release promise that previously released v1 clients remain served; restrict the new rule to v2 or otherwise retain the v1 interpretation.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Comment on lines +254 to +258
// EVERY buffer the canvas holds. Binding says what the chat is working ON;
// it never narrows what the turn is GROUNDED on, so the outline and every
// loaded document ride the request whichever one is bound.
buffers: wireBufferKeys(buffers).map(
(key) => wireBuffer(buffers[key], buffers[key].kind, scopeKey.repository)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-score every widened proposal target after settlement

Now that the request and response can include path-keyed documents, the success-time currency check must also enumerate every live buffer. If a path-keyed document changes while its turn is in flight, its identity event fires before the proposal exists, and the settlement code at lines 1229–1237 still supplies hashes only for outline and document; the new proposal therefore remains current and renders an enabled Apply until the swap-time guard refuses it.

Useful? React with 👍 / 👎.

Comment on lines +928 to +930
for b in buffers:
key = _buffer_key_of(b)
_confined(f, label, f"buffers/{key}/path", b.get("path", ""))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject reserved document paths in the delegated validator

Add the runtime's reserved-key rule to this v2 validation loop. With one outline and a document whose path is exactly document, the keys are unique, bound_buffer: document is considered supplied, and confinement succeeds, so the delegated validator accepts the instance; the route then rejects the same request because require_outline_and_documents reserves document for the null-path create slot. This makes conformance validation certify an envelope that the runtime can never process.

Useful? React with 👍 / 👎.

Comment on lines +1894 to +1896
if request_kind == DOXBENCH_CHAT_TURN_V2_KIND:
canonical["kind"] = request_kind
canonical["bound_buffer"] = bound_buffer_key

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Canonicalize v2 buffer order before hashing

Canonicalize canonical["buffers"] by buffer key before computing the new v2 request identity. The v2 schema and parser allow buffers in any order, but json.dumps(..., sort_keys=True) does not reorder arrays, so retransmitting the same client_turn_id, hashes, binding, and content with only the buffer array reordered produces a different digest and returns turn_id_conflict instead of the recorded idempotent result.

Useful? React with 👍 / 👎.

CODEX-1 CONFIRMED, and my blanket refusal was the regression. Reproduced in a
worktree at a4a6f6e: a v1 turn whose document sits at repo-root path `document`
was SERVED there -- HTTP 200, dispatched -- so refusing it was a breaking change
wearing an additive release's number. The rule is now PER LANE. `outline` stays
refused on both (at a4a6f6e that same shape dropped the connection with no
response at all -- the crash F2 closed); `document` is refused on the widened
lane only, where the reserved unbacked slot can ride beside a path-backed
document. The lane's refused set is chosen where the lane is, and threaded into
build_prompt_envelope so step 9 cannot disagree with step 6.

CODEX-2 CONFIRMED. Reproduced directly: the same v2 turn id with identical
content and hashes, buffers reordered, came back 409 turn_id_conflict --
json.dumps(sort_keys=True) orders keys, never array members. The widened lane's
canonical form now orders buffers by BUFFER KEY, in the same UTF-16 code-unit
order the family declares. The v1 canonical form is untouched: its digests are
recorded in live stores.

CODEX-3 CONFIRMED, with a nuance worth keeping: the `outline` spelling was
already caught, but by the DUPLICATE-KEY rule and only because every request also
carries an outline; the `document` spelling validated CLEAN (exit 0) while the
route always refuses it. The validator now carries the reserved-path rule per
lane, matching the route's post-CODEX-1 behavior, with the sets restated rather
than imported (it is published by exact commit and runs against arbitrary target
repos) and a companion test asserting the restatement agrees with the runtime's.
New negative example, shaped so nothing else claims the key -- otherwise the
duplicate-key rule answers first and the gap hides again, which is how it did.

CODEX-4 CONFIRMED both ways. The success-time re-score enumerated two fixed
names, so a path-keyed document scored against a hash the map did not hold
(falsely STALE) or, where the reserved slot had been re-keyed away, was not
scored at all (CURRENT with an enabled Apply against text the buffer no longer
held -- Codex's own reading). It now re-scores every live buffer. Both scenarios
are pinned through the REAL mount and both DISCRIMINATE: each answer differs
before and after, which the first draft of these tests did not.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 19, 2026 02:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.

Suppressed comments (1)

scripts/ideation_dashboard/web/views/doxbench-chat.js:309

  • createTurnDispatcher.submit no longer guarantees the required buffers are present before building the request. Because wireBufferKeys() always prepends "outline", an editorState.buffers map missing outline (or containing only outline) can slip past the current settled check and then throw in buildTurnRequest when it does buffers[key].kind/wireBuffer(buffers[key], ...). Similarly, if active_buffer points at a key not in buffers, the request is sent and will be refused server-side instead of failing closed locally.

Consider tightening the preflight to require: buffers exists, includes outline, includes at least one non-outline buffer, all buffers are settled, and bound is a key in buffers.

      const bound = boundBufferKey(editorState);
      const settled = editorState && editorState.buffers
        && Object.keys(editorState.buffers).every(
          (key) => bufferSettled(editorState.buffers[key]));
      if (!editorState || !settled || bound === null) {

@brettheap

Copy link
Copy Markdown
Contributor Author

All four findings reproduced before fixing. Every one CONFIRMED — including one where the reproduction showed my own earlier fix was the regression. Pushed as ef969e5.


CODEX-1 — CONFIRMED, and the fix was mine to walk back.

Reproduced in a throwaway worktree at a4a6f6e (the commit before this branch): a v1 turn whose document buffer sits at repository-root path document, with that path in scope and editable, returned HTTP 200 and dispatched. So the blanket refusal I added was a breaking change wearing an additive release's number. The same reproduction also confirmed the other half: the outline spelling at a4a6f6e produced http.client.RemoteDisconnected: Remote end closed connection without response — the crash that refusal exists to close.

The rule is now per lane. outline refused on both (V1_RESERVED_BUFFER_KEYS); document refused on the widened lane only (RESERVED_BUFFER_KEYS), where the reserved unbacked slot can ride beside a path-backed document — a collision the v1 envelope cannot have, since it carries exactly one document whose key is document either way. The lane's set is chosen where the lane is chosen and threaded into build_prompt_envelope, so step 9 cannot disagree with step 6.

Tests: test_a_v1_turn_whose_document_path_is_literally_document_is_still_served, test_a_v1_turn_whose_document_path_claims_the_outline_key_is_refused, test_the_v1_lane_refuses_only_the_outline_spelling, test_the_two_lane_refusal_sets_differ_by_exactly_the_unbacked_key.


CODEX-2 — CONFIRMED.

Direct reproduction: same client_turn_id, same content, same hashes, buffer array reordered → first send 200, second send 409 turn_id_conflict. json.dumps(sort_keys=True) orders keys, never array members.

The widened lane's canonical form now orders buffers by buffer key, in the same UTF-16 code-unit order the rest of this family declares. The v1 canonical form is deliberately untouched — its digests are already recorded in live stores, and that lane's closed envelope fixes buffer order by kind anyway.

Tests: test_a_widened_turn_replays_when_its_buffers_arrive_reordered (byte-identical replay, one dispatch for two sends), test_a_widened_turn_with_changed_content_still_conflicts (so the fix did not loosen idempotency into indifference), test_the_v1_canonical_form_is_untouched_by_the_reorder_fix.


CODEX-3 — CONFIRMED, with a nuance worth recording.

The outline spelling was already refused — but by the duplicate-key rule, and only because every request also carries an outline buffer. The document spelling validated clean (exit 0) while the route always refuses it: conformance certifying a shape that cannot be processed.

check_reserved_document_paths now runs on both lanes with the lane's own set, matching the route's post-CODEX-1 behaviour. The sets are restated, not imported — this validator is published by exact commit and run from a pinned checkout against arbitrary target repositories, so it must not import the runtime package that happens to sit beside it in the publisher — and test_the_validators_reserved_sets_agree_with_the_runtimes asserts the restatement agrees, which is the only thing that makes a restatement safe.

New negative: workbench-chat-turn-v2-reserved-key-path.negative.yaml, shaped as outline + exactly one document so nothing else claims the key. A fixture that also carried the unbacked slot fails on the duplicate-key rule and never reaches this one — which is precisely how the gap survived.

Tests: the three above plus test_a_v1_document_at_the_document_path_is_still_accepted.


CODEX-4 — CONFIRMED, in both directions.

Verified through the real mount. The re-score enumerated outline and document, so a path-keyed document was either scored against a hash the map did not hold (falsely stale — a human told to ask again in a new turn for no reason) or, where the reserved slot had been re-keyed away, the guard buffers.document found nothing and the re-score was skipped entirely, leaving the card current with an enabled Apply against text the buffer no longer held. That second shape is your reading exactly.

Settlement now re-scores every live buffer — the same set the turn's own observed_hashes declared. The swap-time guard is unchanged; this is the card telling the truth before anyone clicks it.

Both scenarios discriminate (each answer differs before and after the fix — my first draft of these tests passed against the unfixed code, so they were rewritten): test_the_settlement_rescore_covers_every_live_buffer, test_the_settlement_rescore_leaves_an_unmoved_buffer_current.


Gates at ef969e5: ideation suites 3234 passed, 7 skipped; openspec validate --all --strict 61 passed / 0 failed; doc-health 3 critical, 6 error, 70 warning, 3 info, 0 new regressions; dashboard validator 0 error(s), 4 warning(s) exit 0; validate-contract-release.py build byte-identical to the committed inventory (neither the validator nor examples/ are inventory members) and verify-commit pass. contract-v1.34 still absent from the CHANGELOG, manifest, contracts/releases/ and the remote tags on origin/main, which has not moved with contract changes.

🤖 Generated with Claude Code

brettheap and others added 2 commits August 19, 2026 00:05
…about v1 order

N5 -- the reworked `require_outline_and_documents` paragraph sat at column 0
inside an indented docstring.

N6 -- the v1-reorder justification said the closed v1 envelope 'fixes buffer
order by kind'. It does not: it fixes the buffer COUNT and their KINDS, not their
array order, so a v1 client that retransmits with its two buffers swapped gets
the same 409 the widened lane's canonicalization closes. That wart is KNOWINGLY
RETAINED -- changing the v1 canonical form would make every already-recorded
digest unreplayable, a live break traded against a latent one -- and it dies with
the lane at contract-v2.0. Corrected in both places it was committed (the route
comment and the test's own docstring); the CHANGELOG never carried the claim, so
no release-surface byte moved.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 19, 2026 04:11
@brettheap
brettheap merged commit 5daa173 into main Aug 19, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.

Comment on lines +2141 to +2142
assistant_prose=outcome.assistant_prose,
proposals=outcome.proposals)
brettheap pushed a commit that referenced this pull request Aug 19, 2026
The annotated tag exists: object 439d76b,
dereferencing to 5daa173 -- the squash-merge of
PR #210 -- and verified from the remote rather than from the local ref that
created it. `validate-contract-release.py verify-commit --commit contract-v1.34`
reproduces every digest in contracts/releases/contract-v1.34.digests.yaml from
the tag's own objects.

So `doxbench_contracts.CONTRACT_REF` stops being the
`unpublished:contract-v1.34` sentinel and names that commit, in the spelling the
v1.31 pin used (the tag's DEREFERENCED commit, never the tag object). The
sentinel did its job: across the realization branch there was no release commit
to name, and a value no stack.yaml can declare made a consumer refuse rather
than match by accident.

Task 13.3 ticks here rather than at the merge, which is the point of the
policy's realization order: the squash created a NEW commit, so every gate reran
against it before anything was tagged.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap
brettheap deleted the change/doxbench-b-s13-chat-wire branch August 21, 2026 23:57
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.

2 participants