Skip to content

fix(approvals): RESUME_FAILED carries the refusal that stranded the run - #34619

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-xczkxx
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-xczkxx

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34579

Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: follow-up #34637

维护者速读

What changes

The card's preferred route (dry-run the post-decision step and keep the request pending) conflicts with ruling #13807 B and the #13937 shape-4 ruling. Per the seat's premise correction (comment 6936860860), this PR ships the fallback inside those rulings.

  • @objectstack/types — StrandedDecisionDetails gains two optional members:

    strandedDecisionDetails validates both (ErrorCode for the code, declaredUserMessage for the text) and drops a malformed one while keeping the four POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 facts. The four facts stay all-or-nothing; a refusal member never rescues a partial envelope.

  • @objectstack/plugin-approvals — serviceResume keeps the engine's innerRefusal / userMessage beside resumeCode / resumeStatus instead of dropping them, and resumeRecordedOutcome attaches them to the stranded-decision envelope. Every decision door that resumes through resumeRecordedOutcome (approve, reject, revise, resubmit, the restored-run continuation) carries them.

  • @objectstack/rest — no logic change: handleApprovalError already spreads the recognised envelope into the RESUME_FAILED body, so both members reach the wire at the top level. Comment updated.

  • @objectstack/spec — ApprovalDecisionResult.resumed docblock (contracts/approval-service.ts) names the two members and the fault-edge route. Comment only; no schema or generated artifact moves.

  • Docs — content/docs/automation/approvals.mdx gains a callout: what the 500 body carries when the step after the decision is refused, and how a fault edge on that step handles it instead.

Why userMessage as well as innerRefusal

Measured, not assumed: for a hook that declares a refusals catalogue, the runtime's SandboxError keeps the diagnostic hook '<name>' threw: … as .message and puts the declared, localized sentence on .userMessage (resolveHookRefusal / resolveInProcessHookRefusal, runtime/src/sandbox/hook-refusal-catalogue.ts). refusalCarriedBy builds innerRefusal.message from .message, so innerRefusal alone does not give the approver the hook's readable sentence. The flow doors serve the same pair (details innerRefusal + top-level userMessage, flow-dispatch-status.ts), so this reuses that vocabulary and adds none.

Why

The engine already reported the refusal on the stranded exit (run-resume.ts, ...readCarriedRefusal(err)), and the approvals door dropped it one line before building the envelope, the same place #13807 found status being dropped.

Verification

  • packages/plugins/plugin-approvals/src/hook-refusal-after-decision.test.ts (new): the card's flow end to end with a real AutomationEngine, the real update_record node and approval node, and a data double that throws a declared hook refusal in the runtime's shape.
    1. No fault edge: still RESUME_FAILED, decision approved, plan still submitted, and strandedDecisionDetails(err) equals the four facts plus innerRefusal: { code: 'VALIDATION_FAILED', message } and the hook's userMessage.
    2. A fault edge on the step: the refusal is routed to the handler, decide answers finalized: true, resumed: true, nothing left parked. (Pins existing engine behaviour; green before and after the fix.)
    3. Reverse control: a step that faults (no declared status) carries neither member.
    • Ablation: with approval-service.ts reverted to origin/main, case 1 goes red (expected { finalized: true, …(3) } to deeply equal { finalized: true, …(5) }); cases 2 and 3 stay green.
  • packages/rest/src/rest-approvals-wire-codes.test.ts: new case — the 500 body carries innerRefusal and userMessage at the top level, exact key set pinned. The existing POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 exact-key-set pins are unchanged and still green.
  • packages/types/src/stranded-decision.test.ts: round-trip, malformed members dropped with the four facts kept, and a refusal member never rescues a partial envelope. The existing "exactly the four declared keys" pin is unchanged and still green.
  • Derived gates at head 95eae72668321d7f8eb2233f80753911e1202288: dispatch-gates --commands derived 125; all 125 exit 0; --ran reconcile: 125 run, 0 NOT-MEASURED, 0 UNRUN.
  • Package suites: plugin-approvals 122 files / 1723 tests, types 40 / 923, rest 419 / 8865 (373 skipped), all green; typecheck green for types, plugin-approvals and rest. The second commit only touches the two new/edited test files (an unused findOne dropped from the new double for check:engine-double-contract, and a module-top import '@objectstack/objectql' for check:test-source-alias) plus scripts/engine-double-contract.pinned.json; both test files re-ran green on the final head.
  • git merge-tree at the final head: clean against origin/main (97defd6), feat(spec, runtime, lint, core): a hook writes the sentences it declares in the organization's language (ctx.text) #34545 (df9ac15) and fix(metadata-protocol): a compile-cache bucket opened by a counter move keeps the row sets read within the last bound #34592 (a6661f5).

No existing test was changed to accommodate the fix.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 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: its generated artifacts are regenerated and committed. (Comment only; no artifact moves.)
  • 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 with Claude Code

https://claude.ai/code/session_01ADHkmT4f9MMpnjemPU3Esb

A decision whose next step is refused by a record hook answers
500 RESUME_FAILED (#13807 B, unchanged), but the body did not say which
refusal stranded the run: the engine reported innerRefusal / userMessage
(ruling B' on #24914) and serviceResume dropped them.

- @objectstack/types: StrandedDecisionDetails gains optional innerRefusal
  and userMessage; the recogniser validates them and drops a malformed one
  without dropping the four facts.
- plugin-approvals: serviceResume keeps the engine's refusal members and
  resumeRecordedOutcome attaches them to the stranded-decision envelope.
- rest: the RESUME_FAILED body spreads them (comment only; the recogniser
  decides).
- Pins: the card's flow end to end (real engine, real update_record, a
  declared hook refusal) with no fault edge, with a fault edge (routed, the
  decision answers normally), and a fault-only reverse control; wire and
  recogniser pins.
- Docs: approvals guide teaches the fault edge for this case.

Claude-Session: https://claude.ai/code/session_01ADHkmT4f9MMpnjemPU3Esb
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/plugin-approvals, @objectstack/rest, @objectstack/spec, @objectstack/types, touching 17 documentable anchor(s).

8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/approvals.mdx (via innerRefusal (symbol, a field of interface StrandedDecisionDetails), userMessage (symbol, a field of interface StrandedDecisionDetails), innerRefusal (literal, a string literal in ResumeRefusal), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/automation/flows.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/frontend/plugins/plugin-chatbot.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/permissions/authentication.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/permissions/system-context.mdx (via describeEffectiveAccess (sdk, the bare tail of client method security.describeEffectiveAccess, bound to GET /api/v1/security/users/:id/effective-access))
  • content/docs/protocol/kernel/error-handling.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/ui/actions.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/ui/views.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))

⛔ 6 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-1.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/releases/v17/17-4.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/releases/v17/17-6.mdx (via ApprovalService (symbol, a top-level class))
  • content/docs/releases/v17/index.mdx (via userMessage (symbol, a field of interface StrandedDecisionDetails), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/releases/v18/18-1.mdx (via ApprovalService (symbol, a top-level class), innerRefusal (symbol, a field of interface StrandedDecisionDetails), userMessage (symbol, a field of interface StrandedDecisionDetails), innerRefusal (literal, a string literal in ResumeRefusal), userMessage (literal, a string literal in ResumeRefusal))
  • content/docs/releases/v18/18-4.mdx (via describeEffectiveAccess (sdk, the bare tail of client method security.describeEffectiveAccess, bound to GET /api/v1/security/users/:id/effective-access))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 178 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 97defd60674b4b7dc795c0e30103818020a6f2c9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 014882d3a5fdb388a6bab6f2ed2a439d9789cd1d — the merge of head 95eae72668321d7f8eb2233f80753911e1202288 into base 97defd60674b4b7dc795c0e30103818020a6f2c9, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 014882d3a5fdb388a6bab6f2ed2a439d9789cd1d && git checkout 014882d3a5fdb388a6bab6f2ed2a439d9789cd1d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 97defd60674b4b7dc795c0e30103818020a6f2c9 95eae72668321d7f8eb2233f80753911e1202288 && git checkout -B drift-repro 97defd60674b4b7dc795c0e30103818020a6f2c9 && git merge --no-ff 95eae72668321d7f8eb2233f80753911e1202288

node scripts/docs-audit/affected-docs.mjs --json 97defd60674b4b7dc795c0e30103818020a6f2c9

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 97defd60674b4b7dc795c0e30103818020a6f2c9 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

The new hook-refusal-after-decision double drops its unused findOne (the
gate requires the ObjectQL predicate on any findOne), and the ledger learns
the update/delete pins. The wire-codes test pays the objectql load at
collection (check:test-source-alias).

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

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 95eae72 · 2026-11-17T04:19Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQVWXw7KT8ThxT4CBy

席位核对

L1 verdict: ACCEPT · PR #34619 · card #34579 · first review · L1-c of seat repo:objectstack#2 · read 2026-11-17T04:24Z

Head-sha: 95eae72668321d7f8eb2233f80753911e1202288 (the head of final-head report 6938126740)

Read from GitHub at this head (get, the diff, check-runs) and from the tree at this head, not from the report.

Checklist

  • Shape: draft, base main. The body opens with the attribution lines, then Fixes #34579. No other card number sits next to a closing verb. 10 files, +458/−6.
  • Scope against the narrowed acceptance (premise correction 6936860860): the approver gets the refusal in the 500 answer, the decision stays recorded and repairable (POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 B, [Decision] Workflow resume ordering: a thrown node today leaves the run terminally unresumable — which of three shapes, given that the current order buys exactly-once across a crash? #13937 shape 4 untouched), and a fault edge on that step does not strand. Each of the three is delivered and pinned (below). The card body's preferred route (a 4xx with the request left pending) is not delivered, and the seat recorded why. See D1.
  • Declarations: Clause-②: yes (widening) and Metadata-protocol: none, in the body and the changeset. The title has no !, which is right for a widening. All three packages are patch, which is right for none (AGENTS.md checklist step 3). No content/docs/releases/.
  • Code, line by line:
    • serviceResume used to drop the engine's innerRefusal / userMessage. It now keeps them on the thrown error as resumeRefusal, beside resumeCode / resumeStatus, and copies them only when the engine reported them.
    • resumeRecordedOutcome spreads resumeRefusalOf(err) into the one strandedDecisionFailure throw. That is the only call site in plugin-approvals (approval-service.ts:6295), so every decision door that resumes through it carries the members.
    • strandedDecisionDetails keeps the four facts all-or-nothing, as before. It then adds innerRefusal only when code parses as ErrorCode and message is a string. That matches FlowInnerRefusalSchema (automation-api.zod.ts:363) member for member. It adds userMessage through the existing declaredUserMessage (a non-blank string). A malformed member is dropped and the facts stand. @objectstack/types already depends on @objectstack/spec and already imports ErrorCode from spec/api in thrown-http-error.ts, so this adds no dependency edge.
    • rest: no logic change. handleApprovalError already spreads the recognised envelope at the top level for RESUME_FAILED only, and only the comment is new.
    • The engine side is not touched. Its failure exits already spread readCarriedRefusal(err) (engine.ts:8553, dag-traversal.ts:1658, run-resume.ts), and refusalCarriedBy brands any throw that declares a status in 400–499 (inner-refusal.ts:90). So the changeset's "a declared refusal, a validation rule, a permission" holds for every 4xx-declared refusal, and a fault (no declared status) carries nothing.
  • Published text: the changeset, the approvals.mdx callout and the ApprovalDecisionResult.resumed docblock were read sentence by sentence against the code and the pins. "Both are absent when the run met a fault rather than a refusal" is pinned by the reverse control. "draw a fault edge … the decision then answers normally" is pinned by case 2. The spec edit is comment-only: no schema, .describe() or generated artifact moves.
  • Tests:
    • hook-refusal-after-decision.test.ts is new. It uses the real AutomationEngine, the real update_record and approval nodes, and a data double that throws in resolveHookRefusal's shape.
      • Case 1: no fault edge. It asserts RESUME_FAILED, the decision still approved and the plan still submitted, and that the details equal the four facts plus both members.
      • Case 2: a fault edge. The handler runs, resumed: true, and nothing is left parked.
      • Case 3, reverse control: a fault, so neither member appears.
      • Ablation (source reverted to origin/main): case 1 is red, and cases 2 and 3 stay green. That is expected, because case 2 pins existing engine routing.
    • rest: a new exact-key-set pin on the 500 body. The POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 key-set pins are unchanged.
    • types: round-trip; five malformed shapes each dropped while the facts stand, with the well-formed reverse control; and a refusal member never rescues a partial envelope.
    • No existing test was changed. The engine-double-contract.pinned.json entries are the new double's two verbs.
  • Gates: 72 check-runs on this head, all completed: 60 success, 12 skipped, 0 failed. success includes Lint & Repo Gates, TypeScript Type Check, Test Core (8/8), Test UI (16/16), Type Check UI, Live E2E UI, Check Changeset and PR-body guards (both re-run after the 04:15Z body edit), Governed Surface Queue Guard, Spec property liveness, Build Docs and Check Documentation Links. The local reconciliation: 125 derived gates run, all exit 0, 0 NOT-MEASURED.

Spot checks (mine)

  1. No leak is added on the 5xx. innerRefusal.message is the same diagnostic text the flow doors already serve in FLOW_FAILED details (ruling B′ on A screen flow whose write node is refused shows the end user the engine's raw node text, in English, with the node id and the object API name ("Node 'create_account' failed: create_record(crm_account) failed: …") #24914), and error already carried the reason's prose. userMessage is present only where the producer marked it, which is the 5xx-safe channel ADR-0112 reads.
  2. The recogniser cannot let an unvetted value through. serviceResume copies the engine's members unvalidated. The only path to the wire is strandedDecisionDetails, which rebuilds { code, message } from parsed values and drops any extra key. The types cases pin a non-ledger code, a missing message, a bare string, a blank userMessage and a non-string userMessage.

Deviations recorded (not L1 defects)

  • D1: the card's preferred route is not delivered (a dry-run, then a 4xx, with the request left pending), and neither is the "refusal visible on the request" alternative. The refusal is carried in the 500 answer only and is not stored on the request row. Fixes closes the card on the seat's narrowed acceptance (6936860860), whose "at least" arm (route down a declared failure edge) is met. Reopening POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 B is the maintainer's call, as the seat recorded.
  • D2: Skills-docs: follow-up owed — skills/objectstack-automation/references/state-machines-and-approvals.md. AGENTS.md does not require this line for none with a widening, but the PR declares it. Per the pm-dispatch rule, the seat files the owed card and rewrites the line to follow-up #N before landing.

L2 owed: yes. It is owed at CONTRACT_REVIEW_TIER because of Clause-②: yes (widening) (a published error envelope gains two members) and the non-test packages/spec/src/contracts/approval-service.ts path (comment only). The opus review seat claimed it at 04:19Z (l2-review#4). No record is on this head yet.

Landing tier: check-governed-merges.mjs --pr 34619 reports NOT governed, +458/−6 = 464 lines ≤ 3000. After the L2 PASS on this head and the D2 line rewrite, the area lands it through the ordinary queue.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 95eae72668321d7f8eb2233f80753911e1202288
Local-runs: none
Scope: packages/spec/src/contracts/approval-service.ts + packages/types/src/stranded-decision.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/rest/src/approvals-routes.ts

Inputs read: card #34579 (body and all four comments, including premise correction 6936860860 and the final-head report 6938126740), PR #34619 (body, file list, net diff against main from merge base 8dd8192c), and the check-runs on this head. The remainder of the diff (three test files, content/docs/automation/approvals.mdx, the changeset prose, scripts/engine-double-contract.pinned.json) is the lane seat's ACCEPT at TIER_DEFAULT; the pin ledger and the changeset level are answered below because the seat asked.

Check-runs on this head: every completed run concluded success or skipped, including Test Core shards 1/8 through 8/8, TypeScript Type Check (workspace, source, consumer, debt ledger), all Lint families, Check Changeset (both runs), Spec property liveness, Governed Surface Queue Guard, Build Core, Build Docs, and Test UI 1/16 through 16/16. One run is still pending and is not a verdict: the aggregate job Test Core (in progress); its eight shards are all green.

① Derived judgments

  • StrandedDecisionDetails (@objectstack/types) gains two optional members, innerRefusal?: FlowInnerRefusal and userMessage?: string. Right: both are optional, the four POST /api/v1/approvals/requests/{id}/reject returns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 facts keep their all-or-nothing rule, and the type of innerRefusal is the spec's existing FlowInnerRefusal, no new vocabulary.
  • strandedDecisionDetails (the recogniser) used to return exactly four keys; it now returns four to six. Right: a carrier it accepted before is still accepted with the same four values; a carrier it refused before (a missing or malformed fact) is still refused, and a refusal member never rescues it (the head's own pin, green in CI). A malformed optional member is dropped without dropping the facts. Nothing previously accepted now refuses.
  • Wire: 500 RESUME_FAILED on the approvals decision doors gains two optional top-level body keys, present only when the engine reported them. Right: status, code, the error prose and the four facts are byte-for-byte what main answers; the REST handler has no logic change (it already spreads the recognised envelope), and the no-refusal body keeps its exact six-key set (existing pin unchanged and green).
  • No existing field changes meaning. error is untouched; repairable is still derived from the engine's 'stranded' status alone.
  • packages/spec/src/contracts/approval-service.ts moves a docblock only: no schema, no exported member, no generated artifact. Right, and consistent with green Spec property liveness and type-check runs.
  • scripts/engine-double-contract.pinned.json gains two rows (update, delete) for the new test file's engine double. This is the honest consequence of adding that double, which routes both verbs through assertEngineUpdateDispatch and assertEngineDeleteDispatch; it is a generated coverage ledger that may only grow, no row was removed, and it is not a consequence of the envelope change itself.

② Semver level

  • The changeset declares patch on @objectstack/types, @objectstack/plugin-approvals and @objectstack/rest. Right under AGENTS.md Post-Task item 3: Metadata-protocol: none takes patch, and a non-protocol widening ships patch. Nothing a metadata author can write changes, so none is the right kind.
  • The declaration Clause-②: yes (widening) is right, on the PR body and in the changeset body alike: a published envelope gains two optional members, nothing previously accepted refuses, and no envelope field changes meaning.
  • @objectstack/spec is not named in the changeset although its contracts file moves. Accepted: the move is a comment, and spec sits in the same fixed release group as the three named packages, so it versions with them. Check Changeset concluded success.

③ Boundary flags

  • Open question 1 (route a contract review): answered by this record.
  • Open question 2 (userMessage beside innerRefusal, beyond the premise's wording): option A, carry both, is upheld. The dev's measurement holds in the tree on main: resolveHookRefusal builds SandboxError(err.message, answer.message, { code, status, userMessage: answer.message }), so .message stays the wrapper hook 'NAME' threw: …; refusalCarriedBy sets innerRefusal.message from resolveThrownHttpError(err).message, which is that .message; the declared, localized sentence is only on .userMessage. Shipping innerRefusal alone would miss the card's narrowed acceptance line (the approver gets the hook's readable refusal).
  • Premise note: the seat's premise called innerRefusal the hook's localized text; the dev narrowed that by measurement and the narrowing is correct as above.
  • Deviation, package suites ran one commit earlier: accepted; the final commit moves only the two test files and the pin ledger, and the check-runs on this head are the verdict.
  • Deviation, review request not sent by the dev: no effect on the contract.
  • Dev flag security_findings: none, and the seat's disclosure question: agreed, no new disclosure. On main the same response already returns the same diagnostic text in error: the update_record arm reports update_record(OBJECT) failed: plus the thrown message, the engine prefixes the node id, serviceResume puts that in its error, and resumeRecordedOutcome appends it to the RESUME_FAILED prose the REST door serves. innerRefusal.message is a substring of what the caller already receives, userMessage is the hook author's own declared sentence for whoever performs the write, and the flow doors already serve the same pair. A crash (no declared 4xx) carries no innerRefusal at all.
  • Out-of-scope finding, Skills-docs: follow-up owed: the skills text on main is not made false. skills/objectstack-automation/references/state-machines-and-approvals.md says nothing about RESUME_FAILED, stranded runs or the envelope; skills/objectstack-api/SKILL.md teaches the flow doors' read order (top-level userMessage, then details.innerRefusal, then message), which stays true and which a client SDK caller can also apply here. The follow-up is additive teaching. The PR names the path but links no card number; the seat should file or link that card before landing.
  • SQL push-down: no finding. The diff adds no query, no id materialisation and no in-app join.

④ Design judgment

packages/spec/src/contracts/approval-service.ts (the hits file), against the rulings it cites and its first consumer:

Implementing files, sentence by sentence:

  • packages/types/src/stranded-decision.ts: agrees. The recogniser validates code against the closed ErrorCode set and message as a string, which is exactly FlowInnerRefusalSchema's shape, and reads userMessage through declaredUserMessage, so a blank or non-string value is not a marking. Every code the engine can produce here comes from resolveThrownHttpError or the ruled unique-violation spelling, so a real refusal is never dropped by the validation. @objectstack/spec is already a declared runtime dependency of this package and ErrorCode is already imported at runtime one file over, so no dependency edge is added.
  • packages/plugins/plugin-approvals/src/approval-service.ts: agrees. serviceResume keeps the two members beside resumeCode and resumeStatus and attaches nothing when the engine reported neither; resumeRecordedOutcome spreads them after the four facts, so they cannot overwrite a fact. Every door that resumes through resumeRecordedOutcome carries them. The RESUME_IN_PROGRESS exit and the log line are unchanged.
  • packages/rest/src/approvals-routes.ts: agrees. Comment only; the spread is still gated on code === 'RESUME_FAILED' and a recognised envelope, and the head pins the exact eight-key body.

Break attempts that did not break it: a carrier with a code outside the ledger, a missing message, a string in place of the object, a blank userMessage, and a partial envelope with valid refusal members are all handled as the docblocks say; a fault (no declared status) carries neither member; a test double returning nothing from resume is still read as success.

No must-fix, no should-fix.

Nits, both left as accepted deviations (a fix on these files would move the head):

  • N1 (nit) — the spec paragraph, and the changeset after it, say both members are absent when the run met a fault. refusalCarriedBy reads userMessage off any throw that marked one, whether or not its declared status is in the 400 range, while innerRefusal needs a declared status in that range, so userMessage can in principle be present alone. Each member is declared optional on its own and the @objectstack/types docblock states the exact rule (absent when the run met no marked refusal), so no consumer branch is wrong; the wording inherits the same looseness from AutomationResult.userMessage on main.
  • N2 (nit) — the refusal reaches only the thrown envelope. The recall door and the subflow-parent strand report a stranded run on a success answer through resumeFailure, which carries no refusal. That is outside this card and the spec text already separates the two channels; a follow-up card can decide whether ResumeFailureReport should carry the same pair.

Observation outside the diff, not a finding on this head: innerRefusal.message for a sandboxed hook is the debug wrapper naming the hook, at this door and at the flow doors alike, where the data doors answer the hook's own sentence in message. That is ruling B′'s existing behaviour on main; the marked userMessage is what makes the answer readable, which is why carrying it here is necessary.

Implemented-by: claude/project-thread-xczkxx
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

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/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants