Skip to content

fix(runtime): read a delegated MCP token's docs audience against the person's own permission sets - #35888

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-a4C-35584
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-a4C-35584

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35584
Clause-②: yes — widening: on a delegated agent token whose scope reaches the docs tools, a permission-set-gated package doc is now found and read when the delegating person holds that set (ADR-0090 D10, ceiling ∩ delegator); nothing served today is refused, a non-holder and a token without docs-tool access still see nothing. Seat runs a contract read before ready; security#2 checks the head read-only before merge.
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户通过自己的 AI 助手授权登录后,助手能搜到、读到只给某个权限集看的应用手册——前提是本人持有这个权限集,且这次授权包含读数据的范围;其他人和其他手册不变。
  • 为什么做:外部 AI 助手接入平台这条线上的遗留问题(应用手册查询的后续);本人在控制台能看的手册,在自己的助手里却搜不到。
  • 出错会怎样:碰到的是通过授权登录使用 AI 助手查手册的人;最坏是该看的手册仍看不到,或权限集手册多给了不持有的人看;改动只在一处读权限的地方,可直接撤回。
  • 要你做什么:无。

What changes

On an OAuth MCP connection the request is an agent acting on behalf of the person who consented (ADR-0090 D10). search_package_docs and read_package_doc read every page through the /meta/doc docs-audience gate; for a manual whose audience is { permissionSet }, the gate asks the security service for the caller's permission-set names. Until now that caller was the agent envelope, whose sets are the token's scope-derived ceiling, so a manual restricted to a set the person holds was neither found nor read on that connection.

  • packages/runtime/src/domains/mcp-package-docs.ts: packageDocsReadGate takes the data engine. On a delegated agent envelope (principalKind: 'agent' with onBehalfOf.userId), the holdings the audience reads are the person's own: resolveUserAuthzGrants in the request's organization (tenantId), the grant resolution the open draft door uses, without that door's manage_metadata admission. It fails closed the way the security plugin's delegator resolution does: no sys_user row, no current membership in the organization (vetOrganizationClaim), or a read that throws leaves the person with no set, so permission-set audiences stay closed. The envelope's ceiling sets are never read for the audience and never unioned in. Holdings are resolved once per gate, and only when a permission-set audience is in play. A non-delegated principal (session, API key, AI service account) is unchanged.
  • packages/runtime/src/domains/mcp.ts: the docs seam rides the bridge only where the grant reaches the docs tools (no grant, or data:read). packageDocToolsServed in @objectstack/mcp stays the authority on listing; the runtime reads the same condition so a token that cannot reach the tools never has the person's holdings read. The bridge call site hands the gate this request's data engine.
  • PR feat(mcp): search and read the installed apps' manuals over MCP, with the answer order in initialize #35564's stated limit: the helper header (mcp-package-docs.ts) no longer says the envelope's ceiling is the caller, and the test header and the pin are rewritten to match. The pending 平台 MCP 提供查找与阅读应用文档的工具,并写明回答应用规则的顺序与出处 #35442 changeset is corrected (below).
  • packages/mcp/src/mcp-http-tools.ts, text only (commit 3dae06c, under the amended claim): the registerPackageDocTools docblock, the searchPackageDocs bridge-member docblock and both tool descriptions now say that on an OAuth connection whose grant reaches the docs tools, the docs audience is the delegating person's own permission sets, never wider. Each description is shorter than before (tools/list weight, mcp: slim the open door's tool list (40 KB at tools/list; validate_expression alone is 7.8 KB) #34689): search_package_docs -25 bytes (100 to 75 for the changed sentence), read_package_doc -29 bytes (93 to 64). No behaviour changes; no test pins either string.
  • Changeset .changeset/35584-delegated-docs-audience.md (@objectstack/mcp and @objectstack/runtime, patch).

DELIBERATE CORRECTION of a pending release note: .changeset/35442-mcp-app-docs-tools.md (unreleased). Its sentence about OAuth grants now reads: "On an OAuth grant the request is an agent acting for the person who consented, and a permission-set audience is read against that person's own permission sets (ADR-0090 D10), never the token's scope-derived sets." The dropped sentence ("Both tool descriptions say so.") no longer holds. check-empty-changeset is red on this by design; the dispatching seat's record confirms it.

Pin flipped in place (mcp-package-docs.test.ts): "on an OAuth grant the caller is the agent: the page is neither found nor read though the delegator holds the set" answered CLOSED for a holder; it is replaced by "the holder of the set finds and reads the page", which answers OPEN. Card #35584, maintainer ruling A.

Ruling conditions

Condition (ruling A) Pin in packages/runtime/src/domains/mcp-package-docs.test.ts
1. The token's scope must still reach the docs tools. a token whose scope does not reach the docs tools is carried no docs member, whatever the person holds (person holds the set; token metadata:write + actions:execute; both members absent, scopes passed unchanged to the MCP runtime)
2. Delegator's own holdings by grant resolution; fails closed for a missing person or one outside the organization; never a union; AI service accounts keep their own sets. the holder of the set finds and reads the page…; fails closed: a person with no user row, or with no membership in the request's organization, holds no set; no union: a manual whose audience is a set only the token's ceiling carries stays closed; an AI service account keeps its own sets
3. Keep the non-holder control; a token that cannot reach the docs tools finds and reads nothing. control: a person who does not hold the set in the token's organization neither finds nor reads it (new, OAuth); the session pair a page only a permission-set manual claims is neither found nor read without the set / control: the holder… kept; the scope pin above
4. security#2 does a read-only check of the head before merge. Not a code pin: security#2 checks this PR's head read-only before merge.

Default-audience pages are unchanged: every OAuth pin asserts the default page crm_order_payment is still found, including the fail-closed and no-union cases.

Clause-② reading

Widening only. Nothing served today is refused: the change opens permission-set manuals to a delegated token whose person holds the set and whose scope already reaches the tools. Every answer that was CLOSED for a non-holder stays CLOSED, and a token without data:read was already listed neither tool by the MCP runtime, so dropping the seam from its bridge changes nothing it is served.

Verification

  • Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/mcp-package-docs.test.ts — 18 tests pass.
  • Files to read first, by risk: mcp-package-docs.ts (packageDocsReadGate, delegatorHoldingsCaller), mcp.ts (the packageDocs scope condition), the new describe block in the test.
Ablation (each leg mutated on disk through scripts/ablation-replace.mjs, then restored; HEAD blob hashes re-matched)
  • A1 user-row check removed: red on fails closed… (1 failed / 17 passed).
  • A2 membership vet removed: red on fails closed… (1 / 17).
  • A3 delegated person not resolved (the old envelope behaviour): red on the holder… and no union… (2 / 16).
  • A4 union of the person's sets with the envelope's ceiling: red on no union… (1 / 17).
  • A5 scope condition removed in mcp.ts: red on a token whose scope does not reach the docs tools… (1 / 17).
  • After restore: git diff HEAD empty; mcp-package-docs.ts 2334108e and mcp.ts f101e596 equal their HEAD blobs.
Local runs at head 3dae06c (origin/main 8145424 merged in, then the mcp text commit)
  • Closure build pnpm --workspace-concurrency=2 --filter '@objectstack/mcp^...' --filter '@objectstack/runtime^...' build: VERDICT command-exit 0.
  • vitest run src/domains/mcp-package-docs.test.ts (runtime): 18 passed (18). vitest run of the mcp doc-tool, tools-list weight and initialize selection-rule files: 3 files, 26 passed (26).
  • pnpm --filter @objectstack/mcp test: Test Files 82 passed (82), Tests 1452 passed (1452). pnpm --filter @objectstack/mcp typecheck and pnpm --filter @objectstack/runtime typecheck: VERDICT command-exit 0 (check:test-typecheck: OK for both).
  • dispatch-gates --commands (68 families, change set vs merge base 8145424), exit codes captured before any pipe: 66 exit 0; check-empty-changeset --base origin/main exit 1 (only .changeset/35442-mcp-app-docs-tools.md, the DELIBERATE CORRECTION, red by design); check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET (needs a whole-repo build), NOT MEASURED. --ran reconciliation: 68 derived, 67 run, 1 NOT-MEASURED. After the changeset line for @objectstack/mcp was added, the changeset, nul-byte, citation, closing-keyword and affected-docs gates were re-run on the final head: same answers.
  • overlap-check --branch=claude/area-a4C-35584: exit 1, the only overlap the bot's Version Packages PR chore: version packages #35129 on .changeset/35442-mcp-app-docs-tools.md; origin/main merges cleanly.
  • Full runtime suite not re-run this round (runtime code unchanged since 942869d); CI runs it.
Earlier local runs (head 942869d; code identical to ea97649, the commit after which only a changeset changed)
  • Closure build pnpm --workspace-concurrency=2 --filter '@objectstack/runtime^...' build: VERDICT command-exit 0.
  • pnpm --filter @objectstack/runtime typecheck: exit 0 (check:test-typecheck: OK).
  • pnpm --filter @objectstack/runtime test (code tree ea97649): Test Files 634 passed (634); Tests 11712 passed, 25 skipped (11737); VERDICT command-exit 0.
  • dispatch-gates --commands (68 families), each run with its exit code captured: 65 exit 0; check-empty-changeset --base origin/main exit 1 (the DELIBERATE CORRECTION above, red by design); NOT MEASURED, exit 3 PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit) and check:dual-build-cjs-loads (needs a whole-repo build). --ran reconciliation: 68 derived, 66 run, 2 NOT-MEASURED, 0 UNRUN.
  • overlap-check --branch=claude/area-a4C-35584: exit 1, the only overlap being the bot's standing Version Packages PR (chore: version packages #35129), which consumes .changeset/35442-mcp-app-docs-tools.md; it is regenerated from main.

Round 3 (seat S1/S2)

Head 183bed4d56, text only, two files:

  • S1 packages/mcp/README.md: the bridge paragraph now says that on an OAuth connection whose grant reaches the docs tools, a permission-set audience is read against the delegating person's own permission sets, never wider. A search of the head for the old sentence ("judged on the token's grant", "caller is the agent", "person's own permission sets") outside CHANGELOGs found no other stale copy.
  • S2 .changeset/35584-delegated-docs-audience.md, second bullet: the organization sentences use the seat's wording verbatim (the organization the request runs in: the one the token's consent bound, while the membership there is current; no user row holds no set; an ended membership is read with no active organization, so no grant stored in an organization applies). No Regen-provenance: line is added to the changeset: that line is a seat-posted thread pointer (scripts/pm/record-recognisers.mjs), not changeset text.
  • Nits: nit a (a second membership pin through oauthEnvelope) was drafted but not verified before the handover stop, so it is not in this head. Nit b was not done: packageDocsReadGate has no logger, so it would take more than one line per arm. Nit c skipped, as the order says.
  • Not re-run this round: the closure build was stopped for the handover, so the runtime and mcp tests, typecheck and derived gates are NOT MEASURED on this head. No code changed; CI runs them. check-nul-bytes: OK. overlap-check: exit 1, the same Version Packages PR chore: version packages #35129 overlap on .changeset/35442-mcp-app-docs-tools.md as before; origin/main merges cleanly.

Acceptance notes

  • Holdings are resolved through resolveUserAuthzGrants directly in mcp-package-docs.ts rather than via a helper shared with mcp-authoring.ts: that file is outside this PR's claimed surface, and its reader is admitted on manage_metadata, which the ruling says must not apply here. The two readers now share the grant call, not the admission.
  • The scope condition (data:read, or no grant) is spelled once more in the runtime beside packageDocToolsServed, as the draft door reads metadata:write beside grantsAuthoringTools. If the MCP runtime's docs family ever changes, both must move.

Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz

🤖 Generated with Claude Code

…gating person's own permission sets

On an agent envelope acting on behalf of a person, the package-docs gate
reads the person's own permission sets (grant resolution in the request's
organization; no user row or no membership there holds no set), never the
token's ceiling sets nor a union with them. The docs seam rides the bridge
only where the grant reaches the docs tools. ADR-0090 D10.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
…ated docs audience

The unreleased note said an OAuth grant judges a permission-set audience on
the token's scope-derived sets; the same release reads the delegating
person's own sets (ADR-0090 D10).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/mcp, @objectstack/runtime, touching 8 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/mcp/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/permissions/authorization.mdx (via buildMcpBridge (symbol, a top-level function))
  • content/docs/permissions/system-context.mdx (via handleMcpRequest (symbol, a top-level function))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/mcp/README.md) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: sys_user (literal, 56 pages)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 37 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 15b7f51b2796ce29d1b027c7033da604df52bb06 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 45d30addfeb82976b51f58d575043f5c984428c4 — the merge of head fbcb450dd5977a5095d7363c443069f56f50895c into base 15b7f51b2796ce29d1b027c7033da604df52bb06, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 45d30addfeb82976b51f58d575043f5c984428c4 && git checkout 45d30addfeb82976b51f58d575043f5c984428c4
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 15b7f51b2796ce29d1b027c7033da604df52bb06 fbcb450dd5977a5095d7363c443069f56f50895c && git checkout -B drift-repro 15b7f51b2796ce29d1b027c7033da604df52bb06 && git merge --no-ff fbcb450dd5977a5095d7363c443069f56f50895c

node scripts/docs-audit/affected-docs.mjs --json 15b7f51b2796ce29d1b027c7033da604df52bb06

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 15b7f51b2796ce29d1b027c7033da604df52bb06 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

On an OAuth connection whose grant reaches the docs tools, the docs
audience is the delegating person's own permission sets, never wider.
The registerPackageDocTools docblock, the bridge member docblock and both
tool descriptions now say so; the descriptions are shorter than before.
Text only. The #35584 changeset now names @objectstack/mcp for it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final head (r2: main merged, plus the text-only commit in packages/mcp/src/mcp-http-tools.ts): 3dae06ce43bd442dce3f5b47aaffb26f160a320f · 2026-11-21T12:38Z

  • CI: 37 success, 18 skipped, 2 failed. Both failures are Check Changeset (two runs, one per trigger), and both are the same refusal. That refusal is the declared DELIBERATE CORRECTION of the pending note .changeset/35442-mcp-app-docs-tools.md, which this PR makes false and rewrites in the same stroke. See the PR body, under "What changes". Restoring the note from the base would put the false sentence back. The dispatching seat confirms the correction by its own record, its ACCEPT or a same-head at-tier contract-review PASS. Every other check is green, including Test Core 10/10, both Type Check lanes, the Lint families and Build Core.
  • r2: search_package_docs / read_package_doc descriptions and the registerPackageDocTools docblock now state the ruled audience. Each description got shorter: −25 B and −29 B. @objectstack/mcp is added to the changeset, patch. The os-dev report is 7062409108.
  • check-governed-merges --pr 35888: NOT governed. The landing path is: L1, then the seat's contract read (Clause-② yes), then a read-only check of the head by security#2 (ruling condition 4), then landing.
  • Sent to L1-a for review on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d12FHULfLH9SigsWws

L1 verdict (L1-a): ACCEPT at head 3dae06ce43 (Fixes #35584: on a delegated OAuth token, the docs audience reads the delegating person's own permission sets, under maintainer ruling A 7043930931).

Gates on this head:

  • l1-face --pr 35888: 37 success, 18 expected skip, 0 pending, 2 failed. Both failures are Check Changeset (check-empty-changeset), red by design on the declared DELIBERATE CORRECTION of .changeset/35442-mcp-app-docs-tools.md. Everything else in the face is ok.
  • Lint & Repo Gates and TypeScript Type Check are both success. Dogfood battery not owed.
  • Local at this head, after building the runtime's dependency closure: vitest run src/domains/mcp-package-docs.test.ts passed 1 file, 18 tests.

Ruling A, condition by condition (holds):

  1. Scope still decides reach. mcp.ts builds the docs seam only when there is no grant or the grant includes data:read. That is the same condition as packageDocToolsServed, so a token without it never has the person's holdings read. Pin: a token whose scope does not reach the docs tools… (both members undefined).
  2. The delegator's own holdings, failing closed, never a union.
    • delegatingPersonOf takes only principalKind: 'agent' with a non-empty onBehalfOf.userId.
    • delegatorHoldingsCaller throws on three cases: no sys_user row (read with isSystem), no membership in the request's organization (vetOrganizationClaim, the one membership rule, as delegatedOrganizationRefusal asks it), and no engine.
    • A throw reaches resolveAudienceCaller (packages/rest/src/meta-item-read-gate.ts:700-707), whose catch leaves permissionSets undefined, so permission-set audiences deny.
    • The returned caller is built only from the person's grants. It carries no onBehalfOf and none of the envelope's permissions, so there is no union.
    • With no tenantId, the resolver's no-tenant rule gives global grants only, as resolveDelegatorContext does (ADR-0123 D2: no active organization is not the membership rule's case).
    • The pins the holder…, fails closed… (ghost and out-of-org), no union… and an AI service account keeps its own sets are all in the diff and green.
  3. Non-holder control is kept, and a new OAuth control is added: control: a person who does not hold the set in the token's organization… answers CLOSED.
  4. Not L1's: security#2's read-only head check before merge.

The DELIBERATE CORRECTION (35442 note), sentence by sentence:

  • Before: "On an OAuth grant that caller is the agent, so the docs audience is judged on the token's grant (its scope-derived permission sets), not on the person's own permission sets: a manual whose audience is a permission set the person holds stays hidden on that connection. Both tool descriptions say so."
  • After: "On an OAuth grant the request is an agent acting for the person who consented, and a permission-set audience is read against that person's own permission sets (ADR-0090 D10), never the token's scope-derived sets."
  • The new sentence is true of the code above, and it sits in a bullet that already says the tools register only for data:read.
  • The dropped "Both tool descriptions say so." is fine. The new 35584 note states the new descriptions.
  • Restoring the old sentence would put a false release note back, so the red is correct. This is a code-changing PR, so per landing-operations it also needs the seat's same-head at-tier contract PASS, which reads the rewritten sentence too.

35584 changeset, sentence by sentence (holds): scope decides reach (data:read); the person's own sets via grant resolution; nonexistent or non-member gets no set; no union with the token's sets; default audience unchanged; API keys, sessions and AI service accounts keep their own sets; both descriptions now say so. Both are true against the diff, and both packages (@objectstack/mcp, @objectstack/runtime) are public and listed as patch.

mcp-http-tools.ts (text only): two docblocks and two descriptions. The descriptions are shorter (−25 B and −29 B) and state the ruled audience ("the person's own permission sets decide, never more"). No test pins either string. The descriptions are an MCP-facing face, so the seat's Clause-② read covers them.

Notes (non-blocking):

  • N1. The 35584 changeset says the person's sets are resolved "in the organization the token's consent bound". The code reads the request's tenantId (the PR body says "the request's organization"). On an OAuth envelope these should be the same organization. security#2 can confirm that in its head check.
  • N2. The data:read condition is now spelled in two places (runtime and packageDocToolsServed). The PR's Acceptance notes say both must move together. A shared export would remove the second copy; it is not owed here.

Landing: seat contract read (Clause-② yes, widening; this is also the DELIBERATE CORRECTION's L2 confirmation), then security#2's read-only head check, then the seat lands with the by-design red.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 3dae06ce43bd442dce3f5b47aaffb26f160a320f
Local-runs: none
Security-touching: yes

Face: the Clause-②: yes declaration alone. The six-file list holds no packages/spec/src path and no governed path, and neither the PR body nor a changeset declares the (narrowing) arm, so reviewFace answers the declaration face, whose tier name is TIER_DEFAULT, exact. No Scope: floor, no ④ and no tier evidence are owed on this face. The run was the seat's isolated read-only sub-agent. Its transcript passes verify-review-tier.mjs, so it was served at CONTRACT_REVIEW_TIER; the line above still names the face's tier, because the committed tree decides the name and the name is exact in both directions.

Read: the net diff against merge-base 8145424b53 (6 files, +259/-58), card #35584 with every comment, the ruling record 7043930931, both dev reports (7045459701, 7062409108), the seat's final-head comment 7062718755, the L1 verdict 7062795354, the cited code in this head's tree, and the head's check-runs: 37 success, 18 skipped, 2 failed, 0 pending. Both failures are Check Changeset, and in both the one failed step is the foreign-changeset refusal on .changeset/35442-mcp-app-docs-tools.md; the ADR-0087 step and the major-bump step of the same job are green. Nothing was built or run.

Result: the code implements ruling A as ruled, and this read found no path on which a permission-set manual is served to a principal the ruling excludes. Security-touching: yes is meant: the hunks decide whose permission sets open a manual on a delegated token. No must-fix. S1 and S2 below are open on this head, and each earns a delta review of its fix. Both are text in published files; neither is in the code. The read-only head check by security#2 (ruling condition 4) is still owed before merge and is not this record's.

① Derived judgments

Ruling A against the code

  • Condition 1, the token's scope still decides reach: holds. handleMcpRequest resolves the docs seam only when the envelope carries no grant or the grant includes data:read. That is the condition packageDocToolsServed registers the two tools on, and registerPackageDocTools is the only reader of the two bridge members. A token without data:read gets a bridge with neither member, so the person's holdings are never read for it. Pin: a token whose scope does not reach the docs tools is carried no docs member, whatever the person holds.
  • Condition 2, the delegating person's own holdings: holds. delegatingPersonOf answers a person only for principalKind: 'agent' with a non-empty onBehalfOf.userId. delegatorHoldingsCaller builds the caller the security service is asked about from resolveUserAuthzGrants alone, in the envelope's organization. It is the same call and the same caller shape as the draft door's resolveHumanReader, without that door's manage_metadata admission, as the ruling asks. That caller carries nothing of the envelope: not its permissions, not its onBehalfOf. resolveCaller still answers the envelope, and the doc and book arms read only whether it has a userId, so the default audience answers as before.
  • Fail closed: holds. No sys_user row (read under the system context, as readSysUserRow reads it), no membership in the envelope's organization (vetOrganizationClaim on the person's own accessible_org_ids, the rule delegatedOrganizationRefusal asks), no data engine, a security service without the verb, and any read that throws all end in the catch of resolveAudienceCaller (packages/rest/src/meta-item-read-gate.ts). It leaves permissionSets undefined, and audienceAllows then denies every { permissionSet } audience. An envelope with no organization resolves the person with none, as resolveDelegatorContext does (ADR-0123 D2): no grant stored in an organization applies.
  • Never a union: holds. With a delegating person, the envelope's ceiling sets never reach resolvePermissionSetNames. Pin: no union: a manual whose audience is a set only the token's ceiling carries stays closed.
  • AI service accounts keep their own sets: holds. With no onBehalfOf the gate is the unchanged one. Pin: an AI service account keeps its own sets.
  • Condition 3: holds. The session control pair is kept, an OAuth non-holder control is added, and the scope pin exists.

Widening paths looked for, none found

  • A missing person: closed, and pinned (ghost: grant and membership rows, no user row).
  • A revoked or changed set: holdings are read once per gate, and a gate is built per tool call (createPackageDocMembers reads its sources per call; the bridge is per request). Nothing outlives the call. The read is the shared resolver's, on the same terms as the person's own request.
  • The organization: on this door the envelope's organization is the one the token's consent bound, kept only while a current membership backs it (resolve-execution-context.ts, then the session arm of resolveAuthzContext). It is never another organization the person belongs to. S2 is about how the new note words this.
  • A cached failure: a rejected holdings promise is kept for the life of the gate, which keeps it closed.
  • Listing: the runtime's scope condition and the MCP runtime's agree at this head.

The DELIBERATE CORRECTION of .changeset/35442-mcp-app-docs-tools.md: accurate, and declared as the rule asks

  • Before (merge base): "On an OAuth grant that caller is the agent, so the docs audience is judged on the token's grant (its scope-derived permission sets), not on the person's own permission sets: a manual whose audience is a permission set the person holds stays hidden on that connection. Both tool descriptions say so."
  • After (this head): "On an OAuth grant the request is an agent acting for the person who consented, and a permission-set audience is read against that person's own permission sets (ADR-0090 D10), never the token's scope-derived sets."
  • The before sentence is false at this head, so restoring it from the base would publish a false note. The after sentence is true of the code. Its first clause is the agent arm of assembleExecutionContext. Its second clause is delegatorHoldingsCaller. "Never the token's scope-derived sets" is the no-union pin. Dropping "Both tool descriptions say so." is right: the descriptions no longer say that, and the new note states what they say now. The rest of the bullet (the gate, the not-found answer, the data:read registration) is untouched and still true, and nothing else in that note speaks of OAuth.
  • The declaration: the PR body names the note under DELIBERATE CORRECTION and quotes the corrected sentence. No skip-changeset label is on the PR. The seat's comment 7062718755 names the gate and the reason. Check Changeset is red on exactly that refusal and on nothing else. The diff changes code, so this record is the confirmation landing-operations.md asks for, and it confirms the correction.

packages/mcp/src/mcp-http-tools.ts (text only): both docblocks and both descriptions state the ruled audience and agree with the runtime.

S1 (should-fix): packages/mcp/README.md still states the rule this PR replaces.

  • Lines 181 to 184 at this head: "on an OAuth grant the caller is the agent, judged on the token's grant rather than the person's own permission sets". The file is not in the diff.
  • It ships in the @objectstack/mcp tarball this PR bumps. It is the same stated limit of PR feat(mcp): search and read the installed apps' manuals over MCP, with the answer order in initialize #35564 that the card's Done-when asks to remove or keep to match: the descriptions, the changeset and the helper header were corrected, and this copy was missed. After this head lands, the package's own README says a holder cannot read a manual that the runtime serves to them.
  • To close it: the same one-sentence correction on this branch, under an amended claim, or the seat's carrier card before landing. A search of the head for the old sentence finds no other copy in content/docs, skills or the other READMEs.

S2 (should-fix, changeset text): the new note's organization sentences say more than the door does.

  • .changeset/35584-delegated-docs-audience.md, second bullet: "…in the organization the token's consent bound. A person who does not exist, or who holds no current membership in that organization, holds no set here, and permission-set manuals stay closed to them."
  • The code reads the envelope's organization (caller.tenantId). The PR body and the helper header say that correctly ("the organization the request runs in"). On this door it is the consent's organization only while a current membership backs it. Once none does, the identity step has already dropped it, and the person is read with no active organization, as their own session is (ADR-0123). The membership vet inside the gate is a second asking of the same rule.
  • So "holds no set here" is exact for a person with no user row and for the gate's own vet. For a person whose membership has ended, the note should say what the door does. Suggested: "…in the organization the request runs in: the one the token's consent bound, while the person's membership there is current. A person with no user row holds no set here. A person whose membership there has ended is read with no active organization, as their own session is, so no grant stored in an organization applies."
  • This is L1 note N1, answered: on a token-only request the two cannot name different organizations, and the mismatch is wording. A changeset is a prose face, so this correction keeps the record on the new head under a Regen-provenance: line.

Nits, none of which moves this head by itself:

  • Nit a. Two of the fail-closed arms the helper header names have no pin at this seam: no data engine, and a user or grants read that throws. They rest on the gate's catch, which packages/rest/src/meta-app-nav-doc-audience.test.ts pins for the REST door. The membership pin drives a hand-built envelope, with an organization the identity step would have dropped. A second case through oauthEnvelope, for a person with a grant row and no membership in the consent's organization, would pin what the door itself answers.
  • Nit b. A holdings failure is silent. The gate reads the throw as unresolved and nothing logs it, where resolveHumanReader beside it warns. On a host that resolves no data engine, every permission-set manual closes on every OAuth connection with no line saying why, which is the card's own symptom again. One warn for the no-engine and unreadable-grants arms (not for a missing person or a non-member) would make that absence loud.
  • Nit c. "Nothing served today is refused" is exact against every published release: the two tools are unreleased, and the 35442 note is still pending. Against main, a manual whose audience names one of the token's scope sets goes from open to closed on an OAuth connection. That is the ruling's no-union condition, it is pinned, and it owes no (narrowing) arm because no published accept set narrows. For the same reason the new note's "used to judge" describes a state no release shipped, and whoever compiles the release notes may fold the two notes.

② Semver level

'@objectstack/mcp': patch and '@objectstack/runtime': patch are right. Both packages are public and both are moved by the diff (the descriptions and docblocks; the gate and the seam). Metadata-protocol: none is correct: nothing an author can write changes, no key, value, type or default, and the audience key means what ADR-0046 §6.7 says it means. That kind alone sets the level. Clause-②: yes is the conservative and correct reading: on a delegated token a permission-set manual is now served to a holder, and two published tool descriptions change. Both lines open a line in the PR body and in the new changeset. readClause2Line reads yes with no arm: the word after the dash is prose, not the (widening) arm, and means the same. No Skills-docs: line is owed for kind none. The corrected 35442 note keeps its own frontmatter and declaration lines untouched. No ADR-0087 disposition is owed.

③ Boundary flags

  • Dev reports 7045459701 and 7062409108: open_questions is empty. security_findings: none, which this read agrees with for the diff. The out-of-scope finding of the first report (the mcp-http-tools.ts text) is closed at this head. Deviations accepted: the searchPackageDocs member docblock corrected in the same text commit, @objectstack/mcp added to the changeset, the default merge-commit message, the model-free trailer.
  • L1 notes: N1 is S2 above. N2 (the data:read condition spelled in two places) is accepted with the PR's own acceptance note: if the docs family ever changes, both move.
  • SQL push-down: the diff adds one findOne existence read and one call of the shared grant resolver. No id materialisation and no in-app join.
  • Check Changeset is red by design, as above. Whether the PR may enter the queue with that red is the landing seat's three-condition check, not this record's.
  • The author is objectstack-fleet[bot]: no login note is owed.
  • Ruling condition 4, the read-only head check by security#2, is open.

Implemented-by: claude/area-a4C-35584
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

…ruled

The MCP README now says a permission-set audience on an OAuth connection is
read against the delegating person's own sets, never wider. The changeset's
organization sentences now say what the door does: the organization the
request runs in, and an ended membership read with no active organization.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Final head (r3, text only, area a4-C under re-claim 7065076776 on #35584): 183bed4d56f62825853b772d7076a4b5af29b8af · 2026-11-21T15:45Z

  • r3 is one commit on 3dae06ce43 (the head L1-a accepted in 7062795354 and the contract record 7063051111 read): 2 files, +4/-3. packages/mcp/README.md closes S1 (the bridge paragraph now states the ruled audience); .changeset/35584-delegated-docs-audience.md closes S2 with the record's suggested organization wording, verbatim. No code moved. The os-dev report is 7063157306.
  • CI at this head (pr-state): 37 success, 18 expected skip, 0 pending, 2 failed. Both failures are Check Changeset. Run locally at this head, check-empty-changeset --base origin/main refuses only .changeset/35442-mcp-app-docs-tools.md, the declared DELIBERATE CORRECTION; r3 does not touch that note, so the correction confirmed by record 7063051111 is unchanged.
  • Owed next: L1-a delta read (3dae06c..183bed4), the area's TIER_DEFAULT contract delta (S1/S2 closure), security#2's read-only head check (ruling condition 4), then landing with the by-design red.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): ACCEPT at head 183bed4d56f62825853b772d7076a4b5af29b8af (Fixes #35584). Delta read 3dae06ce43..183bed4d56, on top of the L1 ACCEPT 7062795354 and contract record 7063051111.

席位核对

Shape and gates. l1-face --pr 35888 at 183bed4: shape, first line, keywords, changesets (@objectstack/mcp, @objectstack/runtime), declarations (Clause-②: yes, Metadata-protocol: none) all ok. Check-runs: 37 success, 18 expected skip, 0 pending, 2 failed. Both failures are Check Changeset, the by-design red on the declared DELIBERATE CORRECTION of .changeset/35442-mcp-app-docs-tools.md, which the delta does not touch (record 7063051111 confirmed it). Lint & Repo Gates and TypeScript Type Check success. Dogfood not owed.

The delta: 1 commit, 2 files, +4/-3, text only. No code moved, so the earlier ACCEPT's code reading stands.

  • S1 (packages/mcp/README.md), closed. The bridge paragraph now says: on an OAuth connection whose grant reaches the docs tools, a permission-set audience is read against the delegating person's own permission sets, never wider. True of delegatorHoldingsCaller and the data:read condition in handleMcpRequest. A grep of the head for the old wording ("judged on the token's grant", "connection's grant") in packages, content, skills and docs finds no other copy on this subject.
  • S2 (.changeset/35584-delegated-docs-audience.md, second bullet), closed, sentence by sentence:
    • "resolved … in the organization the request runs in: the one the token's consent bound, while the person's membership there is current." True: the gate reads caller.tenantId, and resolve-execution-context.ts:257-258 keeps the consent's organization only while a current membership backs it (vetOrganizationClaim).
    • "A person with no user row holds no set here." True: delegatorHoldingsCaller throws on no sys_user row, and the gate's catch closes every permission-set audience.
    • "A person whose membership there has ended is read with no active organization, as their own session is, so no grant stored in an organization applies." True: the identity step drops the organization, so tenantId is undefined and resolveUserAuthzGrants runs with no tenant (ADR-0123 D2).
    • The text matches the record's suggested wording.

Landing (not L1's): the area's contract delta on S1/S2, then security#2's read-only head check (ruling condition 4), then landing with the by-design Check Changeset red under the three-condition rule.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 183bed4d56f62825853b772d7076a4b5af29b8af
Local-runs: none
Security-touching: yes

Delta round on the declaration face (Clause-②: yes alone; no packages/spec/src path, no governed path, no (narrowing) arm), read by the area itself at the face's tier. It reads 3dae06ce43..183bed4d56 (1 commit, 2 files, +4/-3) against record 7063051111, which passed 3dae06ce43 with two findings open. L1-a accepted the same delta in 7065174650.

① Derived judgments

  • S1 (should-fix): closed. packages/mcp/README.md, the bridge paragraph now reads "on an OAuth connection whose grant reaches the docs tools, a permission-set audience is read against the delegating person's own permission sets, never wider". That is the ruled audience and agrees with delegatorHoldingsCaller and the scope condition in mcp.ts at this head. The old sentence ("the caller is the agent, judged on the token's grant") is gone from the file.
  • S2 (should-fix): closed. .changeset/35584-delegated-docs-audience.md, second bullet, carries the record's suggested organization wording word for word: the organization the request runs in, the consent's while the membership is current; no user row holds no set; an ended membership is read with no active organization, so no grant stored in an organization applies. Each clause is true of the code record 7063051111 read (caller.tenantId, the user-row read, the identity step dropping a lapsed organization).
  • No code, test or other text moved, so every code judgment of 7063051111 carries to this head unchanged.

② Semver level

Unchanged: '@objectstack/mcp': patch, '@objectstack/runtime': patch, Metadata-protocol: none. The README ships in the @objectstack/mcp tarball this changeset already bumps.

③ Boundary flags

  • Check Changeset at this head: two failures, both Check Changeset; the only changeset in the diff this PR did not add is .changeset/35442-mcp-app-docs-tools.md. The delta does not touch that note, so the DELIBERATE CORRECTION confirmed in 7063051111 stands as confirmed.
  • Nits a and b of 7063051111 are not in this head (dev report 7063157306 says why); they move nothing here and are not graded against this PR.
  • Ruling A condition 4, security#2's read-only head check, is open (knocked on mailbox pm:mailbox — security#2 · sunhaolin #36108, 7065160521).
  • Author objectstack-fleet[bot]: no login note owed.

No must-fix, no should-fix.

Implemented-by: claude/area-a4C-35584
Reviewed-by: session_01FEkQ5miLqNucRZevceHwNh

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

security#2 read-only head check — PASS (ruling A 7043930931, condition 4). Head read: 183bed4d56f62825853b772d7076a4b5af29b8af; merges cleanly into origin/main 30b0987cd (git merge-tree --write-tree). Reviewer: an isolated CONTRACT_REVIEW_TIER thread, read-only; the runtime closure built and mcp-package-docs.test.ts ran 18/18 on an export of the head, plus scratch probes through the real identity door.

What holds, at rule level:

  • The widening is the agent's ceiling intersected with the delegating person's own holdings, and nothing more: the delegator is the verified token's subject, and request headers cannot move it.
  • Principals with no delegator (session, API key, AI service account) keep the unchanged path.
  • A revoked consent, disabled client, password reset or ban is refused before the audience is read, and so are an ended membership, a foreign organization and an unbound token.
  • Fail-closed: every read error and every missing service keeps the restricted page closed.
  • Public text states rules only.

Two non-blocking notes for the lane (neither fails this head):

  1. Three stated fail-closed behaviours have no pin at this seam: unreadable grants, no data engine, and the ended-membership sentence of the changeset driven through the real door. Each probed closed. The drafted pin can land as a follow-up.
  2. Parity: the data-plane delegator leg reads grants with the cache bypassed; this read uses the default cache policy. The cache is off by default, and when on, this equals the person's own session read, so nothing widens.

Adjacent readings outside this diff are with the security seat.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Contract review

Served-tier: TIER_DEFAULT
Head-sha: fbcb450dd5977a5095d7363c443069f56f50895c
Local-runs: none
Security-touching: yes

Merge-only round on the declaration face. fbcb450dd5 is a plain merge of origin/main 7f4970a273 into 183bed4d56 (landing-k read K = 19 ≥ 15). Read: the commit's parents, the net diff and the os-dev report 7065254317.

① Derived judgments

  • The PR's net change is unchanged: the same 7 files, +262/-60, and the same git patch-id --stable (c2be61cd1e1b) before and after the merge (os-dev report 7065254317; the file list re-read from the PR). So every judgment of records 7063051111 and 7065204007 carries to this head unchanged.
  • .changeset/35442-mcp-app-docs-tools.md holds the same blob (953887f6f3) at both heads, so the DELIBERATE CORRECTION confirmed in 7063051111 is the one at this head.
  • security#2's read-only head check 7065421528 read 183bed4d56 and merged it cleanly into origin/main 30b0987cd; the code it read is this head's net diff, byte for byte.

② Semver level

Unchanged: '@objectstack/mcp': patch, '@objectstack/runtime': patch, Metadata-protocol: none.

③ Boundary flags

  • The two notes of 7065421528 (three fail-closed arms without a pin at this seam; the grants read's cache policy) are not graded against this PR; the lane takes the pin as a follow-up card.
  • Author objectstack-fleet[bot]: no login note owed.

No must-fix, no should-fix.

Implemented-by: claude/area-a4C-35584
Reviewed-by: session_01FEkQ5miLqNucRZevceHwNh

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Landing · head fbcb450dd5977a5095d7363c443069f56f50895c · 2026-11-21T16:28Z

Probe Reading
check-governed-merges --pr 35888 NOT governed; 322 changed lines ≤ 3000
pr-state / check-expected-skips 36 success, 16 expected skip (exit 0), 0 pending; 1 failed: Check Changeset
landing-k --pr 35888 K = 1 < 15, OK
Records at this head L1 ACCEPT 7065174650 (merge-only move, same patch-id), contract PASS 7065518675 (TIER_DEFAULT, declaration face), security#2 read-only head check PASS 7065421528 (ruling A condition 4)
Check Changeset red By design, three conditions: the refusal names only .changeset/35442-mcp-app-docs-tools.md, the declared DELIBERATE CORRECTION confirmed by record 7063051111; pr-automation.yml runs it on pull_request only, never merge_group; the gate's own source names this class red by design; this PR's comments 7062718755 and 7065119281 record the gate and the reason

State: ready + auto-merge now. On merge, #35584 closes by its Fixes line and leaves pm:dispatched.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 16:28
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit ea58563 Nov 21, 2026
53 of 54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-a4C-35584 branch November 21, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: on an OAuth grant, read the docs audience against the delegating person's own permission sets, not the token's ceiling

2 participants