Repository navigation
fix(approvals): the reconciler keeps what it read, and places a stopped run by the step last decided (ADR-0162 item 8, piece 4 rework) - #38603
Conversation
A subflow step names the run it started on every exit, and a map step the item runs that execution started (childRunIds on the step log, ADR-0162 Execution item 8). A run that ends inside execute answers no runId, so the engine names the run it started for a context (runStartedFor), which the subflow and map nodes read. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
…pproval The door walks the approval's run tree from the run that carries the record through the child runs each step records, so a sibling child, a middle run and a run being advanced are placed (ADR-0162 Execution item 8). The reconciler judges every marked approval oldest first on the sweep clock: a cancelled run, a process that died after a decision, past the age bound a run whose pause is gone or that is parked on an ended child, and a deleted record, whose marks it clears. The stranded-request report leaves stamped requests to it. A refused write tried again leaves its timeline line once. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
…oval leaves Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
… 3 note stays as it is Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
…into claude/project-thread-vpfog9
…hat stopped by the step last decided A run the engine has no row for, or a run still parked at the step its decision was recorded on, has stopped at that step once the age bound passes: where a step can follow it the approval is abandoned and the parked run cancelled; at the last step the outcome is written and the administrators are told. The plugin keeps on the approval's own rows what it read of the runs, so a trimmed history is not needed again. A delegating step names only a run that started, a failure routed to a pause outside the set still abandons, the scan walks past marks that stay, a map item run is followed unless it carries another record, and the stranded report skips only decided stamped requests. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUeibB3Ta1iRyj7Fdn
…nd the placed states do Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUeibB3Ta1iRyj7Fdn
Keeping what the plugin read adds one elevated update of the approval request. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUeibB3Ta1iRyj7Fdn
📓 Docs Drift CheckThis PR changes 4 package(s): 25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 182 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 e90559e317ce2dbe2cbff7113f2bdd25dc2fecda && git checkout e90559e317ce2dbe2cbff7113f2bdd25dc2fecda
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 37e97a83661e1df9b4ad870b311167db32ceb648 46ca8ff5612636c062ab280f4bcccc05cebfc362 && git checkout -B drift-repro 37e97a83661e1df9b4ad870b311167db32ceb648 && git merge --no-ff 46ca8ff5612636c062ab280f4bcccc05cebfc362
node scripts/docs-audit/affected-docs.mjs --json 37e97a83661e1df9b4ad870b311167db32ceb648
|
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS Contract-review-claim: session_01QsR2jSyQBDMyRnrrWKy7WS · head 46ca8ff · 2026-11-29T14:23Z Seat 1's review thread R1 hands this head to the isolated reviewer that rendered record 7255916895 (FAIL on #38571 at |
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS Contract reviewServed-tier: PR #38603, piece 4 of card #37767 reworked, base ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentAgainst the first record, by id. M1: closed. M2: closed, as ruled. A run with no row is no longer cannot tell for good: M3: closed. S1 (should-fix) — still open, in the nested shape. Flat, it is closed: the latest request's own run parked at its own node is S2: closed. S3: closed. S4: closed. S5: closed. See ① item 4. N1, N2 and N3 are closed in the tree. N4 stands as a note for piece 5. New findings. M4 (must-fix) — the kept reading drops every child the walk did not reach, and the next pass then answers finished. In
S6 (should-fix) — S7 (should-fix) — the plugin first reads a passage's child runs one human wait after they ended, and a run with no row is placed wherever it stands in the tree. S8 (should-fix) — the administrators' notice goes out when the outcome was not written. N5 (nit) — the docblock of N6 (nit) — the docblock of N7 (nit) — N8 (nit) — N9 (nit) — where nothing was held back, a placed approval has its marks cleared with no log line, no notice and no cancel, and N10 (nit) — the notice body ends "continue or cancel it", which a run with no row offers no way to do. What was tried and held. The strict read: a throwing store is cannot tell at any age in One must-fix (M4), five should-fix (S1 still open, S6, S7, S8, S9), six nits (N5 to N10). The engine half is closed. The rule the rulings gave is built and its two flat ends are pinned; the kept reading is not yet safe to judge from. Implemented-by: VERDICT: FAIL |
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS The brief the isolated reviewer was handed for contract-review record 7257527251, as it stood (2026-11-29T14:43Z). The reviewer ran at BriefContract review brief — PR #38603 @
|
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS 席位核对 — REWORK · L1 · seat repo:objectstack#1, review thread R1 · Head-sha
|
|
repo:objectstack#1 · zhuangjianguo · session_01QsR2jTsdScTh3o2fSjbxSz 2026-11-29T16:51Z · Superseded, on the maintainer's split ruling 7257604888: the engine half is #38618 (base the trunk) and the rebuilt plugin core is #38634 (stacked on #38618). Claim amendment 7257707926 on #37767 names both branches. This PR closes unmerged; its head 46ca8ff stays readable as the Resume-from of both. |
Requested by Jianguo · project thread
Part of #37767
Supersedes #38571
维护者速读
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none —
skills/names none ofExecutionStepLog,childRunIds,runStartedFor,unjudged_since,reconcileMarkedApprovalsorapproval.flow_not_continued(git grep at this head: 0 hits); the step log is a runtime record no skill teaches an author to writeWhat changes
Piece 4 of #37767, re-dispatched on the maintainer's rulings recorded in 7256254988 (A3, and B2 with the last-step notice, which are one rule), from #38571's head
5a93cb0a76merged with the trunk at37e97a83. It answers contract review 7255916895 (FAIL: M1 to M3, S1 to S5, N1 to N4) and L1 7255963810. Everything in the plugin applies only to an approval the check stamped when it opened, so an object that declares noclosedStatesbehaves as before. #38571's description of the engine half, the tree walk and the reconciler stands; this list is what moved.The ruled rule (A3 + B2), in
approval-service.ts.__runsReadthe runs the plugin read, which of them ended, and a failure between two steps it found in a run that ended, with its instant (keepRunsRead,runsReadAtOpening). No new field: the snapshot is where slice 3 keeps__laterStepNotOpenedand__abandoned. A later judgement merges what every request of the approval kept, does not read a run kept as ended again, and counts a kept failure while no request of the approval opened after it. So a child whose history was trimmed after it was read, and a run that carries the record trimmed while a refused outcome is tried again (the reviewer's retry case), no longer hold the document.undeterminedwithin the age bound (a process may still be moving it). Past the bound they areplaced: the run has stopped at the step last decided. Where that step's node is in the stamped set (a step can follow it), the approval is abandoned as any other, and a run still parked there is cancelled with the runs above it that wait on it through asubflow(cancelStoppedRun). At the last step, the outcome is written in the decider's name, the administrators are told on the new topicapproval.flow_not_continued(reportFlowNotContinued, keyed once per request), and the pause is left for an operator.getRun(runId, { strict: true }); a throw isundeterminedat any age.nullis a missing row.M1.
runStartedForno longer names a run that never started. The note moved below the start-condition gate and the re-entry guard inengine.ts#executeand below the gate indag-traversal.ts#executeWithoutRetry(a retry attempt has no re-entry guard); a run that fails before its first node, which is recorded as failed, is noted there. The docblock and the service changeset say which exits name no run.M2. Answered by the ruling above, not by a guard.
M3. A paused run parked outside the set runs the routed-failure check before it answers, so a failure between two steps routed to a
waitno step follows is abandoned again, as on the base.S1. Ruling B2, above.
S2. The reconciler reads two windows of at most
limitmarked requests, the oldest marks and the next page of a keyset walk by id (reconcileScanCursor), as the stranded-request report does since #37808. Marks that stay in progress or cannot tell no longer keep the newer ones from being read. The docblock's "the oldest is never starved" sentence is gone.S3. A
mapitem run is followed unless it carries another record than the approval's (itstrigger), not only where it holds a request of the approval. An item run kept as carrying another record is not read again.S4. The stranded-request report skips a stamped request only in a decided status (
approved,rejected), which the door and the reconciler judge. A returned stamped request whose run failed after a send-back is reported as on the base.S5.
StepLogEntrydeclareschildRunIds, pinned toExecutionStepLog's member by a type-level assertion instep-child-runs.test.ts; the new test reads it withoutas any.Nits. N1:
stepChildRunsOfand its docblock sit abovestepAdvisoriesOf's docblock. N2:judgeApprovalAfterDoor's docblock describes the tree and the placement. N3: the two bounds of "on every exit" (a pause with no run id, the history compaction of a log of more than 200 steps) are stated onNodeExecutionResult.childRunIdsand in the two nodes. N4: left as the reviewer's note for piece 5 (the age bound is measured from the mark).A stop is answered too. A run that ended on a node of the set counts as ending the approval only where no request of the approval opened after it (
completedAt), as a routed failure already did; a run withoutcompletedAtalways counts.Messages and topics.
approvalFlowNotContinuedTitleandapprovalFlowNotContinuedBodyin all 11 locale packs;approval.flow_not_continuedjoinsPLATFORM_NOTIFICATION_TOPICS(service-messaging).The guide.
content/docs/automation/approvals.mdx, "When the outcome lands on the record": the map item reading, a failure routed to a pause, the kept reading, the two states placed by the step last decided and what each end leaves, and the reconciler's two windows.Changesets. The plugin's and the service's changesets are rewritten to what this head does (the L1's item 6: "
undefinedwhere no run started" now names the gates; "a process that died after a decision" is replaced by the placed states). The spec changeset gains theSkills-docs:line.Not in this PR: the hold (piece 5); ADR-0162 Execution item 8's rewording (the dead-process sentence and B2's placed state), which goes in its own governed PR to the trunk.
Tests
approval-reconciler-37767.integration.test.ts(real kernel, ObjectQL, automation engine and sqlite), 25 cases, 11 new:subflowwhose child flow's start condition is false names no run, and the approval finishes at its last decision.faultedge parks the run at awaitno step follows: abandoned (recalled).mapitem run with no request, whose node fails before its step, routed to its end: abandoned.cancelled. The same at the last step: past the boundapproved, the administrators told, no abandoned notice, the run stillpaused.limit: 1, the newer one is written within three passes.limitrows per window.step-child-runs.test.ts(service-automation), 5 cases, 1 new: a child flow its start condition skips is named neither byrunStartedFornor by the parent'ssubflowstep; plus theStepLogEntrytype pin (compiled by the package's typecheck).Ablations
Each mutation was applied to the committed file, the named test file run, and the file restored from HEAD. Every one reds the test that claims it:
runsReadOfmerges nothing (the kept reading is ignored)getRunread withoutstrictmapitem run is not followed (S3)noteRunStartedback above the gates inengine.ts#execute(M1)step-child-runs.test.ts"no run started" (1)Acceptance notes
voidedRunChain), whose warning now names its caller.Verification
Run locally at head
46ca8ff561, underscripts/pm/os-verify-lock.sh:plugin-approvalsfull suite: 141 files, 2,184 tests passed.service-automationfull suite: 300 files, 4,444 tests passed.dispatch-gatesderives from this PR's own paths against the trunk (124 commands;--base origin/mainswapped for the trunk, because againstmainthe list takes in the whole trunk): all green but two.check:tenant-audit-censusand its self-test went red on the plugin-approvals shard, becausekeepRunsReadadds one elevatedsys_approval_requestupdate. The shard is regenerated with--writein46ca8ff561, and both are now green. Two gates refused before measuring (exit 3) and are left to CI:check:dual-build-cjs-loadsandcheck:i18n. Two more refused for local prerequisites and passed once those were in place: the teardown self-test, after its pinned fixture commit was fetched, andcheck:skill-examples, after@objectstack/client-reactwas built.overlap-check.mjs --base=origin/claude/o5-data-approvals-trunk: VERDICT clean. feat(approvals): the reconciler, and the door reads every run of an approval (ADR-0162 item 8, piece 4) #38571 and feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497 merge cleanly.Human Minimum
packages/specholds no runtime logic (unchanged from feat(approvals): the reconciler, and the door reads every run of an approval (ADR-0162 item 8, piece 4) #38571: one optional field on the step log's schema).pnpm lintis CI's.claude/o5-data-approvals-trunk, per the trunk rule).packages/spec: no change beyond feat(approvals): the reconciler, and the door reads every run of an approval (ADR-0162 item 8, piece 4) #38571's.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUeibB3Ta1iRyj7Fdn