Skip to content

get_record_context finds no context pack a real protocol serves: getMetaItems adds _diagnostics, the strict AiContextSchema parse drops every pack #37243

Description

@objectstack-fleet

repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W

Filing gate: ③ maintainer-directed (topic #36996 handed to seat 3). Found by zone ai-A while building #37175's real-kernel rig. Grading is triage's.

维护者速读

What (measured on main ad604c10)

  • ObjectStackProtocolImplementation.getMetaItems decorates every listed ai_context item with _diagnostics (decorateMetadataItem, packages/metadata-protocol/src/metadata-diagnostics.ts).
  • The executor parses each pack strictly with AiContextSchema (parsedContextPacks, packages/services/service-record-context/src/read-set.ts) and drops it as unrecognized_keys.
  • Both doors read through getMetaItems: HTTP via readMergedItems, stdio directly. So a valid package pack answers RESOURCE_NOT_FOUND on both.
  • The existing stdio pins pass only because their protocol double returns undecorated packs.
  • Control, on a real-kernel rig (real ObjectQL/sqlite, SecurityPlugin, the protocol, RecordContextServicePlugin, /mcp and stdio): with _diagnostics stripped, the HTTP door serves the pack correctly.
  • Repro: branch claude/issue-37175-record-context-http-rig at 0fa37da2 (RC_STRIP=1 runs the control). Report comment on 37140 跟进:get_record_context 在运行时 HTTP 通道上用真执行器测一遍(含拒绝) #37175.

Fix direction (dev's recommendation)

Fix it at the doors, not by making the executor tolerant: both doors' listContextPacks read an undecorated listing. Pin it with a real-protocol test on both doors.

Acceptance

  • A valid package pack is served on the HTTP door and on stdio through the real protocol, with no protocol double.
  • A pin fails when the listing is decorated again.

Blocks: #37175, #37189. Parent: #36996. Related: #37140, #37173.

Dedupe words: get_record_context _diagnostics, AiContextSchema unrecognized_keys, decorateMetadataItem context pack.


Generated by Claude Code

Activity

  1. added
    bug
    area:ai
    on Nov 25, 2026
  2. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch 2026-11-25T06:41Z.

  3. added
    domain:server
    pm:queue
    priority:p2
    on Nov 25, 2026
  4. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK

    Claim: PM loop round 6 (area:ai zone ai-A, topic #36996 non-cloud rows) · 2026-11-25T06:48Z
    Session: session_01WGufzi13yZRqVcp2mGonWK
    Account: os-support-ai
    Branch: claude/issue-37243-context-pack-undecorated-read
    Worktree: objectstack-issue-37243
    Domain: domain:server
    Seat: repo:objectstack#3
    Area: ai-A
    File surface: packages/runtime/src/domains/mcp.ts (recordContextMembers listContextPacks, :1691) and packages/mcp/src/stdio-data-bridge.ts (listContextPacks, :1881): both doors hand the executor an undecorated listing; one shared helper where the serving decorations are already known (the dev names it; packages/metadata-protocol/src/metadata-diagnostics.ts only if the strip belongs beside decorateMetadataItem, :405); packages/services/service-record-context/src/door.ts docblock only (the door's contract: the listing it hands over is the authored pack); real-protocol pins on both doors in card-named test files (or the shared harness where AGENTS.md says); .changeset/. ⛔ The executor's strict AiContextSchema parse is not loosened.
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no (a defect fix: a valid pack the record says is read becomes readable; no published shape moves)
    Metadata-protocol: none
    Responsibility: the two record-context doors in objectstack hand the executor the protocol's decorated listing (runtime mcp.ts recordContextMembers, mcp stdio-data-bridge.ts, both reading getMetaItems, which decorateMetadataItem stamps with _diagnostics) at d7f299c0 | none: the executor's strict parse (read-set.ts parsedContextPacks) is right and drops the row | every deployment that serves aiContexts and get_record_context, examples/app-showcase included; reached today on both MCP doors, measured on a real-kernel rig (claude/issue-37175-record-context-http-rig@0fa37da2)
    Thread-read: 7155054903
    Premise: holds. Measured at d7f299c: both doors' listContextPacks read through getMetaItems (runtime mcp.ts:1691, stdio-data-bridge.ts:1881); decorateMetadataItem (metadata-diagnostics.ts:405) adds _diagnostics; the executor parses strictly (read-set.ts:159, record-context-tools.ts:262). Control on the #37175 rig: stripping _diagnostics serves the pack.
    Serial constraints cleared: this zone's open PRs: #37247 (#37176, packages/lint), #37240 (docs/adr): no shared file. #37175's backup branch adds a runtime test file only; it rebases onto this fix. The overlap check runs at the first push.
    Pre-claim lane: domain:server (packages/runtime, packages/mcp)
    Pre-claim deps: none (Blocks: #37175, #37189)
    Prior rulings read: check-prior-rulings.mjs --card 37243 at d7f299c: broad term set, 176 hits, none on this seam; ADR-0160 D4 (one executor, every transport) read by hand; none conflicting

    Done when: a valid package pack is served on the HTTP door and on stdio through the real protocol with no protocol double; a pin fails when the listing handed to the executor is decorated again.

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 25, 2026
  6. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK
    os-dev-report

    {
      "issue": 37243,
      "status": "done",
      "branch": "claude/issue-37243-context-pack-undecorated-read",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37255",
      "session": "session_01WGufzi13yZRqVcp2mGonWK",
      "premise_still_valid": true,
      "summary": "Both record-context doors (runtime packages/runtime/src/domains/mcp.ts listContextPacks; stdio packages/mcp/src/stdio-data-bridge.ts listContextPacks) now map the protocol's served ai_context listing, and the metadata fallback too, through the existing shared helper stripReadDecorations (@objectstack/spec/kernel). It removes exactly METADATA_READ_DECORATIONS (_diagnostics, _draft, _withheldFields, _relatedListsArrangement) and keeps the ADR-0010 protection envelope (_packageId, _packageVersion, _provenance, _lock*), which AiContextSchema declares through MetadataProtectionFields, so those keys parse. No new helper and no edit to metadata-diagnostics.ts: the helper already lives in spec, which both doors depend on, and its module docblock names this failure class. AiContextSchema is unchanged. The door.ts contract sentence is on RecordContextDoor.listContextPacks. Real-protocol pins (no protocol double) are added as top-level describes in the two existing harness files. Remote head: origin/claude/issue-37243-context-pack-undecorated-read @ 083ab1bf4. Dev-effort: high, Rounds: 1. Container and model: M, mode:subagent, effort high. The served tier was not read separately.",
      "tests": "head 083ab1bf4. (1) pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-record-context-tools.test.ts -> Tests 11 passed (11). (2) pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/http-dispatcher.test.ts src/mcp-record-context-tools-bridge.test.ts src/domains/mcp-object-descriptions-34721.test.ts -> Test Files 3 passed, Tests 266 passed. (3) pnpm --filter @objectstack/mcp --filter @objectstack/service-record-context run test -> mcp Test Files 85 passed, Tests 1504 passed; service-record-context Test Files 2 passed, Tests 71 passed (lock VERDICT command-exit 0). (4) typecheck mcp, runtime, service-record-context (tsc --noEmit plus check:test-typecheck) -> all Done, VERDICT command-exit 0. Runtime full suite not run locally (declared narrowing: about 1000 s on CI, 651 files). The diff is two listContextPacks bodies, and the only runtime tests that name ai_context or record-context are the 3 files above. Test Core runs the full suite. Ablation, committed head 083ab1bf4, via scripts/ablation-replace.mjs with trap restore. Stdio leg: anchor x1->x0, replacement x0->x1, then 1 failed of 11 with RESOURCE_NOT_FOUND 'No context pack named policy_document reads object policy'. HTTP leg: anchor x1->x0, replacement x0->x1, then 1 failed of 6 with RESOURCE_NOT_FOUND 'No context pack named rcd_policy_document reads object rcd_policy'. Both restored: blob == HEAD, git diff HEAD empty. No build or dist step was needed: both subjects resolve as relative src imports. The first ablation attempt was a no-op and is void: its replacement was a substring of its anchor, ablation-replace refused it and restored, and it ran with a new replacement text. Baseline wall at d7f299c0, single-file cold runs: runtime harness 16.65 s, now 18.31 s; mcp harness 5.77 s, now 10.8-14.1 s on a loaded box (import-dominated).",
      "gates": "Local derived set: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 083ab1bf4, 86 families run with exit codes captured before any pipe. dispatch-gates --ran gave: 86 derived, 84 run, 2 NOT-MEASURED (exit 3, PREREQUISITE NOT MET), 0 UNRUN. The 2 NOT-MEASURED: check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit) and check:dual-build-cjs-loads (unrelated packages have no dist). The run before that, at f995b11d plus edits, was red on check:driver-memory-census: the stdio pin's first store was the frozen memory driver. The store is now an in-memory SQLite SqlDriver and the gate exits 0 at 083ab1bf4. check:test-source-alias OK, check:engine-double-contract 0, check:nul-bytes 0. PR #37255 check-runs on 083ab1bf4: Lint & Repo Gates success, TypeScript Type Check success, Build Core success, Governed Surface Queue Guard success, Check Changeset success, Dogfood Regression Gate success, Lint UI, Type Check UI, Test UI (16/16), Build & E2E UI and Live E2E UI success. Test Core failure: shard 5/10 alone is red. The red case is @objectstack/cli integration src/commands/migrate/data-commands.absent-database.integration.test.ts, 'Hook timed out in 480000ms' in a beforeAll that spawns the seed child and the CLI doors, during a 1087 s CLI run (220 of 221 files passed, 2752 tests passed). The diff does not touch the CLI or migrate. I read this as load timing, not this change, but did not prove it. Test Core shards 1-4 and 6-10 passed. mergeable true, not dirty.",
      "dogfood_battery": "n/a — no ! in the PR title and Clause-② is 'no' with no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 — relay pr_create (objectstack-ai/objectstack, opened draft #37255, read back 5944/5944 bytes identical, assignee os-support-ai, no labels); post-stamped os-dev-report comment on #37243. git push is not a REST write.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the Test Core 5/10 red: the @objectstack/cli integration hook timeout in data-commands.absent-database.integration.test.ts on this PR's run. One reading only, no repro, so it is not a filing. The seat decides whether to re-run the job or carry it.",
        "carrier: none · noted, not filed — placement asymmetry: service-analytics' dataset executor strips read decorations inside the executor (DatasetSchema.safeParse(stripReadDecorations(item))). Record-context now strips at the doors, per this card's ruling. This is observation only."
      ]
    }
  7. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK

    Close-out · 2026-11-25T09:39Z · PR #37255 merged 2026-11-25T09:38Z as f131c83; this card closed by Fixes. pm:dispatched removed. Both doors now hand authored packs to the executor with the read decorations stripped. This unblocks #37175 and #37189 (both left for the queue; zone ai-A has stood down). Nothing else open on this card.

  8. removed
    pm:dispatched
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aibugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions