Repository navigation
feat(broker): the mint admits hosted-mcp, and reads the row's own entry (TASK-172 slice 3c-1) - #2002
Merged
Merged
Conversation
…ry (TASK-172)
Scope §7's mint half. A hosted-mcp row has no installationId slot, so the
row's `_id` IS the grant's installationId for that type; the grant may name
only tools from the row's own catalogue entry; and `write` is refused there,
because §5(a)'s rule holds only if no grant on the row can run a non-read call
without parking. The type was previously refused three times over at the mint,
so none of this could be reached before.
- `resolveBrokerFor` now takes the CONNECTION rather than its type. A
github-app connection still reads the seeded catalogue row; a hosted-mcp
connection reads its catalogue entry, because there is one entry per vendor
and keying on the type would let a grant on one vendor's row name another
vendor's tool. The entry list is a parameter, so the lookup is testable
against a fixture catalogue while `HOSTED_MCP_ENTRIES` is empty in v1.
- `brokerId` stays the single `GRANT_BROKER_ID`. That is load-bearing rather
than cosmetic: `grantBrokerProjectionService` selects a seat's grants by that
one value, so a per-entry broker id would make the grant invisible to the
seat it was minted for.
- The mint requires `connected`, no `revokedAt` and a `credentialRef` for this
type, and refuses `write` with `write_requires_confirm`.
The signature change forced one existing arm to move: it called
`resolveBrokerFor('github-app')` and now passes `{ type: 'github-app' }`.
Arms: +12 (5 in the tool-Installable suite, 7 in the mint suite), including two
positive controls that a refusal arm would otherwise be missing — a connected
hosted row whose mint fails only on the catalogue, and a github-app row that
still mints `write`. Ledger: 10 mutations over both files, all killed by the
arm that names their claim, no survivors, no named-arm misses, no compiler
refusals. tsc clean; eslint identical to base (9 warnings / 0 errors either
side).
Not in this increment: the broker's hosted branch in `resolveConnection` (the
`_id`-only resolution and the widened `ToolConnection`), the per-entry tool
Installable the catalogue page reads, and the vendor `call` the intake slice
owns. None of them is reachable while the catalogue is empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TASK-172 slice 3c-1 — the mint admits
hosted-mcp, and reads the row's own entryStep 4's second half, first piece (§5, §7): a room grant — the row that says
what a seat may call — must be mintable against a hosted-MCP connection, and the
tool list it enables must be the one belonging to that row's catalogue entry.
Cut from
main(87c73258) — it readsconfig.entryId, which 3a writes, andneeds slice 2's
findHostedMcpEntry, both landed. It is a sibling of 3b (#2001),not stacked on it: the two touch disjoint files.
The rebase is worth one line for what it dropped. This branch also carried two
fixes to 3a's own route and callback suite that had already landed inside 3a's
squash, so both replayed as already applied and were skipped rather than
re-applied — witnessed rather than assumed: after resolving each conflict in
favour of
main, the staged tree was byte-identical tomain(git diff --cachedempty), which is the only thing that justifies a skip. One commit survives, and it
is the whole delta below: 4 files, +275 / −10.
What lands
backend/services/installable/toolInstallables.tsresolveBrokerFortakes the CONNECTION and an injectable entry listbackend/routes/grants.tsbackend/__tests__/unit/services/toolInstallables.test.jsbackend/__tests__/unit/routes/grants.mint.test.jswithCatalog(entries, run)fixtureThe shape, and why
resolveBrokerFornow keys on the connection, not the type. It used to takeconnectionType: stringand return the one catalogue row seeded forgithub-app. A hosted row's tool list is ENTRY-keyed (config.entryId), sokeying the lookup on the type alone would let a grant on one vendor's row enable
another vendor's tools — scope §7's mix-up, one layer down. The entry list is a
parameter defaulted to
HOSTED_MCP_ENTRIESso the branch is testable againsta fixture catalogue while the live list is still empty in v1, and so a test can
push a fixture entry and witness the real default resolution path.
brokerIdstays the singleGRANT_BROKER_ID.grantBrokerProjectionServiceselects a seat's grants by that one constant, so a per-entry broker id would mint
a grant the seat never sees — a silent "no tools" rather than an error.
A hosted grant's
installationIdand connection id are the ROW's_id.The row has neither of the GitHub installation-id slots, and an
_idis neverreused, so the TASK-148 class (a grant matching a re-created row by an external
id) cannot arise for this type.
The mint refuses a hosted row that is not connected or holds no credential
(
isConnected+ acredentialRef), rather than minting a grant whose first callfails.
A hosted write grant is refused (
write_requires_confirm). Scope §5a: ahosted write counts as the member's own act only when it parks for approval,
and a
writegrant runs non-write-classified calls without parking. So therefusal is a
hosted &&conjunct on the existing path, and the arms carry apositive control: a
github-approw still mintswrite, which is whatdistinguishes "the guard was widened to refuse hosted writes" from "the guard
refuses writes".
Evidence
(2, 22)— 5 new service arms and 7 new mint arms, 0 failed,0 runtime errors.
tsc:checkexit 0. eslint on both sources identical tobase (9 warnings / 0 errors either side — the pre-existing count, measured by
swapping the base file in place and diffing the error multiset).
/tmp/kai-172s3c-ledger.py: 10 mutations (M01–M10),baseline
(2, 22), NO SURVIVORS, NO NAMED-ARM MISSES, NO NOT-APPLIED, NOCOMPILER REFUSALS. The refusal arms are written so that the widened guard is
what fails them: a connected hosted row reaching 503
broker_unavailableproves the type check admits hosted rows at all, where a 403
connection_mismatchwould only prove the new branch was reached.Disclosed gap — the broker half of step 4 is deliberately absent
resolveConnectioninbackend/services/toolBrokerService.tsstill resolves{ type: 'github-app', installationId }only, andToolConnectionisGitHub-shaped. Widening it here would add a branch with no consumer:
ToolDefinition.callis a REQUIRED field, the hosted projection(
entryToolProjections) omits it by construction, and the broker looks a call upas
TOOL_DEFINITIONS[input.tool]— so no hosted tool can be registered in thatliteral record until an entry can carry a
call. The honest unit is thereforeone atomic slice: the entry projections with
call(which need 3b'scredentialForand the vendor request) plus theresolveConnectionbranchand the widened union. That is recorded on the row, and it is why §10's implied
step order in
docs/plans/hosted-mcp-connection-scope.mdis corrected thererather than followed here.