Skip to content

The broker mints and doxBench calls, so the provider boundary narrows to one module - #392

Merged
brettheap merged 5 commits into
mainfrom
change/model-provider-broker-build
Aug 26, 2026
Merged

brettheap merged 5 commits into
mainfrom
change/model-provider-broker-build

Conversation

@brettheap

@brettheap brettheap commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What this is

The build of add-model-provider-broker, ratified in-session by Brett on
2026-08-26. doxBench has had a model seam and no model since it was written;
this gives it one, and does it by applying a contract this repository already
owns (credential-contracts: a consumer holds a binding and never a secret)
rather than inventing a new boundary.

Do not merge without a human read of the boundary change. The single most
consequential line in the proposal is that the "no provider is ever contacted
from this repository" invariant MOVES. It narrows; it does not disappear.

Ratification and the 0.3 ruling, recorded

  • proposal.md carries Status: ratified plus the record-citing Ratified:
    line sanctioned by sanction-ratified-record-spelling for the case where no
    approving OpenSpec change exists to name — approver and date, in-session.
  • Open question 4 is DECIDED and task 0.3 ticked: at mid-turn expiry the
    dashboard re-mints and retries ONCE, and the re-mint plus the paid retry are
    visibly recorded; a second expiry in the same turn refuses.
    A second paid
    call the human cannot see was the decision that question was raised to
    avoid, and the ruling answers it by making the retry visible rather than by
    forbidding it.
  • Task 0.2 is ticked: openProfiler PR Archive canonical policy migration change #18 merged 2026-08-26
    (docs/broker-cli.md, openProfiler main d0538c31). The tick recorded that
    a surface existed to consume; task 2.6 now records that the seam consumes
    it
    — all six cross-check findings reconciled, and proven against the real
    openprofiler-broker binary. See Reconciliation + review responses below.

The tick audit

The previous builder ticked every task while still writing, so all eleven of
1.1-3.3 were re-verified against the code and the test that discharges each,
with each task's own note read against what actually exists.

Task Verdict
1.1 binding record, no secret field verified — frozen + slotted, refusal asserted for six secret spellings in both directions
1.2 settings surface finished here — store CRUD was covered, the four CLI verbs were not; a test now drives them through the real parser
1.3 hand-off retaining nothing verified — open handle, copyfileobj to the child's pipe, real broker child, whole-checkout grep for the sentinel
2.1 minting seam verified — declared argv, no command line in code, redacting MintedToken; the endpoint/dialect veto flag is discharged by 2.6 (both moved to the binding)
2.2 one provider-client module verified — PROVIDER_CLIENT_MODULE self-declared, and the boundary test reads that constant
2.3 rewrite the structural check verified — see below; nothing deleted
2.4 expiry per 0.3 verified for both halves since 2.6 — the dashboard's ledger + notice, and the broker's own trail correlated by --retry-of
2.5 wire model_port_factory verified — both entrypoints, first declared binding, unreadable document falls back and says so
3.1 token never in browser/log/disk verified — response, repr, notices and files swept for a token sentinel; browser half is the absolute views clause
3.2 failures map to the fixed refusal verified — BrokerRefused cannot be constructed outside the fixed sentences (eight since 2.6 — the dialect refusal moved earlier, to declaration time); the broker and provider failure modes are exercised; model_failed stays distinct from model_capability_unavailable
3.3 unconfigured posture unchanged verified — same harness construction, refusal pinned at the JSON bytes, and serve.py's diff touches only the factory line

Nothing was unticked. The one gap found (1.2's CLI verbs) was small and clean,
so it was finished rather than reported.

The narrowed boundary

The old claim was carried by ELEVEN per-module source scans, each naming one
file — so a new module under scripts/ideation_dashboard/ inherited no check
at all, which is exactly the gap a change introducing a provider client must
close. All eleven are untouched and still pass, and
test_provider_boundary.py pins them by name so the narrowing cannot be
achieved by deleting the guard it narrows. The new sweep runs over the whole
package in two tiers: the provider tier (SDKs, provider hosts, this
repository's own minted-token type) is exempt for one module only; the generic
HTTP-client tier has a second NAMED holder, snapshot_registry.py, fenced by
a positive assertion that it holds nothing from the provider tier. The views
clause is absolute — no browser module is exempt from anything.

openProfiler contract cross-check

Checked against opensoft/openProfiler docs/broker-cli.md at main
d0538c31 (PR #18, merged 2026-08-26): intake/mint/revoke/list
implemented for api_key, authorize/oauth DECLARED-DESIGN, --retry-of <audit_ref> for the re-mint rule, secrets on stdin only, one JSON object on
stdout with the exit code authoritative. The declaration answers
open question 1 in full: a minted token is provider-native in both kinds; on
the api_key path the token IS the stored key and expires_at is broker
bookkeeping the consumer honours; the whole oauth path is DECLARED-DESIGN
and refuses with exit 5.

Already compatible: exit-code discipline, one JSON object on stdout with the
error object on a stderr this adapter drops unread, argv-never-a-shell-string,
a placeholder vocabulary that cannot name a secret, the declared timeout, the
bounded answer, the scrubbed child environment, ISO-8601 Z parsing, and
honouring expires_at as binding.

Six findings, recorded in tasks.md 0.2's body and deliberately NOT fixed:

  1. Operation framing — this adapter names the operation in a JSON request
    line on stdin; the declaration names it as an argv subcommand and reads no
    request document. One broker_argv cannot express the declaration's four.
  2. Enrolment stdin is corrupted — intake reads stdin to EOF as the
    secret, so the request line would be prepended to the credential.
  3. Mint answer shape — MINT_FIELDS requires endpoint and dialect;
    the declaration carries neither, deliberately. Every real mint would refuse
    as malformed. Task 2.1 flagged exactly this for veto pending 0.2, and the
    declaration has now answered: both facts belong on the binding.
  4. reference vs credential_ref on the intake answer.
  5. --retry-of is not passed — the declaration carries it for precisely
    the 0.3 ruling; this seam never reads audit_ref and has no placeholder to
    carry one, so the broker-side correlation is absent.
  6. A broken pipe reads as "could not be started" — the declaration obliges
    a consumer to treat EPIPE as "read the refusal". Nothing leaks either
    way; the distinction is lost.

All six are now reconciled — see Reconciliation + review responses
below. They were deliberately not fixed in the first commit because closing
them changes the binding's SHAPE and the adapter's parsing of a document this
repository does not own, which is a second slice and not a correction to the
first; that slice is task 2.6, and it is the second commit on this branch. The
findings are kept verbatim in tasks.md 0.2 as the record of what was
reconciled.

Stated limitations, not hidden

  • The operator door is a CLI verb; a browser settings pane is owed and not
    built (tasks.md 1.2).
  • "Visibly recorded" lands in three places — the port's ledger, the console's
    stderr, and (since 2.6) the broker's own broker-audit.jsonl, correlated
    by --retry-of — but not in the browser's turn record. That was measured
    rather than assumed: the v1 and v2 success envelopes are released schemas,
    digest-pinned in contracts/manifest.yaml, additionalProperties: false,
    and self-validated by the route before an envelope is stored or sent, and
    dispatch_turn closes the port's answer shape a second time. A wire fact is
    a contract release, and this change declares target_release: none. The gap
    is now a NAMED task on the change that owns that surface —
    add-doxchat-model-intake 3.6 — rather than prose (tasks.md 2.4).
  • The first declared binding is the one served — the seam takes one port,
    and a selection rule is not invented here (tasks.md 2.5).
  • No file was added under contracts/, and that is a decision: a schema there
    is a release act, this change declares target_release: none, and the
    record has one producer and one consumer inside this repository. Flagged for
    veto (tasks.md 1.1).

Reconciliation + review responses

Second commit on this branch. Two things happened here: the seam was
reconciled with openProfiler's declared surface and measured against the real
binary
, and the four Copilot notes were answered.

Reconciled against the declaration (task 2.6)

Built openprofiler-broker from openProfiler main d0538c31
(cargo build -p opensoft-open-profiler-broker --release; --version →
0.1.4) and read docs/broker-cli.md in full. Per finding:

  1. Operation framing — the invented model-provider-broker-request stdin
    document is gone. broker_operation_argv(binding, operation, retry_of=…)
    appends the declared SUBCOMMAND and its declared flags to the binding's own
    base broker_argv, and expresses all four operations. The binding stays
    declaration-consuming — it names the program and its fixed leading arguments
    and no command path appears in code — while the subcommand/flag vocabulary,
    which is the declaration, is recorded in the adapter with a §-level
    citation on every constant. Four argv templates in an operator's settings
    file is four ways to get somebody else's contract subtly wrong.
  2. Enrolment stdin — intake now receives the credential and nothing
    else
    ; every fact the operation needs rides a declared flag. Asserted by
    reading what the broker child actually received.
  3. Mint answer shape — MINT_FIELDS is the declaration's own seventeen
    under kind: openprofiler_broker_mint, and the demand for
    endpoint/dialect is dropped. Both facts moved to the BINDING with
    validation where they are declared: an unknown dialect and a schemeless
    endpoint are refused when an operator declares the binding, earlier than a
    mint and far earlier than a paid call. 2.1's veto flag is discharged, and
    the proposal's Q1 paragraph and the spec delta both record the resolution.
  4. reference vs credential_ref — the intake answer is read for
    reference, the declaration's own field name.
  5. --retry-of — the mid-turn re-mint passes --retry-of <audit_ref>,
    read from the mint answer and carried in per-turn state. Discard-on-expiry
    deliberately passes nothing: a token that bought no call replaced no
    issuance, and claiming otherwise would put a retry in the broker's record
    that never happened.
  6. EPIPE — a broken pipe on the credential write is the refusal arriving.
    It is swallowed and the answer taken from the exit code and the child's own
    output, so an --auth-kind oauth intake reads as "the broker refused" and
    not as "the broker could not be started". A program that genuinely cannot be
    started keeps the other sentence.

The lane's fake broker was rewritten to speak the declared contract, so it
can no longer agree with the adapter about a protocol nobody implements.

Proven against the real binary

tests/ideation-dashboard/test_openprofiler_broker_e2e.py — 3 tests, passing
locally against the real program. It skips cleanly when the binary is
absent (CI has no Rust toolchain and no reason to grow one), with a reason
naming the build command and both ways to point at one; nothing in it is
softened.

  • the four declared answer key sets are compared to what the binary actually
    emits — which is what makes the exact parse defensible rather than a
    transcription taken on trust, and confirms the mint answer names no route;
  • an --auth-kind oauth intake with a 4 MB credential (enough to overflow the
    pipe buffer) asserts the EPIPE classification against the real refusal;
  • the whole lifecycle: intake a sentinel → mint (token is the stored key
    verbatim, expires_at ≈ 300 s and honoured either side of the instant,
    audit_ref captured) → a mid-turn 401 → re-mint with --retry-of → read
    the broker's own broker-audit.jsonl and assert the third mint record's
    retry_of is the first mint's audit_ref
    → age the clock past the
    broker's declared expiry and prove discard-on-expiry mints afresh and
    correlates nothing → list → revoke.
  • The sentinel's whereabouts, at every step: exactly
    custody/<reference>.json while it is held — never the index, never the
    audit trail — and nowhere at all once it is revoked, while the trail
    survives the revocation carrying no token material.

No environment widening was needed to reach a real broker: HOME and PATH
were already the scrubbed allowlist, and HOME is how the broker's default
custody root resolves. Asserted, because a seam that needed a new inherited
variable would have been a finding of its own.

The four review notes

  • (a) _answer_document exactness — enforced, not reworded. The docstring
    claimed "the required keys, exactly" and the code tolerated any others; the
    key set is now compared exactly, for all four answer kinds. The cost is
    stated in the docstring rather than hidden: a future broker that adds a field
    without moving schema_version refuses here instead of being tolerated,
    which is the right way round for a document carrying a credential. The e2e
    test above is what keeps the enumerated set honest.
  • (b) unbounded response.read() — bounded, reusing the existing
    doxbench_model.SERVER_MAX_OUTPUT_LIMIT_BYTES rather than declaring a second
    number. One byte over the bound is read deliberately so an answer at the
    bound is still honoured while one past it is detected rather than truncated
    into a shorter document that would parse; overflow maps onto the existing
    fixed DIAG_PROVIDER_MALFORMED. Both directions tested.
  • (c) 2.4's "VISIBLY RECORDED in the turn record" — the wording was
    corrected and the gap named, because the implementation genuinely cannot
    honour the ruling's last clause without a contract release.
    Measured first:
    workbench-chat-turn-success and its v2 successor are released,
    digest-pinned, additionalProperties: false and self-validated by the route
    before an envelope is stored or sent, and dispatch_turn refuses any
    dispatch result whose key set is not exactly {assistant_prose, proposals}.
    Two closed shapes, one of them released; this change declares
    target_release: none. So 2.4 now says exactly where the fact lands (ledger,
    stderr, and the broker's audit trail — which is more than it recorded
    before), and the browser half is a named task on the change that owns the
    turn-record surface and carries a target_release that can pay for a schema
    act: add-doxchat-model-intake 3.6, with the shape it should take and an
    amendment-record line saying who handed it over and why.
  • (d) BindingStore._load's bare import yaml — a ModuleNotFoundError
    is now a BindingRefused (_yaml_or_refused, used by _save too), which is
    the class declared_model_port_factory catches. Tested end-to-end rather
    than at the exception: with the parser poisoned and a real bindings
    document present
    , the entrypoint still resolves the harness declaration and
    says so on stderr. Before this, a hosted image that had ever written a
    binding would have died at startup.

Verification

  • tests/ideation-dashboard/ — 4533 passed, 28 skipped, 1 deselected in
    12m04s, exit 0, with the real broker binary on PATH (31 skipped and still
    green without it);
    test_snapshot.py::test_find_validator_locates_pinned_checkout deselected
    (it fails identically on pristine main in a scratch clone — a location
    artifact, not this change's).
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict — 78 passed, 0 failed.
  • python3 scripts/doc-health.py --single-repo . — byte-identical to both the
    base clone's and this branch's first commit's report once the clone name is
    normalized (5 critical, 6 error, 41 warning, 4 info in all three). Zero new
    findings.
  • The real-binary e2e suite — 3 passed with openprofiler-broker on PATH,
    3 skipped with a stated reason without it. Both paths exercised.

🤖 Generated with Claude Code

… to one module

doxBench had a model seam and no model: `doxbench_model.py` said so outright,
and every model-backed affordance refused `model_capability_unavailable`
unconditionally. `add-model-provider-broker` is ratified (Brett, in-session,
2026-08-26, recorded in the proposal's `Ratified:` line under the
`sanction-ratified-record-spelling` record-citing form) and this is its build.

WHAT LANDS

* `doxbench_binding.py` — the `model-provider-binding` record and its store.
  Five fields and the ABSENCE of a sixth: a frozen, slotted dataclass, so a
  secret is not optional but unrepresentable — an extra keyword is a
  `TypeError` at construction and an extra attribute is refused at assignment.
  The argv template is DECLARED and carries a closed placeholder vocabulary
  drawn from the binding's own fields, so no substitution can smuggle a value
  the record does not disclose. YAML is imported lazily because the lean
  hosted image has no PyYAML and both entrypoints now read this store at
  startup.
* `doxbench_provider.py` — the ONE module permitted to hold a provider
  endpoint, a provider SDK or a minted token, declaring its own name so the
  boundary test cannot drift from it. The credential hand-off takes an OPEN
  HANDLE and never a value, streaming it handle-to-pipe; the minted token
  lives in memory behind a redacting `__repr__`; every refusal is one of nine
  FIXED sentences a `BrokerRefused` cannot be constructed outside of, so a
  broker's stderr and a provider's error body are dropped unread.
* The `model-binding` CLI verb group (list / add / edit / remove /
  set-credential) — the operator door. A CLI verb rather than a browser pane,
  stated as a limitation in tasks.md 1.2: a credential typed at a terminal
  crosses no HTTP wire, so "no credential reaches the browser" is structural.
* `declared_model_port_factory`, resolved by both entrypoints: a checkout
  declaring a binding gets the brokered port, a checkout declaring none gets
  exactly the harness construction it always got, and a bindings document that
  will not read falls back and says so on stderr.
* Brett's 2026-08-26 expiry ruling, in `BrokeredProviderPort.dispatch`:
  discard-on-expiry unconditionally, and on the race a re-mint plus ONE paid
  retry, recorded in the port's content-free ledger and printed as a fixed
  notice. A second expiry inside one turn refuses; no third call is bought.

THE BOUNDARY NARROWS RATHER THAN DISAPPEARING

`test_provider_boundary.py` sweeps the WHOLE package in two tiers with one
named exemption, which is a wider net than the eleven per-module scans it
narrows — those named one file each, so a new module inherited no check at
all. Every one of those scans is untouched and still passes, and this file
pins them by name so the narrowing cannot be achieved by deleting the guard it
narrows. The views clause stays absolute.

THE TICK AUDIT

All eleven tasks 1.1-3.3 were re-verified against the code and the test that
discharges each; every note matches what exists and nothing was unticked. One
gap was found and finished here rather than left: task 1.2's CLI verbs were
covered only at the store, so `test_the_cli_verbs_list_add_edit_and_remove_a_binding`
now drives all four through the real parser.

0.2 IS DISCHARGED, AND A RECONCILIATION SLICE IS OWED

openProfiler PR #18 merged 2026-08-26 (`docs/broker-cli.md`, openProfiler main
`d0538c31`), so task 0.2 is ticked: `intake`/`mint`/`revoke`/`list` implemented
for `api_key`, `authorize`/oauth DECLARED-DESIGN, `--retry-of <audit_ref>` for
the re-mint rule, secrets on stdin only, one JSON object on stdout with the
exit code authoritative. A minted token is PROVIDER-NATIVE in both kinds; on
the `api_key` path it is the stored key verbatim and `expires_at` is broker
bookkeeping the consumer is bound to honour.

The tick records that a surface now EXISTS to consume, not that this seam
consumes it. Cross-checking found six incompatibilities — operation framing,
an enrolment stdin the request line corrupts, a mint answer carrying neither
`endpoint` nor `dialect`, the `reference` / `credential_ref` key, an unpassed
`--retry-of`, and a broken pipe reported as an unstartable broker — all
recorded in 0.2's body. None is fixed here: closing them changes the binding's
SHAPE and the adapter's parsing of a document it does not own, which is a
second slice rather than a correction to this one. Until it lands, this seam
mints against the contract it declares in `doxbench_provider` and against no
broker that exists, which is why every test drives a broker child this
repository writes.

Suite: tests/ideation-dashboard green; openspec validate --all --strict 78/78;
doc-health --single-repo byte-identical to the base commit's report.

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

@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

This PR implements the “add-model-provider-broker” slice for the ideation dashboard: it adds a broker-backed model-provider binding/store plus a single provider-client module, and rewires the entrypoints to resolve either the existing harness bridge (unconfigured) or the brokered provider port (configured), while enforcing a narrowed “provider boundary” across the package.

Changes:

  • Add a binding record + YAML-backed store and CLI surface for managing model-provider bindings and handing credentials to a broker via stdin.
  • Introduce doxbench_provider as the only module allowed to hold provider transport concerns (endpoint/token/SDK), with a package-wide structural boundary sweep test.
  • Wire serve.py and cli.cmd_generate_and_open to use a new declared_model_port_factory() that resolves brokered vs harness ports without changing the unconfigured posture.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/ideation-dashboard/test_provider_boundary.py New package-wide structural sweep enforcing the narrowed provider boundary (plus absolute “views clause”).
tests/ideation-dashboard/test_model_provider_broker.py End-to-end tests for binding/store/CLI, broker hand-off & minting, expiry retry rule, and refusal mapping.
scripts/ideation_dashboard/serve.py Switch entrypoint wiring to declared_model_port_factory(...) and document the new resolution behavior.
scripts/ideation_dashboard/doxbench_provider.py New broker runner + token minting + provider transport + expiry retry/ledger logic behind the model seam.
scripts/ideation_dashboard/doxbench_install.py Add brokered catalog + brokered port factory + declared_model_port_factory() resolver.
scripts/ideation_dashboard/doxbench_binding.py New binding dataclass, placeholder substitution, and YAML binding store with disclosure/read-back semantics.
scripts/ideation_dashboard/cli.py Add model-binding verb group (list/add/edit/remove/set-credential) and wire entrypoint to declared resolver.
README.md Update OpenSpec index entry to reflect ratification/build and note reconciliation slice owed.
openspec/changes/add-model-provider-broker/tasks.md Update task ticks with detailed audit narrative and cross-check notes.
openspec/changes/add-model-provider-broker/proposal.md Mark proposal ratified and record the 0.3 expiry ruling decision and 0.2 answer notes.
Suppressed comments (1)

scripts/ideation_dashboard/doxbench_binding.py:422

  • BindingStore._save() also does a bare import yaml, so on environments without PyYAML the CLI verbs will crash with an uncaught ModuleNotFoundError instead of refusing cleanly. If the intent is “stdlib at import time, YAML only when needed”, it’s still better to surface missing PyYAML as BindingRefused so the operator sees a controlled error message and a non-zero exit code.
        import yaml

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

Comment on lines +444 to +445
with opener(request, timeout=timeout) as response:
payload = response.read()
Comment on lines +114 to +115
retry VISIBLY RECORDED in the turn record; a SECOND expiry within the
same turn surfaces the standard refusal. Silently retrying a paid call
# install with no bindings document answers here and never needs a
# YAML parser at all.
return []
import yaml
… and its trail carries the retry

Task 2.6, and the six findings 0.2 recorded against the merged declaration
(`opensoft/openProfiler`, `docs/broker-cli.md`, main `d0538c31`) are closed
rather than restated. The findings stay verbatim as the record of what was
reconciled.

The operation is the declared argv SUBCOMMAND, not a request document this
repository invented: `broker_operation_argv` appends the subcommand and its
declared flags to the binding's own base `broker_argv`, and expresses all four
of `intake`/`mint`/`revoke`/`list`. The binding still names the program and no
command path appears in code; what moved is the verb vocabulary, which was
never the operator's to respell. `intake` now receives the credential and
nothing else, because the declaration reads standard input to EOF and treats
all of it as the secret. The mint answer is parsed for exactly the seventeen
fields it declares, under its own kind, and the intake answer for `reference`.
The mid-turn re-mint passes `--retry-of <audit_ref>`, so the broker's own trail
shows one turn that needed two tokens instead of two unrelated issuances; a
discard-on-expiry deliberately passes nothing, because a token that bought no
call replaced no issuance. A broken pipe on the credential write is the refusal
arriving and is read as one.

The endpoint and the dialect moved to the BINDING, which is where the
declaration's silence puts them: the broker is provider-agnostic about the
request grammar and will not name an endpoint it would then be accountable for.
Both are validated at declaration, so an unknown grammar and a schemeless
endpoint are refused when an operator declares a binding rather than on a paid
call — which is why the fixed-diagnostic set is eight sentences now and not
nine. The binding carries nine fields and still no secret field.

The lane's fake broker was rewritten to speak the declared contract, so it can
no longer agree with the adapter about a protocol nobody implements, and
`test_openprofiler_broker_e2e.py` drives the REAL binary through intake, mint,
a mid-turn 401, a `--retry-of` re-mint read back out of the broker's own
`broker-audit.jsonl`, an aged clock, list and revoke — greping the custody root
throughout, where the sentinel lives in exactly one file while it is held and
in none once it is revoked. It skips with a stated reason when the binary is
absent, which is every CI run and no local one.

The four review notes on #392 are answered. The answer parser enforces the
exactness its docstring already claimed, for all four kinds, with the cost
stated where a reader will meet it. The provider read is bounded by the
server's own declared output ceiling rather than a second number, one byte over
so the bound itself is still honoured. `BindingStore` raises its own refusal
when PyYAML is missing instead of a `ModuleNotFoundError` the entrypoint does
not catch, which is what makes the hosted fallback hold for an install that had
ever written a binding. And 2.4 now says exactly where "visibly recorded"
lands — the ledger, stderr, and the broker's trail — because the browser's turn
record is a released, digest-pinned, closed envelope and a fact on it is a
contract release this change cannot pay for; that half is now a named task on
the change that owns the surface, `add-doxchat-model-intake` 3.6.

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

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

Comment on lines +650 to +653
request = urllib.request.Request( # noqa: S310 - endpoint declared by the broker's mint answer
token.endpoint, data=body, method="POST")
request.add_header("Content-Type", "application/json")
request.add_header("Authorization", f"Bearer {token.token}")
Comment thread README.md Outdated
Comment on lines +1027 to +1032
DECLARED-DESIGN. Cross-checking this seam against that declaration found
SIX incompatibilities (operation framing, the enrolment stdin, a mint
answer carrying neither `endpoint` nor `dialect`, the reference key, an
unpassed `--retry-of`, and EPIPE handling); they are recorded in 0.2's body
and A RECONCILIATION SLICE IS OWED before a binding can name the real
broker.
…bility landed, and the README no longer owes a slice it has

The Authorization-header note is not taken: the code sends Bearer plus the
minted token; the review read GitHub's secret-redacted rendering of the diff.

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

Copy link
Copy Markdown
Contributor Author

Review disposition on the _post_to_provider Authorization note: not taken — the source sends Authorization: Bearer <minted token> (doxbench_provider.py, the single provider-client module); the ****** in the review is GitHub's secret-redacted diff rendering, not the code. The two prose notes (0.3 record's landing places; README's stale 'slice is owed') are taken in 02815866.

…-broker-build

# Conflicts:
#	openspec/changes/add-doxchat-model-intake/tasks.md

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

Suppressed comments (3)

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

scripts/ideation_dashboard/doxbench_provider.py:651

  • The # noqa: S310 justification says the endpoint comes from “the broker's mint answer”, but this request uses token.endpoint, which is sourced from the operator binding (ModelProviderBinding.endpoint). Updating this comment avoids misleading future security reviews/audits.
    request = urllib.request.Request(  # noqa: S310 - endpoint declared by the broker's mint answer
        token.endpoint, data=body, method="POST")

scripts/ideation_dashboard/doxbench_binding.py:503

  • BindingStore._load() only wraps yaml.YAMLError. If the bindings file exists but is unreadable at the filesystem level (permissions, transient IO error, etc), read_text() will raise OSError and bypass the intended BindingRefused/fallback path in declared_model_port_factory(), potentially crashing the entrypoint instead of degrading to the harness posture.
        try:
            document = yaml.safe_load(self.path.read_text(encoding="utf-8"))
        except yaml.YAMLError as error:
            raise BindingRefused(
                f"the bindings document at {self.path} is not readable YAML"

scripts/ideation_dashboard/doxbench_binding.py:544

  • BindingStore._save() can raise OSError from mkdir()/write_text() (permissions, read-only checkout, full disk, etc). Right now that would escape as a raw IO error from CLI verbs, rather than the module’s single refusal type (BindingRefused). Wrapping the write in BindingRefused keeps the surface consistent and makes failures easier to handle upstream.
        self.path.parent.mkdir(parents=True, exist_ok=True)
        self.path.write_text(
            yaml.safe_dump(document, sort_keys=False, allow_unicode=True),
            encoding="utf-8")

Comment on lines +873 to +887
with self._lock:
held = self._token
if held is not None and not held.expired(self._clock()):
return held
self._token = None
try:
minted = mint(self._binding, retry_of=retry_of,
runner=self._runner)
except BrokerRefused:
self._mintable = False
raise
self._mintable = True
self._token = minted
self._record(reason, audit_ref=minted.audit_ref)
return minted
Copilot AI review requested due to automatic review settings August 26, 2026 22:45

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

list(argv),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Comment on lines +650 to +651
request = urllib.request.Request( # noqa: S310 - endpoint declared by the broker's mint answer
token.endpoint, data=body, method="POST")
Comment on lines +158 to +163
def test_the_generic_http_client_has_exactly_two_named_holders():
"""`urllib.request` / `Authorization` / `Bearer ` are HTTP-client facts, not
provider facts, so the second holder is named rather than swept away."""
permitted = {PROVIDER_CLIENT_MODULE, SNAPSHOT_SOURCE_MODULE}
offenders: list[str] = []
for module in _package_modules():
…tor, the S310 note names the binding, and exactly-two-holders asserts both halves

The other two notes stand dispositioned: the 0.3 line is the verbatim ruling
record with its realization note beneath it, and the Authorization header
sends the minted bearer token — the review read a redacted diff rendering.

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

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

Suppressed comments (3)

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

scripts/ideation_dashboard/doxbench_binding.py:371

  • _substitute() performs placeholder substitution via repeated str.replace() over the whole output string. If any substituted value contains a later placeholder pattern (e.g., a label containing {dialect}), it can be substituted unintentionally, altering the declared argv in ways the operator did not write. Substitution should be a single pass over the original template placeholders only (e.g., scan for {name} and replace with values[name]).
def _substitute(member: str, values: Mapping[str, str]) -> str:
    out = member
    for name in ARGV_PLACEHOLDERS:
        out = out.replace("{" + name + "}", values[name])
    return out

scripts/ideation_dashboard/doxbench_provider.py:397

  • subprocess_broker_runner() spawns the broker with text=True but does not set an explicit encoding. That makes decoding of the broker's JSON output locale-dependent, while later size checks assume UTF-8 (answer.encode('utf-8')). Set encoding='utf-8' on Popen so the JSON contract is deterministic across environments.
        child = subprocess.Popen(  # noqa: S603 - argv from a declared binding plus the declared subcommand, never a shell string
            list(argv),
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.DEVNULL,
            env=bridge_mod.child_environment(os.environ),
            text=True,
        )

scripts/ideation_dashboard/doxbench_provider.py:889

  • _current_token() sets self._token = minted and releases _lock before recording the mint event. With ThreadingHTTPServer, another request can observe and use the new token before the mint is appended to ledger, briefly violating the “visibly recorded” property and making ledger ordering racey. Record the mint while still holding _lock (and avoid calling _record() inside the lock, since it also locks).
            self._mintable = True
            self._token = minted
        self._record(reason, audit_ref=minted.audit_ref)
        return minted

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