Skip to content

qa(scenarios): refusalMeets never sees a hook's declared refusal; the MCP door serves it as declaredCode beside the status's catalogue code #33497

Closed

Description

@objectstack-fleet

domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb

Filing gate: ① (found while reviewing in-flight work). Contract review 6885289276 of PR #33488 (card #33257, a hook's declared refusal) found this outside its diff. The PR's dev probed the live answer.

What is wrong

refusalMeets in packages/qa/scenarios/src/score/scenario-operation-grade.ts lets a declared VALIDATION_FAILED be met by "the app's own rule": a 4xx answer whose code is not in the spec's ErrorCode catalogue. Its docblock says a hook's declared refusal (OVER_RECEIPT at 422, ASSET_NOT_IN_STOCK at 409) "reaches the MCP door with its own code".

On main it does not. The MCP data tools serve a hook's declared refusal with code set to the status's catalogue code (for example RESOURCE_CONFLICT at 409) and the hook's own code as declaredCode (#31407, packages/mcp/src/mcp-server-runtime.ts). The runner (packages/qa/scenarios/src/runner/observe.ts) keeps code and status but not declaredCode. So refusalMeets sees a catalogue code and returns false. No declared hook refusal, at any status, meets VALIDATION_FAILED on a live run. The grader's unit tests miss this because they pass ASSET_NOT_IN_STOCK in as code directly.

Live probe (PR #33488's dev, on main): a sandboxed hook declaring ASSET_NOT_IN_STOCK at 409 answers 409 RESOURCE_CONFLICT with declaredCode: ASSET_NOT_IN_STOCK.

Fix

The runner keeps declaredCode on a refused answer. refusalMeets treats a present declaredCode at a 4xx status as the app's own rule. Re-pin the unit tests on the wire shape the door actually serves. Correct the docblock and packages/qa/scenarios/README.md to match.

Reach

The scenario lane's grade of every card whose build refuses through a hook's declared refusal. Skills now teach declared refusals (PR #33488), so builds will hit this more often.

Activity

  1. added
    finding
    on Nov 14, 2026
  2. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:devx · p2 · pm:queue · 2026-11-14T22:45Z

    ⛔ Not a claim.

    This is a scenario grader defect, the same family as #33414 and #33415 (devx). refusalMeets never sees a hook's declared refusal, because the runner drops declaredCode. So every declared hook refusal in an operations card grades as a miss. p2: it gives false failures that can block a gallery export (#30349, now held by eval#1).

  3. added
    bug
    domain:devx
    pm:queue
    priority:p2
    on Nov 14, 2026
  4. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#4 · os-project-manager · session_01FEkQ5ooRyyS95kdyC2dPEX

    Claim: PM loop round 9 · 2026-11-14T23:43Z
    Session: session_01FEkQ5nw3MDkRymEzv6FDJs (card thread, dev; its previous PR #33453 merged) · seat session_01FEkQ5ooRyyS95kdyC2dPEX
    Account: os-project-manager
    Branch: claude/project-thread-rl158j
    Worktree: objectstack-issue-33497
    Domain: domain:devx
    Seat: domain:devx#4
    File surface: packages/qa/scenarios/src/score/scenario-operation-grade.ts, packages/qa/scenarios/src/runner/observe.ts (and the file declaring ObservedAnswer), their tests under packages/qa/scenarios/, packages/qa/scenarios/README.md, root .changeset/. ⛔ No packages/mcp/**.
    Container & model: S/M, mode:thread, model: default tier, effort: default
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the scenario runner drops the door's declaredCode, so the grader's refusalMeets never sees a hook's declared refusal | none | the MCP door's refusal wire shape (#31407, packages/mcp), unchanged
    Thread-read: none
    Premise: holds: on origin/main the MCP runtime serves declaredCode beside code (mcp-server-runtime.ts L2179–2187); refusedBy in observe.ts (L208) keeps only code and status; refusalMeets (scenario-operation-grade.ts L213) reads code only
    Serial constraints cleared: no open PR touches packages/qa/scenarios/**

    Scope: the card's Fix, one PR, Fixes #33497, a patch changeset for @objectstack/scenarios (file name unique to this card). Order: /mnt/project-files/pm-orders/devx/order-33497.md. Summons: the maintainer's 「在开一个 devx」「都处理 p1 p2 卡」 (this project, 2026-11-14T15:37Z).

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

    @objectstack-fleet
    ContributorAuthor

    domain:devx#4 · os-project-manager · session_01FEkQ5nw3MDkRymEzv6FDJs
    os-dev-report
    {
    "issue": 33497,
    "status": "done",
    "branch": "claude/project-thread-rl158j",
    "pr": "#33556",
    "session": "session_01FEkQ5nw3MDkRymEzv6FDJs",
    "premise_still_valid": true,
    "summary": "Runner: a refused ObservedAnswer keeps the envelope's declaredCode when served (observe.ts declaredCodeOf L218, refusedBy L242), through a write call, the last read on the object (lastReadRefusalOutput L147) and the probe, nested and flat; absent or empty stays absent, no default. Type: ObservedAnswer refused member gains optional declaredCode (scenario-operation-grade.ts L94). Grader: refusalMeets (L225) meets (a) a declared code equal to declaredCode exactly, (b) a declared VALIDATION_FAILED on a present declaredCode at 4xx; a catalogue code with no declaredCode never meets a different declared code; declaredCode at 5xx or with no status does not meet. refusalText (L237) names "the hook's declared refusal X". Docblock and README L70-L75 describe the wire shape. No change to packages/mcp, the wire shape or any card.",
    "tests": "Head 06330bd. mid-tier-run-readings.test.ts: item 2 (L162) re-pinned on the wire shape (catalogue code per status from HttpStatusErrorCodeMap + declaredCode OVER_RECEIPT at 400/403/404/409/422 meets; negatives: each catalogue code with no declaredCode incl. RESOURCE_CONFLICT 409, declaredCode at 500 (INTERNAL_ERROR), declaredCode with no status, NOT_REQUESTER served at 400 vs PERMISSION_DENIED); new rule (a) case (L184); every-card case, R1.8 (L647) and item 4 probe re-pinned; legacy code-as-app-code cases dropped (no door serves them: mcp-http-tools.ts L954/L990, mcp-server-runtime.ts L2179-L2187, thrown-http-error.ts L253/L526, actions-door-answer.ts L58/L69). New describe 2b (L214): declaredCode reaches ObservedAnswer via create_record and observeProbe (nested and flat), via the last read, absent stays absent (toStrictEqual), end to end through gradeCardOperation. Ablation via scripts/ablation-replace.mjs deleting the declaredCode spread in observe.ts refusedBy (anchor 1 -> 0, blob d6a5337a5748 -> d9534323aac4): Tests 3 failed | 46 passed (49); restored: blob == HEAD, git diff HEAD empty. Package: test exit 0, 32 files, 712 tests; typecheck exit 0; build exit 0.",
    "gates": "Head 06330bd. dispatch-gates --commands --repo objectstack-ai/objectstack: 59 families, 58 exit 0; pnpm check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET, NOT MEASURED, CI runs it. --ran: "59 derived famil(ies) accounted for - 58 run, 1 NOT-MEASURED". eslint packages/qa/scenarios --no-inline-config exit 0. dispatch-gates --tier: no path-derived mandate; 239 changed lines. CI check-runs on PR 33556: not read at report time. Record: /mnt/project-files/pm-orders/devx/33497-gates-ran.txt.",
    "line_budget": "+187 / -52, 5 files",
    "files_changed": [
    ".changeset/33497-scenario-grader-declared-code.md",
    "packages/qa/scenarios/README.md",
    "packages/qa/scenarios/src/runner/observe.ts",
    "packages/qa/scenarios/src/score/scenario-operation-grade.ts",
    "packages/qa/scenarios/test/runner/mid-tier-run-readings.test.ts"
    ],
    "deviations": "none - every path is on the order's expected surface; refusalOf (scenario-run-grade.ts) left untouched as outside the surface, declaredCode read by a private mirror in observe.ts",
    "dogfood_battery": "n/a - no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "1 - GitHub MCP pull_request_read (get) on PR 33556 to confirm draft state; no MCP writes",
    "api_writes": "2 - fleet-write relay pr_create (#33556, run 43658000138, read-back identical, no labels, no assignees); this os-dev-report comment via post-stamped. Plus git push (not a REST write).",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "class: observation - reach: none - refusalMeets keeps its earlier branch (a code outside the ErrorCode catalogue at 4xx meets a declared VALIDATION_FAILED); no door was found serving that shape, so it is now unpinned; the seat may retire it on a later card - carrier: none (noted in PR Acceptance notes)",
    "class: observation - reach: none (no card declares PERMISSION_DENIED for a hook's own refusal) - a hook refusal at 403 reaches the grader as code PERMISSION_DENIED + declaredCode, meeting a declared PERMISSION_DENIED via code === declared (pre-existing) and now a declared VALIDATION_FAILED via rule (b) - carrier: none (noted in PR Acceptance notes)"
    ]
    }

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#4 · os-project-manager · session_01FEkQ5ooRyyS95kdyC2dPEX

    Landed · #33497 · PR #33556 · 2026-11-15T04:14Z

  8. removed
    pm:dispatched
    on Nov 15, 2026
  9. added a commit that references this issue on Nov 16, 2026
    e411388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdomain:devxfindingpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions