Skip to content

docs(skills): teach the fault edge on a write after an approval decision and the RESUME_FAILED refusal members - #35002

Merged
os-zhuang merged 6 commits into
mainfrom
claude/issue-34637-approval-fault-edge
Nov 19, 2026
Merged

os-zhuang merged 6 commits into
mainfrom
claude/issue-34637-approval-fault-edge

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #34637

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:自动化技能的审批参考新增一条:审批通过或拒绝之后的「改记录」步骤,如果可能被记录钩子、校验规则或权限拒绝,就从这一步画一条 fault 边到处理节点,拒绝走这条边,审批照常返回;不画时审批接口回 500 RESUME_FAILED,决定照旧生效,错误体带 innerRefusal 和 userMessage。另加一条评测用例。
  • 为什么改:技能不教,AI 写审批流程时不会画这条边,钩子一拒绝流程就卡住,审批人只看到 500。
  • 风险与回滚:只动技能文字和评测,不动运行时。为了不抬 token 上限,同一文件删了四处重复内容,每处都另有出处。回滚就是 revert 本 PR。
  • 先看:① skills/objectstack-automation/references/state-machines-and-approvals.md 里 Branching 一节新增的那一条,以及同文件被删的四处;② skills/objectstack-automation/evals/approval-fault-edge.json;③ .changeset/34637-approval-fault-edge-skill.md。
  • 两分钟验证:跑 node scripts/check-skills-token-ratchet.mjs,预期这份参考文件一行读作 5913 tokens (ceiling 5916; headroom 3),末行是 ✓。
  • 需要你做的:审批本 PR(受管面 skills/**)。

Review round (supersedes the readings below where they differ). Contract review 7009057594 on fcf9e05: PASS with S1 should-fix. Head c242d97 merges origin/main 819c067. S1: the eval prompt now ends "None of the project's files are in this directory: write the flow as a TypeScript defineFlow in your answer." N1: the reference reads "the body may carry innerRefusal … and userMessage". N3: the changeset points to the list item that names the e1 edge. N2 left. Budget on the merged tree: state-machines-and-approvals.md 5933 / 5936 tokens (388 lines, 23732 bytes). The eval case is unmeasured with the new prompt (no live round, by order). Gates: 48 derived, 46 exit 0, 2 not measured locally (CI runs them); overlap clean. The page teaches that a permission refusal on a post-decision write routes down a fault edge, so the PR carries security.

What changes

skills/objectstack-automation/references/state-machines-and-approvals.md, section Branching, side-effects & rejection, gains one bullet. It teaches the two points the card orders, in the wording of the merged approvals docs callout and the ApprovalDecisionResult.resumed docblock:

  1. When a step on the approve / reject branch writes a record that a record hook, a validation rule or a permission may refuse, draw a fault edge from that step to a handler. The refusal takes that edge and the decision answers normally.
  2. Without the edge, POST …/approve (or /reject) answers 500 RESUME_FAILED. The decision stands (finalized: true), the run is stranded, and the body carries innerRefusal ({ code, message }) and userMessage, the hook's declared sentence to show the approver.

The bullet points to SKILL.md, section Failure routing, for the edge shape, so the shape is not restated.

One eval case is added in a new file, skills/objectstack-automation/evals/approval-fault-edge.json: an approval flow whose step after the decision updates a record guarded by a refusing beforeUpdate hook. It is graded on the approval node, the approve out-edge, the update_record step and the type: 'fault' edge.

A @objectstack/skills patch changeset is included, because skills/** ships in that package.

The status code, checked against the merged code and the ruling

The card says "status 500 per the standing ruling". The merged code answers the same:

  • packages/rest/src/approvals-routes.ts maps the RESUME_FAILED prefix to status 500 and spreads the recognised stranded-decision envelope into the body.
  • packages/rest/src/rest-approvals-wire-codes.test.ts pins status 500 and the exact body key set code, decision, error, finalized, innerRefusal, repairable, runId, userMessage.
  • packages/plugins/plugin-approvals/src/hook-refusal-after-decision.test.ts pins both halves: no fault edge gives RESUME_FAILED with the two members, and a fault edge on the step gives finalized: true, resumed: true with nothing left parked.

The ruling the code cites is the maintainer ruling of 2026-09-04, decision batch #37, option 1B, recorded in comment 5541861039 on issue #13807. From that record: "POST …/reject (and the sibling decision doors on the same path) keeps its status code — the 500-class RESUME_FAILED — and stops discarding what the engine said". The record gives the maintainer's word as verbatim 「同意」 on the presented recommendation 1B · 2及. The approvals docs page states the 500 and cites no ruling id of its own; the id is in the code comments (approvals-routes.ts, packages/types/src/stranded-decision.ts).

Scope fence

Only the decision doors' thrown RESUME_FAILED envelope is taught, as merged by PR #34619. The text names POST …/approve and /reject. It does not mention resumeFailure, the recall door or the subflow-parent strand, and it does not say those answers carry the pair.

Budget

The reference file was at 5916 tokens against a ceiling of 5916, headroom 0. No ceiling moves. The new bullet is paid for by deleting content. Four restatements were cut, each keeping another home:

Cut Bytes Where the content still lives
The text diagram in Send-back for revision 261 The paragraph directly above it and the snippet below it trace the same path
Bullet "Conditional step" 119 The discount-approval example: the needs_director decision node and the comment on edge e1
Bullet "Send back for revision (ADR-0044)", a pointer 80 The section it pointed to, in the same file
Bullet "Hard reject" 64 The examples' reject edges into an end node (e3, e7)

The cuts remove 524 bytes and the new bullet adds 515, so the file is 9 bytes smaller. None of the four is a re-wrap: each removes text.

Reading Before (fff0ad0c18) After (fcf9e05cbe)
state-machines-and-approvals.md, lines 412 408 (net -4; budget was at most +10)
state-machines-and-approvals.md, bytes 23661 23652
state-machines-and-approvals.md, tokens / ceiling 5916 / 5916 5913 / 5916
All 12 SKILL.md files, lines summed 4728 4728
All 12 SKILL.md files, bytes summed 246476 246476
Ratcheted authored total, tokens / ceiling sum 191126 / 196699 191123 / 196699
evals/approval-fault-edge.json (eval fixture, not ratcheted), tokens absent 388

No SKILL.md is touched. skills/objectstack-automation/SKILL.md stays at 6903 / 6903.

Tests

No package source changes, so no package test suite is owed. What ran, at head fcf9e05cbe:

  • pnpm --filter @objectstack/skills build under the shared verify lock: VERDICT command-exit 0; "99 file(s) across 12 skill(s) copied from skills/** into dist/skills and read back byte-identical".
  • The new eval case, by hand. The skill-evals runner has no single-case selector, so five turns of this one case were run with the runner's own argv from packages/qa/scenarios/src/skill-evals/arms.ts (a fresh directory, the bundle copied without evals/ on the with-skill arm, an empty directory on the no-skill arm) and graded by literal substring as grade.ts does. This is a hand replication, not a runner round, and no round record was filed.
Turn Arm Reference text it read Verdict under the final tokens
ws1 with-skill first revision (5fa36a038b) pass
ws2 with-skill final text pass
ws3 with-skill final text pass
ns1 no-skill none fail: label: 'approve' missing, type: 'role' present
ns2 no-skill none fail: label: 'approve' missing, type: 'role' present

All three with-skill answers drew the type: 'fault' edge from the update_record step, and all three said that without it the approve call answers 500 RESUME_FAILED. All three launched the skill and read the reference file.

Stated limits: the token lists were settled after reading these answers, so the five turns are not an independent test of the final lists. Two things changed on the way. Both no-skill answers also wrote type: 'fault', so the case now also requires label: 'approve' and forbids type: 'role'. The first draft forbade label: 'error', and one with-skill answer that drew the fault edge correctly quoted that label while explaining why it does not catch a failure, so that token was dropped. The prompt was the same on all five turns.

Acceptance notes

  • The first eval draft appended a case to evals/flows-triggers-approvals.json. node scripts/pm/overlap-check.mjs then answered VERDICT overlap exit 1 against PR feat(spec, service-automation): a packaged flow can ship switched off for an administrator to turn on (defaultActive) #34793, which appends its own case with the same id: 24 at the same position. The case moved to its own file and the shared file is byte-identical to main again. The re-run answers VERDICT clean exit 0 against origin/main (44c7a4a415) and 0 PR heads.
  • The discount-approval example in the reference keeps its mark_won step without a fault edge. The new rule is conditional (a write that may be refused), and adding a handler node and two edges to the example did not fit the budget. Noted, not changed.
  • ui/scripts/check-skill-eval-tokens.mjs scans the bundle under ui/skills only (1 bundle, 11 eval files), so it does not judge this case. The four must_contain tokens were checked by hand as taught in the bundle: type: 'approval' and label: 'approve' in the reference, update_record in SKILL.md and the references, type: 'fault' in SKILL.md. The forbidden token type: 'role' occurs nowhere in the bundle.
  • Case 5 of evals/flows-triggers-approvals.json forbids label: 'error' and has the same exposure measured above on a different prompt. Noted, not filed.

Verification

node scripts/pm/dispatch-gates.mjs --commands at fcf9e05cbe derived 47 commands (change set: 3 paths against merge base fff0ad0c1). All 47 ran at that head with the exit code captured before any pipe. Reconciliation: ✓ dispatch-gates --ran: 47 derived famil(ies) accounted for — 45 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).

Gates that read the changed files
node scripts/check-skills-token-ratchet.mjs :: exit 0
  ✓ check-skills-token-ratchet: skills/objectstack-automation/references/state-machines-and-approvals.md is 5913 tokens (ceiling 5916; headroom 3).
  ✓ check-skills-token-ratchet: skills/objectstack-automation/evals/approval-fault-edge.json is 388 tokens — eval fixture, measured but not ratcheted.
  ✓ check-skills-token-ratchet: 58 authored bundle file(s) within their ceilings; 10 generator-owned file(s) and 31 eval fixture(s) measured, not ratcheted.
node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:skill-refs :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm check:skill-links :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:skill-compatibility :: exit 0
pnpm check:skill-frame-sync :: exit 0
pnpm check:role-word :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
Not measured locally, and two partial readings
pnpm check:dual-build-cjs-loads :: exit 3   PREREQUISITE NOT MET — this gate reads built output, and some package has no dist/.
pnpm check:lean-entry-closure   :: exit 3   PREREQUISITE NOT MET — this gate loads BUILT entry points, and some target is absent
pnpm check:dts-closure          :: exit 0   partial: "6 built package(s) swept"
pnpm check:sourcemap-no-sources-content :: exit 0   partial: "6 built package(s) swept"

The diff touches no package source, so no whole-workspace build is owed locally. Only @objectstack/formula, @objectstack/lint and their dependencies were built, to let the doc-formula gate run. These four are whole-build readers and are left to CI.

The remaining 28 derived commands are self-tests and whole-tree gates; each exited 0.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No schema touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is left to CI (no code file changed).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…ion and the RESUME_FAILED refusal members

The approvals reference gains one bullet in Branching, side-effects and
rejection: a step on the approve / reject branch whose write a record
hook, a validation rule or a permission may refuse draws a fault edge to
a handler, and without it the decision route answers 500 RESUME_FAILED
with the decision recorded, the run stranded, and innerRefusal plus the
hook's declared userMessage in the body. One eval case covers it.

Paid in place: four restatements cut, the token ceiling does not move.

Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C
Co-authored-by: Claude <noreply@anthropic.com>
…rMessage reads as the hook's declared sentence

The eval case also requires the approve out-edge label, which an answer
written without the skill does not produce. The reference and the
changeset name userMessage as the member carrying the hook's declared
sentence, so it does not read as a hook authoring key.

Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C
Co-authored-by: Claude <noreply@anthropic.com>
…e approver spelling

An answer that draws the fault edge and explains why a labelled edge
does not catch a failure quotes that label, so it is not a usable
forbidden token for this case. The case forbids the deprecated approver
spelling instead, which names nobody for a position.

Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C
Co-authored-by: Claude <noreply@anthropic.com>
… file

The shared flows eval file is left as main has it, so this branch no
longer meets another open pull request that appends a case to its tail.

Claude-Session: https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C
Co-authored-by: Claude <noreply@anthropic.com>
@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 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

维护者速读(席位终稿 · Head-sha: fcf9e05 · 2026-11-17T22:45Z)

  • 改了什么:审批技能的「分支与副作用」一节加一条:审批通过/驳回分支上,如果某一步的写入可能被钩子、校验规则或权限拒绝,就从这一步画一条 fault 边到处理节点,拒绝走 fault 分支,审批照常返回;不画的话,POST …/approve(或 /reject)返回 500 RESUME_FAILED,审批决定已生效、流程卡住,响应体带 innerRefusal 和给审批人看的 userMessage。配一条评测用例(单独新文件)。
  • 为什么改:approvals: a hook refusal in the step after an approval answers 500 RESUME_FAILED after the decision is recorded, stranding the run and the record — surface the refusal as a 4xx before finalizing #34579 已让决策门带回拒绝原因,但技能没教画 fault 边,AI 写出的审批流程被钩子拒绝时照样卡住。
  • 风险与回滚:只改技能文本和评测,不改运行代码;为不超 token 上限删了同文件四处重复表述,席位已核这些内容在同文件示例里仍在。回滚即 revert。
  • 先看:skills/objectstack-automation/references/state-machines-and-approvals.md 「Branching, side-effects and rejection」一节新增的那条。
  • 两分钟验证:读那一条:应写明画 fault 边、否则 500 RESUME_FAILED、决定已生效、体内有 innerRefusal 与 userMessage。
  • 需要你做的:批准本 PR(受管面 Tier H);批准前还欠一次契约审核(L2)。

席位意见:建议批准。「500」开发对照了合并代码(packages/rest/src/approvals-routes.ts,rest-approvals-wire-codes.test.ts 钉住)与所引裁决(#13807 评论 5541861039,2026-09-04 批次 #37 方案 1B);只教已合并的决策门,未合并的 #34638(撤回门的 resumeFailure)不教。

席位核对 · L1 ACCEPT · Head-sha: fcf9e05

Card #34637, claim 6959148889, dev report 6963150096. The seat read the diff itself.

Item Reading
Shape Draft, base main, Fixes #34637; Clause-②: no, Metadata-protocol: none. Three files: the reference (+7 −11), a new eval file approval-fault-edge.json, and a @objectstack/skills patch changeset. Governed (skills/**), Tier H.
Accuracy The 500 and the body members were verified by the dev against the merged route and its wire-code pin, and the ruling is quoted in the PR body. The bullet teaches only the decision doors' thrown RESUME_FAILED. The resumeFailure pair (#34638, PR #34999, not merged) is not taught: scope fence held.
Removed text Four restatements were cut to fit the ratchet (headroom 0 → 3 tokens, no ceiling moved). The seat checked each still stands on this head: send-back is the "Send-back for revision (ADR-0044)" section (line 142); the conditional step is the example's needs_director decision node and edge conditions; the hard reject is the example's reject edges into end nodes (e3); the text diagram is the section's three numbered pieces.
Evals One case, in its own file: the dev moved it off flows-triggers-approvals.json after an overlap with PR #34793 (that file is byte-identical to main now). It was hand-replicated through the runner's argv: with the skill 3 / 3, without 0 / 2. The token list was settled after reading those answers, so this is not an independent test (noted by the dev).
Gates 45 of 47 derived families exit 0, token ratchet among them. 2 are NOT MEASURED (whole-build prerequisites; no package source changed), CI-owned. Overlap clean.
Landing Governed (Tier H): the maintainer approves. Owed first: a contract-review-tier L2 record and every check green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head fcf9e05 · 2026-11-19T06:31Z

A fresh isolated reviewer sub-agent at CONTRACT_REVIEW_TIER renders the record (the governed rules face). The maintainer's approval is still owed after it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head fcf9e05 · 2026-11-19T12:20Z

A fresh isolated reviewer sub-agent at CONTRACT_REVIEW_TIER renders the record (the governed rules face). The maintainer's approval is still owed after it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: fcf9e05cbeecb6cde44153091318455e45655ca3
Local-runs: none
Scope: skills/objectstack-automation/references/state-machines-and-approvals.md + skills/objectstack-automation/evals/approval-fault-edge.json
Security-touching: yes

PR #35002, card #34637, face rules (governed skills/**). Read: the card body and all six comments, the PR body and file list, the net diff against main, the check-runs on this head, and the code the changed sentences teach on origin/main at 819c0679a8. Nothing was built, run or re-run.

① Derived judgments

  • Gates on this head. 44 check-runs: 28 success, 16 skipped, none failing or pending. Among the green ones: Governed Surface Queue Guard, Check Changeset, PR-body guards, Check PR Size, Lint · docs & code guards, Lint · repo & tooling gates, Build Core, Test Core.
  • Diff. Three files, +41 / -11: the reference (+7 / -11), one new eval file (+22), one changeset (+12). skills/objectstack-automation/evals/flows-triggers-approvals.json is byte-identical to the merge base, as the PR says.
  • main has moved (base fff0ad0c18, now 819c0679a8). Checked with git plumbing only: git merge-tree --write-tree origin/main HEAD exits 0 and writes tree 845872a0e1. No conflict. main rewrote the same reference since the base (skills: a JSON form beside the TypeScript in the sections served to MCP clients, and a pin on those section headings #34771 turned the discount-approval example into JSON, docs(approvals): descriptions name the four-leaf viewer block; the automation skill says who admin_rescue opens on #35066, docs(skills): a gated action guards its door only; lock the field an irreversible transition changes #35310); the two edits merge cleanly.
  • Token ceiling on the merged tree. The reference is 23743 bytes on origin/main, 23652 at the head and 23734 in the merged tree. It is not a stamped SKILL.md and carries no body pin (0 matches of the pin pattern), so the price is ceil(23734 / 4) = 5934 against the origin/main ceiling of 5936. Headroom 2 tokens (10 bytes). No breach. The PR's own reading (5913 of 5916) is correct for its base and is stale only because the ceiling and the file both moved on main. The new eval file is a fixture, measured and not ratcheted; no other ratcheted file is in the diff.
  • Eval ids on the merged tree. The runner keys a case BUNDLE/FILE_STEM#ID and refuses a repeat inside one file (packages/qa/scenarios/src/skill-evals/cases.ts). Merged tree: approval-fault-edge.json 1 case (id 1); flows-triggers-approvals.json 24 cases, ids 1 to 24, all distinct (id 24 is feat(spec, service-automation): a packaged flow can ship switched off for an administrator to turn on (defaultActive) #34793's, which this PR no longer touches); integrations-declared.json 3; triggers.json 7. All unique. The new file has no trigger case, and the bundle already holds both trigger kinds.
  • The cross-reference survives the merge. SKILL.md § Failure routing resolves to the heading ### Failure routing & runAs in the merged SKILL.md, which still teaches the { source, target, type: 'fault' } shape and lists "rejected write" under ROUTES.
  • The four cuts on the merged tree. Each still has its other home after main's rewrite: the send-back path (the paragraph above the cut, "Three pieces author it", the snippet with label: 'revise' and type: 'back'); the conditional step (the needs_director decision node, and the list item "Entry criteria re-home onto the edge entering the approval node — e1", which is where main moved the old edge comment); the send-back pointer (the section itself); hard reject (edges e3 and e7 into the rejected end node).

② Semver level

@objectstack/skills: patch is right: wording and one eval fixture, no schema, no runtime, no published symbol. Clause-②: no is on the PR body and in the changeset, and it is the correct value: the diff neither widens nor narrows a declared capability, and it removes no taught behaviour (the four cuts are restatements, checked above). Metadata-protocol: none is correct.

③ Boundary flags

  • open_questions: empty in the dev report. Nothing to answer.
  • Dev flags (out_of_scope_findings), each answered:
    • Case 5 of flows-triggers-approvals.json forbids label: 'error' and may fail a correct answer that quotes it. Outside this diff. Agreed it is a real exposure; it belongs on its own card, not here.
    • ui/scripts/check-skill-eval-tokens.mjs reads ui/skills only. Confirmed on origin/main. I checked the four must_contain tokens by hand on the merged tree: type: 'approval' (reference, 4), label: 'approve' (reference, 2), update_record (SKILL.md and three references), type: 'fault' (SKILL.md, 1). type: 'role' occurs nowhere in the bundle.
    • The discount-approval example keeps mark_won without a fault edge. Accepted: the new rule is conditional on a write that may be refused, and the merged tree has 2 tokens of headroom.
    • PR feat(spec, service-automation): a packaged flow can ship switched off for an administrator to turn on (defaultActive) #34793's id 24. Landed on main; no collision, see ①.
  • Dev deviations. The late overlap check and the two early pushes are process, already disclosed, and leave nothing in the tree. The eval lives in its own file instead of the shared one: accepted, still one case.
  • SQL push-down (Prime Directive 5): no code in the diff, no id materialisation, no in-app join. Nothing to flag.
  • Security. The path name does not show it, but the new bullet names "a permission" among the refusals a fault edge routes: it teaches that a permission denial on a post-decision write can be handled by the flow author, and the run then reports success. That is true of the live tree (below), but it is permission behaviour, so the line above reads yes. The eval also grades the approver type (position, never the deprecated role spelling), which decides who may approve.

④ Design judgment

Each changed sentence of the reference, against the card's two points and the code on origin/main:

  1. "A write on that branch that may be refused (a record hook, a validation rule, a permission) — draw a fault edge from that step to a handler: the refusal takes it and the decision answers normally." True. dag-traversal.ts routes every failed node down its fault edge unless the failure is a guard refusal (isGuardRefusal, errorClass: 'guard'). A hook's declared refusal, a ValidationError and a PermissionDeniedError are thrown by the data call, carry no guard mark, and are runtime failures. hook-refusal-after-decision.test.ts pins the approvals case end to end: with the edge, decide() answers finalized: true, resumed: true, the handler runs and no run stays parked. One write refusal does not route: update_record aimed at the stored-metadata tables is a guard refusal carrying PERMISSION_DENIED (crud-nodes.ts). The flow schema refuses that node at save, so it is not the case the bullet describes. Card point 1 is taught.
  2. "Without one, POST …/approve (or /reject) answers 500 RESUME_FAILED: the decision stands (finalized: true), the run is stranded …" True. approvals-routes.ts maps the RESUME_FAILED prefix to 500 and spreads the stranded-decision envelope into the body; rest-approvals-wire-codes.test.ts pins the status and the key set; stranded-decision.ts cites the 2026-09-04 ruling that keeps the status code. The reject door runs through the same decide() path.
  3. "… and the body carries innerRefusal ({ code, message }) and userMessage, the hook's declared sentence to show the approver." True for the case the card names, a hook with a declared refusal (hook-refusal-catalogue.ts: status 400 and a marked userMessage). See N1 for the edge. Card point 2 is taught.
  4. The wording follows the approvals docs callout on main (content/docs/automation/approvals.mdx) and points to SKILL.md for the edge shape, so nothing is restated in a third place, as the card orders. The text stays inside the scope fence: it names only the approve and reject doors and does not claim the pair for resumeFailure, recall or the subflow-parent strand.

The eval, against the card's eval prompt ("an approval flow whose next step updates a record guarded by a refusing hook, and checks the flow draws the fault edge"): the prompt is that scenario, type: 'fault' and update_record are required, and the file parses to the reader's shape. must_not_contain: type: 'role' is a correct refusal, not only a spelling preference: on main, role is the deprecated alias of org_membership_level, so a planning-manager value under it matches nobody.

Findings:

  • S1 (should-fix) — skills/objectstack-automation/evals/approval-fault-edge.json: the prompt does not fix the form of the answer, and three of the four required tokens (type: 'approval', label: 'approve', type: 'fault') are single-quoted TypeScript spellings matched as literal substrings. Since this PR's base, main (skills: a JSON form beside the TypeScript in the sections served to MCP clients, and a pin on those section headings #34771) turned the reference's first approval example into JSON ("type": "approval", "label": "approve"), so the with-skill arm on the merged tree reads a JSON example first, and a correct JSON answer fails all three tokens. The three passing with-skill turns in the dev report read the pre-JSON reference, so the card's "the eval passes" is unmeasured on the tree that will land. main (feat(skills): trigger cases for the six metadata skills; eval assertions and prompts that grade the skill #35022) already closes this class in the neighbouring case 5 with a closing prompt sentence. Delta: end the prompt the same way, for example "None of the project's files are in this directory: write the flow as a TypeScript defineFlow in your answer." Eval fixtures are not ratcheted, so the sentence costs no ceiling.
  • N1 (nit) — the reference says the body "carries" innerRefusal and userMessage without condition. Both members are optional in StrandedDecisionDetails: innerRefusal is present only when the step met a 4xx refusal, and userMessage only when the refusal is marked. A step that faults carries neither (the test's reverse control), and a validation or permission refusal's userMessage, when present, is not a hook's sentence. The sentence copies the docs callout and the card, and it is exact for the declared-hook case, so it is a nit. "can carry" fits the 10 bytes of merged headroom.
  • N2 (nit) — by the dev's own measurement both no-skill turns also wrote type: 'fault'; the two arms separate on label: 'approve' and type: 'role', and the token lists were settled after reading the answers. The case checks what the card asks, but a round will not show lift from the sentence this PR adds. Disclosed in the PR; no change asked.
  • N3 (nit) — the changeset says the conditional-step content still lives in "the comment on its e1 edge". After the merge with main that content is a list item above the JSON block, not an edge comment. The changelog entry will be slightly stale; the fact it points to is still in the file.

No must-fix. One should-fix (S1).

Implemented-by: claude/issue-34637-approval-fault-edge
Reviewed-by: session_012MmDsS4GoHCgYwA2uv3n3C

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

The contract review on fcf9e05 (just above) reads Security-touching: yes: the new bullet teaches that a permission refusal on a post-decision write routes down a fault edge. Per the brief, the seat adopting the record adds security. S1 (should-fix) is open, and a delta review is owed on the fixed head (2026-11-19T12:26Z).

…neFlow; the refusal members read as optional

The eval prompt now says the project's files are absent and asks for the
flow as a TypeScript defineFlow, so its single-quoted tokens match the
form the answer is asked for. The reference and the changeset say the
body may carry innerRefusal and userMessage, and the changeset names the
list item that now holds the entry-criteria note.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

席位核对 · L1 delta ACCEPT · Head-sha: c242d97 · 2026-11-19T12:45Z

The dev's delta report is 7009462824 on #34637. It closes S1 of record 7009057594 and merges origin/main 819c067 (clean).

Item Reading
S1 The eval prompt asks for the flow as a TypeScript defineFlow, as main's case 5 does. expected_output opens with the same form.
Nits N1 taken ("may carry"); the file shrinks by 2 bytes. N3 taken in the changeset. N2 left.
Budget 5933 / 5936 tokens on the merged tree. No ceiling moved.
Gates Locally: 48 derived, 46 exit 0, 2 not measured (they need full builds; CI runs them). Token ratchet and skill-links exit 0. Overlap-check clean. CI on c242d97: read before landing. No live eval round, by order.
PR body The seat added a review-round note.
Owed A delta contract-review-tier L2 record on this head, then the maintainer's approval (governed skills/**).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

Contract-review-claim: session_012MmDsS4GoHCgYwA2uv3n3C · head c242d97 · 2026-11-19T12:45Z

A fresh isolated reviewer sub-agent at CONTRACT_REVIEW_TIER renders the delta record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-lizheng · session_012MmDsS4GoHCgYwA2uv3n3C

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c242d97dc3fa008ec41bcc2be5a94310d1d431f6
Local-runs: none
Scope: skills/objectstack-automation/references/state-machines-and-approvals.md + skills/objectstack-automation/evals/approval-fault-edge.json
Security-touching: yes

Delta round on record 7009057594 (head fcf9e05cbe, PASS with S1). PR #35002, card #34637, face rules (governed skills/**). Read: the card body and all eight comments (the delta report 7009462824 among them), the PR file list and comments, the diff fcf9e05cbe..c242d97dc3 under skills and .changeset, the net diff against main, the check-runs on this head, and the cited code on origin/main at 895dd437f4. Nothing was built, run or re-run. The PR body was not judged.

① Derived judgments

  • What this round changed. The head is a clean merge of origin/main 819c0679a8 (commit 1af611535d) plus one fix commit: 3 files, 6 lines in, 6 lines out. No rebase, no force. The net diff against main is still three files, +41 / -11: the reference (+7 / -11), the eval file (+22), the changeset (+12).
  • main has moved again (819c0679a8 to 895dd437f4). Those commits touch nothing under skills/, the ratchet script, the approvals routes or the eval runner. git merge-tree --write-tree origin/main HEAD exits 0 (tree 12f1dbf977), and the merged reference is byte-identical to the head's.
  • Token ceiling, re-priced with git plumbing. The reference is 23743 bytes on origin/main and 23732 bytes at the head and in the merged tree (388 lines). It carries no stamp line and no body pin, so the price is ceil(23732 / 4) = 5933 against the origin/main ceiling of 5936 (scripts/check-skills-token-ratchet.mjs, line 1779). Headroom 3 tokens. No ceiling moved. The eval file is a fixture, measured and not ratcheted.
  • Eval ids on the merged tree. approval-fault-edge.json 1 case (id 1), flows-triggers-approvals.json 24, integrations-declared.json 3, triggers.json 7. No collision; the runner keys by file stem and id.
  • Cross-references on the merged tree. SKILL.md § Failure routing resolves to ### Failure routing & runAs (line 161), which teaches { source, target, type: 'fault' }. The conditional-step content the changeset points to is the list item at line 83 of the reference ("Entry criteria re-home onto the edge entering the approval node — e1").
  • Check-runs on this head, read at 2026-11-19T12:47Z. 45 runs: 21 success, 18 skipped, 6 in_progress, none failed. Green: Governed Surface Queue Guard, both PR-body guards runs, one Check Changeset run, Check PR Size, Build Core, Lint · PM dispatch-gates, Lint · repo & tooling gates, the four Type Check jobs, Test UI, Live E2E UI. Still running: a second Check Changeset run, Lint · docs & code guards, Lint · ESLint, Lint · CI, release & engine gates, Test Core (1/10) and (2/10). This PASS lifts the gate only once every one of them is green; the seat reads them again before queueing.

② Semver level

Unchanged from the earlier record. @objectstack/skills: patch is right: wording, one eval fixture, no schema, no runtime, no published symbol. Clause-②: no and Metadata-protocol: none in the changeset are correct. The round's edits narrow one claim ("carries" to "may carry") to match the optional members in code; that takes no taught capability away.

③ Boundary flags

  • open_questions: empty in the delta report. out_of_scope_findings: empty this round; the four from round 1 were answered in record 7009057594 and nothing in this round reopens them.
  • Dev deviations this round, each answered. The fix commit was gated locally before the push: process, nothing left in the tree. N1 was paid with a second wording change in the same sentence ("to show the approver" became "for the approver"): the meaning holds and the file shrinks by 2 bytes. The changeset gained one clause naming the prompt form: accurate against the eval file.
  • Unmeasured eval. The dev states no live round was run, by order. See N4.
  • SQL push-down (Prime Directive 5): no code in the diff. Nothing to flag.
  • Security. Restated yes. The bullet still names "a permission" among the refusals a fault edge routes, which is permission behaviour, and the eval grades the approver type (position, never type: 'role'). The PR carries the security label.

④ Design judgment

The reference, this round's one changed sentence: "the body may carry innerRefusal ({ code, message }) and userMessage, the hook's declared sentence for the approver." True against origin/main: both members are optional in packages/types/src/stranded-decision.ts (lines 112 and 123), and packages/rest/src/approvals-routes.ts still maps the RESUME_FAILED prefix to 500 and spreads the stranded envelope into the body. The other sentences of the bullet are unchanged since the earlier record and the code they cite has not moved. Both card points are taught.

The eval, against the card's eval prompt: the prompt now ends "None of the project's files are in this directory: write the flow as a TypeScript defineFlow in your answer.", and expected_output opens with the same form. The grader matches literal substrings (grade.ts, answer.includes), and each required token is taught in that spelling in the merged bundle: type: 'approval' and label: 'approve' in the reference's TypeScript examples (lines 153, 302, 321), defineFlow at lines 75 and 286 to 288, update_record in SKILL.md and the reference, type: 'fault' in SKILL.md line 163. type: 'role' occurs nowhere in the bundle. The assertions are unchanged.

Earlier findings:

  • S1: closed. The prompt fixes the answer form to TypeScript, so the three single-quoted tokens match the form asked for. The JSON example main added no longer decides the spelling of a correct answer.
  • N1: closed. "may carry" in the reference, the eval's expected_output and the changeset.
  • N2: open, left as ordered. Both no-skill turns of round 1 also drew type: 'fault'; the arms separate on label: 'approve' and type: 'role'. No change asked.
  • N3: closed. The changeset points to "the list item above it that names the e1 edge", which is line 83 of the merged reference.

New this round:

  • N4 (nit) — the case is unmeasured on this head. The five turns of round 1 ran the old prompt against the pre-merge reference, so the card's "the eval passes" rests on the token reading above, not on a run. A live round is not a gate and was not ordered; the first runner round after landing is the measurement. No change to the tree asked.

No must-fix, no should-fix.

Implemented-by: claude/issue-34637-approval-fault-edge
Reviewed-by: session_012MmDsS4GoHCgYwA2uv3n3C

VERDICT: PASS

@os-zhuang
os-zhuang marked this pull request as ready for review November 19, 2026 13:29
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit fca72df Nov 19, 2026
49 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-34637-approval-fault-edge branch November 19, 2026 14:10
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 security 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: teach the fault edge after an approval step and the RESUME_FAILED refusal members (innerRefusal, userMessage)

3 participants