Repository navigation
fix(mcp,runtime): get_record_context reads a package's context packs on both MCP doors - #37255
Conversation
…hored packs The protocol's served ai_context listing stamps every item with the read path's _diagnostics; the executor parses each row with the closed AiContextSchema, so every pack was dropped and get_record_context answered RESOURCE_NOT_FOUND on the HTTP and stdio doors alike. Both doors now pass their listing through stripReadDecorations (METADATA_READ_DECORATIONS), which keeps the ADR-0010 protection envelope the schema declares. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…xt pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…d on both record-context doors Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
… protocol Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
… packs Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…t the frozen memory driver Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
📓 Docs Drift CheckThis PR changes 3 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 37 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 935f9dc055eb783623e3bd7f2315753071bca5c0 && git checkout 935f9dc055eb783623e3bd7f2315753071bca5c0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9171bed0a65ab242567f243969368ead786cd830 1176335e4863e31f3446cbe8b06f79e1f0344bbf && git checkout -B drift-repro 9171bed0a65ab242567f243969368ead786cd830 && git merge --no-ff 1176335e4863e31f3446cbe8b06f79e1f0344bbf
node scripts/docs-audit/affected-docs.mjs --json 9171bed0a65ab242567f243969368ead786cd830
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 083ab1b · 2026-11-25T08:45ZL1: REWORK (L1-w, zone ai-A) There is one should-fix, which is a changeset push. The code is right. This is Tier S: no governed path, 249 changed lines on this card's only PR. No L2 is owed:
Should-fix
Read and found right (head 083ab1b)
Path to ACCEPT
|
…ips in its types Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 1176335 · 2026-11-25T09:12ZL1: ACCEPT (L1-w, delta read, zone ai-A) No must-fix and no should-fix. No L2 is owed: nothing under Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK Landing · 2026-11-25T09:14Z · ACCEPT 7158044850 at head 1176335 (no L2 owed: no
State: ready + auto-merge (Tier S). On MERGED, #37243 closes by |
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK
Fixes #37243
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
packages/runtime/src/domains/mcp.ts,listContextPacksin the bridge's record-context members) and the stdio door (packages/mcp/src/stdio-data-bridge.ts,listContextPacks) read the protocol's servedai_contextlisting, whichdecorateMetadataItemstamps with_diagnostics; the executor's closedAiContextSchemaparse (parsedContextPacks) dropped every row. Each door now maps its listing throughstripReadDecorations(@objectstack/spec/kernel), the metadata-fallback branch included.METADATA_READ_DECORATIONS(_diagnostics,_draft,_withheldFields,_relatedListsArrangement), the read path's derived keys that are no part of a document. The ADR-0010 protection envelope (_packageId,_packageVersion,_provenance,_lock,_lockReason,_lockSource) stays:AiContextSchemadeclares it throughMetadataProtectionFields, so it parses, and the pin asserts the served pack still carries_packageId. A blanket underscore strip would remove declared keys; stripping only_diagnosticswould leave the next listed decoration to fail the same way.spec/kernel/metadata-read-decorations.ts, whose module docblock names this exact failure class ("any re-parse of a served document"). Both doors already depend on@objectstack/spec, so neither takes a new runtime dependency, and the protocol's served read (with its per-type redaction) is still the one a door reads —getMetaItemsForExecutionwould have dropped the_diagnosticstoo, but its docblock forbids reading it from a door that answers a caller.RecordContextDoor.listContextPacks(packages/services/service-record-context/src/door.ts). The executor's strict parse is unchanged.Tests
packages/mcp/src/mcp-record-context-tools.test.ts: new top-leveldescribe— a realObjectStackProtocolImplementationover a realObjectQL(an in-memory SQLiteSqlDriverstore) with a package carrying the pack; the metadata service lists no pack, so the protocol's listing is the only one. Precondition asserts the served pack carries_packageIdand_diagnostics; thenget_record_contextanswers through the pack, identically on MCP-over-HTTP and stdio.packages/runtime/src/mcp-record-context-tools-bridge.test.ts: new top-leveldescribe— the/mcproute end to end (HttpDispatcher.handleMcp, the realMCPServerRuntime, the real executor,SecurityPlugin, the real protocol overObjectQL+SqlDriver); same precondition, then the call answers the pack's fields.git diff HEADempty and blob == HEAD): removing the strip at either door turns its pin red with the defect's own answer,RESOURCE_NOT_FOUND"No context pack named … reads object …".@objectstack/mcpgains devDeps@objectstack/metadata-protocoland@objectstack/driver-sql;@objectstack/runtimegains devDeps@objectstack/mcpand@objectstack/service-record-context; each new value import has an anchored source alias row in that package'svitest.config.ts(check:test-source-alias).Acceptance notes
service-analytics' dataset executor strips decorations inside the executor; this card's ruling puts the strip at the doors and keepsAiContextSchema's consumer strict. Noted, not changed.metadata-protocolsource through the new alias. These readings come from single-file runs. A full-package run shares the transform cost across files.Verification
Local readings (final head in the report)
See the report comment on #37243 for the exact commands, exit codes and the head sha they were read on.
Read first:
packages/mcp/src/stdio-data-bridge.ts(listContextPacks, the strip on both branches),packages/runtime/src/domains/mcp.ts(same),packages/mcp/src/mcp-record-context-tools.test.ts(the precondition that makes the pin non-vacuous).Two-minute check:
pnpm --filter @objectstack/mcp exec vitest run src/mcp-record-context-tools.test.ts→ 11 passed; delete.map(stripReadDecorations)from the stdiolistContextPacksand the last case fails withRESOURCE_NOT_FOUND.Generated by Claude Code