Skip to content

Realize 10.7: the success envelope states its context posture (additive contract-v1.40) - #256

Merged
brettheap merged 38 commits into
mainfrom
change/doxbench-turn-posture-release
Aug 22, 2026
Merged

brettheap merged 38 commits into
mainfrom
change/doxbench-turn-posture-release

Conversation

@brettheap

@brettheap brettheap commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Realize 10.7: the chat-turn record states its assembled context's posture (additive contract-v1.40)

Closes the last open release in doxBench Phase B. The ratified knowledge-service
requirement ends "the turn SHALL degrade to a declared reduced packet … with
the reduced posture STATED
"
. The packet half shipped with §10; the posture was
stated only inside the assembled context, where no reader of the record and no
human on the surface could consult it. workbench-chat-turn-v2-success is a
closed envelope with no field for one, so 10.7 stayed open with its obligation
recorded against itself. This is that release, and it ticks 10.7 and 13.8 —
every task box in the change is now checked.

Re-cut as contract-v1.40 (was v1.39)

add-roster-directory-admission-surface (PR #259, 5124fbcd, merged at
1f45e427) landed while this was in review and allocated contract-v1.39.
The version is allocated at realization against what is available, and CHANGELOG
presence on main is the availability test — so v1.39 is theirs and this
release is contract-v1.40.

Both sides saw it coming: their entry names this branch and its working v1.39 by
sha, and says "Whichever of the two lands second re-cuts against the CHANGELOG
it then finds."
This is that re-cut. The two releases are independent —
theirs grows xfactory-client-identity-roster.schema.yaml, this one grows
xfactory-workbench-chat-turn.schema.yaml — so the only conflicts were the
shared release surface: the CHANGELOG (both entries kept, theirs at v1.39 and
this one renumbered above it) and the v1.39 inventory path (theirs taken verbatim
and byte-identical to origin/main; ours rebuilt at contract-v1.40).

Not the PR #235 landmine that made the v1.37→v1.38 re-cut messy: their
releases/contract-v1.39.digests.yaml is present and complete, and
verify-commit --commit 1f45e427 passes against it. The schema's own bytes do
move in the renumber — its comments name the release it belongs to — so the
digest is repinned at all four sites and the v1.40 inventory moves exactly four
digests: CHANGELOG, contracts/README, manifest, chat-turn schema.

The contract

$defs/success_v2 gains ONE optional property, context_packet, referencing one
new closed $def: posture (full | reduced, required) and reduced_reason
(present iff reduced). Two allOf conditionals enforce the pairing; they are
not each other's inverse and each has its own packaged negative and revert-test.
contract_schema_version stays 1.

Additive, verified against the released bytes: the pre-release record shape
still validates (a packaged instance proves it), the v1 success and v2 failure
envelopes both refuse the key, and no existing record is reinterpreted.

This producer ALWAYS states the posture, including full — the release's
largest judgement call.
doxbench_turn_v2_success_body takes the posture as a
REQUIRED argument, so no v2 record this repository builds can silently omit it,
and a full turn's record says full rather than saying nothing. The cost is
stated rather than buried: every v2 success body this server produces now
carries one more key than it did at contract-v1.38
, as does the copy the
idempotency store replays — this is the only part of the release that changes the
bytes of every existing response. contract-v1.38 rejected always-emitting for
its catalog projection and this adopts it, because the omission means something
different here: there, absent and explicit-false were the same fact and
emitting bought nothing; here a turn always ran under some posture, so omitting
on a full turn would make the posture inferable only by ABSENCE — which is
exactly the reading the next paragraph forbids.

Omission is not a posture claim. An absent context_packet means a producer
older than v1.40 — never that the context was full. This is the mirror of
contract-v1.38's disclosure call and the opposite conclusion, for the
opposite reason: there, omission and explicit-false were the same fact; here a
turn always ran under some posture and the only question is whether the producer
said so. Both readings are packaged.

Five things a reviewer should read first

1. The review record: 46 revert runs, 41 mutations, FOUR came back GREEN.
Every schema clause was reverted individually with the digest repinned so each
fired on the clause rather than the pin. The four GREENs are the useful part, and
two of them are the same class: a probe satisfied by a downstream guard rather
than by the thing it names.
S1's order probe read writes[length-1] and a
later benign re-render masked the defect; NEW-2's stored-blob probe read the
rendered note, which reducedContextNote's own second guard satisfies. Both now
assert at the layer they name (every write; the adopted state), both re-run RED.
The other two: an unguarded thread-switch clear (test added), and the delegated
validator's restated pairing arms, which are kept as diagnostics — disabling
them leaves the validator's own self-test green because the shape refuses the
same instances, so their only guard is the finding-code pin, and the record says
so rather than calling them a second refusal.

2. The ceiling is producer-enforced, pre-dispatch, in CODE POINTS. An earlier
draft claimed a byte guard that did not exist. Measured against the released
validators: a 500-code-point CJK reason (1,500 UTF-8 bytes) was served 200,
and a 501-code-point reason answered 502 response_invalid with the provider
dispatch already paid for
. serve.doxbench_context_packet now refuses
pre-dispatch, in code points, so it refuses exactly what the shape refuses and no
conformant record more — the CJK case is still served, and a released-lane test
says so.
Consumers sizing a buffer must size it in bytes; maxLength is
code points. Nothing is truncated: truncating a statement about a degradation is
how a degradation goes quiet.

3. A named follow-up, not a defect: 400 vs 500. All four refusals in
doxbench_context_packet have server-authored, non-caller-fixable causes — which
is precisely the class the route's context_packet_invalid (500) arm exists for
and says so in as many words ("never a 4xx blaming the turn") — yet they answer
invalid_turn_request (400). Kept on one code: one function, one refusal shape,
and all four arms verified unreachable in production (ContextPacket refuses
three at construction; a test holds the shipped constants under the fourth).
Moving the whole function to the 500 arm is a follow-up, named rather than
smuggled into a fix pass that four tests pin.

A second follow-up, named and deliberately not coded here:
adoptContextPacket applies no length bound to a RESTORED reason, so a tampered
browser-local snapshot renders an arbitrarily long muted note (the reviewer's
instance: 200,000 code points). Neither a security nor a correctness defect — the
blob is browser-local and per-viewer, the only party who can tamper with it is
the person who then reads it, and nothing it produces reaches the wire, the
server, or another viewer. One line
(reason.length <= CONTEXT_REDUCED_REASON_MAX_LENGTH) is the fix, and it belongs
to the slice that touches that function next.

4. The note is keyed to the transcript's LAST ASSISTANT ANSWER, and the
failed-follow-up case is why. An earlier draft cleared it when a flight started;
a reduced answer followed by a failed follow-up then lost its disclosure
while still holding the transcript — the same lost-badge defect the release cited
when it rejected per-turn badges, at rail level. A flight starting replaces no
answer, so the clear is gone and the invariant holds by not being violated.
Restoring it in settleTurnFailure was rejected: it needs a stash plus the same
restore in abortTurn and recordLocalFailure — one invariant at three
sites. A full turn shows nothing new, deliberately: a standing "full context"
badge is a line operators learn to stop reading.

5. The fourth answer-replacing path, and the snapshot disposition.
restoreChatState replaces the transcript wholesale and kept a stale posture —
reproduced as a restored answer captioned by a note that never described it.
Reachability was nil; the sentence was the defect, and three places claimed
the enumeration was complete at three paths. NEW-2 taken as CLOSE, with no
version bump:
CHAT_SNAPSHOT_VERSION is a fail-closed gate, so bumping would
discard every stored blob on the first reopen (composer text, subject, model
choice, proposals) to add a caption. An optional field invalidates nothing — an
old blob restores to posture-unknown, which renders no note and is the
pre-release behaviour exactly, and a new blob read by an older build is ignored.
The stored field carries the released object whole under the same name, so one
validator serves a wire record and a stored blob
and a contradictory blob fails
closed. An explicit full is persisted too — dropping it would restore "unknown"
over a posture somebody checked, re-introducing the inference-by-absence the
release forbids.

The bot round: Copilot named two gates, there were four

Copilot filed two inline findings, both real, both the same class — presence
vs truthiness on reduced_reason
. The released shape forbids the field's
KEY on a full posture (not: {required: [reduced_reason]}); three other
gates forbade only a useful value. Reproduced across all five gates before
anything was touched:

instance shape delegated validator ContextPacket serve derivation browser adopter
key absent ok ok ok ok ok
reduced_reason: "" REFUSES REFUSES accepted accepted accepted
reduced_reason: null REFUSES accepted n/a n/a accepted
a real reason REFUSES REFUSES REFUSES REFUSES REFUSES

Copilot named columns 3 and 5. Fixing them surfaced two more: the CONSTRUCTION
gate ContextPacket.__post_init__ had it too — which matters because this
release claims in writing that the type, the shape and the validator "assert
this one rule"
, and that was false at the blank string — and the DELEGATED
VALIDATOR read the value where the shape reads the key, so .get() could not
tell a null from an absent one.

The defect was SILENT NORMALISATION, not a wire violation. Nothing
non-conformant ever reached the wire: the producers accepted the
self-contradicting packet and then emitted a record with the key quietly
dropped — a conformant, key-less {posture: "full"}. That is worse than a
refusal and harder to see, because the record that arrives looks perfectly
well-formed and the contradiction is gone by the time anyone can read it. The
fix makes all four gates refuse at the same boundary the shape does.

The reduced arm is deliberately unchanged, and the asymmetry is the shape's
own: full refuses the field for being there; reduced refuses it for being
unusable (required plus minLength: 1). Two rules, not one predicate.
Pinned both ways.

No contract byte moved in the bot round — the shape was right all along. The
schema digest is unchanged at
cc874fef63e387a5f16c9d7ed5235bc03fb4fc68537a31c42d3acc5259d76ffa, the
inventory is untouched, and verify-commit passes; asserted rather than
assumed, and the two new packaged negatives (one per instance a different gate
missed) are confirmed not inventory members.

Recorded gaps (not closed, and why)

  • The thread sidecar still cannot state the posture. _parse_turn refuses
    any turn header that does not split into exactly three fields, so a fourth
    would make every sidecar on disk unreadable by the new parser and every new one
    unreadable by the old. A breaking migration inside an additive release. This is
    the honest counterpart to v1.38's F3: a reader of a thread file can learn which
    model answered and cannot learn what context it answered on. The contrast with
    the snapshot is exactly why one closed and this did not.
  • The delegated redaction scan is a LINT, with misses in both directions
    (refuses innocent api_key prose, passes a PAT-shaped token). Kept for the
    obvious shapes; a clean scan establishes nothing. The structural protection is
    that the reasons are module constants, not formatted provider errors.
  • An owed cross-repo follow-up, recorded and not performed. The schema's
    description names codexFactory specs/010-doxbench-editor-chat/contracts/chat-turn.md as its consumer
    contract. That file is not in this checkout and was not read, so this is an
    OBLIGATION rather than a finding: if it enumerates the v2 success envelope's
    fields, it is now short by one, exactly as contract-v1.38's entry recorded
    for the model-catalog document. It stays CORRECT either way while that
    repository pins contract-v1.27, which is the pin it declares — nothing there
    is wrong today, and it becomes wrong the moment that repository re-pins.
    Updating it is codexFactory's own governed act under the domain upgrade
    runbook; no file in that repository is touched here.
  • The deprecated v1 envelope is not widened — a v1 turn that ran reduced
    succeeds and cannot say so. Recorded at the arm, in the CHANGELOG, and pinned
    by a test that fails if the v1 record ever grows the key.

Release surface

CHANGELOG entry, manifest row digest + rewritten consumption_rule, bundle bump,
and the 190-entry inventory built after the bump (exactly four digests move:
CHANGELOG, contracts/README, manifest, chat-turn schema). verify-commit --commit HEAD passes. The runtime repin carries the unpublished:contract-v1.40 sentinel;
the annotated tag is published against the commit that actually lands, and every
gate reruns at that squash first. 13.8's tick states those three pending facts at
the head of its block: built and gated now; merged at the landing squash.

Archiving is Brett's act and was NOT performed. Every task box in the change
is now checked, so proposal-support.py archive's "change has incomplete tasks"
refusal no longer stands in the way — which is a statement about the gate, not
permission to walk through it. The archive runs through proposal-support on
Brett's explicit word, and nothing here decides it.

🤖 Generated with Claude Code

brettheap and others added 22 commits August 21, 2026 23:17
…ecord

Additive on `$defs/success_v2`: ONE optional property, `context_packet`, a
closed object carrying the packet's own `posture` (`full | reduced`) and its
`reduced_reason`, with two conditionals refusing each half of the truth-pairing
`ContextPacket` enforces at construction -- reduced-without-reason and
reason-on-full. Nothing previously valid becomes invalid: the key is OPTIONAL and
its ABSENCE is not a posture claim.

ONE OBJECT rather than two sibling keys, on the `selected_model` precedent in
the same file: one fact about one thing, the present-iff rule stays local to the
object that owns it, and the ENVELOPE's key set is identical for a full turn and
a reduced one.

`serve.doxbench_context_packet` is the ONE derivation, beside
`doxbench_selected_model`, reading the packet the turn actually ran under --
never re-deriving from "was there a knowledge service?", which would be a second
authority (the packet also reduces when a live backend REFUSES a retrieval). It
is called INSIDE the route's packet boundary, so a lying injected assembler is a
`PacketError` mapped to the fixed `invalid_turn_request` rather than a guessed
posture. The builder takes two named scalars, not a dict, and the posture is
REQUIRED of it.

The v1 lane is untouched and its second limitation is recorded at the arm.

Co-Authored-By: Claude Fable 5 <[email protected]>
The browser half the release exists for. `settleTurnSuccess` adopts the record's
`context_packet` instead of projecting it away (the adopter is total by refusal
and FAILS CLOSED on a contradiction -- a `reduced` with no readable reason drops
to null rather than showing the silent degradation with a badge on it), and
`beginTurn` and `adoptThreadTranscript` clear it, so the note only ever
describes the answer currently on screen.

`reducedContextNote` is the one pure selector, and `div.doxchat-context` is one
aria-live note under the transcript. A FULL turn shows nothing new: a standing
"full context" badge is a line operators learn to stop reading, which is how the
reduced one would stop being noticed.

Deliberately a rail-level fact about the LAST ANSWER, not a per-turn badge: a
transcript restored from the server's thread sidecar carries no posture, so
per-turn badges would be present on a lived-through turn and absent on the
identical restored one.

Co-Authored-By: Claude Fable 5 <[email protected]>
The validator learns `check_context_packet`: the PAIRING (restated on purpose --
the v1.38 F2 finding was a file gate that had grown weaker than the type gate
while claiming parity, and three gates now assert this one rule) plus the
credential/endpoint spelling scan over the reason, which is the release's one new
free-prose field and the only rule here the shape cannot express. A third rule
was considered and rejected in the docstring: prose-matching the reason.

Packaged: TWO positives (reduced-with-its-reason, explicitly-full) beside the
unchanged pre-release record whose continued validity IS the additive claim, and
FOUR negatives -- reduced-without-reason, reason-on-full, an unknown posture, and
a fourth fact on the closed object. Validator stays 0 errors / 4 warnings;
examples 39 -> 41 valid, 61 -> 65 negative.

Repin: CONTRACT_TAG -> contract-v1.39 with the `unpublished:` sentinel for the
ref, the CHAT-TURN digest moved (the catalog's unmoved -- the mirror image of the
v1.38 repin), the manifest row digest + rewritten consumption_rule, and the
test-side RELEASED_* mirror plus the packaged-positive count 11 -> 13.

The route fixture schema declares `context_packet` and does NOT require it,
mirroring the release: that fixture's job is discriminators and closedness, and
the released bytes hold the value rules.

Co-Authored-By: Claude Fable 5 <[email protected]>
CONTRACTS: the additive-class block against the REAL released bytes -- the
pre-release record still valid with no posture at all, four conformant postures,
eleven refusals (including the reason at its exact 500-byte ceiling and one byte
past it), the S1-vs-S3 read on this shape (each conditional guards a case the
other does not, and the unknown posture is refused by the enum NEITHER touches),
and the blast radius: the v1 success and the v2 failure both refuse the key, so
"one optional property on one shape" is checkable rather than described.

THREE GATES, ONE RULE, asserted: each packaged pairing negative is refused by the
shape, by the delegated validator with the `context-packet` finding code, AND by
`ContextPacket.__post_init__`. The other two negatives are the shape's alone and
the table says so -- the validator does not restate an enum or a closure.

ROUTE: the reduced and full scenarios end to end on the widened lane; the record
and the packet's own declaration pinned equal; a REFUSING backend recording its
own reason (the case a "re-derive from whether a knowledge service existed"
implementation would get exactly backwards); the v1 lane still succeeding and
still unable to say so; and every shipped reduction reason checked against the
released ceiling, because an over-long one would turn a degraded turn into a
`response_invalid` refusal on the one path nobody exercises by hand.

FAIL-CLOSED: four lying-assembler cases through the injected seam, each refused
with the fixed `invalid_turn_request` and nothing dispatched.

SURFACE: a node probe over the SHIPPED bytes -- reduced renders the note and the
reason, full renders nothing, an older record renders no phantom badge, both
self-contradicting records render silence rather than half a statement, and a
new flight clears the note.

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

Completes the release surface for tasks.md §10.7 of add-doxbench-editing-phase-b:
the CHANGELOG entry and the release DIGEST INVENTORY. The schema growth, the
manifest row (recomputed digest + rewritten consumption_rule), the bundle bump
and the consuming runtime repin are the preceding commits on this branch; the
branch squashes to one unit, exactly as §11.7's and §13's releases did.

ALLOCATED v1.39, CHECKED AT ALLOCATION. At the branch base 6614061 the
CHANGELOG's newest heading was contract-v1.38 and the bundle read
contract-v1.38, so v1.39 was the next available number. CHANGELOG presence is
the availability test -- the habit the v1.37/v1.38 episode earned.

THE PRECEDING RELEASE SURFACE IS GREEN, checked rather than assumed:
verify-commit --commit origin/main PASSES at 6614061 against
contracts/releases/contract-v1.38.digests.yaml. The v1.37 lane's
HGR-RELEASE-DIGEST-MISMATCH no longer applies now the bundle has moved.
Recorded in the entry, because the two preceding releases both found the
surface broken when they got there.

INVENTORY BUILT AFTER THE BUNDLE BUMP (v1.36's first tag failed on exactly
this): 190 entries, and exactly four digests move -- CHANGELOG, README,
manifest, and the chat-turn schema, which are precisely this cut's
inventory-member files.

A FIFTH PACKAGED NEGATIVE lands with the entry: a reduction reason leaking a
raw endpoint and a bearer credential. It is the ONE case the shape cannot
refuse, which is why it is the one this release delegates -- and the negative
table now records which gate owns each case rather than settling for
"something refused it".
10.7 is CHECKED because the ratified `The knowledge service is unavailable`
scenario is claimable in full: the record carries `context_packet` and the rail
states the reduced posture to the HUMAN, which is the half the task stayed open
for. The tick records the release, the one derivation and its four
lying-assembler refusals, the two delegated rules and the third that was
rejected, the five packaged negatives and which gate owns each, the fail-closed
ceiling hazard, and SIX flagged judgement calls: one nested object with the
packet's own names, always stating the posture (the OPPOSITE of 11.7's
disclosure call, and why), omission is not a posture claim, no
`dependentRequired` and why that is not a weakening, the rail-level note rather
than per-turn badges, and the THREAD SIDECAR GAP -- flagged as a gap, refused on
the parser's fixed arity rather than on merit, and named as F3's honest
counterpart.

13.8 is CHECKED because the set it waits on is empty. Its stale sentence
claiming 11.7 owes a model-catalog release is CORRECTED with the citation
(contract-v1.38, PR #244 / 0f50b35, pin resolved at 58e4aec) -- 11.7's own
tick deliberately left that to this task's owner, and this is the owner
arriving. What the tick does NOT claim is spelled out: the squash sha, the
published tag and the sentinel resolution are the post-land step, with a blank
line for the follow-up to fill in.

Ledger: both remaining rows struck with attribution, TWO open rows became ZERO,
and the note says plainly that the archive gate's mechanical refusal no longer
standing is a statement about the gate rather than permission to walk through
it. Nothing archived.

proposal.md `contract_release:` goes THREE releases -> FOUR across three schemas
(the chat-turn schema carries two), and owes none.

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

R24 came back GREEN: deleting adoptThreadTranscript's posture clear broke no
test. The probe now asserts it -- switching documents replaces the transcript
with the SERVER's thread record, which carries no posture, so a note left
standing captions one conversation with a fact about another (the same defect
class P2-9 found for the transcript itself).

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

TWO honest corrections to the record, both from the 26-case revert pass:

* the delegated validator's RESTATED pairing arms are a DIAGNOSTIC, not an
  independent guard -- disabling both leaves the validator's own self-test
  green, because the shape refuses the same instances anyway. Same class as
  11.7's separator-collision and self-reference arms, handled the same way
  (pinned on the finding CODE, which is the only guard that fails). Said in
  both the CHANGELOG and the tick rather than left implying a second refusal.
* the tick now carries the revert-test summary, including the ONE case that
  came back GREEN and the test added for it.

The CHANGELOG is a v1.39 INVENTORY MEMBER, so the inventory is REBUILT with it
-- the habit the v1.37 lane's PR #242 miss earned. Still 190 entries, still the
same four moved digests.
An adversarial reader would have caught every one of these, so they are fixed
before one has to:

* the key-set-equality argument cited "an existing route-level test still passes
  UNCHANGED". The pre-existing test is on the DEPRECATED v1 lane, where the key
  does not exist at all and which therefore says nothing about the nesting. The
  claim now names the NEW widened-lane test that actually carries it -- and says
  why two sibling keys would have made that test unwritable.
* "the packet half shipped at contract-v1.34's slice" -> it shipped with §10
  itself (PR #216). v1.34 was §13.
* "the inventory ships inside this cut, as contract-v1.34 through v1.38 all did"
  -> v1.37 did NOT, which is the defect this very file records against it.
* "the two preceding releases both found the surface broken" -> ONE preceding
  release found it broken, twice.
* the codexFactory chat-turn consumer doc is NOT in this checkout and was NOT
  read. The entry now states the OBLIGATION rather than asserting a finding.
* "1..500 bytes" -> JSON Schema counts `maxLength` in CODE POINTS. The producer's
  guard checks the stricter UTF-8 BYTE count against the same number, which is
  now what both the schema comment and the entry say.

Also: the unchanged pre-release example is unchanged in its INSTANCE (its header
comment grew), the pin-drift revert wording says three surfaces drifted once
rather than "both directions", `check_context_packet`'s own docstring now carries
the diagnostic finding, and 13.8's green numbers are re-measured AFTER the
origin/main merge with the fifteenth skip explained as a checkout-layout artifact.

The CHANGELOG and the SCHEMA both moved, so the digest is repinned on all three
surfaces and the inventory REBUILT after it.
S1 — THE NOTE WAS WRITTEN WHILE HIDDEN, so "live-announced" was nearly false.
A `hidden` node is out of the accessibility tree; the text mutation landed in a
node no live region observed, and `aria-live` read `polite` either way, which is
why an attribute assertion could not catch it. Order now matches the failure
note beside it (un-hide, then write), and the probe pins the ORDER by recording
`hidden` AT THE MOMENT of the write.

S2 — THE SCHEMA COMMENT CLAIMED A BYTE GUARD THAT DID NOT EXIST, in released
bytes. Reproduced against the RELEASED validators: a 500-code-point CJK reason
(1,500 bytes) SERVED 200; a 501-code-point reason 502 `response_invalid` with
dispatch ALREADY COUNTED. Three fixes: the comment now says CODE POINTS and what
that means for a consumer sizing a buffer; the constants test's docstring names
its unit and why it uses the stricter one; and `doxbench_context_packet` gained
the bound itself, in code points, pre-dispatch -- so it refuses exactly what the
shape refuses and no conformant record more (the CJK case is still served, and a
test says so). The constant is pinned to the released `maxLength`.

S3 — 13.8 ASSERTED "MERGED" PRE-MERGE. The three pending facts (squash sha, tag,
sentinel) are lifted to the HEAD of the block so a reader meets them before any
claim they qualify, and the gate's verb is stated exactly: BUILT AND GATED now,
MERGED at the landing squash.

S4 — A FAILED FOLLOW-UP STRIPPED THE REDUCED ANSWER'S DISCLOSURE. Reproduced
(reduced -> note; FAILED follow-up -> no note, transcript unchanged). Took the
reviewer's SECOND shape: delete the `beginTurn` clear, because a flight starting
replaces no answer and every path that replaces one already replaces the posture
beside it. Restoring in `settleTurnFailure` was rejected -- it would need a stash
plus the same restore in `abortTurn` and `recordLocalFailure`, re-implementing
one invariant at three sites. Both directions probed and revert-tested.

N1 the redaction scan is a LINT with misses in both directions, not a guard --
kept, reworded in the validator docstring, the CHANGELOG and the tick.
N3 one route test drives a reduced turn through the RELEASED schema with the
default validator seam, closing the fixture-schema gap on the posture rules.
N6 `TurnStore` is per-process, in-memory and bounded; nothing durably stores a
v2 body. The durable record is the thread sidecar, which does not carry it.

The schema and the CHANGELOG both moved: digest repinned on all three surfaces,
inventory REBUILT after it.
The R27 revert-test came back GREEN with the defect restored. Cause: under the
wrong order a reduced turn produces TWO non-empty writes -- the settling render
writes the text while the node is still hidden (the announcement is lost there)
and a LATER re-render writes the identical text with it already visible. The
probe read writes[length-1] and saw only the benign second one.

Now asserted over every non-empty write: none may happen while hidden, and the
FIRST one is checked explicitly. Exactly the trap the reviewer warned about when
they said attribute assertions cannot catch this.

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

The S1 probe itself came back GREEN with the defect restored -- the most useful
result in the table, and the reviewer's own predicted failure mode one level up.
Recorded beside the other two.

Co-Authored-By: Claude Fable 5 <[email protected]>
…d the snapshot

S3 RESIDUAL — the ledger summary paragraph, which a reader reaches BEFORE the
tick block, still said the release had "landed" and that the archive gate's
sentence "is true ... and it now is". Same overclaim, same correction: built and
gated now; merged and landed become true at the landing squash.

NEW-1 — `restoreChatState` is a FOURTH answer-replacing path and kept a stale
posture. Reproduced: restore a different conversation's snapshot over a reduced
state and the note survives, captioning "a DIFFERENT, un-described answer".
Reachability nil (the sole caller restores onto a freshly mounted rail) but
three enumerations claimed completeness at three paths. Named as the fourth in
all three, probed, revert-tested.

NEW-2 TAKEN AS (a), CLOSE IT, NO VERSION BUMP. `CHAT_SNAPSHOT_VERSION` is a
fail-closed gate -- restoreChatState keeps the FRESH state on an unrecognized
version -- so bumping would discard every stored blob on the first reopen:
composer text, subject, model choice and proposals, spent to add a caption. An
OPTIONAL field invalidates nothing: an old blob restores to posture-unknown (no
note, the pre-release behaviour), and a new blob read by an older build is
ignored because the restore reads named fields and never enumerates. Same
additive reasoning the wire contracts use, applied to a blob. The stored field
is named `context_packet` and carries the released object whole, so ONE
validator serves both readers and a contradictory blob fails closed.

An explicit `full` IS persisted. The first probe called that an oversight; it is
the doctrine -- absent and `full` are different facts everywhere else in this
release, so dropping `full` would restore "unknown" over a posture somebody
checked.

NEW-3 the live region is written only when its text CHANGES (the reviewer
measured seven re-announcements of the same 227-char sentence from composer
keystrokes); probe pins the write count across seven keystrokes.
NEW-4 the CJK conformance test now runs @released_only through _UNSET, so
"conformant" is a claim about the released bytes rather than about the fixture.
Its over-long sibling needs no such treatment: the producer guard fires before
any validator is consulted.

Also corrected: a tick sentence still saying `beginTurn` clears the note.
The CHANGELOG moved, so the inventory is REBUILT with it (the schema did not).
…dered note

R39 came back GREEN twice. Cause: reducedContextNote holds its own second guard
on the same rule, so a note-level assertion is satisfied even when
restoreChatState trusts the blob whole. The probe now reads the adopted state
across five contradictions and also asserts the honest blob still adopts, so the
guard is shown to be discriminating rather than merely refusing.

(The second GREEN was a process error of mine, not a second defect: revert.py
restores with , which reverted this strengthening because I
had not committed it before running the drive. Committing first from here.)

Co-Authored-By: Claude Fable 5 <[email protected]>
Twice now a probe has been satisfied by a downstream guard rather than by the
thing it names (S1's later re-render, NEW-2's selector second-guard). Recorded
as a habit to check. Also records the harness process note: commit before
revert-testing, because restore() is git checkout -- .

Co-Authored-By: Claude Fable 5 <[email protected]>
The adopter NORMALIZES (drops an unknown key and still adopts) where the
released shape's closure REFUSES the instance. "Exactly the rule a malformed
wire record does" was a shade strong for the closure case, so the comment now
says the PAIRING rule is shared and the verdicts differ -- and why each is right
where it sits. It lives in doxbench-chat-model.js, which is not released bytes,
so the correction lands at the source rather than in a frozen entry.

Recorded, NOT coded: adoptContextPacket applies no length bound to a RESTORED
reason (a tampered browser-local blob renders an arbitrarily long muted note;
browser-local, self-tamper only, nothing reaches the wire, the server or another
viewer). One line is the fix and it belongs to the slice that touches the
function next.

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

@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 pull request realizes contract-v1.39 by adding an optional context_packet object to the workbench-chat-turn-v2-success envelope so the success record explicitly states the assembled context posture (full|reduced) and (when reduced) its reason, and then propagates that posture to the doxBench chat UI so humans can see the reduced-context disclosure.

Changes:

  • Extend the chat-turn v2 success schema with a closed $defs/context_packet and update the contract release surface (bundle version, digests inventory, manifest, changelog, docs).
  • Emit and validate context_packet from the server route, and delegate posture lint/pairing checks to the ideation-dashboard contracts validator.
  • Adopt posture into browser chat state and render a reduced-context disclosure note (with accessibility-focused ordering), with extensive new route/UI/contract tests and examples.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ideation-dashboard/test_doxbench_routes.py Updates v2 success key pins and adds a released-lane end-to-end posture conformance test.
tests/ideation-dashboard/test_doxbench_knowledge_service.py Adds end-to-end assertions that records state full vs reduced posture (and reasons) based on knowledge-service behavior, plus pre-dispatch length guarding.
tests/ideation-dashboard/test_doxbench_contracts.py Repins released digests/tag sentinel and adds additive/negative coverage for the new context_packet schema rules.
tests/ideation-dashboard/test_doxbench_chat_view.py Adds a Node-based harness probe to validate shipped UI bytes render/announce reduced-context disclosure correctly and robustly.
scripts/validate-ideation-dashboard-contracts.py Adds delegated validation/linting for context_packet (pairing + credential/endpoint scan).
scripts/ideation_dashboard/web/views/doxbench-chat.js Adds reduced-context note selector + renders a live-announced disclosure region with change-only writes.
scripts/ideation_dashboard/web/views/doxbench-chat-model.js Adds posture adoption from wire and snapshot persistence/restoration for disclosure continuity.
scripts/ideation_dashboard/web/styles.css Styles the new reduced-context disclosure note.
scripts/ideation_dashboard/serve.py Adds producer-side context_packet derivation + maxLength guard and emits the new field in v2 success responses.
scripts/ideation_dashboard/doxbench_contracts.py Repins runtime contract bundle/tag/digests to v1.39 sentinel/digest.
openspec/changes/add-doxbench-editing-phase-b/tasks.md Marks tasks 10.7 and 13.8 closed and records detailed realization evidence and follow-ups.
openspec/changes/add-doxbench-editing-phase-b/proposal.md Updates proposal frontmatter to include the fourth additive release (contract-v1.39).
examples/ideation-dashboard/workbench-chat-turn-v2-success.example.yaml Clarifies that absence of context_packet remains valid and means “producer older than v1.39”.
examples/ideation-dashboard/workbench-chat-turn-v2-reduced-context.example.yaml Adds a positive example for reduced posture with reason.
examples/ideation-dashboard/workbench-chat-turn-v2-full-context.example.yaml Adds a positive example for explicitly stated full posture.
examples/ideation-dashboard/README.md Documents new posture examples and negatives.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-context-unknown-posture.negative.yaml Adds negative example for invalid posture vocabulary value.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-context-reduced-without-reason.negative.yaml Adds negative example for reduced posture missing reason.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-context-reason-on-full.negative.yaml Adds negative example for full posture carrying a reason.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-context-reason-leaks-a-credential.negative.yaml Adds negative example for credential/endpoint leakage caught only by delegated validator.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-context-extra-field.negative.yaml Adds negative example for closure violation (extra key on posture object).
contracts/schemas/xfactory-workbench-chat-turn.schema.yaml Adds $defs/context_packet and optional success_v2.context_packet with pairing conditionals and bounds.
contracts/releases/contract-v1.39.digests.yaml Adds the v1.39 digest inventory for the contract release.
contracts/README.md Updates contract index documentation for chat-turn schema growth at v1.39.
contracts/manifest.yaml Bumps bundle version to v1.39 and updates chat-turn schema digest + consumption rule.
contracts/CHANGELOG.md Adds the contract-v1.39 release entry documenting the additive schema growth and surface behavior.

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

Comment on lines +760 to +765
if posture == doxbench_packet.POSTURE_FULL:
if reason:
raise doxbench_packet.PacketError(
"a full packet carries no reduction reason; a record cannot "
"state both postures and let a reader pick")
return {"posture": posture}
Comment on lines +361 to +366
const posture = raw.posture;
const reason = raw.reduced_reason;
const hasReason = typeof reason === "string" && reason !== "";
if (posture === "full") {
return hasReason ? null : Object.freeze({ posture: "full" });
}
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 46e609fb8a

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

brettheap and others added 2 commits August 22, 2026 07:31
BOTH FINDINGS CONFIRMED, reproduced across all five gates before anything was
touched. The released shape forbids `reduced_reason`'s KEY on a `full` posture
(`not: {required: [reduced_reason]}`). Three other gates forbade only a USEFUL
value, so `{posture: "full", reduced_reason: ""}` passed them:

  instance            shape   delegated  ContextPacket  serve    adopter
  key absent            ok       ok           ok          ok       ok
  reduced_reason ""  REFUSES  REFUSES      ACCEPTS*    ACCEPTS*  ACCEPTS*
  reduced_reason null REFUSES ACCEPTS*       n/a         n/a     ACCEPTS*
  a real reason      REFUSES  REFUSES      REFUSES     REFUSES   REFUSES

Copilot 1 (serve.py) and Copilot 2 (doxbench-chat-model.js) are the third and
fifth columns. Fixing them surfaced two more of the same class: the CONSTRUCTION
gate `ContextPacket.__post_init__` had it too — and the release claims in writing
that the type, the shape and the validator "assert this one rule", which was
false at the blank — and the DELEGATED VALIDATOR read `reason is not None` where
the shape reads the key, so `.get()` could not tell a `null` from an absent one.
Copilot named two gates; there were four.

FIXED at each, with the unit matched to what the reader can see: `is not None`
at the type and the derivation (a Python attribute has no key/value distinction,
so that IS presence there), own-key presence in the validator and the adopter,
which read JSON and do.

THE REDUCED ARM IS UNCHANGED, deliberately, and the asymmetry is the shape's
own: `full` refuses the field for BEING THERE, `reduced` refuses it for being
UNUSABLE (`required` plus `minLength: 1`). Two rules, not one predicate — said
at each site, because collapsing them is how this comes back. Pinned both ways:
a blank still refuses on `reduced`, a real reason still passes, an absent key
still adopts on `full`.

Two packaged negatives, one per instance a different gate missed:
`-context-empty-reason-on-full` and `-context-null-reason-on-full`. Six
revert-tests, all RED, including two that loosen the reduced arm to prove the
fix tightened `full` without weakening it.

NO CONTRACT BYTE MOVES — the shape was right all along. Schema digest unchanged
at cc874fef…, inventory untouched, verify-commit passes; asserted rather than
assumed, and the two new examples confirmed NOT inventory members.

Co-Authored-By: Claude Fable 5 <[email protected]>
…o fifth GREEN

The validator revert leaves its own self-test green because its pairing arms are
DIAGNOSTICS -- already recorded, and the finding-code pin that guards them went
RED. Predicted, then observed.

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

@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: bdd35b434e

ℹ️ 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 thread scripts/ideation_dashboard/serve.py Outdated
Comment on lines +738 to +739
if not reason:
raise doxbench_packet.PacketError(

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 non-string reduction reasons before stringifying

When an injected/custom packet assembler returns a ContextPacket whose reduced posture has a truthy non-string reason (for example reduced_reason=123), the dataclass constructor and require_valid both accept it, this truthiness check passes, and the later str(reason) silently emits "123" before dispatch. That defeats this boundary's stated fail-closed/verbatim behavior and turns malformed collaborator output into a conformant-looking posture record; require a non-empty string before measuring or returning the reason.

Useful? React with 👍 / 👎.

Reproduced, and worse than reported. `if not reason:` accepted any truthy value
and `str(reason)` then MANUFACTURED a reason from it:

  123          -> "123"
  ["a","b"]    -> "['a', 'b']"
  {"why": "x"} -> "{'why': 'x'}"
  object()     -> "<object object at 0x71c078978c90>"

A heap address, in a durable record, on the degraded path. Same
silent-normalisation class as the presence findings: malformed collaborator
output turned into a conformant-LOOKING posture instead of a refusal.

Fixed at BOTH gates, as the presence rule was -- the derivation and
`ContextPacket.__post_init__` -- because the released shape says
`type: string` and a truthy non-string is not a reason. The reason is now
carried VERBATIM rather than coerced: `str(reason)` is gone from the return and
from the ceiling measurement.

NOT restated in the delegated validator, deliberately and consistently: that
gate restates the PAIRING and nothing the shape already expresses, exactly as it
restates neither the posture enum nor the object's closure. A type constraint is
the same category. The browser adopter already required `typeof === "string"`.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

Fixed at 8ffb33fb, and the reproduction was worse than the report: str(reason) did not just stringify a number, it turned a bare object() into "<object object at 0x71c078978c90>" — a heap address, in a durable record, on the degraded path.

Fixed at BOTH gates as the presence rule was (the derivation and ContextPacket.__post_init__), and str() is gone from the return and from the ceiling measurement, so the reason is carried verbatim rather than coerced. Deliberately NOT restated in the delegated validator: that gate restates the pairing and nothing the shape already expresses — it restates neither the posture enum nor the object's closure, and a type constraint is the same category. The browser adopter already required typeof === "string".

Both directions revert-tested (R49 derivation, R50 construction gate — both RED). Gates at this tip: ideation-dashboard 3941/15, ideation_dashboard 63, doc-health 704, validator 0/4 (41 valid + 68 negative), openspec 66/0, verify-commit pass. No contract byte moved; schema digest still d8ee5624….

Note for this pass: the last five rounds have each surfaced one more instance of the same family — fail-closed boundaries around the posture derivation and adoption — and each has been real and fixed. If you see another, please say so; if you don't, I'll take this as converged.

Copilot AI review requested due to automatic review settings August 22, 2026 13:50

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 29 out of 29 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/ideation_dashboard/serve.py:836

  • doxbench_turn_v2_success_body() builds context_packet using str(...) casts. That reintroduces the silent-normalisation class this PR is otherwise carefully closing: e.g. a non-string context_reduced_reason (including object()) would be coerced into a string (potentially a heap-address repr) and could then validate/ship as a seemingly well-formed record. Since the posture/reason are meant to be carried verbatim and fail-closed on malformed collaborator output, avoid coercion here and enforce types instead.
    context_packet = {"posture": str(context_posture)}
    if context_reduced_reason is not None:
        context_packet["reduced_reason"] = str(context_reduced_reason)

@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: 8ffb33fb92

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

// a different reason and by a different test. Do not collapse these.
const reasonPresent = Object.prototype.hasOwnProperty.call(
raw, "reduced_reason");
const reasonUsable = typeof reason === "string" && reason !== "";

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 reduction reasons over the released ceiling

When a custom or malformed chat transport returns a v2 success with a non-empty reduced_reason longer than 500 code points, this predicate accepts it even though the released context_packet schema caps the field at 500. The dispatcher validates only ok and kind, so the oversized reason reaches browser state, the live region, and subsequently the persisted snapshot; include the released ceiling in this adoption gate rather than treating every non-empty string as usable.

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

Useful? React with 👍 / 👎.

Comment on lines +843 to +845
contextPacket: (transcript.length
&& transcript[transcript.length - 1].role === "assistant")
? adoptContextPacket(snapshotValue) : null,

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 Verify the stored terminal answer survived filtering

When the stored posture belongs to a malformed final assistant row and filtering leaves an older assistant as the new tail—for example [valid human, valid assistant, {role: "assistant", content: null}]—this condition still adopts the posture and captions the older answer. Fresh evidence beyond the prior report is that the new guard examines only the filtered transcript, so it cannot distinguish the original terminal answer from an earlier retained one; adoption must also establish that the snapshot's original terminal answer itself survived validation.

Useful? React with 👍 / 👎.

…that could not see its own case

TWO findings, both reproduced, both real -- and one of them breaks a guard this
branch added two rounds ago.

F1 -- THE ADOPTER HAD NO CEILING. This was recorded in the tick as a named
follow-up, deliberately deferred, on the grounds that the blob is browser-local
and self-tamper only. That rationale covered the wrong half of the surface: the
same adopter also reads the WIRE, the dispatcher validates only `ok` and `kind`,
so a malformed transport's oversized reason reaches browser state, the live
region and from there the persisted snapshot. Reproduced at 5,000 code points.
The bound is now in, pinned to the released `maxLength` by its own test, with a
reason exactly AT the ceiling still adopting. The tick records this as a
REVERSAL of its own deferral rather than quietly doing it.

F2 -- MY ROUND-4 GUARD COULD NOT SEE ITS OWN CASE. It tested the FILTERED
transcript's tail, which cannot distinguish the original terminal answer from an
earlier retained one: `[human, assistant "older", assistant(malformed)]` filters
to a tail that IS an assistant turn, so the guard passed and captioned the older
answer with the newer answer's posture -- exactly the defect it was added to
prevent, one layer in. Reproduced.

The test is now THE SNAPSHOT'S OWN TERMINAL ROW: adoption asks whether the
answer the posture BELONGS TO survived, using the same well-formedness predicate
the transcript filter uses so the two cannot disagree about what "survived"
means.

THREE restatements of one ceiling now exist (schema, serve, browser) and each
pair has a pinning test, so they cannot drift into three ceilings.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

Both fixed at e9383334, both reproduced first.

F1 — the ceiling on the reading side. You were right that my deferral was wrong, and specifically why: the tick had recorded this as a named follow-up on the grounds that the blob is browser-local and self-tamper only. That rationale covered the wrong half of the surface — the same adopter reads the WIRE, and the dispatcher checks only ok/kind. Reproduced at 5,000 code points reaching browser state. The bound is in, pinned to the released maxLength by its own test, with a reason exactly AT the ceiling still adopting so it is a bound and not an off-by-one. The tick now records this as a reversal of its own deferral rather than quietly doing it.

F2 — my round-4 guard could not see its own case. Correct, and this is the better catch: testing the filtered tail cannot distinguish the original terminal answer from an earlier retained one. [human, assistant "older", assistant(malformed)] filters to a tail that IS an assistant turn, so the guard passed and captioned the older answer with the newer answer's posture — the exact defect it was added to prevent, one layer in. The test is now the snapshot's own terminal row, using the same well-formedness predicate the transcript filter uses so the two cannot disagree about what "survived" means.

Three restatements of one ceiling now exist (schema, serve, browser); each pair has a pinning test. Four revert-tests, all RED (R51–R54).

Gates: ideation-dashboard 3943/15, ideation_dashboard 63, doc-health 704, validator 0/4 (41 valid + 68 negative), openspec 66/0, verify-commit pass. No contract byte moved.

Copilot AI review requested due to automatic review settings August 22, 2026 14:05

@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: e9383334e8

ℹ️ 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 +405 to +406
const reasonUsable = typeof reason === "string" && reason !== ""
&& reason.length <= CONTEXT_REDUCED_REASON_MAX_LENGTH;

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 Count reduction reasons by Unicode code points

Fresh evidence after the prior ceiling fix: JavaScript's String.length counts UTF-16 code units rather than the Unicode code points counted by JSON Schema maxLength. A conformant reason containing 300 emoji therefore has 300 code points but reason.length === 600, causing this adopter to discard the posture and hide the reduced-context disclosure; use a code-point count such as [...reason].length so the reading-side ceiling matches the released contract.

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

Useful? React with 👍 / 👎.

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 29 out of 29 changed files in this pull request and generated 1 comment.

Comment on lines +405 to +406
const reasonUsable = typeof reason === "string" && reason !== ""
&& reason.length <= CONTEXT_REDUCED_REASON_MAX_LENGTH;
brettheap and others added 2 commits August 22, 2026 10:10
…-16 units

Correct, subtle, and the same mistake this release argued against on the server
side -- arriving on the browser side in the other unit.

JavaScript's `String.length` counts UTF-16 code UNITS; JSON Schema's `maxLength`
counts CODE POINTS. Reproduced: a conformant reason of 300 emoji is 300 code
points and `.length === 600`, so the ceiling added one round ago DISCARDED a
record the released contract accepts -- hiding the very disclosure this release
exists to show. `[...reason].length` iterates code points.

This is precisely the reasoning the S2 fix used to reject a BYTE-counting guard
on the server ("a byte-counting guard would refuse a conformant 1,500-byte CJK
reason"); the unit discipline was right there and the browser side got it wrong
anyway, which is worth recording rather than just fixing.

Pinned: 300 code points / 600 UTF-16 units, adopted.

Co-Authored-By: Claude Fable 5 <[email protected]>
`\u{1F600}` inside the Python-hosted JS harness string is an invalid Python
unicode escape (`\u` wants exactly four hex digits), so the previous commit
left test_doxbench_chat_view.py failing to COLLECT -- caught immediately by the
targeted run, but it was committed broken. `String.fromCodePoint(0x1F600)`
needs no backslash and says the same thing.

Recorded rather than amended away: a commit that cannot be collected is worse
than the defect it was fixing, and the reason it happened is that I ran the
tests AFTER committing rather than before.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 22, 2026 15:08
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

Final pass, at 8f2a0716. Your code-point finding was correct and is fixed — reproduced first: a conformant 300-emoji reason is 300 code points and .length === 600, so the ceiling I added one round earlier discarded a record the released contract accepts, hiding the very disclosure this release exists to show. Now [...reason].length. Pinned at 300 code points / 600 UTF-16 units, adopted; revert-test R55 RED.

Worth naming: this is exactly the unit discipline the S2 fix used on the server side to reject a byte-counting guard ("a byte-counting guard would refuse a conformant 1,500-byte CJK reason") — and the browser side got it wrong anyway, in the other unit.

The second commit (8f2a0716) fixes a broken escape my own round-7 test commit introduced: \u{1F600} inside the Python-hosted JS harness string is an invalid Python unicode escape, so that file failed to collect. String.fromCodePoint(0x1F600) says the same thing with no backslash. Recorded rather than amended away.

This is the last review round on this PR — anything non-blocking you raise I'll record as a named follow-up in the change packet rather than spin another cycle. Gates at this tip: ideation-dashboard 3943/15 skipped, ideation_dashboard 63, doc-health 704, validator 0 errors/4 warnings (41 valid + 68 negative), openspec 67/0, verify-commit pass on contract-v1.40.digests.yaml, doc-health zero-new.

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 29 out of 29 changed files in this pull request and generated no new comments.

@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: 8f2a0716ae

ℹ️ 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 +931 to +932
and `reduced_reason` (`minLength` 1, `maxLength` 500 — code points, which
the producer's own guard shadows with the stricter UTF-8 byte count),

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 Remove the stale byte-counting guard claim

This still says the producer enforces a stricter UTF-8 byte ceiling, but serve.doxbench_context_packet now deliberately uses Python len(reason) to enforce 500 code points, while the byte check applies only to repository-authored constants in a test. The same task later calls the byte-counting producer claim false (lines 1024–1039), so the authoritative change packet now contradicts both its implementation and its own correction; describe the runtime code-point guard and the separate shipped-constant test instead.

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

Useful? React with 👍 / 👎.

The tick's shape description still said the producer's guard "shadows [the code
point bound] with the stricter UTF-8 byte count". That was true of a draft and
is not true of the code: `serve.doxbench_context_packet` counts `len(reason)`
(code points) and the browser adopter counts `[...reason].length`, both pinned
to the released bound; the BYTE count applies only to the shipped `REDUCED_*`
constants, in a test, as a rule about text this repository authors.

The same task already called that claim false 90 lines further down, so the
change packet was contradicting both the implementation AND its own correction.
Now it describes the runtime code-point guard and the separate constants test as
two different things.

The two remaining "500-byte ceiling" mentions are contract-v1.38's, about
`data_handling`, and are not this release's to restate.

No contract byte moves.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 22, 2026 15:12
@brettheap
brettheap merged commit 671a690 into main Aug 22, 2026

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 29 out of 29 changed files in this pull request and generated no new comments.

brettheap pushed a commit that referenced this pull request Aug 22, 2026
The annotated tag exists: object 3c82f6b,
dereferencing to 671a690 -- the squash-merge of
PR #256 -- and verified FROM THE REMOTE rather than from the local ref that
created it (`git ls-remote origin 'refs/tags/contract-v1.40^{}'` peels to that
commit). Both release verifications pass at the tag:
`validate-contract-release.py verify-commit --commit contract-v1.40` reproduces
every digest in contracts/releases/contract-v1.40.digests.yaml from the tag's own
objects, and `verify-tag --remote origin --tag contract-v1.40` confirms the
published tag dereferences to that exact commit.

So `doxbench_contracts.CONTRACT_REF` and its test-side mirror `RELEASED_REF` stop
being the `unpublished:contract-v1.40` sentinel and name that commit, in the
spelling the v1.38, v1.34 and v1.31 pins 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.

Every gate reran at the SQUASH before anything was tagged, which is the point of
the policy's realization order -- the squash created a new commit, and main moved
SIX times under this branch (one of them taking contract-v1.39 and forcing the
re-cut to v1.40), so the tree that got tagged was one nothing had gated until
then.

This also completes 13.8's post-land step: its blank SHA line is filled with
PR #256 / 671a690 and the tag's verification, so the three facts that tick
deliberately did not claim -- the squash sha, the published tag, and the
sentinel -- are all now true and recorded in the change packet.

Nothing under contracts/ changes here, so the digest chain and the tag are
untouched; verify-commit still passes at the tag after this commit.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap
brettheap deleted the change/doxbench-turn-posture-release branch September 4, 2026 19:25
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