Skip to content

skills(automation): the approvals reference says a reject carries its reason - #35842

Merged
os-zhuang merged 1 commit into
mainfrom
claude/area-a4A-35817
Nov 20, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/area-a4A-35817

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35817
Part of #35772
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:照着自动化技能写审批调用的 AI 助手,以前会写出不带理由的驳回,现在会带上驳回理由;产品行为本身没有变。
  • 为什么做:属于「驳回必须写理由」这条审批规则的文字收尾,替按技能文档写代码的作者和助手解决「照文档写却被系统拒绝」的问题。
  • 出错会怎样:只改了一段说明文字,最坏情况是这句话讲得不准;撤回这一个合并即可恢复原文。
  • 要你做什么:这是对外发布的技能文字,请在契约审核记录给出后确认可以合并。

What changes

skills/objectstack-automation/references/state-machines-and-approvals.md, section "Recording a decision", one hunk (the card's hunk, byte-identical to the wording contract-reviewed at 6d93210a: the resulting blob is 3277c7f9b2, the same blob id the card's diff header names).

  • The first paragraph now says a reject recorded through ApprovalService.decide() or POST /api/v1/approvals/requests/:id/reject always carries a non-blank comment, its reason, else 400 VALIDATION_ERROR.
  • Paid in place: the structured-outputs paragraph drops its restatement of how the previous approver picks the next step's approvers and points at "Dynamic approvers ② below", where that is already taught.
  • .changeset/35817-skill-reject-reason.md: '@objectstack/skills': patch.

The wording was re-verified against origin/main at bb1c55d138 before writing:

  • packages/plugins/plugin-approvals/src/approval-service.ts, decide(): for decision === 'reject' it validates comment as a required textarea param and throws { status: 400, code: 'VALIDATION_ERROR' } before decideAndResume runs. A missing, blank or non-string comment is refused; nothing is read or written first.
  • An approve never enters that branch, so its comment stays optional (the reference says nothing new about approve).
  • packages/spec/src/contracts/approval-service.ts: the ApprovalDecisionInput.comment and IApprovalService.decide docblocks state the same rule.
  • System rejects (the SLA sweep's auto-reject, the revision-limit reject) do not pass through decide(). The sentence is scoped to a decision "recorded through ApprovalService.decide() (or the REST routes)", so it stays true of them.

Read first, by risk: (1) the reworded first paragraph of "Recording a decision"; (2) the shortened outputs paragraph, to confirm "Dynamic approvers ② below" still carries what was cut; (3) the changeset.

Two-minute check: node scripts/check-skills-token-ratchet.mjs prints the line quoted below and exits 0.

Evals

No eval case added. Decision: not owed for this change, and it would not fit.

  • The skill's eval fixtures (skills/objectstack-automation/evals/*.json) grade authored metadata, a defineFlow an agent writes. This hunk teaches a runtime call rule (what a decide call must carry), not an authorable key, and no existing case exercises the decide call, so no existing case goes stale.
  • A new case that asks for a reject call and asserts a comment would be a new eval subject for the skill, well past this card's net-added-line budget of 5 (the PR sits at exactly 5). It is named here as a possible follow-up for the skills lane, not filed.

Verification

Head ddcee8b8f6. Net-added lines, whole PR: 5 (git diff --numstat origin/main...HEAD: changeset 6/0, reference 6/7).

Token ratchet, no ceiling raise:

before (origin/main bb1c55d138)  ✓ check-skills-token-ratchet: skills/objectstack-automation/references/state-machines-and-approvals.md is 5933 tokens (ceiling 5936; headroom 3).
after  (this head)               ✓ check-skills-token-ratchet: skills/objectstack-automation/references/state-machines-and-approvals.md is 5927 tokens (ceiling 5936; headroom 9).

The hunk is a net token cut of 6: the restatement it drops is larger than the rule it adds. The dispatch order quoted 5927/5936 as the reading before; measured, 5927 is the reading after and main sits at 5933.

Size readings for the published catalog:

Reading Before After
The edited file, lines 388 387
The edited file, tokens 5933 5927
All SKILL.md files, lines 4939 4939
Bundle total (whole shipped tree), tokens 284660 284654
Local gates at this head (each exit code captured before any pipe)

All exit 0: node scripts/check-skills-token-ratchet.mjs and its --self-test (104 cases), node scripts/check-closing-keyword-parity.mjs, node scripts/check-doc-route-spelling.mjs --advisory, pnpm check:doc-authoring, pnpm check:pm-skill-id-lint, pnpm check:role-word, pnpm check:skill-compatibility, pnpm check:skill-frame-sync, pnpm check:skill-identifier-liveness, pnpm check:skill-links, pnpm check:published-files, pnpm check:nul-bytes, pnpm check:corpus-claim-drift, pnpm check:adr-anchors, pnpm --filter @objectstack/spec run check:skill-refs, pnpm --filter @objectstack/spec run check:skill-served-sections, node scripts/check-empty-changeset.mjs, node scripts/check-adr-0087-registration.mjs, node scripts/check-commit-card-trailers.mjs --self-test.

node scripts/pm/overlap-check.mjs --branch=claude/area-a4A-35817: VERDICT clean exit 0 (merges cleanly with origin/main and with the open PR #35673 that shares the file).

NOT MEASURED locally: pnpm --filter @objectstack/lint run check:doc-formula-expressions answered PREREQUISITE NOT MET (the formula package is not built in this worktree); left to CI. dispatch-gates --ran names 32 of 49 derived families unrun: a declared narrowing to the families that read skill text and changesets. The rest are self-tests and build-reading gates that this two-file text diff cannot move, and CI runs the full farm.

No test, ablation or dogfood battery: the diff changes prose and a changeset, no tested behaviour.

Acceptance notes

🤖 Generated with Claude Code

… reason

A reject recorded through ApprovalService.decide() or POST …/reject always
carries a non-blank comment, else 400 VALIDATION_ERROR. Paid in place: the
outputs paragraph drops a restatement.

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

Copy link
Copy Markdown
Contributor Author

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

L1 verdict (L1-a): ACCEPT at head ddcee8b8f643e13fefdc38e7c7b61fed9bdbf39a (Fixes #35817, Part of #35772: the automation skill reference says a reject carries its reason).

Gates on this head: l1-face --pr 35842 CLEAN (13 items, none flagged): open, draft, base main, first line Fixes #35817, no closing keyword binds another card, Clause-②: no / Metadata-protocol: none, skills-docs not owed. Check-runs at ddcee8b: 28 success, 16 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success. Mergeable: clean. Dogfood battery not owed.

What I checked (holds):

  • The hunk is the reviewed one. The reference's blob at this head is 3277c7f9b2, the same blob as at 6d93210a (contract record 7036174996). Both start from base blob 825ace0e. That is the file at this PR's merge base bb1c55d1 and at docs(approvals): a reject reason is required at every human door — contract docblock, docs, checklist and skill reference #35803's merge base d9be915f. The +/- lines of the two diffs match exactly. The file has not changed on origin/main since bb1c55d1 (main now d6ce9ba6).
  • The sentence is true on main. ApprovalService.decide() (plugin-approvals approval-service.ts, if (input?.decision === 'reject')) validates comment as a required textarea param. It throws { status: 400, code: 'VALIDATION_ERROR' } before decideAndResume. Approve never enters that branch. The docblock above it says every human door reaches decide(), the REST route included. The SLA auto-reject and the revision-limit reject do not, and the sentence scopes itself to decisions "recorded through ApprovalService.decide() (or the REST routes)".
  • What was cut still has a home. The outputs paragraph now points to "Dynamic approvers ② below". ② (// ② The previous approval node's decision outputs pick this node's approvers: with vars.lead_review.next_reviewers) teaches the same thing.
  • Changeset, sentence by sentence (.changeset/35817-skill-reject-reason.md, '@objectstack/skills': patch, the published package at packages/skills):
    • "says a reject recorded through ApprovalService.decide() or POST …/reject always carries a non-blank comment, its reason, else 400 VALIDATION_ERROR": holds against the hunk.
    • "Text only; the outputs paragraph gives up a restatement to pay for it": holds. The diff has two files, prose and the changeset.
  • Ratchet, run by me. On main: 5933 / 5936. On this head: 5927 / 5936, headroom 9. check-adr-0087-registration: one non-breaking changeset. check-empty-changeset: clean.
  • Shared file with docs(skills): name the publish-time findings, drop the fallbackLocale refusal workaround, name the MCP door tool set #35673 (draft, head a42688df). A three-way git merge-file of the reference (base bb1c55d1, this head, docs(skills): name the publish-time findings, drop the fallbackLocale refusal workaround, name the MCP door tool set #35673's head) gives 0 conflicts. The ratchet on the merged text reads 5928 / 5936. Either order fits under the ceiling as the two heads stand now.
  • Evals. No eval case added. The body gives a reason: the hunk teaches a runtime call rule, not an authorable key, and no existing case exercises a decide call. With Metadata-protocol: none, SKILL.md:320 does not require an eval. I agree it is not owed here.
  • Scope. Two files: the card's reference and its changeset. Net added lines 5, inside the card's budget of 5.

NOT MEASURED: overlap-check.mjs --branch (my clone is shallow and the branch does not resolve, exit 3). I used the file-level three-way merge above instead. check:doc-formula-expressions was not run locally. CI's lint jobs are green.

Non-blocking notes:

  1. Changeset layout. The changeset has no blank line after the front matter and none around the two declaration lines, to fit the 5-line budget. readClause2Line and check-adr-0087-registration read it correctly. In the rendered CHANGELOG, though, the summary sentence and both declaration lines will run together as one paragraph. Every other skills entry keeps them as separate paragraphs. This is cosmetic only and is not a reason to hold the PR.
  2. Landing bookkeeping. Fixes #35817 closes the card on merge. approvals: after the reject-requires-reason change (#35716, #35741), the contract docblock, object comment, docs, checklist and skill reference still say a reject reason is optional — bring them in line #35772 is already closed but still carries pm:dispatched. Under landing rule B, remove that label by hand when this lands.

Landing: governed, Tier H (skills/**). It goes to the seat for the contract delta before ready/enqueue.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Served-tier: CONTRACT_REVIEW_TIER

Contract review — PASS at ddcee8b

Head-sha: ddcee8b8f643e13fefdc38e7c7b61fed9bdbf39a
Local-runs: none
Scope: skills/objectstack-automation/references/state-machines-and-approvals.md + none; widened to the prose face: .changeset/35817-skill-reject-reason.md; read, not reviewed: packages/plugins/plugin-approvals/src/approval-service.ts, packages/rest/src/approvals-routes.ts, packages/rest/src/error-response.ts, packages/spec/src/ui/action-params.zod.ts, packages/spec/src/data/field-value.zod.ts, packages/spec/src/contracts/approval-service.ts, packages/spec/scripts/skill-served-sections.json, packages/skills/package.json, scripts/check-skills-token-ratchet.mjs, scripts/pm/check-governed-merges.mjs
Security-touching: no

Isolated, read-only sub-agent record, written 2026-11-20T11:27Z. Face: governed rule text (skills/**), one hits file. Inputs: card #35817 with its thread (triage 7036464113, claim 7037559916), its parent #35772, the PR body and file list, the net diff against main, the earlier record 7036174996 on PR #35803, and the check-runs on this head: 44 runs, 28 success, 16 skipped, none red, none pending. Merge base is bb1c55d; main is de25d58, five commits past it, and none of them touches a PR path or a file cited below. The head has not moved. No earlier record and no claim line was on this head, on the PR or on the card. Every statement below was derived from the tree and the check-runs; the PR body and ACCEPT 7038156033 were read as claims to test.

F: none. S: none. No must-fix, no should-fix. N1 to N3 are nits, and none of them moves the head.

① Derived judgments

  1. Accept set and public surface: unchanged. The diff is two paragraphs of one skill reference and a changeset. No schema, type, export or route moves. Clause-②: no and Metadata-protocol: none are right: the hunk states a rule fix(approvals): a reject carries its reason at the approvals route, decide, the SDK and the inbox #35741 already made real and adds none of its own.
  2. The hunk is the one judged at 6d93210a, read off the objects. The reference's blob at this head is 3277c7f9b2026c8b0c3405f1365f18ffd821b173 (23706 bytes), the same object id as at 6d93210aee93175b9abdd382c1acd88487949384. The base blob is 825ace0e21348e422d6f01fe1c8381c941c5fbdc (23732 bytes) at this PR's merge base bb1c55d, at docs(approvals): a reject reason is required at every human door — contract docblock, docs, checklist and skill reference #35803's merge base d9be915 and on main at de25d58, so the file has not changed on main since that review. One object id on both heads is the same bytes, and two diffs from one base blob to one result blob are one diff. The card's own diff header names the same pair, 825ace0e21..3277c7f9b2.
  3. "a reject always with a non-blank comment, its reason (else 400 VALIDATION_ERROR)", clause by clause on main at de25d58:
    • ApprovalService.decide() opens with if (input?.decision === 'reject') and runs validateActionParams([{ name: 'comment', required: true, type: 'textarea' }], …). isActionParamValuePresent reads undefined, null, the empty string and a whitespace-only string as absent, so "non-blank" is exact; textarea is in STRING_VALUE_TYPES, so a number, boolean, array or object is refused as invalid_shape.
    • The throw carries { status: 400, code: 'VALIDATION_ERROR' } and comes before decideAndResume, so before the request is looked up. approval-service.test.ts pins all eight inputs, the request left pending, no action row and no resume.
    • POST …/requests/:id/reject forwards body.comment untouched to decide(). The message opens with none of handleApprovalError's prefix rows, so the route asks classifiedRefusalAnswer, which answers a declared 4xx status carrying a string code at that status with that code.
    • "its reason": decideNode writes comment: input.comment ?? null on the sys_approval_action row.
    • "always": the gate has no bypass arm. The only non-test callers of decide are the route and redeemActionToken. An approve never enters the branch, and the hunk says nothing new about an approve.
  4. System rejects and the email link: the sentence speaks of a decision recorded through decide() or the two routes, and of nothing else. The SLA sweep's auto-reject calls the private decideAndResume with 'SLA escalation', and the revision-limit reject writes its own row; neither passes the gate, neither is named, and both carry a non-blank string anyway. redeemActionToken calls decide() with the constant 'Via action link': it passes the gate and asks the approver for nothing, and the sentence does not say it asks. That leg is approvals: the email action-link reject (ADR-0043 confirm page) records "Via action link" instead of a reason the approver typed — add a required reason field (remaining leg of #35593's "reject carries a reason") #35722, open, untouched here.
  5. Nothing merged since has changed it. fix(approvals)!: rejecting through the approval_reject action requires a reason #35716 (03bce5c), fix(approvals): a reject carries its reason at the approvals route, decide, the SDK and the inbox #35741 (d9be915) and docs(approvals): a reject reason is required at every human door — contract docblock, docs, checklist and skill reference #35803 (bb1c55d) are on main. Each code file the earlier record read is one blob at 6d93210a, on main at de25d58 and at this head: the plugin's approval-service.ts (4c675f1e), approvals-routes.ts (17fec475), error-response.ts (0d931a34), action-params.zod.ts (2d33e300), field-value.zod.ts (a9a9b881), the spec contract (7600f992), sys-approval-request.object.ts (2abdb335), the SDK index (7b49fb64), the inbox page (52f03970) and its API service (c88c1fd6). The five commits since the merge base are a spec describe line, the ask skill, two UI fixes and a docs dependency bump.
  6. "(Dynamic approvers ② below)" resolves at this head: under ### Dynamic approvers the example comment // ② The previous approval node's decision outputs pick this node's approvers: carries vars.lead_review.next_reviewers, and the end-to-end crm_dynamic_approval flow follows it.
  7. Token ratchet and size. The gate's own line on this head, from the Type Check · source gates job: "skills/objectstack-automation/references/state-machines-and-approvals.md is 5927 tokens (ceiling 5936; headroom 9)", then "60 authored bundle file(s) within their ceilings". By hand, ceil(23706 / 4) = 5927; main is ceil(23732 / 4) = 5933. The file carries no release stamp and no body pin, so neither exclusion applies. No ceiling row moves: the ratchet script is one blob (a78922b6) on main and at this head. The bundle total, 284654, is measured and not ratcheted. No SKILL.md is touched.
  8. Generated and served copies: none owed. The paragraph exists in one file of the tree. packages/skills ships skills/** through a build-time sync into its dist, with no committed copy. The served-sections table pins four headings of this file (Approvals (Flow Nodes), Approver Types, the Node Config heading, Approval Best Practices); "Recording a decision" is not one of them and no heading changes. The generated references/_index.md does not list this file.

② Semver level

One changeset, '@objectstack/skills': patch, which is the level owed for text under skills/**, and it releases nothing else. Both declaration lines stand at a line start in the PR body and in the changeset. Check Changeset is green. Its two sentences each match the diff: the rule as the hunk states it, and "Text only; the outputs paragraph gives up a restatement to pay for it". Right. Layout is N1.

③ Boundary flags

④ Design judgment

  • skills/objectstack-automation/references/state-machines-and-approvals.md: holds against the code it cites. The clause is true at both doors the sentence names. It sits where an agent reads before writing a decide call. It has a reader: an agent writing a script, test or integration that rejects a request, which before this hunk was taught a call that answers 400. It cites no issue number. It is paid for in place: the file shrinks by 26 bytes, 6 tokens, and no ceiling moves.

    Tried to break it, each read on main:

    • a whitespace-only or non-string comment: refused, as "non-blank" says;
    • a human reject through a door that skips decide(): none found; the two paths that skip it are system rejects the sentence does not name;
    • the fixed-text action link: passes the gate, and the sentence does not claim a typed reason there;
    • the route answering another status or code: the classified refusal keeps 400 and VALIDATION_ERROR;
    • a contradiction elsewhere in the catalog: the other mentions of /reject under skills/** are edge labels and the stranded-run line under "Branching, side-effects & rejection", and none teaches a reject body. The outputs rule two sentences on ("to approve (never to reject)") is about decisionOutputs and stays true beside it;
    • the cut: what was removed keeps its home (N2).

Notes:

  • N1 (nit, prose face, accepted) — the changeset has no blank line after the front matter or around the two declaration lines, to stay inside the card's five-line budget. The readers take it (Check Changeset and the PR-body guards are green). In the rendered CHANGELOG the summary and both declaration lines will run together as one paragraph, where other skills entries keep them apart. Cosmetic; nothing to change on this head.
  • N2 (nit, accepted, carried from record 7036174996) — the outputs paragraph loses the words "without writing to a record field". The substance survives where the pointer lands: example ② and the crm_dynamic_approval flow route a decision output through vars.lead_review.next_reviewers with no record write, and example ① is the record-field contrast.
  • N3 (nit, the seat's, no head change) — the PR body's maintainer line asks the maintainer to confirm the merge, and ACCEPT 7038156033 says "Landing: governed, Tier H". Both were written before any record named this head. The seat re-runs node scripts/pm/check-governed-merges.mjs --pr 35842 now and makes the body's ask and the PR's labels say what it prints: if the arm reads Tier S, the owning seat queues on this record and the body asks nothing of the maintainer; if it still reads Tier H, the PR waits for his word under pm:awaiting-merge.

Implemented-by: claude/area-a4A-35817
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 — ACCEPT · repo:objectstack#4 · head ddcee8b8f643e13fefdc38e7c7b61fed9bdbf39a

  1. 形态:state-machines-and-approvals.md 一处、changeset(@objectstack/skills patch);净 +5。
  2. 前提实测:参考文本 blob 与 docs(approvals): a reject reason is required at every human door — contract docblock, docs, checklist and skill reference #35803 在 6d93210 判为真的 hunk 逐字节一致;驳回代码自那以后在 main 上未变。
  3. 门禁:现 head 44 个 check-run,28 成功、16 跳过、0 失败;ratchet 5927/5936。
  4. 接受的偏差:changeset 无空行,CHANGELOG 段落连在一起(为守 5 行预算,接受)。
  5. 范围外去向:docs(skills): name the publish-time findings, drop the fallbackLocale refusal workaround, name the MCP door tool set #35673 同文件,三方合并 5928/5936 无冲突,无需变基。
  6. 落地条款:Clause-②: no、Metadata-protocol: none;请 os-zhuang / hotlong 入队;落地时移除已关 approvals: after the reject-requires-reason change (#35716, #35741), the contract docblock, object comment, docs, checklist and skill reference still say a reject reason is optional — bring them in line #35772 的 pm:dispatched。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 11:30
@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 9a28a48 Nov 20, 2026
50 checks passed
@os-zhuang
os-zhuang deleted the claude/area-a4A-35817 branch November 20, 2026 12:23
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
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 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.

skills: the automation skill reference teaches decide() and POST …/reject without the reject reason that #35741 now requires (sub-card of #35772)

2 participants