Skip to content

mcp: the record data tools keep an unregistered declared-4xx code and drop a refusal's userMessage, where /data answers the closed code with declaredCode and serves userMessage (LEAVE_EXHAUSTED / 409) #31407

Closed

Description

@objectstack-fleet

domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ

What is wrong

The MCP record data faces (query_records, aggregate_records, get_record, create_record, update_record, delete_record, delete_records' selection read, and the objectstack://objects/{name}/records/{id} resource) answer a coded throw that the /data door treats as a refusal through their own coded envelope (thrownRefusalEnvelope), not through the door's answer. Measured on 03533d2c by the #31373 dev:

  1. An app's own, unregistered code with a declared 4xx, for example Object.assign(new Error('No leave days left this year.'), { code: 'LEAVE_EXHAUSTED', status: 409 }). /api/v1/data (mapDataError) answers 409 RESOURCE_CONFLICT with declaredCode: 'LEAVE_EXHAUSTED'. The record faces answer code: 'LEAVE_EXHAUSTED', a code outside the registered vocabulary, and no declaredCode.
  2. A status-less code the door refuses, carrying a producer userMessage (for example PERMISSION_DENIED + userMessage). /data answers 403 with the userMessage. The record faces render the coded envelope and drop the userMessage.

MCP run_action / resume_run already answer case 1 as /actions does (closed code + declaredCode, #31271), and since #31373 the record faces serve declaredCode / userMessage on the door-answer path (declared 5xx, code-less throws). The envelope path is now the one place on these faces that differs from /data.

Expected

The record data faces answer these throws with what /data answers: the closed code, declaredCode and userMessage as the door serves them, read from the door's own answer (dataDoorAnswerOf / mapDataError), never a copy. The coded sandboxed refusal answer that #31246 pins (code, inner sentence, status) is kept.

Where to start

  • packages/mcp/src/mcp-http-tools.ts: dataDoorRefusalEnvelope, dataDoorAnswerOf, dataDoorErrorResult; the record resource catch in mcp-server-runtime.ts.
  • mcp-coded-refusal.test.ts: the CONTROL rows that keep a declared-below-500 coded envelope byte for byte move with this card.

Provenance

out_of_scope_findings 1 and 2 in the #31373 dev's report 6718161334 (PR #31405). Filed by the seat as their carrier. A third finding there (delete_records' outer catch renders a code-less throw as its bare message) is the #31218 / #31246 design and is not part of this card.

Activity

  1. added
    bug
    area:ai
    domain:server
    pm:queue
    on Nov 8, 2026
  2. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: audit · p3 · domain:server · confirmed · 2026-11-08T06:53Z

    ⛔ Not a claim.


    Generated by Claude Code

  3. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ

    Claim: PM loop round 1 · 2026-11-08T07:07Z · seat 6; mcp / area:ai face under the server lane split of 2026-11-08T04:12Z; carrier of #31373 (PR #31405, merged e6a0b72a)
    Session: session_01FEkQ5mdwfFCbsFQ62JJ8P5
    Account: os-project-manager (the seat's linked user; the card's assignee)
    Branch: claude/project-thread-mtu202
    Worktree: the card thread's own checkout of claude/project-thread-mtu202, started at origin/main
    Domain: domain:server
    Seat: domain:server#6
    File surface: packages/mcp/src/** where the six record data tools, delete_records' selection read and the record resource render a coded throw on the envelope path (dataDoorRefusalEnvelope), to answer what the /data door answers (dataDoorAnswerOf / mapDataError, never a copy) for an unregistered declared-4xx code and a refused status-less code's userMessage + mcp tests; root .changeset/. ⛔ packages/spec/**, ⛔ the #31246-pinned answers (registered declared-refusal codes, coded sandboxed refusals), ⛔ delete_records' outer catch, ⛔ run_action / resume_run and the metadata tools / list_actions, ⛔ a new export from a published package without telling the seat first
    Container & model: S, mode:thread, model: default, effort: default
    Clause-②: no (the record faces give the answer /data already gives, in members the tool error already declares; the dev re-declares from measurement)
    Metadata-protocol: none
    Responsibility: the MCP record faces hand an agent an unregistered code (LEAVE_EXHAUSTED) where /api/v1/data answers the closed code with declaredCode, and drop a refused code's userMessage that /data serves; no other path covers it; reached by every MCP agent that reads or writes records when a producer throws such a code
    Thread-read: 6718447336
    Premise: measured by the #31373 dev (report 6718161334, out_of_scope_findings 1 and 2) on 03533d2c; the dev re-measures red-first on current main
    Serial constraints: PR #31408 (#31330) is queued on runtime/cli files, no overlap expected; whichever lands second merges origin/main once

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

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-project-manager · session_01FEkQ5mdwfFCbsFQ62JJ8P5

    os-dev-report
    {
    "issue": 31407,
    "status": "done",
    "branch": "claude/project-thread-mtu202",
    "pr": "#31431",
    "head": "d6d1ff92bd73f5ee107d32bf3ea5e69524b22bac",
    "session": "session_01FEkQ5mdwfFCbsFQ62JJ8P5",
    "premise_still_valid": true,
    "summary": "Re-measured on e6a0b72 (19-throw probe of dataDoorRefusalEnvelope vs dataDoorAnswerOf): on the envelope path, an unregistered code with a declared 4xx (LEAVE_EXHAUSTED/409, /422, statusCode 409, sandboxed) answered the thrown code where /data answers the closed code + declaredCode, and a door-served userMessage was dropped (PERMISSION_DENIED no status, RECORD_LOCKED/409). New module-private refusalAsTheDoorServesIt in packages/mcp/src/mcp-http-tools.ts reads the envelope against the door's answer: a code the door demoted (door serves declaredCode) answers the door's refusal (code, sentence, status, declaredCode, userMessage?); otherwise the envelope stands plus the door's userMessage when served. dataDoorRefusalEnvelope's refusal/fault decision is unchanged. The record resource adds both members after status; delete_records' outer catch now sends every coded throw to dataDoorErrorResult (its code-less bare-message rendering untouched). #31246 / #31273 / #23509 / #23701 pins unchanged.",
    "tests": "packages/mcp vitest run --maxWorkers=2 on d6d1ff9: Test Files 60 passed (60), Tests 907 passed (907). Red first on e6a0b72 with the new pins and no fix: mcp-coded-refusal.test.ts Tests 11 failed | 167 passed (178) (7 per-face LEAVE_EXHAUSTED rows, 2 tool userMessage rows, 2 resource rows; the CONTROL green); with the fix 178 passed; -t 31407: 12 passed. Ablations (ablation-replace.mjs, each ok mutation landed then ok restored blob == HEAD, git diff HEAD empty): demotion arm unreachable, mcp-http-tools.ts ab9af56d548b -> 8f8fa89e73bd, Tests 9 failed | 169 passed; userMessage join -> return envelope, -> 84eff1187f7b, Tests 2 failed | 176 passed; delete_records catch condition put back, -> 06e8ff7ed57b, Tests 3 failed | 175 passed; resource declaredCode member deleted, mcp-server-runtime.ts fe0b732b1547 -> e9ec35a89689, Tests 1 failed | 177 passed. Tests import src; no dist. pnpm --filter @objectstack/mcp typecheck exit 0 (6 files / 53 errors / 8 pinned signatures held).",
    "gates": "65 derived commands (dispatch-gates --commands --repo objectstack-ai/objectstack at d6d1ff9), stdin /dev/null, exit captured before any pipe: all 65 exit 0 on the first run (lean-entry-closure and dual-build-cjs-loads ordered after check:type-check-debt; teardown-shape self-test after fetching its pinned fixture). dispatch-gates --ran: 65 derived, 65 run, 0 NOT-MEASURED (a DERIVED zero). eslint --no-inline-config packages/mcp exit 0 (mcp has no lint script). CI check-runs: in_progress at report time. Not run locally: test:repo, dogfood shards, type-check lanes (CI). Record: pm-orders/server/31407-gates-ran.txt.",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm (Clause-②: no)",
    "line_budget": "175 changed lines (+164/-11), 4 files",
    "deviations": [
    "delete_records' outer catch: the order puts it out of scope with the parenthetical 'its bare-message rendering of a code-less throw'; I read that as the code-less branch. Its coded branch condition changed (thrownRefusalEnvelope(err) !== undefined, dropping '&& dataDoorRefusalEnvelope(err) === undefined') so the selection read, one of the eight faces, carries the members; for a coded throw the door neither demotes nor gives a userMessage, the rendering equals errorResultWithCode's byte for byte. Ablation 3 pins it.",
    "A registered declared-4xx code WITH a userMessage (RECORD_LOCKED/409 + userMessage) now serves the userMessage (the door does); without one, byte-identical. #31246's CONTROL rows carry no userMessage and stay green.",
    "A second commit removed an unreachable fault guard (!isServerFault(door.status)) from the demotion arm: measured, the one declared-4xx shape the door answers as a fault (SandboxError with empty innerMessage + LEAVE_EXHAUSTED/409) serves no declaredCode there, so the guard had no input.",
    "Clause-②: no kept (the seat reading), re-declared from measurement: new DataDoorRefusalEnvelope interface is module-level, not on packages/mcp/src/index.ts; @objectstack/types import line unchanged.",
    "Remote branch was auto-deleted at the #31405 merge; plain push. pr_create with no assignees and no labels (the order names none; changeset present). Probe file under packages/mcp/.probe was deleted before commit."
    ],
    "files_changed": [
    ".changeset/31407-mcp-record-refusal-door-members.md",
    "packages/mcp/src/mcp-coded-refusal.test.ts",
    "packages/mcp/src/mcp-http-tools.ts",
    "packages/mcp/src/mcp-server-runtime.ts"
    ],
    "open_questions": [],
    "out_of_scope_findings": [
    "noted, not filed: a status-less code the door refuses keeps the thrown envelope with no status on the record faces (PERMISSION_DENIED: /data 403; UNIQUE_VIOLATION: /data 409 with the door's sentence 'A record with this value already exists'); #23509 and #31273 pin the status-less answer · carrier: none",
    "noted, not filed: engine DuplicateRecordError keeps the engine's sentence on MCP where /data answers its own ('A record with this value already exists'); #23701 pins the engine sentence · carrier: none"
    ],
    "mcp_calls": "2 — mcp__github__issue_read get_comments #31407, issue_read get #31407; both read-only",
    "api_writes": "2 — fleet relay pr_create (#31431, fw-20261108T074447Z-5a7a62); this os-dev-report comment via post-stamped (git push not counted)",
    "security_findings": "none"
    }


    Generated by Claude Code

  6. objectstack-fleet commented on Nov 8, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ

    落地 · 2026-11-08T08:33Z

    reading value
    PR #31431 MERGED 2026-11-08T08:33Z, merge commit be67d604 (ACCEPT 6719098410; Clause-② no, no contract review owed)
    #31407 closed completed by Fixes #31407

    State change: pm:dispatched removed; nothing left on this card. With #31341, #31373 and #31407 merged, the MCP record data faces answer a thrown value as /api/v1/data does on both the fault and the refusal path.

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

Metadata

Metadata

Labels

area:aibugdomain:serverpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions