Repository navigation
fix(approvals): RESUME_FAILED carries the refusal that stranded the run - #34619
Conversation
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>
📓 Docs Drift CheckThis PR changes 4 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 6 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 178 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
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>
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 95eae72 · 2026-11-17T04:19Z |
|
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: Read from GitHub at this head ( Checklist
Spot checks (mine)
Deviations recorded (not L1 defects)
L2 owed: yes. It is owed at Landing tier: |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: 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 Check-runs on this head: every completed run concluded ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implementing files, sentence by sentence:
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 No must-fix, no should-fix. Nits, both left as accepted deviations (a fix on these files would move the head):
Observation outside the diff, not a finding on this head: Implemented-by: VERDICT: PASS |
Requested by Steve · project thread
Fixes #34579
Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: follow-up #34637
维护者速读
POST /api/v1/approvals/requests/{id}/rejectreturns 500 while its effect lands AND strands the workflow run — three inconsistent outcomes from one call #13807 裁决仍是 500,决定照旧记下;错误体新增innerRefusal(拒绝码和原文)和userMessage(钩子声明的、按调用者语言的那句话),审批人能看到为什么。POST /api/v1/approvals/requests/{id}/rejectreturns 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 形态 4 两条裁决不动);钩子没拒绝而是崩溃时,两个新字段都不出现。@objectstack/types的StrandedDecisionDetails加两个可选成员,属放宽,需契约复审。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—StrandedDecisionDetailsgains two optional members:innerRefusal?: FlowInnerRefusal— the engine'sAutomationResult.innerRefusal(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), the same member every flow door serves inFLOW_FAILEDdetails;userMessage?: string— the refusal's producer-marked end-user text (the engine'sAutomationResult.userMessage).strandedDecisionDetailsvalidates both (ErrorCodefor the code,declaredUserMessagefor the text) and drops a malformed one while keeping the fourPOST /api/v1/approvals/requests/{id}/rejectreturns 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—serviceResumekeeps the engine'sinnerRefusal/userMessagebesideresumeCode/resumeStatusinstead of dropping them, andresumeRecordedOutcomeattaches them to the stranded-decision envelope. Every decision door that resumes throughresumeRecordedOutcome(approve, reject, revise, resubmit, the restored-run continuation) carries them.@objectstack/rest— no logic change:handleApprovalErroralready spreads the recognised envelope into theRESUME_FAILEDbody, so both members reach the wire at the top level. Comment updated.@objectstack/spec—ApprovalDecisionResult.resumeddocblock (contracts/approval-service.ts) names the two members and thefault-edge route. Comment only; no schema or generated artifact moves.Docs —
content/docs/automation/approvals.mdxgains a callout: what the 500 body carries when the step after the decision is refused, and how afaultedge on that step handles it instead.Why
userMessageas well asinnerRefusalMeasured, not assumed: for a hook that declares a
refusalscatalogue, the runtime'sSandboxErrorkeeps the diagnostichook '<name>' threw: …as.messageand puts the declared, localized sentence on.userMessage(resolveHookRefusal/resolveInProcessHookRefusal,runtime/src/sandbox/hook-refusal-catalogue.ts).refusalCarriedBybuildsinnerRefusal.messagefrom.message, soinnerRefusalalone does not give the approver the hook's readable sentence. The flow doors serve the same pair (detailsinnerRefusal+ top-leveluserMessage,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 foundstatusbeing dropped.Verification
packages/plugins/plugin-approvals/src/hook-refusal-after-decision.test.ts(new): the card's flow end to end with a realAutomationEngine, the realupdate_recordnode and approval node, and a data double that throws a declared hook refusal in the runtime's shape.RESUME_FAILED, decisionapproved, plan stillsubmitted, andstrandedDecisionDetails(err)equals the four facts plusinnerRefusal: { code: 'VALIDATION_FAILED', message }and the hook'suserMessage.faultedge on the step: the refusal is routed to the handler,decideanswersfinalized: true, resumed: true, nothing left parked. (Pins existing engine behaviour; green before and after the fix.)approval-service.tsreverted toorigin/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 carriesinnerRefusalanduserMessageat the top level, exact key set pinned. The existingPOST /api/v1/approvals/requests/{id}/rejectreturns 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.95eae72668321d7f8eb2233f80753911e1202288:dispatch-gates --commandsderived 125; all 125 exit 0;--ranreconcile: 125 run, 0 NOT-MEASURED, 0 UNRUN.plugin-approvals122 files / 1723 tests,types40 / 923,rest419 / 8865 (373 skipped), all green;typecheckgreen fortypes,plugin-approvalsandrest. The second commit only touches the two new/edited test files (an unusedfindOnedropped from the new double forcheck:engine-double-contract, and a module-topimport '@objectstack/objectql'forcheck:test-source-alias) plusscripts/engine-double-contract.pinned.json; both test files re-ran green on the final head.git merge-treeat the final head: clean againstorigin/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
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Comment only; no artifact moves.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmT4f9MMpnjemPU3Esb