Skip to content

fix(approvals)!: rejecting through the approval_reject action requires a reason - #35716

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-a4W-35659
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-a4W-35659

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35659
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — the published skills never teach the approval_reject action or its comment param, and nothing a metadata author writes changes

维护者速读

  • 用户能看到什么变化:审批人通过「驳回」动作驳回时必须填写理由;不填或只填空格,动作接口、AI 助手和界面对话框(含收件箱与审批列表里的「驳回」按钮)都会拒绝提交,填了理由的驳回照旧生效;审批接口本身、SDK 方法与邮件里的驳回链接另有两张后续卡处理。
  • 为什么做:落实维护者在记录页头部那张卡里的要求(驳回必须带理由),这次在服务端声明处强制,而不只是前端对话框。
  • 出错会怎样:不带理由调用驳回的外部脚本或智能体会收到 400 校验错误,审批单保持待审;可直接撤回本改动恢复为可选。
  • 要你做什么:无。

Migration

Callers of approval_reject must send params.comment (a non-blank reason); there are no production customers and no stored data to migrate.

What changes

  • packages/plugins/plugin-approvals/src/sys-approval-request.object.ts: approval_reject declares its comment param required: true (was required: false), and its AI tool description says the reason is required. No new code path: the declared param contract (ADR-0104 D2, validateActionParams) already judges every action door before the target route runs, and already counts an empty or whitespace-only string as missing (isActionParamValuePresent).
  • REST POST /api/v1/actions/sys_approval_request/approval_reject and MCP run_action refuse a missing or blank reason with the existing param-contract refusal: 400, code VALIDATION_ERROR, message naming comment. The refusal is raised before the AI confirmation gate and before the approvals route, so the request stays pending and nothing is recorded. The console's param dialog already holds Confirm on a required param that is empty or whitespace-only (its translated actionDialog.requiredError).
  • POST /api/v1/approvals/requests/:id/reject (the approvals route itself, client.approvals.reject) is unchanged and still accepts a reject with no reason, so the guarantee is scoped to the action: a reject through approval_reject always carries its reason. The route, SDK method and service decide leg is approvals: the approvals route POST /approvals/requests/:id/reject and client.approvals.reject still record a reject with no reason (follow-up of #35659, which narrows only the approval_reject action) #35719.
  • content/docs/automation/approvals.mdx: one sentence saying a reject through approval_reject carries its reason, and naming the three doors that refuse one without it.
  • docs/qa/platform-checklist/areas/approvals.json: two lines. The record-page Reject dialog step takes main's text (feat(record): one header row and one button group on the record page (#35593, #35419) #35679's one header row), except its parenthetical: main said the declaration keeps the comment optional, so it now says approval_reject's declaration requires the reason too, and a missing or blank one is also refused at the REST action door and over MCP. The declared-actions source line gives approve an optional comment and approval_reject a required comment, refused when missing or blank at the REST action door, MCP and the console. The item's revision history is untouched.
  • .changeset/35659-approval-reject-requires-reason.md: patch with the BREAKING banner (non-protocol narrowing, AGENTS.md Post-Task step 3) and its ADR-0087 disposition.

Step 0, measured at origin/main 238661f (the branch base) and unchanged through 5d2ce34 for the files read: comment was required: false; enforceActionParams (packages/runtime/src/action-execution.ts) is called once, in the shared action dispatch (packages/runtime/src/action-dispatch.ts) that serves both the REST door and the ai posture MCP run_action uses; validateActionParams treats undefined, null, '' and whitespace-only strings as missing. The REST/MCP refusal sentence is English-only (the param contract's existing wording); no new sentence is added, so no translation is owed. No doc, skill or test text in this repo's own surface said the reject reason is optional beyond the AI description fixed here (see Acceptance notes for one checklist line outside the surface).

Tests

  • packages/plugins/plugin-approvals/src/sys-approval-request.object.test.ts: the spec validator over approval_reject's declaration refuses {}, '', whitespace-only and null with one required issue on comment; CONTROL: a reason passes (with and without attachments); CONTROL: approval_approve keeps its comment optional.
  • packages/qa/dogfood/test/approval-decide-over-mcp.dogfood.test.ts (the existing harness that boots the real security, flow, approvals and MCP plugins): the approver's reject with no reason, '' or whitespace-only answers 400 VALIDATION_ERROR naming comment at the REST action door and over MCP run_action, and the request stays pending with no decision; CONTROL: a REST reject with a reason answers 200, the request is rejected, and the decision row carries the comment.
  • No existing test or fixture rejected without a reason (approval-act-doors-read-visibility already sends { comment: 'no' }).
Readings at 400c82e, 5023ae8 and f350577

All at head 400c82eed3 (the merge of origin/main 74d3d83 plus the two commits on it), under scripts/pm/os-verify-lock.sh:

  • Dogfood closure build: pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build · VERDICT command-exit 0.
  • pnpm --filter @objectstack/plugin-approvals test · VERDICT command-exit 0 · Test Files 124 passed (124) · Tests 1773 passed (1773).
  • pnpm --filter @objectstack/plugin-approvals typecheck · VERDICT command-exit 0 (tsc, scripts tsconfig, check:test-typecheck OK).
  • pnpm --filter @objectstack/dogfood typecheck · VERDICT command-exit 0 (its tsconfig includes test/**/*; the edited file is in --listFilesOnly).
  • vitest run test/approval-decide-over-mcp.dogfood.test.ts · VERDICT command-exit 0 · Tests 7 passed (7).
  • Dogfood battery (the (narrowing) arm), pnpm --filter @objectstack/dogfood test, no shard, no path · VERDICT command-exit 0 · Test Files 482 passed, 3 skipped (485) · Tests 4094 passed, 68 skipped (4162).
  • Reverse verification, one-off (committed fix first; scripts/ablation-replace.mjs, anchor hit x1 then x0, blob 2693614c6a3a to 2cff7aca34ed; @objectstack/plugin-approvals resolves to source in both suites, so no dist leg): with comment back to required: false, the dogfood pin went red (REST {} answered 200 and the request was rejected) and the unit pin went red ({}: expected [] to deeply equal [['comment','required']]); restore: blob == HEAD 2693614c6a3a, git diff HEAD empty.
  • node scripts/pm/dispatch-gates.mjs --commands: 98 commands; 97 exit 0, pnpm check:dual-build-cjs-loads exit 3 (PREREQUISITE NOT MET: unbuilt studio, client-react, scenarios and other packages outside this diff), NOT MEASURED locally, CI runs it. check:skill-examples first exited 3 on an unbuilt client SDK; after building @objectstack/client and @objectstack/client-react it exited 0. --ran reconciliation: 98 derived, 97 run, 1 NOT-MEASURED, 0 UNRUN.
  • node scripts/pm/overlap-check.mjs --branch=claude/area-a4W-35659: VERDICT clean exit 0 (merges cleanly into origin/main 74d3d83).
  • Head 5023ae8d (checklist-only commit on top of 400c82e): dispatch-gates --commands docs/qa/platform-checklist/areas/approvals.json derived 17 commands, all exit 0, including pnpm check:platform-checklist (OK, 16 areas, 433 items) and pnpm check:nul-bytes; check:doc-formula-expressions first exited 3 (lint/formula unbuilt), then 0 after building the lint closure. The full derivation for the branch adds only pnpm check:platform-checklist over the 98 run at 400c82e. Code is unchanged since 400c82e.
  • Head f3505776 (d1f69fb's scoped wording, then the merge of origin/main 5d2ce34): dispatch-gates --commands derived 99 commands. 98 exit 0, among them check:platform-checklist and check:nul-bytes. check:type-check-debt re-ran under the lock after timing out in the queue behind the battery: exit 0. check:skill-examples exit 0 after building the client SDK. check:dual-build-cjs-loads exit 3 (PREREQUISITE NOT MET), NOT MEASURED locally. --ran: 99 derived, 98 run, 1 NOT-MEASURED, 0 UNRUN.
  • Dogfood battery at f3505776 (the (narrowing) arm), pnpm --filter @objectstack/dogfood test, no shard, no path, under os-verify-lock after the closure build: VERDICT command-exit 0 · Test Files 482 passed, 3 skipped (485) · Tests 4094 passed, 68 skipped (4162).
  • CI on f3505776: CI run 44665722006 success, Lint & Type Check run 44665721964 success; check-runs 42 success, 17 skipped, 0 failed.

Verification

Two-minute check: pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2 test/approval-decide-over-mcp.dogfood.test.ts after building the dogfood closure; expect 7/7 green, including the reject-reason pin.

Read first, by risk: (1) the approval_reject params hunk in sys-approval-request.object.ts; (2) the new it at the end of approval-decide-over-mcp.dogfood.test.ts; (3) the changeset's BREAKING banner and ADR-0087 marker.

Acceptance notes

Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2

🤖 Generated with Claude Code

approval_reject declares its comment param required, so the declared
param contract (ADR-0104 D2) refuses a reject whose comment is missing
or blank at the REST action door, MCP run_action and the console's
param dialog. A reject with a reason runs as before.

Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com>
…T action door and over MCP

The approver's reject with no comment, an empty one or a whitespace-only
one answers 400 VALIDATION_ERROR naming comment at the REST action door
and at MCP run_action, and the request stays pending; CONTROL: a REST
reject with a reason rejects it and records the comment.

Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 5d2ce34f88a0d3440386b381bd678a25cd59f7a4 → packageMentionDocs.

The record-page Reject dialog item and the declared-actions source line
now say approval_reject's comment is required, refused when missing or
blank at REST, MCP and the console; approve's comment stays optional.

Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ

L1 verdict (L1-a): CHANGES at head 5023ae8dbaa58bcdc9b05f26d6df3a561e82e845 (review requested through the seat). Code is unchanged from 400c82ee, and the code review below covers both heads. The change itself is right and minimal. The one must-fix is how the PR describes its reach, because a public route still rejects without a reason.

Gates: 5023ae8d has no CI at all at 02:57Z: 0 check-runs and 0 workflow runs for the head SHA, about 30 min after the push. The push did not trigger CI, so this is not yet a green head. The previous head 400c82ee, with the same code, finished at 55 check-runs: 40 success, 15 skipped, 0 failed. Lint & Repo Gates and TypeScript Type Check both passed there. The next push (fix (a)) should trigger CI; confirm it does before announcing.

Must-fix:

  1. "A rejection always carries its reason" is not true at merge, and the gap is not recorded.
    • POST /api/v1/approvals/requests/:id/reject is the approvals route itself. It is a public SDK route (rest-route-ledger.ts ~475, disposition sdk, client.approvals.reject(id, { comment? })). It is unchanged and still records a reject with no comment. The body says so in one line (line 23) but gives no reason and no follow-up.
    • These texts state the guarantee without that limit:
      • the source comment on the param (sys-approval-request.object.ts ~701, "A rejection always carries its reason");
      • the docs sentence (approvals.mdx ~937, "A rejection carries its reason:");
      • the unit and dogfood test docblocks;
      • the two approvals.json checklist lines added in 5023ae8d, which say "refused … at REST, MCP and the console". "At REST" should read "at the REST action door", because the REST approvals route still accepts a reject with no reason.
    • Fix both parts, the way fix(i18n, mcp): a translation fault serves untranslated text; ?locale= reaches MCP labels and dataset sentences #35680 / review follow-ups of PR #35680: client-visible translation-fault warning slot, three unguarded i18n bundle builders, two test gaps #35707 did:
      • (a) Scope the wording to the action, for example "A reject through approval_reject always carries its reason". The docs sentence's second half already names the three doors, so only its lead needs the scope.
      • (b) File the follow-up card for the route and SDK leg (whether POST /approvals/requests/:id/reject, client.approvals.reject and the service decide should refuse a reasonless reject too). That is a further narrowing with its own contract read. Name #N in the Acceptance notes so the seat's CONTRACT_REVIEW_TIER read sees the cut.
    • Fixing (a) moves the head. If you would rather keep Fixes #35659 without (b), say why the route is out of the maintainer's requirement; the card's acceptance names only the action.

What I checked (holds):

  • No new code path. The only code change is required: false → true on approval_reject.params.comment, plus the AI description string.
    • validateActionParams (spec/src/ui/action-params.zod.ts ~131) counts undefined, null, '' and whitespace-only as missing.
    • enforceActionParams (runtime/src/action-execution.ts ~3774) runs it, and is called once in the shared action-dispatch.ts (~622) that both the REST action door and MCP run_action use.
  • Ordering. The MCP leg calls without the confirmation member and asserts 400 VALIDATION_ERROR. That pins the param refusal before the confirmation gate, as the body says.
  • Tests are real pins with controls.
    • Unit: {}, '', whitespace and null each give exactly [['comment','required']]. Controls: with a reason (with and without attachments) and approval_approve's comment staying optional.
    • Dogfood: three bad bags at REST and MCP, then expectUndecided, then a CONTROL reject with a reason that writes the decision row ['reject','Over budget.'].
    • The ablation in the body shows both going red on revert. The dogfood battery passed at 400c82ee (4094 tests). The landing needs it re-pinned to the final head.
  • Changeset. @objectstack/plugin-approvals: patch with a BREAKING paragraph and a caller fix. Clause-②: no (narrowing), Metadata-protocol: none and the ADR-0087 not-required (no-migration-prescription) marker fit a plugin-owned param declaration with no stored data. The ## Migration line is present.
  • Surface extensions. The dogfood file is the only harness that reaches both doors. The two approvals.json lines (5023ae8d, at the seat's request) correct the "optional Comment" text and keep approve's comment optional. Both are declared in the body, and I accept them.

Notes (non-blocking):

  1. The MCP leg never sends a call with no comment key: act() always sends params: { comment }, so {} goes out as ''. Missing-key is covered by the unit pin and the REST leg through the same dispatch, so this is low risk.
  2. The refusal sentence is the existing English param-contract message, as the order asked. Localizing it belongs to the param contract, not this card.

Next: fix (a) and record (b), push, and announce the final green head. I do a delta review; then the seat runs the CONTRACT_REVIEW_TIER read and a4-W lands it.


Generated by Claude Code

The source comment, the approvals guide, the unit and dogfood test
docblocks, the changeset and the two checklist lines now say a reject
through approval_reject always carries its reason, and name the REST
action door rather than REST: the approvals route itself still accepts
a reject with no reason.

Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com>
Resolves the approvals checklist conflict with the record page's one
header row change: line 1021 takes main's text, with its parenthetical
now saying approval_reject's declaration requires the reason too, so a
missing or blank one is also refused at the REST action door and over
MCP. The declared-actions line keeps this branch's scoped wording.

Claude-Session: https://claude.ai/code/session_016WV4czKnDE6hsyXQzB9wB2
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4cxk4f4T7at3YeFruhZ

L1 verdict (L1-a): ACCEPT (delta) at head f350577622b2227b8aee2684a5395fc827ca6ed1. This resolves CHANGES 7028928770.

Delta 5023ae8d..f3505776:

Gates on this head: 59 check-runs: 42 success, 17 skipped, 0 failed, 0 pending. Lint & Repo Gates, TypeScript Type Check and Check Changeset all passed. Mergeable: clean. The dogfood battery is re-pinned at f3505776 (4094 passed, os-dev report 7030048961).

The code review in 7028928770 is unchanged, since the code has not moved since 400c82ee. This is a Clause-②: no (narrowing) change: the seat runs the CONTRACT_REVIEW_TIER read, then a4-W lands it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f350577622b2227b8aee2684a5395fc827ca6ed1
Local-runs: none
Scope: packages/plugins/plugin-approvals/src/sys-approval-request.object.ts (+ its test), packages/qa/dogfood/test/approval-decide-over-mcp.dogfood.test.ts, content/docs/automation/approvals.mdx, docs/qa/platform-checklist/areas/approvals.json, .changeset/35659-approval-reject-requires-reason.md
Security-touching: no

Read: card #35659 (body and its comments), #35593 (body, item 6 and its acceptance line), #35719 (body), PR #35716 (title, body, the net diff of its 6 files against main, +94/-5), L1 records 7028928770 and 7030081619, os-dev report 7030048961, the check-runs on this head, AGENTS.md Post-Task step 3, and on main: packages/spec/src/ui/action-params.zod.ts, ui/packages/app-shell/src/layout/InboxApprovalItem.tsx, ui/packages/app-shell/src/views/ActionParamDialog.tsx, the auto-reject paths of approval-service.ts.

① Derived judgments

  • What is newly refused is exactly a reasonless reject through approval_reject. The only behaviour change is required: false → true on that action's comment param. isActionParamValuePresent counts undefined, null, '' and a whitespace-only string as missing, so those four are the refused set; a reject with a reason, with or without attachments, runs as before. A reject carrying attachments but no comment is refused too, which is the requirement (a reason, not a file). approval_approve and the other seven declared actions are untouched; the unit pin holds approve's comment optional.
  • System rejections are unaffected. The revision-limit auto-reject (approval-service.ts, writes its own Auto-rejected: revision limit (N) exceeded comment) and the SLA auto_reject escalation run inside the service and never pass the action dispatch. The approvals route POST /api/v1/approvals/requests/:id/reject and client.approvals.reject are unchanged, as the body, the changeset and the source comment each say.
  • Refusal shape is the existing one and the same at both server doors. REST action door and MCP run_action share one dispatch, so both answer 400, VALIDATION_ERROR, message naming comment; the dogfood pin asserts all three at both doors and that the request stays undecided. The console holds Confirm with the translated actionDialog.requiredError. No new sentence, no new code.
  • Other callers in the repo. No source outside plugin-approvals runs approval_reject without a reason: approval-act-doors-read-visibility already sends { comment: 'no' }; HotCRM names the action only to forbid it in a skill.
  • Docs and checklist are true at this head. approvals.mdx scopes its sentence to approval_reject and names the three doors. Both edited approvals.json lines say "at the REST action door"; the approve step's "optional Comment" stays true. No other text under content/docs/automation, content/docs/ai, skills/ or the checklist says a reject's comment is optional.
  • Check-runs on the head: 59, all completed: 42 success, 17 skipped, none failed or pending. Mergeable state clean; the PR is draft.

② Semver level

@objectstack/plugin-approvals at patch with the BREAKING banner: accepted. AGENTS.md Post-Task step 3 sets the level by the Metadata-protocol kind alone, and "a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition". Metadata-protocol: none is right: the kind measures what a metadata author can write, and no author writes this declaration (it is the plugin's own object metadata; no spec key, accepted value or requirement on authored metadata moves). That is the difference from the #33121 ruling, where the platform began refusing something an author could write, hence narrowed and minor. Here what is refused is a runtime request to one action, so Clause-②: no (narrowing) is the arm that carries it. The changeset has both declaration lines, one ADR-0087 marker (not-required (no-migration-prescription), fitting: no stored row or authored value to rewrite), and the caller's one-line fix. The PR body has ## Migration.

③ Boundary flags

④ Findings

Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot changed the title fix(approvals)!: rejecting an approval requires a reason at every door fix(approvals)!: rejecting through the approval_reject action requires a reason Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4czKnDE6hsyXQzB9wB2

Landing (area a4-W) · 2026-11-20T04:13Z

Probe Reading
L1 verdict ACCEPT 7030081619 (L1-a, delta) at head f3505776
Contract review PASS 7030124251 (CONTRACT_REVIEW_TIER) at head f3505776; S1 retitled to the changeset's line, S2 and N1 fixed in the body (text only, head unmoved); N2/N3 are wording/coverage notes, not blocking
Dogfood battery pinned to f3505776 (os-dev report 7030048961)
Checks at head f3505776 63 check-runs: 44 success, 19 skipped, 0 failed, 0 pending
Governed surface check-governed-merges.mjs --pr 35716: NOT governed; 99 changed lines ≤ 3000

State change: ready for review + auto-merge on the maintainer's area line 「本区通过复审的 PR 都可以 ready + auto-merge」 (a4-W thread, 2026-11-19T21:59Z). On MERGED: #35659 closes via Fixes; #35719 (route, SDK, service decide) and #35722 (email link) stay open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

审批「驳回」不填理由也能提交:approval_reject 的 comment 声明为可选,API 与 MCP 也一样(承 #35593 第 6 条)

2 participants