Skip to content

Build add-doxchat-model-intake: the selector's missing path, the flow behind it, the act that approves it, and the paid retry nobody could see - #401

Merged
brettheap merged 6 commits into
mainfrom
change/doxchat-model-intake-build
Aug 27, 2026
Merged

brettheap merged 6 commits into
mainfrom
change/doxchat-model-intake-build

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Builds add-doxchat-model-intake (ratified 2026-08-21) now that its blocking
dependency is discharged on both sides of the seam:
add-model-provider-broker merged as PR #392 (main bb7d7ae8, this branch's
base) and openProfiler declared its CLI surface (openProfiler PR #18, main
d0538c31, docs/broker-cli.md).

The change answers Brett's browser annotation of 2026-08-21 on
select.doxchat-model — "this model selector is not working… we need to have
add model as the first option in the dropdown and if no current models loaded,
that is the default. if user does add model, then we need to bring up a wizard
that helps the user auth with oauth to their subscription or add a api"
— and
the seam nobody had written down: how anything a human adds becomes
APPROVED.


§ 1 — the selector

web/views/doxbench-chat.js, web/views/doxbench-chat-model.js

  • The intake affordance renders FIRST, ahead of every catalog entry and
    ahead of the placeholder, carrying __doxchat_intake__ — a value belonging to
    no provider's namespace, so it cannot collide with a model_id.
  • Empty catalog selects it by default. The consequence OQ-4 accepted out
    loud is accepted here: the control shows a selected option that is not a
    model while the rail says no approved model is configured.
  • The send control's refusal and the rail's sentence are byte-identical,
    pinned by an assertion against the view's own constant rather than by a
    reading. Selecting intake selects nothing — selectModel refuses any value
    the catalog cannot vouch for.
  • Not offered on either catalogFailure rung, nor on the hosted plane. An
    unreadable catalog and a stale console token are bugs with their own
    remedies; offering enrolment as the cure would send a human to buy a
    subscription to fix a reload.
  • Not rendered at all when the flow behind it does not exist, and a test
    proves the indistinguishability on the rendered control: no intake option, the
    placeholder selected, the selector disabled — exactly as before this change.
  • A non-empty catalog now defaults to a model as a real selection
    (withDefaultModel in the view, not in the pure model). Displaying one
    without selecting it was measured and wrong: the control showed a model while
    the send gate, which reads the selection, kept Send closed.

§ 2 — the intake flow

web/views/swb-model-intake.js (new), serve.py, doxbench_intake.py (new)

Where does the string go? To the declared broker and nowhere else, and the
route's shape is what makes that structural rather than careful: the facts ride
the query string, where a fact belongs, and the body is the credential and
nothing else
— streamed in chunks from the connection into the broker's
standard input through the existing hand_off_credential, whose signature takes
an open handle and refuses to take a value. _CredentialStream holds only the
chunk in flight.

  • Both authentication kinds are offered, read from
    doxbench_binding.AUTH_KINDS and served
    — no browser module spells either
    one, which a test sweeps for, because the absolute views clause forbids
    exactly that vocabulary.
  • With no broker declared the flow refuses rather than degrades, states why,
    and presents no field that would accept a value.
  • The OAuth kind is offered and never simulated. It reaches the broker's own
    intake; today's broker refuses that before reading standard input at all,
    and this console surfaces the refusal in its own fixed sentence. No invented
    redirect, no field for token material, nothing stored.
  • THE GREP TEST (task 2.4) runs against a real broker program the test
    writes: after a completed intake and approval the whole checkout, both
    response bodies and the process's own output are searched for the supplied
    value and it is found nowhere. The broker's own record is checked to contain
    it — a sweep finding it nowhere at all would only prove the hand-off never ran.
  • The provider boundary passes unmodified.

§ 3 — proposed, then approved

serve.py, doxbench_intake.py, doxbench_install.py, gate_console.py

Intake proposes. A pending model-declaration lands beside the binding and
declared_model_port_factory passes over a pending binding exactly as if it
were not declared, so it contributes no available catalog entry. A binding the
declarations document says nothing about is untouched — it was declared by
hand by the operator, and the operator is who approval is a record of.

POST /actions/workbench/model-approval — beside _workbench_model_port, under
the same reused session local-human verdict — writes an approve-model gate
action naming the declaration and carrying issuer, approver, expiry and audit
reference. The record is written before the settings document moves: a crash
between them should leave an audit record for an approval that did not take
effect, not an available model no record accounts for. Agent invocation refuses
and is reported on all three routes.

The closed seven-field public catalog entry does not widen.

§ 3.6 — the mid-turn re-mint, made visible

Handed here by add-model-provider-broker task 2.4 (PR #392 review note c).
That change built the behaviour and could not discharge the condition attached
to it: both success envelopes are released, digest-pinned, closed and
self-validated before send, and it declares target_release: none. It left
three server-side records of a mid-turn re-mint that the browser can read none
of.

It lands as an additive optional provider_retry on the v2 success
envelope only (the v1 family is deprecated and its promise is byte-identical
stability), carrying the redacted fact and nothing more: that it happened, that
the ruling's bound held, and the mint's audit_ref — which the broker's own
declaration guarantees carries no token material.

Nothing else widened. dispatch_turn still refuses any adapter answer whose key
set is not exactly {assistant_prose, proposals}, and the port's member surface
is still exactly the declared three. The turn route reads the port's
already-existing content-free ledger around the dispatch — duck-typed, so
an adapter without one is unaffected — and derives the fact from the delta.
Stated honestly rather than over-claimed: a shared ledger means the record says
a re-mint happened while this turn was dispatched, which on the
single-operator loopback console this surface is gated to is the same thing. The
contract's own description says so in those words.

The browser adopts it fail-closed and the rail renders a fixed sentence on a
polite live region, so a screen-reader user hears that their answer cost a
second paid call too.


The two recording-act groups (§0)

0.1–0.3 are RECORDING ACTS, not new decisions. All three were ruled on
2026-08-21 in an in-session multiple-choice round; each is ticked by quoting its
proposal RULED line verbatim, so the build's own record names the sentence
it was built to:

  • 0.1 / OQ-3 — split by install. consent_ref REQUIRED on shared/tenant,
    and (the other half of "only that case carries") REFUSED on single-operator.
    Enforced by two schema conditionals and at the dataclass.
  • 0.2 / OQ-4 — the affordance IS the empty-catalog default, consequence
    accepted as stated. The confirm-against-the-live-console half is 4.1's, and
    4.1 is open.
  • 0.3 / OQ-5 — the approval is the flow's own explicit last step. No route
    to a separate gate console exists, which is the point.

0.4 is the discharge, with evidence on both sides: add-model-provider-broker
merged (PR #392, main bb7d7ae8) and openProfiler's CLI surface declared
(PR #18, main d0538c31, docs/broker-cli.md).

The additive contract release — contract-v1.45

Change class: ADDITIVE (minor). Two schemas move; nothing previously valid
becomes invalid, no required field is added to any existing shape, both
contract_schema_versions stay 1.

  • gate-action-record.schema.yaml — action gains approve-model (a new
    member, never a reused one), plus the two optional properties its conditional
    requires: target.model_declaration and model_approval
    (issued_by / approved_by / expires_at / audit_ref /
    install_posture, in credential-contracts' own field names, with the two
    consent_ref conditionals).
  • xfactory-workbench-chat-turn.schema.yaml — success_v2 gains the optional
    provider_retry (additionalProperties: false; retried and
    at_most_once both const: true, so no retried: false spelling exists).

Recipe followed exactly: contracts/manifest.yaml bundle version bumped to
contract-v1.45, both changed rows' sha256 recomputed, both
consumption_rules extended, one contracts/CHANGELOG.md entry, and
contracts/releases/contract-v1.45.digests.yaml built by
validate-contract-release.py build and shipped inside the cut
(verify-commit --commit HEAD passes on it). Five packaged fixtures join
examples/ideation-dashboard/ — two that must validate, three that must not.

The runtime consumer pin (doxbench_contracts) re-cuts to contract-v1.45 and
carries the unpublished:contract-v1.45 sentinel, exactly as the v1.40 cut did
across its own realization branch: the tag is published against the commit that
actually lands, so until that commit exists there is nothing honest to name.

What task 4.1 still owes

4.1 is OPEN, and open honestly. This build had no browser, so it was
discharged as far as a headless run can and no further.

Proven headlessly, over a real ephemeral server against a real scratch corpus
with a real broker: the surface route's offered/not-offered answers and their
stated reason; the agent-invocation refusal and its report on all three
routes; a completed intake that hands the value to the broker, keeps only the
reference and leaves a pending declaration contributing no available entry; the
approval writing a record that validates against the released schema, and only
then the model appearing as available; the grep test; and, against the same
minimal DOM stub the chat-view suite drives, the rendered selector in all four
postures.

Still owed, and it needs a human at a screen: scripts/reserve-dashboard.sh,
a real browser, and the five-step walk end to end — including OQ-4's own
follow-up, which is a judgement about how a selected non-model option READS
beside the rail's sentence and is not a thing any test can assert. A live turn
through an approved brokered model also needs a real provider subscription,
which no test environment has.

4.2 is OPEN BY DESIGN. Under release-realization this change archives only
on merged plus green — never on authoring alone. The evidence 4.2 will record is
the merge commit, the green run, the published contract-v1.45 annotated tag on
that commit, and the aggregation-repo pin sync.


Verification

  • tests/ideation-dashboard/ — full suite green (--deselect the known
    scratch-clone location artifact test_snapshot.py::test_find_validator_locates_pinned_checkout).
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict — 77 passed, 0 failed.
  • scripts/doc-health.py --single-repo . — zero new findings: the report is
    byte-identical to a pristine clone of the base commit run at the same clock
    (5 critical / 7 error / 42 warning / 4 info, same rows).
  • scripts/validate-ideation-dashboard-contracts.py — 0 errors (4 pre-existing
    deprecation warnings on the v1 family).
  • scripts/validate-contract-release.py verify-commit --commit HEAD — pass on
    contracts/releases/contract-v1.45.digests.yaml.

Three pins moved, each with its reason recorded beside it rather than loosened:
the doxBench error catalog admits three intake-era codes, the packaged v2
positive count advances by one, and the consumer contract pin re-cuts. Every
other pin this change stood next to passes unmodified — the privacy scan,
the transport budget, the renderer's fetch-bearing set, the provider boundary,
and the workbench write-path guards.

🤖 Generated with Claude Code

brettheap and others added 4 commits August 26, 2026 20:23
…d approving what it bought is a separate act somebody signed

The wizard's whole question was where a string goes. It goes to the declared
broker: the facts a binding needs ride the query string, where a fact belongs,
and the request BODY is the credential and nothing else — streamed in chunks
from the connection into the broker's standard input through
`hand_off_credential`, whose signature takes an open handle and refuses to take
a value. No local in this process is ever the whole of it, and `_CredentialStream`
holds only the chunk in flight.

Completing that flow PROPOSES a model. It does not approve one, and keeping the
two apart is the point: if intake set `available`, then supplying a payment
credential would be the same act as approving a provider to process governed
corpus material, and the control the human is looking at already says "approved
model". So a pending `model-declaration` lands beside the binding,
`declared_model_port_factory` passes over a pending binding exactly as if it
were not declared, and `POST /actions/workbench/model-approval` writes an
`approve-model` gate action — issuer, approver, expiry, audit reference, and
the install posture Brett's OQ-3 ruling splits on — before anything becomes
selectable. The record is written BEFORE the settings document moves, because a
crash between them should leave an audit record for an approval that did not
take effect rather than an available model no record accounts for.

A binding this declarations document says nothing about is untouched: it was
declared by hand in a settings file by the operator, and the operator is who
approval is a record of. Inverting that would have retroactively unapproved
every install that already works.

The OAuth kind is offered and never simulated. It reaches the broker's own
`intake` with an empty source, because the broker's surface is the redirect
target and this dashboard may not be the party that receives a provider's
tokens. Today's declared broker refuses that before reading standard input at
all, and this console says so in its own fixed sentence — no invented redirect,
no field for token material, nothing stored.

Also here, because it needs the turn route rather than the intake one: the
mid-turn re-mint. The port already recorded it three ways the browser cannot
read, so the route reads the port's content-free ledger around the dispatch —
duck-typed, so an adapter without one is unaffected — and `provider_retry_fact`
derives the redacted fact the v2 record now carries. The consumer pin re-cuts to
contract-v1.45 with the sentinel ref the versioning policy asks for, because the
chat-turn schema's bytes moved and a stale pin would have failed every model
route closed.

Co-Authored-By: Claude Fable 5 <[email protected]>
… new when there is no path to offer

Brett's annotation asked for three things and this is all three: "add model" as
the first option, the default when nothing is loaded, and a flow behind it. The
affordance renders ahead of every catalog entry and ahead of the placeholder,
carries a value belonging to no provider's namespace, and is the selected option
when the catalog answers empty — the consequence OQ-4 accepted out loud, that
the control then shows a selected option which is not a model while the rail
says no approved model is configured. Selecting it selects nothing: `selectModel`
refuses a value the catalog cannot vouch for, so the send control stays refused
for exactly the reason it was refused before, and the rail's sentence is
untouched character for character.

It is not offered on either catalog-FAILURE rung. An unreadable catalog and a
stale console token are bugs with their own remedies, and telling a human to buy
a subscription to fix a reload is worse than telling them nothing.

And it is not rendered at all when the flow behind it does not exist. That is
the sequencing requirement's own test — with no broker declared the selector is
indistinguishable from the one that shipped before this change, down to the
disabled control and the placeholder — and it is why the shell asks the server
rather than guessing: a browser cannot know whether an install has somewhere
governed to put a credential.

The flow lives in `swb-model-intake.js`, a sibling in the shape `swb-create.js`
and `swb-session.js` established, so three new routes cost `app.js` no transport
budget at all. It names neither authentication kind: the vocabulary is served,
rendered by its label and submitted verbatim, because the absolute views clause
keeps exactly those spellings out of every page. The field that would take a
value is not presented for a kind that takes none, and is cleared the moment the
value leaves.

With a non-empty catalog the rail now performs the default as a REAL selection
rather than displaying one. Displaying it was measured and wrong: the control
showed a model while the send gate, which reads the selection, kept Send closed.

The re-mint the human was never shown now has a place to appear — a polite live
region beside the posture note, on the same only-when-it-changes discipline, so
a screen-reader user hears that their answer cost a second paid call too.

Co-Authored-By: Claude Fable 5 <[email protected]>
…el and for the paid call nobody could see

Two schemas move and neither narrows anything. `gate-action-record` gains
`approve-model`, a new member rather than a reused one, because a governance
record whose action is misnamed is worse than one that does not exist — the wall
`add-doxbench-editing-phase-b` hit with `share-session` and declined to climb.
With it come the two optional properties its conditional requires:
`target.model_declaration`, which names the declaration by the binding id that
also resolves the catalog entry a turn selects, and `model_approval`, which
answers the question this action exists to answer — who put the credential into
custody, who approved it for this console, when the approval stops being good,
and which audit act it corresponds to. Those are `credential-contracts`' own
four field names, not a second vocabulary, because a model reached through a
broker is a credential-bearing capability answerable in the same terms.

`install_posture` is the field with no precedent, and it encodes Brett's OQ-3
ruling in both directions: `consent_ref` REQUIRED on a shared or tenant install,
REFUSED on a single-operator one. The refusal half is not the inverse of the
first — the ruling says only that case carries one, and a single-operator record
that carried a consent reference would claim a second party who does not exist.
The posture is stated rather than inferred from which keys happen to be present,
so a record can be read back against the rule it was made under.

`workbench-chat-turn-v2-success` gains the optional `provider_retry`. The broker
change built the behaviour and could not discharge the condition attached to it:
both success envelopes are released, digest-pinned, closed, and self-validated
before an envelope is stored or sent, and that change declares no target
release. So it landed three server-side records of a mid-turn re-mint and the
browser could read none of them. This is the field that carries the fact to the
person paying for it — that it happened, that the ruling's bound held, and the
audit reference the broker's own trail is keyed by. No token, no prefix, no
provider words, and `additionalProperties: false` because this record is stored,
mirrored into a session sidecar and rendered in a page: a key nobody declared is
a key nobody redacted.

The v1 envelope is deliberately untouched. It is deprecated and its promise is
byte-identical stability.

Manifest bundle version, both recomputed digests, both consumption rules, the
changelog entry, the digest inventory, and five packaged fixtures — two records
that must validate and three that must not, including a `provider_retry` block
that grew a fourth key.

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

The change has four surfaces and each needs a different instrument, so the new
suite has four layers: the pure model in node, the mounted rail against the same
minimal DOM stub the chat-view suite drives, the routes over a real ephemeral
server against a real scratch corpus, and the contract asserted against the
released bytes this repository ships.

The routes layer runs a REAL broker — a small program the test writes and an
operator's declaration invokes exactly as it would invoke openProfiler — because
the grep test is the assertion that makes §2's requirement real and a hand-off
that never runs proves nothing about where a value went. After a completed
intake and a completed approval the whole checkout, both response bodies and
this process's own output are searched for the supplied value and it is found
nowhere; the broker's own record IS checked to contain it, since a sweep finding
it nowhere at all would only prove the hand-off never happened.

Three pins move, each with its reason recorded beside it rather than loosened:
the doxBench error catalog admits three intake-era codes, the packaged v2
positive count advances by one, and the consumer contract pin re-cuts to
contract-v1.45. Every other pin this change stood next to passes unmodified —
the privacy scan, the transport budget, the renderer's fetch-bearing set, the
provider boundary, the workbench write-path guards.

tasks.md ticks 0.1 through 3.6. The three ruling ticks are RECORDING ACTS and
say so, each quoting its RULED line verbatim so the build's record names the
sentence it was built to; 0.4 carries the discharge evidence from both sides of
the seam. 4.1 and 4.2 stay OPEN, and 4.1 records exactly what a headless run
proved and exactly what it cannot: a real serve in a real browser, and OQ-4's
own follow-up, which is a judgement about how a selected non-model option READS
beside the rail's sentence and is not a thing any test can assert.

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

@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 ✨

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

Implements the add-doxchat-model-intake feature end-to-end: adds a first-option “Add a model…” selector affordance (only when the intake flow exists), introduces the intake + approval flow (with a recorded approve-model gate action), and makes the mid-turn re-mint / paid retry visible to the user via the released v2 turn record (provider_retry) and the chat rail.

Changes:

  • Add model intake UI flow (surface probe, enrolment, and approval) and wire it into the staging workbench + chat rail selector behavior.
  • Add server-side intake/approval routes plus a declarations store, and enforce “proposed vs approved” by skipping pending declarations in the model port factory.
  • Cut additive contract contract-v1.45 updating gate-action-record and workbench-chat-turn-v2-success, plus fixtures and updated pins/tests.

Reviewed changes

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

Show a summary per file
File Description
tests/ideation-dashboard/test_doxbench_request_handling.py Extends doxBench error-code pin set to include intake/approval-era codes.
tests/ideation-dashboard/test_doxbench_contracts.py Re-pins contract expectations to contract-v1.45 and updates digest/count pins.
scripts/ideation_dashboard/web/views/swb-model-intake.js New intake dialog + transport module (surface/enrol/approve).
scripts/ideation_dashboard/web/views/staging-workbench.js Wires intake surface probing and flow opening into the workbench/rail lifecycle.
scripts/ideation_dashboard/web/views/staging-workbench-model.js Adds shared JS route constants + intakeQuery, and threads intakeOffered into posture facts.
scripts/ideation_dashboard/web/views/doxbench-chat.js Renders intake selector option first (when offered), adds retry live-region note, and enforces default selection behavior.
scripts/ideation_dashboard/web/views/doxbench-chat-model.js Adds intake option constants/defaulting logic and adopts provider_retry into chat state.
scripts/ideation_dashboard/web/styles.css Styles intake UI host/panel and the provider-retry note + intake selector option.
scripts/ideation_dashboard/web/app.js Installs the model-intake transport seam using the new sibling module.
scripts/ideation_dashboard/serve.py Adds intake surface + intake act + approval act routes; adds provider-retry derivation into v2 success envelope.
scripts/ideation_dashboard/gate_console.py Extends gate action record builder/target ID logic to support approve-model and model_approval.
scripts/ideation_dashboard/doxbench_intake.py New declarations store + model declaration record types and invariants (pending vs approved, consent rules).
scripts/ideation_dashboard/doxbench_install.py Skips pending declarations when selecting declared bindings for the brokered model port.
scripts/ideation_dashboard/doxbench_contracts.py Re-cuts runtime contract pin to contract-v1.45 with updated schema digests.
README.md Updates active change index entry to reflect the build + remaining open tasks.
openspec/changes/add-doxchat-model-intake/tasks.md Updates tasks as completed/recorded and expands verification notes.
openspec/changes/add-doxchat-model-intake/proposal.md Updates banner + target_release to contract-v1.45 while keeping change active pending realization evidence.
examples/ideation-dashboard/workbench-chat-turn-v2-provider-retry.example.yaml Adds a positive v2 success example including provider_retry.
examples/ideation-dashboard/README.md Registers new positive/negative fixtures for approve-model and provider-retry.
examples/ideation-dashboard/negative/workbench-chat-turn-v2-provider-retry-carries-a-token.yaml Adds a negative fixture ensuring provider-retry remains redacted/closed.
examples/ideation-dashboard/negative/gate-action-approve-model-without-approval-block.yaml Adds a negative fixture requiring model_approval on approve-model.
examples/ideation-dashboard/negative/gate-action-approve-model-shared-install-without-consent.yaml Adds a negative fixture enforcing consent on shared install approvals.
examples/ideation-dashboard/gate-action-record-approve-model.example.yaml Adds a positive fixture for approve-model gate action record.
contracts/schemas/xfactory-workbench-chat-turn.schema.yaml Adds optional provider_retry definition and wiring into v2 success schema.
contracts/schemas/gate-action-record.schema.yaml Adds approve-model action and the model_approval / target.model_declaration conditional requirements.
contracts/manifest.yaml Bumps bundle version to contract-v1.45 and updates schema digests + consumption rules.
contracts/CHANGELOG.md Adds contract-v1.45 entry documenting the additive schema changes and fixture updates.

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

Comment on lines +1268 to +1270
from ideation_dashboard import doxbench_provider
fresh = [event for event in after if event not in before]
if not any(getattr(event, "reason", None) == doxbench_provider.REASON_PAID_RETRY
The record said the routes ran on a real serve, and they ran against the
server object `build_server` returns rather than through the entrypoint with a
browser attached. That is the same object, and it is not the same proof — so
the note now draws the line where it actually falls, for whoever picks 4.1 up.

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

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.

Suppressed comments (2)

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

scripts/ideation_dashboard/serve.py:1272

  • provider_retry is derived from a shared, process-wide mint ledger, but provider_retry_fact ignores each MintEvent's binding_id. That means a paid retry for a different model binding that happens concurrently can be attributed to this turn, making the turn record (and the UI note "this answer cost...") incorrect. Consider filtering ledger deltas by the selected model/binding id (e.g., model_entry.model_id) and only setting provider_retry when the fresh events match that binding.
    from ideation_dashboard import doxbench_provider
    fresh = [event for event in after if event not in before]
    if not any(getattr(event, "reason", None) == doxbench_provider.REASON_PAID_RETRY
               for event in fresh):
        return None

scripts/ideation_dashboard/web/views/doxbench-chat-model.js:580

  • adoptProviderRetry only checks retried === true, but the schema also requires at_most_once: true. Validating both constants here keeps the browser fail-closed if an unexpected/malformed payload slips through and avoids showing a retry note without the bound being stated.
function adoptProviderRetry(payloadValue) {
  const block = payloadValue && payloadValue.provider_retry;
  if (!block || typeof block !== "object" || block.retried !== true) {
    return null;
  }

Comment on lines +2989 to +2992
accepts_secret = (
declared["kind"] == doxbench_binding.AUTH_KIND_API_KEY)
source = (_CredentialStream(self.rfile, length)
if accepts_secret else io.StringIO(""))
PR #401's review found both, and each is a case of a check that agreed with
itself while being wrong about the world.

The turn record's re-mint delta compared MintEvent values, and a frozen
dataclass whose fields coincide compares equal — so a second turn's paid retry,
minted on the same tick and carrying no audit_ref to tell it apart, was filtered
out as already-seen and the human was never shown the paid provider call the
2026-08-26 ruling exists to make visible. The delta is now taken by identity,
which no two events can share. It is deliberately NOT positional: the ledger is
append-only only up to MAX_LEDGER_EVENTS, past which _record trims from the
front, so a ledger[before_len:] slice reads nothing at all on exactly the
long-lived consoles that dispatch the most turns. The weaker invariant that does
hold — appended at the right, dropped only from the left — is enough.

The api_key intake let an empty body through to the broker, which would have
taken custody of nothing and answered with a reference naming it, after which
the binding and the PENDING declaration this route writes would both assert a
credential that does not exist. A zero-length declaration — or an absent one,
which this route reads as zero — now earns the flow's existing invalid-request
refusal, beside the over-bound length it is kin to, before any broker child is
spawned. The secret is still never counted by buffering it; only the declaration
is read. api_key only: the oauth kind is SUPPOSED to send an empty body, because
the broker's own flow is what decides whether an authorization can be opened.

The fake broker now logs that it was STARTED, separately from what it received,
because an oauth intake reaches it and stores nothing either — only the spawn
tells "refused before the broker" apart from "the broker refused".

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

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 +2970 to +2974
try:
length = int(self.headers.get("Content-Length", "0"))
except (TypeError, ValueError):
length = -1
declared = self._intake_query_facts()
@brettheap

Copy link
Copy Markdown
Contributor Author

Review disposition on the three notes at 7eee092: the first two are stale repeats — the equality delta was replaced by the identity-set fresh_ledger_events (serve.py:1236, with the frozen-clock and front-trim regression tests), and the empty api_key body now refuses with DOXBENCH_ERR_INVALID_INTAKE_REQUEST before any broker child is spawned (serve.py:2989, with a never-spawned assertion). The third is measured non-applicable: this handler inherits SimpleHTTPRequestHandler at the stdlib default protocol_version = HTTP/1.0, under which close_connection is always true — the socket closes after every response, so bytes beyond a declared Content-Length die with the connection; no keep-alive request exists for them to smuggle into.

@brettheap
brettheap merged commit 7b7447d into main Aug 27, 2026
3 checks passed
@brettheap
brettheap deleted the change/doxchat-model-intake-build branch August 27, 2026 03:06
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