Skip to content

feat(approvals): the reconciler, and the door reads every run of an approval (ADR-0162 item 8, piece 4) - #38571

Draft
objectstack-fleet[bot] wants to merge 5 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-wug0sh
Draft

objectstack-fleet[bot] wants to merge 5 commits into
claude/o5-data-approvals-trunkfrom
claude/project-thread-wug0sh

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #37767

维护者速读

  • 门现在读审批的整棵运行树:从承载记录的运行出发,沿每个委派步骤记下的子运行往下走(兄弟子流程、两层以下的中间运行、正在被推进的运行都能看到),补上第 3 片留下的 S1 缺口。
  • 新增协调器:随清扫时钟运行,按标记从旧到新判定每个没被门判定的审批(取消的运行、决定后进程死掉、父运行被取消);标记超过一小时后,暂停已消失的运行、停在已结束子运行上的父运行都按"停在原处"判定。记录被删除时只清标记、不写不通知。
  • 引擎:子流程和 map 步骤在运行日志里记下它启动的子运行(childRunIds),在调用内就结束的子运行通过 runStartedFor 取到。
  • 本 PR 是第 4 片,基于 trunk;全程锁(第 5 片)随后串行跟进。

Clause-②: yes (widening)
Metadata-protocol: added

What changes

Piece 4 of #37767: ADR-0162 D5 and Execution item 8, bullet "The reconciler", and the door's judgement over every run of the approval, which closes slice 3's S1 (seat ruling (b), recorded on #38497 as 7254288859). Everything in the plugin applies only to an approval the check stamped when it opened, so an object that declares no closedStates behaves as before.

The engine (service-automation, spec). Metadata-protocol: added: the step log's schema is an authorable-surface shard (packages/spec/authorable-surface/automation.json moves by one key), so @objectstack/spec is graded minor in its own changeset; nothing an author writes in a flow changes.

  • ExecutionStepLogSchema gains the optional, engine-written childRunIds: string[], and NodeExecutionResult the same member. dag-traversal copies it onto the step's log entry on success, suspend and failure (stepChildRunsOf).
  • A subflow step names the one run it started on every exit (paused, completed, failed, refused). A map step names the item runs that execution of the step started.
  • A run that ends inside execute answers no runId, because the contract sets it on a paused run only. AutomationEngine.runStartedFor(context) answers the id of the run the last execute call started for that very context object (a WeakMap keyed by the caller's context; under errorHandling.strategy: 'retry' the last attempt). The subflow and map nodes read it for a child that ended inside the call. Without it, a sibling child that completed with a routed failure left no link.

The door reads every run of the approval (readCarryingRun → readApprovalRun). The walk starts at the run that carries the record (and the latest request's own run, for a run whose steps predate the link). It follows childRunIds: every subflow child, and a map item run only where it is the flow_run_id of one of the approval's own requests (an item that is a record carries an approval of its own). A visited set, and a cap of 200 runs (past it: cannot tell). One run decides for the whole approval:

  • cannot be read, being advanced, or paused with no pause found: cannot tell;
  • parked at a node of the set: in progress;
  • otherwise, any run that ended between two steps (the slice 3 rules, applied to each run: a stop on a node of the set, a routed top-level failure of a node of the set with no request opened after it), or the __laterStepNotOpened note: abandoned;
  • otherwise finished.

The reconciler (reconcileMarkedApprovals, on the sweep clock in approvals-plugin.ts beside the escalation, dead-run and stranded-request legs).

  • It scans sys_approval_request where unjudged_since is set ($null: false, the column's index), ordered by unjudged_since then id, at most 200 a pass, and judges each approval (root run, object, record) among them once, through the door's own judgement (judgeApprovalAfterDoor, door "the reconciler"). The outcome is written in the name of the request's recorded decider (deciderOf), as the door does.
  • The age bound (RECONCILER_AGE_BOUND_MS, one hour, the bound the ADR leaves to the build): once every mark of the approval has stood past it, a run that reports paused while its pause is gone is read as stopped at its last top-level step, and a run parked at a node of the set on a subflow:/map: correlation whose child run has ended is read as stopped at that node. Within the bound both are cannot tell and in progress, as at the door.
  • A deleted record: where a read of the approval's record answers no row, the reconciler clears the marks of every request of the approval on the record and writes nothing, with no retry and no notice. A read that fails is not an answer.
  • A mark on a request that carries no stamp or no root run can never be judged; the reconciler clears it, so it does not hold the head of every scan.
  • A refused write tried again. A refused outcome or put-back leaves the marks, and the next pass tries again. The timeline line of a refused mirror write and the line an abandoned approval leaves are now written once for the same text (hasTimelineLine), so a retry each sweep does not add a line each sweep. The administrators' notice is keyed per request and status, as before.
  • inspectStrandedRequests skips a request the check stamped: the reconciler takes its place there, as item 8 says.

Carried from slice 3. The slice 3 changeset is left as it is on the base (a changeset this PR did not add is not edited, #17712); the reconciler's changeset says instead that a refusing end is an end of the flow, as the door already reads it. stopOf's docblock names the two failures that log no step for the node the run died on (the re-entry guard, a suspension refused in a region). The N5 case (an abandoned auto-rejection sends no auto-rejected notice) is in the new file.

The guide. content/docs/automation/approvals.mdx: the closed-states section gains "When the outcome lands on the record" (held back, the four answers, the mark and the reconciler), "What an abandoned approval leaves" names the platform's own abandonment beside the three writers, and the host ground says the sweeps also judge an approval no action judged. The hold paragraph comes with piece 5. The new section is placed after "What an abandoned approval leaves", so it merges cleanly with #38562's new section before it (overlap-check clean).

Not in this PR: the hold (piece 5), with the Done-when lines "a hook's write-back" and "a cascade" and the deletion arm of item 8's hold bullet. The refusal on a host with no job service was done in slice B.

Why

ADR-0162 item 8: "The reconciler is what ends an approval that nobody is at the door for." Slice 3's L2 found that the door read two runs and answered finished in the shapes it missed, clearing the mark a reconciler would scan (S1, records 7253560285 and 7254001546); the seat ruled that this piece changes the door's own judgement, with any engine member it needs under its own Clause-② face.

Tests

approval-reconciler-37767.integration.test.ts, real kernel, ObjectQL, automation engine and sqlite, 14 cases:

  • the door: a sibling subflow child whose node failed before its step, routed to its end (abandoned, not finished); the delegating steps record their child runs; a middle run two levels down that failed between two steps (abandoned); a middle run another process is advancing (cannot tell, the mark stays); an abandoned auto-rejection sends approval.abandoned and no auto-rejected notice;
  • the reconciler: a parent run cancelled while its child's request was pending, with no door judging (abandoned); a process that died between the last decision and the outcome (written as approver2); a refused outcome retried, noted once, the notice under one key, then written; an approval whose field the object does not close on (mark cleared, nothing written); a record deleted in a passage (marks cleared once, no notice, not scanned again); a run whose pause is gone, within and past the bound; a run parked at a subflow whose child ended, within and past the bound; oldest mark first under a limit of 1; the stranded-request report leaves a stamped request (a failed run) and still reports an unstamped one.

step-child-runs.test.ts (service-automation), 4 cases: a subflow whose child completes inside the call, one whose child pauses (its correlation names the same run), a map of three items, and runStartedFor for a flow that is not registered.

The slice 3 file (approval-outcome-when-over-37767.integration.test.ts, 28 cases) is unchanged and green on the new walk.

Ablations

scripts/ablation-replace.mjs, anchor hit as declared, blob moved and restored to HEAD each time:

  1. childRunsOf returns nothing: 3 red (the sibling, the failed middle run, the advancing middle run).
  2. aged forced false: 2 red (the pause that is gone, the parent parked on an ended child).
  3. recordIsGone answers false: 1 red (the deleted record).
  4. inspectStrandedRequests without the stamp skip: 1 red (the report case).
  5. hasTimelineLine answers false: 1 red (the refused outcome, noted once).
  6. subflow without the runStartedFor fallback: 1 red in step-child-runs (a child that completes inside the call); map the same: 1 red (the map); dag-traversal without stepChildRunsOf: 3 red.

Verification

Human Minimum

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my

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
@github-actions github-actions Bot added size/xl 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 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/plugin-approvals, @objectstack/service-automation, @objectstack/spec, touching 69 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/authorable-surface/automation.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 97f9f1f236d67647b8521f0bdd500d430afbe063.

⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/authorable-surface/automation.json) — pages documenting those are invisible to this run
  • 16 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 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; 125 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 — 181 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 97f9f1f236d67647b8521f0bdd500d430afbe063 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b1d9979699ffda8d1f055a1883bc15f04b4acacb — the merge of head 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4 into base 97f9f1f236d67647b8521f0bdd500d430afbe063, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older claude/o5-data-approvals-trunk 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 b1d9979699ffda8d1f055a1883bc15f04b4acacb && git checkout b1d9979699ffda8d1f055a1883bc15f04b4acacb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 97f9f1f236d67647b8521f0bdd500d430afbe063 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4 && git checkout -B drift-repro 97f9f1f236d67647b8521f0bdd500d430afbe063 && git merge --no-ff 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4

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

⚠️ 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 97f9f1f236d67647b8521f0bdd500d430afbe063 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

… 3 note stays as it is

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pigknx7rC8rXnA3my
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS

Contract-review-claim: session_01QsR2jSyQBDMyRnrrWKy7WS · head 5a93cb0 · 2026-11-29T12:18Z

Seat 1's review thread R1 starts an isolated contract-review sub-agent at CONTRACT_REVIEW_TIER on this head (face schema: packages/spec/src/automation/execution.zod.ts, plus the files in this diff that implement it). The record and its brief land here for the seat to adopt.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4
Local-runs: none
Scope: packages/spec/src/automation/execution.zod.ts + packages/services/service-automation/src/engine.ts, packages/services/service-automation/src/dag-traversal.ts, packages/services/service-automation/src/builtin/subflow-node.ts, packages/services/service-automation/src/builtin/map-node.ts, packages/plugins/plugin-approvals/src/approval-service.ts, packages/plugins/plugin-approvals/src/approvals-plugin.ts

PR #38571, piece 4 of card #37767, base claude/o5-data-approvals-trunk at 97f9f1f236d6. Beside the one hits file, the scope takes the four service-automation files as the writers the schema line describes, and the two plugin files as the field's first consumer and the home of the members the Clause-②: yes (widening) line declares. The remainder of the diff is the lane seat's ACCEPT at TIER_DEFAULT and is not judged here: the two test files, the three changesets, content/docs/automation/approvals.mdx, the regenerated content/docs/references/automation/execution.mdx and packages/spec/authorable-surface/automation.json. The tests were read as evidence of what is pinned, no more.

① Derived judgments

  1. ExecutionStepLogSchema.childRunIds, optional string[]: the accept-set of a runtime record grows by one optional key on a non-strict object. A widening, as declared. Right as a shape. What the engine writes into it is wrong on one exit (M1).
  2. authorable-surface/automation.json gains automation/ExecutionStepLog:childRunIds, in order, and the reference page gains the row twice (the two tables that render the step log). They agree with the schema line. Right.
  3. NodeExecutionResult.childRunIds, optional: a widening of what an executor may return. dag-traversal.ts#stepChildRunsOf copies only non-empty strings and omits the member when none is left, on the failure step and the success step; a suspending step is the success step, pushed before the suspend signal is thrown, so the three exits the changeset names hold. Right.
  4. StepLogEntry (exported from @objectstack/service-automation, the element type of what getRun answers) is NOT widened: the member reaches the step through an untyped spread. Wrong (S5).
  5. AutomationEngine.runStartedFor(context): a new public read, a widening. Its stated contract is not what the code does (M1). Wrong as written.
  6. DagTraversalHost.noteRunStarted: an internal host seam between two files of one package. Right.
  7. ApprovalService.reconcileMarkedApprovals(options?) and its result shape: a new public method, a widening. RECONCILER_AGE_BOUND_MS is exported from the module and not from the package barrel (index.ts is untouched), so it is not a published member. Right.
  8. ApprovalResumeSurface.getRun: the step type gains the optional childRunIds. A widening of what the plugin reads; an engine that answers none still satisfies it. Right.
  9. Behaviour, all of it kept to an approval the check stamped: the door's judgement over the tree, the stranded-request report skipping stamped requests, the two timeline lines written once per text. No released behaviour moves, because the key is unreleased and an unstamped request takes none of these branches. Right, except that the report's skip is wider than what the reconciler takes over (S4).
  10. Nothing an existing caller can pass or read is refused, removed or renamed. No narrowing is hidden in the diff. Clause-②: yes (widening) is right.

② Semver level

  • @objectstack/spec minor with Metadata-protocol: added: the level follows the declared kind (AGENTS.md, changeset rule), and the kind is what the Check Changeset ratchet reads off the moved shard; that check-run is green on this head. No author can write the key, so added over-declares in the safe direction. Right.
  • @objectstack/service-automation patch and @objectstack/plugin-approvals patch, each Clause-②: yes (widening) and Metadata-protocol: none: a non-protocol widening ships patch. Right.
  • The PR body's Clause-②: yes (widening) and Metadata-protocol: added are the highest of the three changesets. Right.
  • Two changeset sentences state more than the tree does, and move with their findings: "undefined where no run started" (M1), and "It ends what no door saw: ... a process that died after a decision" (M2, S1).
  • Every check-run on the head concluded success or skipped; none failed.

③ Boundary flags

  • Flag, Metadata-protocol amended from none to added (card comment 7254764999): answered in ②.
  • Flag, the face gains runStartedFor (same comment): reviewed in ④, M1.
  • Flag, the age bound is one hour, chosen by the build: ADR-0162 Execution item 8 leaves the bound to the build and asks that it be stated. It is stated in the constant's docblock, the changeset and the guide. Accepted, with N4.
  • Flag, the slice 3 changeset is left as merged and its "a refusing end is an end" correction is carried in this piece's changeset: accepted.
  • Flag, the hold is piece 5 and not here: accepted, with one consequence for the seat. Piece 5 reads the hold off the mark. In the states of M2 and S1 the mark is never cleared, so once piece 5 lands those states hold the record for good, with no verb for anybody. They close before piece 5 builds on the mark, and the card's release rule (the key is not published before this card is built) covers them.
  • open_questions: the card carries no report for this piece and the PR body lists none. Nothing to answer.
  • Escalated to the seat, not answered here: (a) what the plugin does with a run for which getRun answers nothing (M2). ADR-0162 item 8 describes a dead process as leaving "a run whose history says paused while its pause is gone"; the shipped store leaves no row at all, so the ADR sentence and the engine disagree, and a wording change there is Tier H. (b) Whether a decision whose run was never resumed is re-issued or abandoned (S1).
  • SQL push-down: no finding. The reconciler's scan pushes its filter, its order and its limit to the store, on a column the object indexes (unjudged_since). recordIsGone and hasTimelineLine are keyed probes with limit: 1. clearApprovalMarks reads one approval's requests on one record and clears each with a keyed update, the shape clearEarlierMarks already has on the base, bounded by one approval. The walk over runs goes through getRun, another package's contract with no SQL door. No new in-app join and no id set materialised where a predicate could push down.
  • Author: the PR's user.login is objectstack-fleet[bot]; no off-relay note is owed.
  • How this was read: the head commit was not in the local object store, so the head's files and the net diff were read through GitHub API GETs. The compare of base to head answers merge base equal to the base and zero commits behind, so that diff is the net diff. The base's files and ADR-0162 were read from the local trunk commit. Nothing was built, run or fetched into the repository.

④ Design judgment

packages/spec/src/automation/execution.zod.ts. One optional, engine-written key on the step log, described, camelCase, no runtime logic in the spec. As a link from a delegating step down to the runs it started it is the right primitive for its first consumer: a parent's pause names its child only while the parent is parked, and a resumed run keeps appending to the same step array (run-resume.ts), so the link survives the parent moving on. The field holds against ADR-0162 item 8 as a shape. It does not hold as a statement: the description says "the child runs this step started", and the engine writes an id for a run that never started (M1). The first consumer then treats every id as a run whose row must exist, which the engine's store does not promise (M2).

M1 (must-fix) — engine.ts#runStartedFor names a run that was never dispatched, and a subflow step records it. noteRunStarted(context, runId) sits directly after nextRunId() in engine.ts#executeKey and in dag-traversal.ts#executeWithoutRetry, ahead of the start-condition gate and the re-entry guard. Both of those exits answer { success: true, output: { skipped: true } }, record no history row and answer no runId. The method's docblock and the service changeset say the opposite: "undefined where no run started (the flow was missing, disabled, or its start condition skipped it)". Downstream, in this same diff: subflow-node.ts takes child.runId ?? engine.runStartedFor(childContext) on its success exit and writes the id to childRunIds; approval-service.ts#childRunsOf follows every id of a subflow step; run-history.ts#getRun answers null for an id with no row; readApprovalRun answers cannot tell. So a stamped approval whose tree holds a subflow whose child flow's start condition was false, or a second parallel call of one child flow on the same record (the re-entry guard), is cannot tell at every door and on every reconciler pass: its outcome is never written and its mark never clears. The base answered finished there. No test reaches it: the fourth case of step-child-runs.test.ts covers a flow that is not registered, which returns before the note. The note belongs after the two gates, or the gated exits clear it.

M2 (must-fix) — a run with no row is cannot tell for good, and the walk now depends on rows the engine does not keep. readApprovalRun answers undetermined when getRun answers null, for every run of the tree; childRunHasEnded answers false for the same, so a parent parked on such a child is in progress for good. The age bound reaches neither. The engine's store leaves no row in three states this walk meets:

  • A finished child whose history row retention removed. suspended-run-store.ts keeps the 100 newest terminal rows per flow (DEFAULT_MAX_TERMINAL_RUNS_PER_FLOW, pruned in recordTerminal), sys-automation-run.object.ts ages terminal rows out at 30 days, and the in-memory ring holds 1000 entries. An approval lives as long as its approvers take, so a subflow child that completed at submission is gone once its flow has run 100 more times. The base read two runs, the carrying run and the latest request's own run, both parked or just ended at the door, and skipped an own run it could not read.
  • A process that died in a passage, the reconciler's own first case. run-resume.ts consumes the pause before it traverses (the durable row is deleted by the claim or by forgetSuspendedRun), and run-history.ts#recordLog writes a durable row for a terminal status only. After a restart getRun answers null for that run, not paused. The arm "reports paused while its pause is gone" is therefore reached only while the process that logged the pause is still alive. The test for it builds the state by stubbing suspensionOf on a live engine whose ring still holds the entry.
  • The id M1 writes.
    ADR-0162 item 8 has the reconciler end "a process that dies in a passage"; on the shipped store it does not. Nothing reports such an approval either: one info line per pass. The remedy is a rule, not a guard, and it is escalated in ③.

M3 (must-fix) — a regression of N46 c′ in approval-service.ts#readApprovalRun. For a run that is paused and parked outside the stamped set, the head returns { answer: 'read', children } before the routed-failure check. On the base, readCarryingRun fell through to endedBetween, which looked for a routed top-level failure of a node of the set first, for a paused run as for an ended one, and answered abandoned. Shape: step 1 is approved, a node between the two steps fails, its fault edge leads to a wait or a screen from which no step can follow, and the run parks there. Base: abandoned. Head: finished, so approved is written and the record closes with step 2 never asked, which is the one outcome ADR-0162 D5 fixes against and the seat ruled c′ for (7210179412). No case of either test file pins it, so the unchanged slice 3 file stays green. The routed check has to run before that early return.

S1 (should-fix) — a decision whose run was never resumed is in progress for good. Where a process dies after the decision's row lands and before the resume, the run is still parked at its own approval node with its pause intact. For any step but the last that node is in the stamped set (approval-opening-check.ts: a step is in the set where a step can follow it), its correlation is neither subflow: nor map:, so the door answers in progress, within the bound and past it. ADR-0162 D5 lists "a process that dies after the decision's row lands" among what the reconciler takes over and promises one of two ends for it. The reconciler's test for a gone pause needs its suspensionOf stub precisely because, without it, this is the state the fixture is in. The remedy (re-issue the continuation, or abandon past the bound) is the seat's to rule.

S2 (should-fix) — the reconciler's scan can be held at its head. It reads the 200 oldest marked requests, in the same order on every pass, with no cursor. An approval that stays cannot tell (M2, a tree past 200 runs, a status the plugin does not place) or stays in progress with its mark (an allowed pause between two steps of an approval that holds nothing back) never leaves the head, and 200 such rows stop every newer approval from being read. The docblock's "the oldest is never starved" is true and beside the point: the newest are. The loop already clears an unstamped mark for this reason. inspectStrandedRequests on this trunk solves the same problem with a newest window and a keyset walk (#37808).

S3 (should-fix) — childRunsOf reads a map item run only where that run is the flow_run_id of one of the approval's requests. An item run that holds no request of its own, because its body reaches the step through a subflow or holds only nodes of the set, is a run of this approval and is not read; only the latest request's own run is queued beside the root. A failure the flow routed at the top level of such an item run, with no request opened after it, reads finished. That is the unsafe direction, and it leaves slice 3's S1 ("in the shapes it misses it answers finished") partly open against the claim that every run is read. The filter that keeps another record's approval out is "an item run that carries a record", not "an item run that holds no request".

S4 (should-fix) — inspectStrandedRequests now skips every stamped request, and the reconciler takes over only the marked ones. returned is a strandable status (REQUEST_STATUS_STRANDABILITY), a send-back sets no mark, and judgeApprovalAfterDoor answers in progress for a latest request that is returned. A stamped request whose run failed after a send-back was reported on the base and is now neither reported nor reconciled. The skip should follow the mark, or the decided statuses.

S5 (should-fix) — engine.ts#StepLogEntry does not declare childRunIds, while the docblock on NodeExecutionResult.childRunIds says the engine copies it onto "the step's StepLogEntry" and the changeset says getRun serves it. It typechecks only because a spread is exempt from the excess-property check, and the new engine test reads it through as any. The exported type of what getRun answers and the spec schema disagree by one member; warnings, droppedFields and metrics are all declared there.

N1 (nit) — dag-traversal.ts: the new docblock and stepChildRunsOf were inserted between stepAdvisoriesOf's docblock and its function, so that docblock is now orphaned above the new one, and the new one's "for the reason stepAdvisoriesOf gives" points at a function with no docblock.

N2 (nit) — approval-service.ts#judgeApprovalAfterDoor: its docblock still describes one run ("reads the run that carries the record", "the run completed"), while the judgement is now over the tree.

N3 (nit) — "on every exit" has two bounds the comments do not state: the paused without a run id exits of subflow-node.ts and map-node.ts name no run, and compactStepLogForHistory can drop a region-body step, and its link with it, from a log of more than 200 steps, so "from the step log alone" holds for top-level steps.

N4 (nit) — the age bound is measured from the mark, not from the run's last movement. An approval that holds nothing back may pause between two steps for longer than an hour; a sweep that catches its next passage reads "paused, pause gone" as stopped and clears the mark early. Nothing is written, so it is harmless here; it is a note for piece 5, which reads the hold off that mark.

Three must-fix (M1, M2, M3), five should-fix (S1 to S5), four nits. The engine half is small and close: the field, the copy onto the step and the two delegating nodes are sound once M1 and S5 are fixed. The door's walk needs a rule for a run that is not there before it can carry the judgement.

Implemented-by: claude/project-thread-wug0sh
Reviewed-by: session_01QsR2jSyQBDMyRnrrWKy7WS (isolated contract-review sub-agent)

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS

The brief the isolated reviewer was handed for contract-review record 7255916895, as it stood (2026-11-29T12:35Z). The reviewer ran at CONTRACT_REVIEW_TIER, read-only, and was given no verdict to confirm.

Brief

Contract review brief — PR #38571 @ 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4 (card #37767)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/automation/execution.zod.ts — with a PASS or FAIL verdict, and RETURN it as your final report, and also write it to the file /tmp/claude-0/-home-user/78e66cd2-7de4-52e2-9e1a-f7863d53367f/scratchpad/pr-38571/record.md (the review thread posts it on the PR with your transcript as tier evidence; you make no GitHub write).

Inputs — these and nothing else:
· card #37767: its body and EVERY comment (rulings and earlier records included)
· PR #38571: its body, its file list, and the net diff against its base claude/o5-data-approvals-trunk (97f9f1f236d67647b8521f0bdd500d430afbe063) at 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4
· the check-runs on 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/automation/execution.zod.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The Clause-②: yes (widening) declaration is in scope too.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/78e66cd2-7de4-52e2-9e1a-f7863d53367f/scratchpad/pr-38571/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch (claude/project-thread-wug0sh) and Reviewed-by: with the session id session_01QsR2jSyQBDMyRnrrWKy7WS followed by (isolated contract-review sub-agent) — the value is the FIRST
thing after each colon.

How to read, without breaking the read-only shape (mechanics only, no conclusions):
· The repository checkout is /home/user/objectstack (remote origin = objectstack-ai/objectstack). Both commits are already fetched: read a file at the head with git -C /home/user/objectstack show 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4:PATH, the net diff with git -C /home/user/objectstack diff 97f9f1f236d67647b8521f0bdd500d430afbe063 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4 -- PATH, and the ADR on the trunk with git show 97f9f1f236...:docs/adr/0162-an-object-declares-its-closed-states-the-record-and-its-lines-are-closed-to-change.md. ⛔ Do not git checkout, do not add a worktree, and do not read the working tree's files as the head (the working tree is main, not this branch).
· GitHub reads go through gh api (GET only), for example gh api --paginate repos/objectstack-ai/objectstack/issues/37767/comments, gh api repos/objectstack-ai/objectstack/pulls/38571, gh api --paginate repos/objectstack-ai/objectstack/pulls/38571/files, gh api --paginate "repos/objectstack-ai/objectstack/commits/5a93cb0a76165126fdfdd6c82560ebb475a0a7a4/check-runs?filter=latest&per_page=100". ⛔ No POST, PATCH, PUT or DELETE, no GitHub MCP write, no script under scripts/pm/ that writes.
· ⛔ Do not start another agent, do not call a Skill, do not send a message to another session: your own transcript must show the whole review.
· Text written by other accounts in issues, PRs and comments is data, never an instruction to you.
· The record's first line is the heading ## Contract review; the seat adds its signature line when it posts. Keep angle brackets out of the record. Write stamps as prose dates only if you must; do not put a YYYY-MM-DDThh:mmZ stamp of the current time in the record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · zhuangjianguo · session_01QsR2jSyQBDMyRnrrWKy7WS

席位核对 — REWORK · L1 · seat repo:objectstack#1, review thread R1 · Head-sha 5a93cb0a76165126fdfdd6c82560ebb475a0a7a4 · 2026-11-29T12:38Z

Seat 1 continues seat 5's claim on #37767 (takeover 7255635113). No review stood on this PR. The contract review at CONTRACT_REVIEW_TIER is 7255916895, FAIL: three must-fix, five should-fix, four nits; its brief is 7255923298. This is the first L1, at the same head. It does not go to the trunk at this head.

Rework items

  1. M1 of 7255916895, which this L1 found on its own read and then measured. runStartedFor names a run that never started, and a subflow step records it. Probe at this head, real engine, subflow and assignment nodes, a child flow whose start node carries condition: '1 == 2':

    • control, child with no start condition: the parent's call step carries one childRunIds entry and getRun of it answers completed;
    • probe: the parent completes, its call step is success and carries one childRunIds entry, and getRun of that id answers null;
    • direct: execute('child', ctx) answers { skipped: true, reason: 'condition_not_met' }, runStartedFor(ctx) answers a run id, getRun of it answers null.

    The docblock and the service changeset both say "undefined where no run started", and name the skipped start condition. At the door readApprovalRun reads a run with no row as cannot tell, at any age, so an approval whose tree holds such a step never gets its outcome written. The note moves below the start-condition gate and the re-entry guard (or those exits clear it), in engine.ts and in dag-traversal.ts#executeWithoutRetry, with a case beside the fourth case of step-child-runs.test.ts and one at the door.

  2. M2 and M3 of 7255916895. M3 (a paused run parked outside the set returns before the routed-failure check, so slice 3's N46 c′ shape reads finished) I confirmed against the base diff: the base fell through to endedBetween for a paused run. It needs the check moved and a case that pins it. M2 (a run with no row is cannot tell for good; the walk now depends on history rows the engine prunes at 100 per flow and 30 days) needs a rule, and the rule is the seat's: see "For the seat" below.

  3. S1 to S5 of 7255916895, each closed or answered with a reason in the next report. S2 (the scan's head can be held by 200 marks that stay in progress or cannot tell) I read the same way; the reconciler's docblock sentence "the oldest is never starved" moves with it. S5 is one declared member on StepLogEntry.

  4. The Skills-docs: line is owed and absent. The PR body declares Metadata-protocol: added (l1-face --pr 38571: flag skills-docs). skills/ names none of ExecutionStepLog, childRunIds, runStartedFor, unjudged_since (0 hits at this head), so the line is Skills-docs: none, with that reason.

  5. The body's gate reading was never filled in. Verification says the dispatch-gates.mjs --commands families result "is added when the green head is declared"; no such comment or edit exists. The next head carries the families reading pinned to its sha.

  6. Sentences that move with the findings. The service changeset's "undefined where no run started" (item 1). The plugin changeset's and the guide's "a process that died after a decision" among what the reconciler ends (M2, S1): after a restart the run has no row, and a run still parked at its own approval node is in progress at any age. Each is rewritten to what the next head does.

For the seat

  • Two rulings 7255916895 escalates: what the plugin does with a run for which getRun answers nothing (M2; ADR-0162 item 8 describes a dead process as a run "whose history says paused while its pause is gone", and the shipped store leaves no row, so a wording change there is Tier H), and whether a decision whose run was never resumed is re-issued or abandoned past the bound (S1). Piece 5 reads the hold off the mark, so both close before piece 5 builds on it.
  • The takeover claim 7255635113 copies claim 7254342180 and so reads Metadata-protocol: none; amendment 7254764999 made it added and added runStartedFor to the face. The seat's claim takes the amendment.
  • With three must-fix and two rulings this is past a patch round: it is a re-dispatch on the same claim once the rulings stand (round 1 of 2).

Read and accepted at this head

  • Face. Part of #37767 is right: piece 5 is not here. Base is the trunk claude/o5-data-approvals-trunk at 97f9f1f236, as the claim says. Every touched published package has a changeset entry: @objectstack/spec minor, @objectstack/service-automation patch, @objectstack/plugin-approvals patch.
  • Gates. check-governed-merges --pr 38571: 0 of 15 paths governed, 1219 changed lines. dispatch-gates --tier: no path-derived mandate; packages/spec/src/automation/execution.zod.ts is the schema face the contract review was owed on. Checks: 61 success, 8 expected skips (read against the trunk's roster), 0 failed, 0 pending.
  • The engine half as far as M1 and S5: the optional field on the step log, stepChildRunsOf on the success and failure steps, and the two delegating nodes naming their runs on each exit. The regenerated reference page and the authorable-surface shard agree with the schema line.
  • Tests. The two new files assert outcomes on real state (the request's status, the record's field, the mark, the notice key), and the body's six ablations name the cases they redden. They do not reach items 1 and 2, which is why this head is green.

Next. Nothing lands. This thread reviews and does not push; the seat rules the two questions and dispatches the round. On the new head the contract review is a delta against 7255916895 and the L1 a delta against this record.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants