Skip to content

37418 跟进:资料包读取把关联对象的故障当作「无权」拒绝,故障应如实报出且不泄露 #37463

In progress

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Filing gate: ② follow-up out of #37418. The source is seat 5's contract review on PR #37438 (record 7184346569, ③ escalation and N3) and REWORK 7184355118, which ask for this card under #36996 before ACCEPT. The owning area files it, per the maintainer's standing permission for areas to file their own follow-up cards.
Grading: area:ai · Task · p2 · reach: every get_record_context call on a pack with related (and every citation the host verifies against such a pack) · evidence: read.

维护者速读

  • 做什么:记录资料包读取时,如果关联对象的读取因为故障(比如数据库抖动)失败,现在会被当成「无权访问」整次拒绝。这样核对引用的一方分不清是权限问题还是故障,引用会被悄悄永久丢掉。要让故障以「故障」的形式报出,同时仍然不泄露提问人看不到的对象。
  • 谁受益:AI 回答的引用(云端产生引用那一步)和排障的人。
  • 不做会怎样:故障时整条回答的引用永久丢失,且看起来像权限问题。
  • 需要你做的:无,除非改动需要修改 ADR 文字(受管文件,需要 os-zhuang 批准)。

What

In executeGetRecordContext (packages/services/service-record-context/src/record-context-tools.ts, on main after PR #37412):

  • step 4a: a throwing servedObjectDefinitionOf(child) returns refuseObject(child, false), "A read that failed is no answer about this caller: it refuses, unnamed";
  • step 4a: an assertApiExposed failure that is not an API-exposure refusal (a package gate, an outage) also refuses unnamed;
  • publishedOf: a published-definition read that throws after the gates passed refuses the call unnamed;
  • the child list query, where it fails for a reason that is not a refusal.

Each comes out as PERMISSION_DENIED 403, which the verifier of #37418 (PR #37438) rightly reads as a refusal. So an outage on a pack with related still drops every citation silently and for good.

  1. Tell an outage apart from a refusal at those sites. A failure that is not a coded refusal should surface as a failure, for example a coded 5xx such as SERVICE_UNAVAILABLE per ADR-0112, or by rethrowing the original error. It must still name nothing: no object, field or package name the caller is not shown, and no door rendering of the failure. A package gate that is a real refusal stays 403.
  2. Confirm the verifier end to end: a citation on a pack whose child read throws an uncoded error is dropped and reported through onError, and a coded refusal is dropped and not reported.
  3. If ADR-0160 (D3 "Object level" or point 12, "one object-level code") fixes the 403 for these cases, the ADR sentence needs an amendment (governed docs/adr/**). State the sentence in the PR, and file or ride the amendment.

Acceptance

  • A test per site: an uncoded throw surfaces as a failure that names nothing, with a refusal control that stays PERMISSION_DENIED 403.
  • The real-kernel harness on both doors carries one outage case.
  • The verifier pin of item 2.
  • Clause-②: state the line. The tool's error answer changes for outages, so judge widening or narrowing, and the L2 is owed. Metadata-protocol: none.

Blocked-by: #37438 (the PR, on main)
Parent: #36996
Size: S
Dedupe (objectstack, is:issue): refuses, unnamed outage 0 · record-context PERMISSION_DENIED outage 0.

Activity

  1. added
    priority:p2
    pm:blocked
    area:ai
    domain:server
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ai · domain:server · Task · priority:p2 · pm:blocked · size S; rationale: a fault while reading a related object is refused as "no access", so the host cannot tell a fault from a permission refusal and drops the citations. It happens only on a fault, so p2 as filed. The waiting line now reads Blocked-by: #37438 (it said "Blocked by: PR #37438", which the board does not read); no other text changed.

  3. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Unblocked: PR #37438 merged at 2776e882f5; the verifier reports uncoded failures through onError. pm:blocked → pm:queue. Serial note: waits for #37233 (in flight in record-context-tools.ts) before dispatch.

  4. added
    pm:queue
    and removed
    pm:blocked
    on Nov 26, 2026
  5. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim: PM loop round 9 · area ai-36996 (topic #36996 non-cloud rows; the maintainer, verbatim, 2026-11-25T12:57Z project thread: 「开一个 36996 专题,接手剩余任务」; concurrency per area 3, 2026-11-25T23:33Z) · 2026-11-26T11:31Z
    Session: session_01Utp6CbeF2saT6wUBV4E9uc
    Account: os-bill
    Area: ai-36996
    Branch: claude/issue-37463-record-context-outage
    Worktree: objectstack-issue-37463
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/services/service-record-context/src/record-context-tools.ts (the four sites of the card's What), sentences.ts only if a failure sentence is needed, src/__tests__/record-context-tools.test.ts, src/__tests__/verify-citations.test.ts (the verifier pin); the real-kernel outage case in packages/runtime/src/mcp-record-context-tools-bridge.test.ts; root .changeset/. ⛔ No packages/spec/**, no docs/adr/**: if a spec error code or an ADR sentence must move, stop and report (the ADR text rides #37490). Stop on breach and report.
    Container & model: S, mode:subagent, model: default — dispatch-gates --tier: "no path-derived mandate", effort: medium
    Clause-②: no — the accept set is unchanged; the error answer for an uncoded outage moves from PERMISSION_DENIED 403 to a coded failure, a contract change that owes one contract-review-tier review (L2) before the queue
    Metadata-protocol: none
    Responsibility: packages/services/service-record-context (executeGetRecordContext step 4a, publishedOf, child list query: an uncoded throw refuses unnamed) produces the outage-as-refusal | no platform path covers it | every get_record_context call on a pack with related, and every citation verified against one
    Premise: holds — on origin/main 276174ab0: record-context-tools.ts:427 "A read that failed is no answer about this caller: it refuses, unnamed"; the verifier of #37418 (PR #37438) is on main.
    Serial constraints cleared: #37233 (PR #37484) and #37365 (PR #37485) merged. Sibling #37141 (dispatched now) is in packages/spec/src/ai/skill*, packages/mcp/src/skill-prompts.ts and packages/lint: disjoint. #37432 (same harness) waits until this lands.
    Pre-claim deps: #37418 closed (PR #37438 merged)
    Prior rulings read: contract review 7184346569 and REWORK 7184355118 on PR #37438; ADR-0160 D3 "Object level" and point 12; ADR-0112

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
     "issue": 37463,
     "status": "done",
     "branch": "claude/issue-37463-record-context-outage",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/37550",
     "head": "32aba545983608ea7b5787ffeb82d95c829267e2",
     "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
     "premise_still_valid": true,
     "summary": "One classifier, isCodedRefusal (ADR-0112: a non-empty string code plus a declared 4xx, .status then .statusCode), now decides refusal vs failure at all four sites through one executor helper (refusedOrFailed): the step 4a assertApiExposed catch, the step 4a servedObjectDefinitionOf catch, publishedOf, and the child list query. A coded refusal answers as before (PERMISSION_DENIED 403 within the naming bound at the three object-level sites; at the child query the door's own coded refusal is rethrown unchanged, as on main). Any other throw now fails the call SERVICE_UNAVAILABLE 503 (an existing ledger code; no spec change). Its own sentence (sentences.ts readFailed, en and zh-Hans) names only the pack and the root, and the original error is on cause. verifyRecordCitations imports the same classifier in place of its private copy, and its docblock paragraph that this change made false is rewritten. Item 3: no ADR-0160 sentence fixes 403 for a failed read. D4 'The naming bound' (\"Every such refusal carries one code — PERMISSION_DENIED, the code #35145 uses — so the code does not tell a hidden object from a refused one.\") and point 12 (\"An object-level refusal names the refused object only when the caller's served schema shows it, and every such refusal carries one code.\") govern refusals only, so no amendment is owed by this PR. Both are quoted in the PR body. ADR untouched.",
     "acceptance": {
      "a test per site, uncoded throw -> failure naming nothing, refusal control stays 403": "PASS: record-context-tools.test.ts new describe, it.each over assertApiExposed / servedObjectDefinitionOf / publishedObjectDefinitionOf / query (503, exact readFailed sentence, no child/field/package/outage text, cause === original); controls: OBJECT_PACKAGE_DISABLED 404 -> PERMISSION_DENIED 403 unnamed at the three object-level sites; child query coded refusal rethrown unchanged; plus driver errno, coded 5xx, status-without-code, thrown string all failures; locale case",
      "real-kernel harness on both doors carries one outage case": "PASS: mcp-record-context-tools-bridge.test.ts, engine.find throws uncoded for rc_revision; /mcp and stdio answer identical bytes, SERVICE_UNAVAILABLE 503, no rc_revision / outage text; control reads after mockRestore",
      "verifier pin (item 2)": "PASS: verify-citations.test.ts, uncoded child served-definition throw -> citation dropped, onError called once with {code SERVICE_UNAVAILABLE, status 503, cause: outage}, message names no child; coded OBJECT_NOT_FOUND 404 there -> dropped, onError not called; control verifies",
      "Clause-② line stated, Metadata-protocol: none": "PASS: 'Clause-②: no' + 'Metadata-protocol: none' line-initial in PR body and in .changeset/37463-record-context-outage.md (patch, @objectstack/service-record-context); L2 contract review owed per claim",
      "ablation on the classifier": "PASS: see tests"
     },
     "files_changed": [
      ".changeset/37463-record-context-outage.md",
      "packages/services/service-record-context/src/record-context-tools.ts",
      "packages/services/service-record-context/src/sentences.ts",
      "packages/services/service-record-context/src/verify-citations.ts",
      "packages/services/service-record-context/src/__tests__/record-context-tools.test.ts",
      "packages/services/service-record-context/src/__tests__/verify-citations.test.ts",
      "packages/runtime/src/mcp-record-context-tools-bridge.test.ts"
     ],
     "line_budget": "n/a: no skills/** or ledger file touched; diff 309 changed lines (+255/-54) across 7 files, under the 3000 human-merge threshold",
     "tests": "At head 32aba54598. `pnpm --filter @objectstack/service-record-context test && typecheck` (locked): Test Files 4 passed (4), Tests 162 passed (162); tsc clean; check:test-typecheck OK; VERDICT command-exit 0. `pnpm --filter @objectstack/runtime test` (whole suite, locked): Test Files 649 passed (649), Tests 12062 passed | 25 skipped; VERDICT command-exit 0. Ablation, classifier: scripts/ablation-replace.mjs replaced `if (err == null || typeof err !== 'object') return false;` in isCodedRefusal with `if (err !== 'ABLATION_37463') return true;` (every throw read as a refusal, which is the pre-change behaviour). Anchor went 1 to 0, blob 74d1834cb467 to 496f2990cf29. Rebuilt; ablation-dist-preflight found the marker in dist/index.js and dist/index.cjs (exit 0). Results: service suites 16 failed / 122 passed: all 9 new outage cases, the new verifier pin, and 6 existing verifier failure cases. Runtime harness 1 failed / 24 passed, the new outage case. Restore leg: blob back to 74d1834cb467, equal to HEAD; git diff HEAD empty; tree clean; rebuilt; preflight --absent exit 0; 138/138 and 25/25 pass. cause safety probe: mapDataError (packages/types, the classifier both MCP doors answer with) on the thrown 503 answers {status 503, code SERVICE_UNAVAILABLE, error 'Internal server error'} identically for cause = none, a plain Error, a SQLite unique violation, a Postgres 23505, SQLITE_BUSY, and a coded 403.",
     "gates": "Local: the 68 families from `dispatch-gates --commands --repo objectstack-ai/objectstack` at 32aba54598, each run with its exit code captured before any pipe. 67 exit 0. 1 NOT MEASURED: `pnpm check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET, because it reads every package's dist and only the runtime closure was built here. `--ran` reconciliation: 68 derived, 67 run, 1 NOT-MEASURED (derived from the recorded exit 3), 0 UNRUN. The overlap check before the push gave VERDICT clean (merges cleanly onto origin/main 276174ab0c). CI on PR head 32aba54598, all 53 check-runs completed: 37 success, 16 skipped, 0 failure. Required contexts: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Dogfood Regression Gate success, Live E2E UI success, Test UI success. Lint UI, Type Check UI and Build & E2E UI were skipped (no ui/ paths). Check Changeset success.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "readings": "Premise checked on origin/main 276174ab0. Sites 1–3 answered an uncoded throw with PERMISSION_DENIED 403 (record-context-tools.ts:419/427/448 on main). Site 4, the child list query, did NOT: it was not caught, so an uncoded throw left the executor raw. At the MCP doors mapDataError then answered 500 INTERNAL_ERROR, and the verifier already reported it through onError. The card's 'each comes out as 403' holds for three of the four sites. ADR-0160 grep found no sentence on failed or failing reads.",
     "deviations": [
      "File surface: verify-citations.ts (src) was edited, though the claim names only its test. This change made its docblock paragraph false ('arrives here as PERMISSION_DENIED 403 ... dropped without a report'), and it now imports the shared classifier in place of its private isRefusal and declaredStatusOf copy. That is the one-helper design the dispatch asked for. Same package, inside the fences.",
      "Child list query, coded refusal: rethrown as the door wrote it (the behaviour on main), not mapped to PERMISSION_DENIED 403. The dispatch says a coded refusal stays 'as today', and today that site never produced 403. The child has passed step 4a (it is served to the caller), so the naming bound holds.",
      "PR body footer: the AGENTS.md session-URL footer and the dispatch's signed trailer were used, and the harness's own attribution block was left out (AGENTS.md takes precedence).",
      "Background waits: one until-loop waiter (task ba25d0yiq) hit its background time limit and was killed; it watched a log that had already finished. The other waiters completed or were stopped. No dev server was started."
     ],
     "mcp_calls": "0",
     "api_writes": "2 — relay (fleet-write repository_dispatch, run 45822180814): pr_create POST /repos/objectstack-ai/objectstack/pulls + assignees os-bill (read back: 7360 bytes sent = stored); post-stamped comment on #37463 (POST /repos/objectstack-ai/objectstack/issues/37463/comments). git push x2 (not REST).",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": []
    }
  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim amendment · 2026-11-26T13:11Z · claim 7190841367 · records the surface PR #37550 needed (os-dev report 7192952275, deviation 1).

    • File surface, added: packages/services/service-record-context/src/verify-citations.ts (imports the shared isCodedRefusal classifier in place of its private copy, the one-helper design the dispatch asked for, and rewrites the docblock paragraph this change made false). Same package, inside the fences. Clause-②: no and Metadata-protocol: none stand; the L2 is owed.
  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim amendment · 2026-11-26T13:25Z · claim 7190841367 (amended 7192997436) · records the surface seat 5's REWORK 7193191377 (S2) needs on PR #37550.

    • File surface, added: packages/services/service-record-context/package.json (one workspace dependency, "@objectstack/types": "workspace:*") and its importer stanza in pnpm-lock.yaml. Why: S2 keeps main's refusals at the child list query (a sandboxed beforeFind plain throw stays 400 HOOK_ABORTED; a code-only PERMISSION_DENIED stays 403), and the executor asks the /data door's own classifier (mapDataError, @objectstack/types) rather than copying it, so there is one reader. @objectstack/core already depends on @objectstack/types: no new package in the closure. Still ⛔ packages/spec/**. Clause-②: no and Metadata-protocol: none stand; the L2 is owed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpm:dispatchedpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions