Repository navigation
fix(automation): a branch whose subflow or map child parks, where the run cannot park, fails the run instead of dropping work - #39030
Conversation
… at run time Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…roval rig Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
… of them may still pause Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…bflow-branch-pause-lost
…rding call Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 11 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 10022e12664fcfecc36dad263d1a60f2c7e401b3 && git checkout 10022e12664fcfecc36dad263d1a60f2c7e401b3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 356b8744af0f29d9e9dd059d938dc138f6cbc100 bb04e46ae6ce41029fe996701a4afa64700babad && git checkout -B drift-repro 356b8744af0f29d9e9dd059d938dc138f6cbc100 && git merge --no-ff bb04e46ae6ce41029fe996701a4afa64700babad
node scripts/docs-audit/affected-docs.mjs --json 356b8744af0f29d9e9dd059d938dc138f6cbc100
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 90d4d51 · 2026-12-02T04:06Z |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 CI reading · 2026-12-02T04:10Z · head |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Faces. The file list touches none of the four L2 faces: no non-test path under ① Derived judgmentsMeasured on the real
② Semver level
③ Boundary flags
④ Design judgment
Findings: must-fix 1 (item 4). Should-fix 3 (items 5, 6, 7). Nits, no effect on the verdict: the at-the-pause judgement (item 3); the retry policy (③, follow-up card); "an administrator recalls it" beside the sweep; in a region body a branch shape's child is cancelled under the branch reason and log phrase while the run reports the region refusal; the unit file does not pin the wait arm. Runs. All in
Implemented-by: VERDICT: FAIL |
…econd pause fails the parked run Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…s (N1, N2 both orders, P1b, N4, late region refusal) Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…ns the reviewer's M1 in both arrival orders Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…-code and plugin-type sentences Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…bflow-branch-pause-lost
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 81efb0b · 2026-12-02T05:39Z Delta of record 7335051595 (FAIL), on the patch round reported in 7336138269. |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Faces. Delta review of my own FAIL record at What changed. The wait is gone. A fan-out answers at its first rejection, as ① Derived judgmentsMeasured on the real
② Semver levelUnchanged from round 1 and still right: ③ Boundary flags
④ Design judgment
Findings: must-fix 2 (items 6, 7). Should-fix 4 (items 8, 9, 10, 11). Nits, no effect on the verdict: on a failure that arrives first, a sibling's parked child is cancelled with "the run that started it failed at a branch that could not carry the pause" when the cause was an ordinary error, and inside a Runs. All in
Implemented-by: VERDICT: FAIL |
…bflow-branch-pause-lost
The watch that fails a run after it answered `paused` now acts on the pause it was armed for, not on the run id: it enters the in-process resume gate (waiting its turn), leaves a run no longer parked at the watched node and correlation alone, and claims against that pause. It acts on the first late suspension or pause refusal instead of once every branch has settled. A parent whose own pause is not yet stored when the ancestor walk reads it is handed the failure and fails itself from its store step. The watch never rejects, its terminal write is guarded, and its log line says what happened. Pins: re-park on a wait and on a call, resume wins, two late branches, a never-settling sibling, the gate with no store, a parent and grandparent under a slow save, ObjectStore-shaped jitter, a throwing history sink, a store that cannot be read or claimed; on the approval rig the b_review re-park in both late shapes and resume wins. Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…in; the resume gate holds its set The fault handler of the late-branch watch moves into late-branch-watch.ts, so `AutomationEngine.watchLateBranches` delegates in one call (check:facade-delegation-only). `ResumeGate` keeps its run ids in a set of its own instead of extending `Set`, so no `super.delete()` reads as an unplaced write (check-tenant-audit-census). Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
…bflow-branch-pause-lost
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 {
"issue": 38876,
"status": "done",
"branch": "claude/issue-38876-subflow-branch-pause-lost",
"pr": "https://github.com/objectstack-ai/objectstack/pull/39030",
"session": "session_01QSeKYnrQ7UMtHofKQVjcH2",
"premise_still_valid": true,
"head": "cde1774909ae345bfb374ab3f5768564e9a1c052",
"summary": "Fix round on the contract review 7336913949, direction kept (no wait; a late watch fails the parked run after the answer). The watch moved to late-branch-watch.ts and now binds to the pause it watched: it takes the engine's in-process resume gate (ResumeGate, waiting its turn), leaves a run not parked at the watched node+correlation alone, claims against that pause, acts on the FIRST late suspension or pause refusal through a per-arrival feed, never rejects, guards its failed-record write and picks its log line by outcome. The ancestor walk leaves a pending failure under each parent id before reading it, and a parent whose pause was not stored yet takes it from its own store step, so no parent stays parked on a child the watch failed. CI's red 'Lint · repo & tooling gates' at f7912ecccf (check-facade-delegation-only N6: the engine member held a body) is fixed at 162712650a (that job success there); cde1774909 is a merge of origin/main. Item dispositions: 6 fixed, pinned by unit 'RE-PARK on a wait' / 'RE-PARK on a call' and integration 'RE-PARK' x2 (b_review); 7 fixed, pinned by unit 'save 60 ms, read 2 ms' (parent, grandparent) and the 40-trial ObjectStore-shaped jitter case; 8 fixed (watch enters the same gate, waiting), pinned by 'NO STORE ... gate held' and 'NO STORE: a resume in flight'; 9 fixed (catch inside watchLateBranches, recordLog guarded, outcome-chosen line), pinned by 'a history sink whose terminal write throws' and 'a store whose load/claim fails'; 10 fixed (feed delivers each rejection as it arrives; LateBranches.feed doc replaces readonly rejections), pinned by 'the FIRST late suspension acts' and 'TWO late branches'; 11 fixed: resume-wins, re-park, two late branches, parent under store latency all pinned with gate nodes, the PR body's 'not pinned' sentence is dropped in the proposed body; nits: process-memory sentence added to the header, late-branch-watch docblock, changeset and flows.mdx; cancelled-child reason for an ordinary-error first rejection now says another branch failed first. The nested-forks message attribution nit and the try_catch nit were not addressed (not in the dispatch's list). PR body NOT patched by me (see open_questions); proposed body is at the path named there.",
"tests": "At 162712650a (cde1774909 = + merge of origin/main): service-automation full `pnpm exec vitest run --maxWorkers=2`: Test Files 304 passed (304), Tests 4514 passed; plugin-approvals full: Test Files 146 passed (146), Tests 2335 passed. Measured set (service-automation rebuilt before each): unablated branch-suspension-refusal.test.ts 26 passed, flow-route.integration.test.ts -t 38876 13 passed | 29 skipped, held-suspension-steps-38988 4 passed, approval-fanout-late-steps-38988 17 passed. Ablation L (watchLateBranches returns at once): unit 17 failed / 9 passed, integration 7 failed / 6 passed, held 4 passed, fanout 17 passed. Ablation S (runSequentialBranch always rethrows): unit 6 failed / 20 passed, integration 4 failed / 9 passed, held 4 passed, fanout 17 passed. Previous head 81efb0ba63's engine against the new pins: unit 13 failed / 13 passed (every new race-arm case red), integration 3 failed / 10 passed (the three new cases red; RESUME WINS red partly on line wording). Restore after each ablation: git checkout of the mutated file, git status clean, dist rebuilt clean before the full suite. At cde1774909: branch-suspension-refusal + held-suspension 30 passed.",
"gates": "Local: `node scripts/pm/dispatch-gates.mjs --commands` = 109 families, all exit 0 captured before any pipe (check:query-options-erasure exit 124 at a 300 s timeout once, rerun exit 0 in 580 s; node scripts/check-tenant-audit-census.mjs exit 1 on an untyped `super.delete()` receiver in ResumeGate, fixed by composition, rerun exit 0); `--ran` 109 derived, 109 run, 0 NOT-MEASURED, 0 UNRUN. pnpm check:facade-delegation-only exit 0 and its --self-test exit 0 (44 cases); `pnpm --filter @objectstack/service-automation run typecheck` and plugin-approvals typecheck exit 0. CI at 162712650a: Lint · repo & tooling gates success, Lint & Repo Gates success, Lint · ESLint success, Lint · PM dispatch-gates success, Lint · CI, release & engine gates success, Lint · docs & code guards success, Lint · scoped · tooling self-tests success; Test Core shards in_progress when read. CI at cde1774909: NOT MEASURED (just pushed).",
"mcp_calls": "0",
"api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/39030/comments (this report, via post-stamped.mjs); git pushes (3, not REST): f7912ecccf, 162712650a, cde1774909",
"classifier_refusals": [],
"open_questions": [
{
"question": "The dispatch asks me to update the PR body; the agent contract says a dev writes the PR body only at pr_create and the seat writes later edits. I followed the contract and did not PATCH it. Which applies?",
"options": [
"A: the seat PATCHes PR #39030's body with the proposed text at /tmp/claude-0/-home-user-objectstack/96353139-b75c-518e-b0e8-54f835f491d0/scratchpad/issue-38876/prbody.new.md (same container; every sentence re-measured at 162712650a/cde1774909, the 'not pinned' sentence removed)",
"B: the seat re-dispatches with an explicit PATCH permission and I write it"
],
"recommendation": "A, because it keeps the write with the seat as the contract says and the text is ready"
}
],
"security_findings": "none",
"out_of_scope_findings": [],
"deviations": "Merged origin/main twice (d5c2223282 at start, cde1774909 at end), never force-pushed, PR left draft, auto-merge not enabled. The derived gate chunk 1-40 was moved to the background by the harness (not by me) and its completion was read before reporting; it ran partly over a tree being edited, and the two gates touched by later edits were rerun on the final tree. late-branch-watch.ts is new (the >1,000-line rule: engine.ts only gained host wiring, a field and an import)."
} |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head cde1774 · 2026-12-02T07:48Z Delta of record 7336913949 (FAIL), on the fix round reported in 7338592320. The PR body was patched by the seat with the dev's measured text (read-back identical, 17619 bytes). |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Faces. Second delta review of my own FAIL record at What changed. The watch moved to ① Derived judgmentsMeasured on the real
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgment
Findings: must-fix 0. Should-fix 1 (item 8). Nits, no effect on the verdict: the Runs. All in
Implemented-by: VERDICT: FAIL |
…stead of being refused The late-branch watch takes the run's resume gate before it has read whether the run is still at the pause it watched. A resume that met it there was answered RESUME_IN_PROGRESS and never retried, so a child's bubble or an approval decision on a run the watch then left alone was lost: the parent stayed parked on a completed child, the decided request's flow never moved. The gate now knows when the watch holds it undecided. A resume that meets it then waits for the watch's read and claim (never for a release hook), goes on when the watch leaves the run alone, and is refused as before once the watch has claimed the pause. The ancestor walk's failure no longer skips the late child cancels, and a refused branch's child is cancelled with a reason that stays true when the run has moved on. Pins: the child's bubble and the b_review decision with the watch's store read held in flight, the at-pause arm under the same hold, and a sink that throws on the parent's terminal write only. Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 {
"issue": 38876,
"status": "done",
"branch": "claude/issue-38876-subflow-branch-pause-lost",
"pr": "https://github.com/objectstack-ai/objectstack/pull/39030",
"session": "session_01QSeKYnrQ7UMtHofKQVjcH2",
"premise_still_valid": true,
"head": "bb04e46ae6ce41029fe996701a4afa64700babad",
"summary": "Round-3 item 8 fixed by the second route (the gate's other users wait), narrowed so it cannot deadlock: ResumeGate now knows when the late-branch watch holds it UNDECIDED (taken, run not yet read and claimed). resumeInternal waits, before its unchanged synchronous has/add guard, while the watch is undecided; the watch marks the gate decided right after its claim succeeds and before forgetSuspendedRun fires any release hook, so a waiting resume goes on when the watch leaves the run alone (moved-on, lost claim, unreadable store) and is answered RESUME_IN_PROGRESS as before once the watch acts. Nits: a throw in the ancestor walk is caught and said at error, so the two late-child cancels and the FAILED line still run; refuse() cancels a refused branch's child with a reason true whether the run then fails or had moved on. Header, changeset and flows.mdx gained one sentence each; the proposed PR body is in the scratchpad (not patched).",
"items": {
"8 (should-fix, watch refuses a resume of a run it then leaves alone)": "fixed: undecided gate hold; resumes wait for the watch's read and claim only. Pinned on the engine (child bubble while the watch's store read is held: parent completes) and on the approval rig (b_review decided while the read is held: [true, true], run completed); both red on cde1774909's engine (parent paused; [true, false]). The at-pause arm is pinned too (resumeInternal under the same hold answers RESUME_IN_PROGRESS, run failed; green on both heads).",
"nit: late sequential refusal meeting a moved-on run cancels its child with 'the run that started it failed'": "fixed: refuse() reason is now 'a branch of the run that started it was refused because it could not carry the pause, so nothing will resume this run: MESSAGE'. Not pinned (reason text, no consumer parses it). The two sibling spellings in runConcurrentBranches/refuseConcurrent and the region one in dag-traversal were left as they were.",
"nit: parent-only throwing sink on the walk path skips the two cancels": "fixed: failParkedRun catches a throw from failAncestorsAfterLateFailure, logs it at error with the remedy, and returns 'failed', so actOnLate cancels both children and writes the FAILED line. Pinned (red on cde1774909).",
"nit: try_catch wording": "left, as ordered.",
"texts": "header (late-branch-watch.ts steps 1-2 and the ResumeGate docblock), changeset and flows.mdx: one sentence added each (a decision arriving during the read is held, not refused, and goes on when the run moved on); 'left as it is' now true. Proposed PR body also fixes the two round-3 placement nits (the late watch no longer listed under branch-suspension-refusal.ts; runSequentialBranch moved under it)."
},
"tests": "At bb04e46ae6, tree clean. branch-suspension-refusal.test.ts: 29 passed (26 + 3 new). flow-route.integration.test.ts -t 38876: 14 passed (13 + 1 new). held-suspension-steps-38988: 4 passed. approval-fanout-late-steps-38988: 17 passed. service-automation full: 304 files, 4517 tests passed. plugin-approvals full: 142 files / 2314 tests passed, 4 files failed to resolve @objectstack/trigger-record-change (not built in this worktree); after building it, those 4 files: 22 passed. Typecheck service-automation exit 0; plugin-approvals exit 0 after building connector-slack (before: one TS2307 in the untouched approval-requested-slack-dm test). New pins against cde1774909's engine (its three changed sources restored, dist rebuilt): unit 2 failed / 27 passed (bubble case: expected 'completed', received 'paused'; sink case: no ancestor line), rig 1 failed / 13 passed (expected [true,true], received [true,false]). Ablation L (watchLateBranches returns at once): unit 20 failed / 9 passed, rig 8 failed / 6 passed. Ablation S (runSequentialBranch always rethrows): unit 6 failed / 23 passed, rig 4 failed / 10 passed. Every variant restored from HEAD with git restore --staged --worktree; status clean after each.",
"gates": "dispatch-gates --commands at bb04e46ae6: 109 families; 105 exit 0 (each captured before any pipe); 4 exit 3 PREREQUISITE NOT MET, recorded NOT-MEASURED and left to CI: check:dual-build-cjs-loads, check:i18n, check:published-readme-exports, spec check:skill-examples (built output of packages outside this diff's closure). --ran: 109 derived, 105 run, 4 NOT-MEASURED, 0 UNRUN. PR check-runs at bb04e46ae6 when read: 42 completed/success, 17 completed/skipped, 0 failed, 0 pending.",
"mcp_calls": "0",
"api_writes": "2 - git push of bb04e46ae6 (not REST); this report comment via post-stamped.mjs (POST issues/39030/comments). PR body not written.",
"classifier_refusals": [],
"open_questions": [
{"question": "The dispatch said to merge origin/main if behind; AGENTS.md Multi-agent discipline 10 says that once the PR is open, main is merged only on a reported conflict, a main-caused CI red or a queue removal. The branch is 9 commits behind, GitHub reports mergeable clean, and none of those commits touches a file of this PR, so I did not merge.", "options": ["A leave as is", "B merge on the seat's word"], "recommendation": "A, because AGENTS.md outranks the dispatch and nothing in the incoming range overlaps"}
],
"security_findings": "none",
"out_of_scope_findings": [],
"deviations": "Did not merge origin/main (see open_questions). restoreConsumedSuspension still answers RESUME_IN_PROGRESS while the watch holds the gate undecided: it is not a resume and is operator-retryable; said in the proposed PR body. Ablations L/S were not re-run against held-suspension-steps-38988 and approval-fanout-late-steps-38988 this round (both green at the head)."
} |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head bb04e46 · 2026-12-02T09:50Z Delta of record 7339338916 (FAIL, 0 must-fix, 1 should-fix: item 8), on the fix round reported in 7341539338. The PR body was patched by the seat with the dev's proposed text (read-back identical, 20245 bytes). The branch is not merged with |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Faces. Third delta review of my own record at On not merging main. I agree. What changed. ① Derived judgmentsMeasured on the real
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgment
Findings: S8: closed No must-fix, no should-fix. Nits and notes, no effect on the verdict: the Runs. All in
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39030 (#38876) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Landing · PR #39030 · head
Status: ready + auto-merge armed on L1 ACCEPT 7342379498 and delta PASS 7342344440. #38876 keeps |
Part of #38876
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The run-time door of the limit #3267 ruled 禁, for the two shapes the parse rules of #38871 and #38970 cannot see because a
subflow/mappauses only when the child flow it names does (ruling D: not judged by type).service-automation/src/branch-suspension-refusal.ts:FlowBranchSuspensionRefusalError(anError, recognised by a registered symbol, branded a guard refusal viamarkGuardRefusal, carryingshape,forkNodeId,suspendedEdge,suspended[]with each child flow,untakenEdges[]), the two traversal helpers and the late feed:runConcurrentBranches: the unconditional bucket. The node answers at its FIRST rejection, at the moment it arrives, asPromise.alldid, so a pause is never delayed and nothing ever waits on a sibling. First a suspension with nothing else collected yet: it is thrown, the run parks and its pause is stored exactly as before (same moment, step log ending at the node it parked on), and the branches still running are recorded on the signal. First a suspension with a second suspension or a pause refusal (branch or region) already collected when the frame resumes: the refusal is thrown at once, nothing is stored, every parked child cancelled. First anything else: thrown as before, and a branch that suspends after it has its child run cancelled.runConcurrentBranchesrecords, on the signal it throws, a feed of the fan-out's later rejections that hands each one over the moment its branch rejects (never once every branch has settled).runSequentialBranch: a conditioned orisDefaultbranch that suspends while the traversal still has an edge to take after it (a later conditioned edge whose condition holds at the pause, on any node but an exclusivedecision; a laterisDefaultedge; any unconditional edge) is the sequential refusal, thrown at once (sequential edges are awaited anyway, so nothing waits that did not before). Nothing left to take: the suspension is re-thrown untouched.service-automation/src/late-branch-watch.ts:watchLateBranches, armed by the three places that store a pause (execute, a retry attempt inexecuteWithoutRetry, a resume that parks again inresumeInternal) right after they stored it, never awaited, and never rejecting (a fault inside is said aterror). It acts on the FIRST late suspension or branch/region refusal, bound to the pause it watched: it enters the engine's in-process resume gate (ResumeGate, theresumingsetresumetakes, now able to be waited on) UNDECIDED, reads the run strictly, leaves it alone unless it is still parked at the watched node with the watched correlation, claims that pause throughclaimAdvance(which compares the same node and correlation), marks the gate decided, writes thefailedrecord from the stored pause (the write guarded assettleUnresumableSuspensionguards it), fails the ancestors, and cancels every child run the suspensions parked. A run a decision has moved on (finished, or parked again elsewhere) keeps its new pause and that pause's child; the late child is cancelled and oneerrorline says the run had already left that pause. While the gate is undecided, a resume that meets it (a child's bubble to its parent, an approval decision) waits for the watch's read and claim instead of being refused: it goes on when the watch leaves the run alone, and is answeredRESUME_IN_PROGRESSas before once the watch has claimed the pause. It never waits on a node's release hook, so a hook that resumes the run is answered, never deadlocked. A throw while failing an ancestor is said aterrorand no longer skips the late child's cancellation. A store that cannot be read or claimed gets its ownerrorline (the run may still read paused, cancel it withcancelRun), never the moved-on one. The ancestor walk leaves a pending failure under each parent's id BEFORE reading it; a parent the read finds is failed by the walk, one whose pause is not stored yet takes the entry from its own store step (the samewatchLateBranchescall) and fails itself, so no parent stays parked on a child the watch failed. The watch lives in process memory: an engine restarted between the store write and the late settle keeps base's behaviour.parked-child-cancel.ts:runRegion's child-run cancellation (the strict chain read, deepest first, the twoerrorlines), moved out unedited apart from the location phrase, so the region refusal and the branch refusal call one copy. The region's log text is byte-identical.dag-traversal.ts:traverseNextcalls the two helpers;runRegionre-raises a branch refusal met inside a region body as the region refusal (the containers know that type, and a region cannot pause on any branch), calls the shared cancel, and cancels what a converted suspension's late branches park;executeWithoutRetryarms the late watch after storing its pause.engine-run-facet.ts,run-resume.ts:executeandresumeInternalarm the late watch after storing a pause;resumeInternalwaits, before its synchronous gate check, while the watch holds the gate undecided.engine.ts:watchLateBranches(a host of forwarders and one forwarding call;check:facade-delegation-onlygreen),resumingis aResumeGate(samehas/add/delete, plus the watch's undecided hold),pendingAncestorFailuresis a bounded map (1000, oldest first), thetraverseNexthost carriesresolveSuspensionChainForCancelandcancelRun, and three hosts carrywatchLateBranches.dry-run.ts: its traversal host carries the two cancel members, which a dry run never reaches (it starts no child run).content/docs/automation/flows.mdx): the two "not judged here" sentences point to a paragraph teaching the run-time refusal, its two messages, WHEN it fires (at once, or after the run answeredpaused), what is cancelled and what is left. Changeset@objectstack/service-automationpatch.Not built: the arming half. Two reasons, both outside this claim's file surface and both contract changes: a declined flow reports an
unboundCausefrom the sealed listFLOW_UNBOUND_CAUSESinpackages/spec/src/contracts/automation-service.ts(no member fits; reusingsuspending_subflow_in_regionwould make/_statuslie), and the traversal model the arming reader needs (which out-edges run together, which before which) is private topackages/spec/src/automation/flow-concurrent-pause.ts. Reported to the seat as a decision with options; this PR leaves the card open.Read first
packages/services/service-automation/src/late-branch-watch.ts,ResumeGate,failParkedRunandfailAncestorsAfterLateFailure: the risk is the late failure of a run already answeredpaused: the gate and its undecided hold (wheredecideis called, before the release hook), the watched-pause check before the claim, and the set-before-read hand-over to a parent not yet stored.packages/services/service-automation/src/branch-suspension-refusal.ts,runConcurrentBranches: the first rejection answers at once; the feed hands later ones over as they arrive.packages/services/service-automation/src/dag-traversal.ts,traverseNext:takenAfterwardsandwouldHoldjudge the later edges only after a suspension, so a traversal that does not pause evaluates exactly what it did.Tests
Measured first, through
registerFlow+ execute on the real engine and approval service (a scratch file on this rig, deleted), against the base dist:a_reviewbesidesub, child parks onc_review):paused, two pending requests, two suspensions. Child decided first: child[finalized, resumed] = [true, true], the parent runcompletedwith stepsstart, a_review, anda_review's decision threwRESUME_TARGET_LOST, the request stillpending. Parent decided first: both decisions[true, true], the work aftersubnever ran.x1 -c1-> sub,x1 -c2-> s_sync, bothtrue):paused,c_reviewdecided[true, true], the runcompletedwith stepsstart, x1, sub;s_syncnever ran.failedwith the named refusal, the child runcancelled, nothing parked.Pinned:
plugin-approvals/src/flow-route.integration.test.ts, top-level describe[#38876](one ObjectQL inbeforeAll(() => boot(), 30_000),afterAlldestroy), 14 cases: 5 refusals (concurrent with asubflow, with amap, twosubflows with an approval child and a timer child; sequential conditioned; sequentialisDefaultbeside an unconditional sibling), the contract review's M1 in both arrival orders (an approval besidex1, whose true edge enters the subflow before a later true edge: approval parks first, the refusal arrives after and fails the parked run; adelaybefore the approval, the refusal arrives first and fails the run at execute), the race arms on agatenode the case opens (RE-PARK:a_reviewapproved parks the run atb_review, then a late timer-child branch suspends, or is refused as sequential: the run is left atb_review, one moved-on line,b_review's decision completes it, nothing parked; RESUME WINS:a_reviewapproved completes the run, then the late branch suspends: stillcompleted, the late child cancelled; DECIDED IN THE WINDOW:a_reviewapproved parks the run atb_review, the late branch suspends, andb_reviewis decided while the watch's store read of the run is held in flight: the decision answers[finalized, resumed] = [true, true], the run is left alone andcompleted, nothing parked), and 3 controls (one pausing branch beside a synchronous one parks and completes withs_afterrun; the call branch taken last; a later sibling whose condition is false at the pause). The refusal helper reads a late failure throughgetRunand waits for every run to leave the store.service-automation/src/branch-suspension-refusal.test.ts, 29 cases on timer children: concurrent and sequential; the refusal's fields / symbol / guard brand; the region boundary insideparallelandtry_catchbodies; the contract review's N2 (refusal late: answeredpaused, thenfailed, resume refused, nothing parked, the stale-answererrorline), a parent waiting on that run as asubflowfailing with it, N2b (refusal first:failedat execute), N1 (an outer wait beside an inner fan-out to two parking calls), a region refusal collected late; P1b (a wait beside a call whose child CAN park and does not: stored steps exactlystart, fork, hold, the run stayspaused); N4 (a sibling that may pause and never settles:pausedwithin the bound, the suspension stored athold); and the one-pausing-branch control. The race arms, each put inside its window by agatenode the case opens: RE-PARK on a wait and on a call (the run stays athold2, the second pause's child row untouched, the next decision completes it); RESUME WINS; TWO late branches (onefailedrecord, one line, both children cancelled); the FIRST late suspension acts beside a sibling that never settles; NO STORE with the gate held (the watch waits, then fails the run still at its pause) and with a resume in flight (completed, never failed); a parent and a grandparent whose save takes 60 ms against 2 ms reads, the late branch released as that save starts (every ancestorfailed, nothing parked); ObjectStore-shaped jitter, save two round trips and load one, each 1 to 6 ms, 40 seeded trials (no parent parked); a history sink whose terminal write throws (no unhandled rejection, the run still failed, the write failure said); a store whose load or claim fails after the pause (the may-still-read-paused line, never the moved-on one). With a store whose read of the run can be held in flight: the run parked again on a call, the late branch suspends, and the child of that call completes while the watch's read is out, so its bubble meets the watch (the bubble waits; the run is left alone and the bubble completes it); the same hold at the pause the watch watched (a resume throughresumeInternalis answeredRESUME_IN_PROGRESSonce the watch claims it, and the run isfailed: one actor). A history sink that throws on the PARENT's terminal write only, the parent read by the walk (the late child is still cancelled, and the ancestor failure is said).Suites and typecheck at bb04e46
pnpm exec vitest run --maxWorkers=2inservice-automation: Test Files 304 passed (304), Tests 4517 passed (4517).pnpm exec vitest run --maxWorkers=2inplugin-approvals: Test Files 142 passed, Tests 2314 passed; the other 4 files (save-notice-approval-round-trip, threestatus-mirror-*) failed to resolve@objectstack/trigger-record-change, which was not built in this worktree; after building it they ran alone: 4 files, 22 tests passed.branch-suspension-refusal.test.ts29 passed;flow-route.integration.test.ts -t 3887614 passed;held-suspension-steps-38988.test.ts4 passed;approval-fanout-late-steps-38988.test.ts17 passed.pnpm --filter @objectstack/service-automation typecheck: exit 0.pnpm --filter @objectstack/plugin-approvals typecheck: exit 0 once@objectstack/connector-slackwas built (before, one TS2307 in an untouched test file that imports it).node scripts/pm/dispatch-gates.mjs --commands: 109 families; 105 exit 0; 4 refused with exit 3, PREREQUISITE NOT MET (built output of packages outside this diff's closure):check:dual-build-cjs-loads,check:i18n,check:published-readme-exports, speccheck:skill-examples, left to CI.--ran: 109 derived, 105 run, 4 NOT-MEASURED, 0 UNRUN.The contract review's round-3 item 8, previous head cde1774 against this head
The new pins run against cde1774's engine (its
late-branch-watch.ts,run-resume.tsandbranch-suspension-refusal.tschecked out, dist rebuilt): unit 2 failed / 27 passed (the bubble case: the parent stayspaused, expectedcompleted; the parent-only sink case: no ancestor-failure line); integration-t 388761 failed / 13 passed (the decision in the window answers[true, false], expected[true, true]). The at-pause case is green on both: that arm answeredRESUME_IN_PROGRESSbefore and still does.Ablation (service-automation rebuilt each time; restored from HEAD, tree clean)
watchLateBranchesreturns at once: unit 20 failed / 9 passed; integration-t 388768 failed / 6 passed.runSequentialBranchalways rethrows: unit 6 failed / 23 passed; integration 4 failed / 10 passed.Acceptance notes
approvalopened before the run was refused stayspending; deciding it answers409 RESUME_TARGET_LOST("Nothing was recorded"): measured for the parent'sa_reviewand forc_reviewin the cancelled child. Loud, not silent, and the region refusal leaves a cancelled child's request the same way. The approvals' sweep of requests whose run has ended (releaseDeadRunRequests) releases it where the deployment schedules that sweep, and an administrator can recall it sooner. The arming half would keep a triggered run from opening it; voiding it on refusal would need the approval node to act on a released suspension (onSuspensionReleased, which it does not implement). Reported to the seat.pausedand the run turnsfailedonce the refusing branch settles (said once aterror, naming the run). A decision that resumes the parked run before that branch settles wins: the run is left as it is, finished or parked again with its new pause and that pause's child intact, the lost branch is logged aterrorand its child cancelled. A decision that arrives while the watch is reading the run waits for that read: it goes on when the run has moved on; when the run is still at the watched pause the watch fails it and the decision is answeredRESUME_IN_PROGRESS(the approval service records it withresumed: false), as before. The watch lives in process memory: an engine restarted between the store write and the late settle keeps base's behaviour (run parked, resumable, no line). No pause is delayed and nothing waits on a sibling: the stored pause, its moment and its step log are base's.Promise.all; the late watch acts only on suspensions and pause refusals. A sibling's parked child cancelled because another branch FAILED first now carries that reason, not the pause-refusal one. UndererrorHandling.strategy: 'retry'the branch refusal is retried, as the region refusal is on base; a non-retryable ruling for both is a follow-up.restoreConsumedSuspension) that meets the watch's hold still answersRESUME_IN_PROGRESS("its outcome is not decided yet"): it is no resume, and the operator's call is retryable.error, and a run failed after it parked keeps the step log it parked with.subflowcalls of the SAME approval child on one record: the second call's step wassuccessin 6 ms with no child run id and no request. The pin uses two different children.Clause-②: no,Metadata-protocol: none, the claim's lines, confirmed by the contract review. Nothing an author writes changes meaning, and every door before a run (validate, save, publish,registerFlow, arming) answers as before; the executions that now fail are exactly those that lost a branch's continuation or a request's resumability.subflow/mapwhose child can suspend (suspendingNode) over the showcase flows (33 flows, 4 calls, 21 multi-out nodes): 0 hits; positive control (the two card shapes) 2 hits. Docs: onemapsnippet, single branch. No other example carries a call.Verification
After
pnpm --filter @objectstack/service-automation build, one command:pnpm --filter @objectstack/plugin-approvals exec vitest run src/flow-route.integration.test.ts -t 38876prints 14 passed; each refusal case reads a run that endsfailedwith an error startingdurable pause on concurrent branchesordurable pause before a later branch.Generated by Claude Code