Skip to content

Approval status mirror: a write that does not land, a run that ends between two steps, and a decision whose run cannot resume must not leave a document closed on an unfinished approval (ADR-0162 item 8) #37767

Description

@objectstack-fleet

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Filing gate: ③ maintainer-directed · Source: ADR-0162 Execution item 8 (accepted by merge 972114d)

维护者速读

  • 做什么:补上发起审批时检查不出来的三种情况:应用自己的规则拒绝了审批状态的写入、流程在两步审批之间出错或被取消、审批决定已记录但流程无法继续。三种情况下都不能让单据停在「已批准并锁住」而后面的审批其实没走完。
  • 用户会看到什么:出现这三种情况时,单据不会假装已批准;状态写入被拒不再悄悄吞掉,管理员能看到哪张单据卡住了、为什么。
  • 不做会怎样:这三种情况虽少见,但一旦发生,单据会带着一个没走完的审批结果被锁死,用户改不了,只能靠管理员手工处理。
  • 顺序:「声明与执行」那张卡要等这张卡;这张卡开工前有几处做法需要先定。

What happens

ADR-0162 D5 refuses, when an approval opens, every configuration it can read ahead that would leave a document on an earlier step's outcome (item 7). Three things cannot be read ahead, and each can leave a record closed on a value its own approval wrote and did not finish:

  • A write of the mirror that does not land. A validation rule or a hook of the app refuses it, or a visibleWhen on an option the mirror puts back does. On main a failed write of the mirror is logged and swallowed, on every transition (packages/plugins/plugin-approvals/src/approval-service.ts#mirrorStatusField).
  • A run that ends between two steps. A node fails, or the run is cancelled. The next step itself can fail to open, by the policy its own configuration declares for an empty slate (packages/spec/src/automation/approval.zod.ts#onEmptyApprovers), or because another request is pending on the record (approval-service.ts#openNodeRequest). A node can also fail on the closed-state lock through a write the check cannot read: a hook that writes back to the record, or a delete on another object whose cascade reaches it. No request is open then, so none of the three writers that abandon a request acts, and the sweep of dead runs reads pending requests only (approval-service.ts#releaseDeadRunRequests).
  • A decision that is recorded while its run cannot be resumed, so that the next step is never asked. main has a reader of such requests that reports them and changes nothing (approval-service.ts#inspectStrandedRequests).

On main the same events leave the same status on the record. What the key adds is that the status may now be a closed one.

The recommendations the maintainer adopted on 2026-11-26, 「全部按推荐」 (ruling record 7200732942 on #36253, text on 7202242844), give the mirror's failed write a child card. The seat's rulings on the eighth and ninth contract reviews of ADR-0162 added the other two to it. ADR-0162 fixes what the card delivers and leaves it the means.

Expected

What must hold (fixed by ADR-0162 D5). On a field the object closes on, none of the three leaves a record closed on a value its own approval wrote and did not finish. A refused write of the mirror is no longer swallowed. An end after the last step is another case: there the approval is finished and its decision stands.

What this card settles (left to it by the record).

  • How a refused write of the mirror is shown, and to whom.
  • How the plugin learns that an approval's run has ended, or will not go on.
  • How it tells a stop between two steps from one after the last step.
  • Where the decision of the earlier step stands afterwards.
  • What the platform then does with the record.

The record names two starting points. For the refused write, the first candidate is to set the object's rules aside for that one write (ADR-0162 "Alternatives considered"). For a run that will not go on, the reader of stranded requests on main is the starting point. Either may change what an app's own rules can refuse, so the choices are written up for the seat before the build starts, and the seat decides which of them go to the maintainer.

Carried from the contract reviews of ADR-0162

  • A failed mirror write on any transition (N24). The swallow is the same on every transition, not only on an abandoned request. The card covers each transition that writes the mirror.
  • A failure the flow routes (N46). A flow can route a node's failure and go on, and a run can then complete without the next step having been asked. The card says on which side of its bound that falls: the author's own routing, as a branch that skips a step is, or an end between two steps. A test pins it.

Done when

  • The five questions above are answered in a design note on this card, and the seat has ruled it or taken the open ones to the maintainer.
  • A refused write of the mirror on a closing field: not swallowed, shown as the note says, and the record is not left closed on the value its approval wrote. Tested for a validation rule, a hook, and a visibleWhen on a value the mirror puts back.
  • A run that ends between two steps: tested for a node that fails, a cancelled run, a next step that fails to open on an empty slate and on a request already pending on the record, and a node that fails on the closed-state lock through a hook's write-back and through another object's cascade.
  • A decision whose run cannot be resumed: the record is not left closed on that decision, and the case is visible to an administrator.
  • An end after the last step leaves the decision standing, with a test.
  • The routed-failure case (N46) is on the side the note names, with a test.
  • Each test records the value the field keeps.
  • The approvals guide (item 7, slice D) says what an author and an administrator see in each case.
  • The release rule holds: the key (item 1) is not published before this card is built.

Category ③: maintainer-directed. A build card of ADR-0162, child of #36253.
Grade: area:data · Feature · n/a (not a defect on main; it becomes one the day the key ships without it) · reach: an approval of several steps on an object that closes on its outcome, when one of the three events happens · evidence: read (ADR-0162 D5 "What the conditions do not reach" and its Readings)
Suggested-grade: p2 · it gates the release of #36253's key, so it takes the grade of the card it blocks
Size: L (it needs design rulings before it is built). The design note is S; the build is M once the note is ruled.
Business reason: carried from #36253 and the ruling 「平台拒绝这种配置」 (7205949718): a document must not pretend to be approved. These are the cases the opening check cannot see.
Reader: seat 2 (repo:objectstack#2). First a design note by a card thread at the ADR tier, then the build at effort high.
Release-order: the root run of item 7 (slice A), which is how the plugin places a request in its approval. Like item 7's slices B and C it needs item 1's key on the same trunk branch.
Clause-②: not judged before the design note. No if the means stay inside the plugin; yes if the plugin gains a published member or a platform object gains a field.
Metadata-protocol: none expected. If the note chooses to set an object's rules aside for the mirror's write, the seat judges whether that is semantic for the rules concerned.
Dedupe: searched mirrorStatusField (open issues): 0 hits. Searched closedStates (all issues): 1 hit, #36253 itself.
Related: #36253, PR #37606 (ADR-0162), the card for item 7.

Dispatch note: the card thread also reads the seat's private memo for this card before it starts.

Activity

  1. added
    priority:p2
    domain:server
    on Nov 27, 2026
  2. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:server · Feature · priority:p2 · pm:queue · size M; rationale: closedStates (ADR-0162). The approval status mirror handles a write that does not land, a run that ends between steps, and a late decision. It ships with the key (#37768). p2.

  3. added
    pm:queue
    on Nov 27, 2026
  4. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim: PM loop round 1 · 2026-11-27T03:40Z
    Session: session_01L6bhgV6i8jfWwSXjpWJrjA
    Thread session: session_01L6bhgUVBTmJLAWKkUBAzZe
    Account: os-sales
    Branch: none — design note round, no code
    Domain: domain:server
    Seat: repo:objectstack#2
    Area: s2-data
    File surface: none in the repository this round; the thread writes a design note answering the card's five questions, and the seat posts its public part on this card. The build (M) is a later dispatch after the seat rules the note.
    Container & model: S, mode:thread, model: CONTRACT_REVIEW_TIER (reason: the card's Reader line asks for the ADR tier, a design analysis that may go to the maintainer; decision analyses at the ceiling tier, standing order 10-29), effort: high (reason: five design questions across the approval plugin and automation service, read against live code)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7208024204
    Premise: holds — ADR-0162 merged (PR #37606)
    Serial constraints cleared: none — no code this round

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 27, 2026
  6. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    设计说明(第 2 版)与裁定 · #37767 · 2026-11-27T04:53Z

    维护者裁定(2026-11-27T04:50Z)

    • 一、多步审批的单据什么时候显示「已批准」并锁住:「全部走完才显示已批准」。即下文的 shape P:在对象声明为关闭的字段上,关闭值只在这条记录的审批全部结束时写入,中途一直是「审批中」,应用自己的规则始终有效。
    • 二、审批期间单据是否从提交一直锁到结束:「随新能力一起全程锁」。只对声明了 closedStates 的对象,从提交到审批结束都锁住,随键一起发布。

    座位就说明给出的裁定(这些属于座位可定的做法,列出供知情)

    • 较窄的写入时机(只在后面可能还有步骤时才推迟)保持「考虑过、不采用」。
    • 没有安装 job 服务的宿主:在关闭字段上发起审批时,第一张申请就拒绝,并说明缺什么。
    • 第 7 项 A 片的申请额外记下承载这条记录的运行(record_run_id);「两步之间」的集合在审批开启时盖到申请上,归第 7 项 B 片的开启检查。
    • N46 取 c′:流程按作者的出错路线走到结束、后面的审批没有开出来,算没走完,不算批准。

    三、座位可以自己定的做法(列出供知情)

    • 状态写不进去时:写错误日志,在审批记录的时间线上留一行说明,并通知本组织管理员。发起审批时如果「审批中」写不进去,就不让这次审批发起,提交人当场看到应用自己规则的提示。
    • 流程在两步之间停了:这次审批作废,单据回到提交前的状态;已经做出的那一步批准保留在审批记录里,不改写。一次偶发故障的代价是重新提交,前面批过的人都要再批一次。
    • 流程里某个节点出错后按作者画的出错路线走到结束、后面的审批没有开出来:算没走完,不算批准。作者如果确实想「出错后不再需要后面的审批」,要用错误捕获区加条件分支明确写出来。
    • 没有安装定时任务服务的环境:不允许在声明了关闭状态的对象上发起审批,报错说明缺什么。

    接下来


    Design note: #37767 (ADR-0162 Execution item 8), revision 2

    The approval status mirror: a write that does not land, a run that ends between two steps, a decision whose run cannot resume.

    Changes in revision 2, after the independent review. Each was checked against the code before it was taken.

    • Readings 3, 6, 7 and 9 are corrected: the door does not hold the answer of the whole run tree; a parent run can be cancelled while its child's request is pending; the sweep runs only where a job service is installed and its scan is capped and unordered; the engine has four switches.
    • Shape P is respecified where it broke: "over" is judged for each record; the outcome is written only where the decided request is the approval's latest of any status; a pause after the last step is placed; the stop is placed from a set stamped when the approval opens; the reconciler scans a mark the store can filter on and writes as the decider.
    • Clause-② for shape P is yes. The ADR cost is about ten statements. N46 is option c′. The hold through the passage is recommended to ship with the key.

    维护者速读

    • 问题:多步审批的单据,在某一步批准之后、下一步还没开始的时候如果出了故障(应用自己的规则拦住了状态写入、流程节点出错或被取消、决定记下了但流程续不上),单据会停在「已批准并锁住」,后面的审批其实没走完,用户也改不了它。很少见,但一旦发生只能靠管理员手工处理。
    • 选项:一是整个审批走完才把「已批准」写到单据上,中途一直显示「审批中」,出故障时这次审批作废、单据回到提交前,约三个 PR,另要修订设计文档约十处表述;二是保持每一步批完就写,出故障时平台把状态改回去,应用自己的规则拦着也照样写入,约两个 PR。
    • 推荐第一种:单据从不显示没走完的「已批准」,平台也不需要绕过应用自己的规则。
    • 不定会怎样:这张卡开不了工,「声明关闭状态」这个新能力要等它,也就发布不了。

    1. What main does today

    Each reading names the file and symbol it was taken from.

    1. Six call sites write the mirror, and one catch swallows every failure. packages/plugins/plugin-approvals/src/approval-service.ts#mirrorStatusField wraps the value choice and the engine.update in one try, and its catch logs at warn and returns. The callers are: a request opening (pending, in #openNodeRequest, which a resubmitted step also passes through), a finalising decision (approved or rejected, in #decideNode), a send-back (returned, in #sendBack), the revision-limit auto-reject (rejected, same method), a recall or an administrator's override (recalled or the put-back, in #recall), and the dead-run sweep (the same, in #abandonForDeadRun).
    2. The request row is written first and the mirror second, with no shared unit of work. Every door finalises sys_approval_request, syncs the approver index, and only then calls the mirror. The service opens no transaction anywhere.
    3. The door that records a decision gets back the answer of the request's own run, and of a parent only where that parent stranded. #decideAndResume calls #resumeRecordedOutcome, which calls the engine's resume and returns when the request's own run has paused again, ended or failed. A child that completes bubbles into its parent inside the same call, but packages/services/service-automation/src/engine.ts#bubbleToParent returns nothing and never throws. It records the parent's failure for the door only where the parent's resume answered stranded (#takeSubflowParentStrand). A parent that was cancelled (RUN_NOT_FOUND), a store that could not be read, a replica already advancing the parent (RESUME_IN_PROGRESS) and a bubble that threw are each a warn line, and the door is told the resume succeeded. So a clean answer from resume does not mean the approval went on. One door already measures after the resume whether a decision ended the process (#notifyDecisionOutcome), and it asks for a pending request on the decided request's own run only.
    4. A node that fails after a decision ends the run failed, and the engine says stranded. The engine consumes the pause before it runs the nodes after it, journals a snapshot when one of them throws, cascade-fails the ancestors, and answers status: 'stranded' (packages/services/service-automation/src/run-resume.ts#resumeInternal). The decision door throws RESUME_FAILED with repairable. An operator can put the pause back (restoreConsumedSuspension, served by the automation domain's admin route). Re-issuing the continuation is #continueRestoredRun, a contract member that no REST route serves today.
    5. A step that cannot open fails its node, and the flow may route that failure. #openNodeRequest throws NO_APPROVERS under onEmptyApprovers: 'fail' (the default is admin_rescue, and auto_approve is the declared way to pass over an empty step) and DUPLICATE_REQUEST when another request is pending on the record. The approval node returns success: false (approval-node.ts). A runtime failure is routed in one of two ways, after which the run goes on and can complete: down the node's fault edge (packages/services/service-automation/src/dag-traversal.ts#followFaultEdge), or by a try_catch region around it. A guard refusal is never routed. Each failure arm writes a failure step to the run's log before it routes.
    6. cancelRun cancels one suspended run and touches no child (run-resume.ts#cancelRun). Between two steps a run is suspended in three cases. An ancestor run parked at a subflow or map node is suspended for as long as its child's request is pending, and the operator's cancel route reaches it. The decision on the child is then still admitted, because #assertRunResumable asks about the request's own run only; the child completes, the bubble finds no parent, nobody is told (reading 3), and the parent's next step is never asked. The second case is a pause, which item 7 refuses when the approval opens. The third is a stranded run whose pause an operator restored and then cancels.
    7. The reader of stranded requests is a capped report, and it runs only where a job service is installed. #inspectStrandedRequests lists requests that are approved, rejected or returned, with a limit of 500 and no order: that is every decided request the deployment ever had, so past 500 rows it reads an arbitrary 500. It reports a run that is missing or failed, and skips completed, cancelled and paused. Its result goes to a log line; no route, notification or page shows it. It changes nothing, by an earlier ruling: a decision a person made is not rewritten. The sweep that calls it is scheduled in approvals-plugin.ts only where the host has a job service, every five minutes by default; with no such service nothing runs, at boot or later.
    8. The dead-run sweep reads pending requests only, 500 of them (#releaseDeadRunRequests). A terminal run abandons its pending request, whether or not the run is repairable.
    9. Every control of the object meets a system write, and no switch sets them all aside. Validation rules, an option's visibleWhen and the app's hooks all run against the mirror's write. packages/spec/src/kernel/execution-context.zod.ts declares four server-set switches: skipTriggers, skipAutomations (hooks bound from metadata and record-change dispatch; hooks registered in code still run), and seedReplay and skipStateMachine (the state_machine rule alone). None sets aside the other validation rules or option visibility. They are used by curated loads an administrator opted into (import, seed), under the rule that docblock states: only the system principal may take an app's declared controls off a write.
    10. Nothing holds a record between one step's decision and the next step's opening. The pending lock keys on status: 'pending' in its three reads (lifecycle-hooks.ts). On main a caller's write can land in that passage on every multi-step approval.
    11. A run's history names where it stopped. getRun answers the run's step log, each entry with its node id and success, failure or skipped (packages/spec/src/automation/execution.zod.ts#ExecutionStepLogSchema).
    12. The plugin can rarely prove afterwards which flow body a run ran. approval-service.ts#ranArmedBody answers "not known" after an edit of the flow, and after the registration every restart makes.

    2. One choice sits under all five questions

    ADR-0162 D5 has the mirror write each step's outcome as it is decided. On a field the object closes on, that write closes the record in the middle of its approval, and the next step's pending has to open it again. All three cases of this card are ways that second write, or the step behind it, never comes. So the five questions depend on one earlier choice: when a closing outcome is written.

    Shape P: write a closing outcome when the approval is over for the record (recommended)

    On a field the object closes on, the mirror does not write a step's approved or rejected at the decision where the object closes on that value. It is written once the approval is over for that record. Until then the field keeps pending. An outcome the object does not close on is written at once, as today.

    • Why this is now possible. ADR-0162 lists "Hold a step's outcome back until the approval is over" as not chosen, because the mirror cannot know, when a step is decided, whether another follows. That is true at the decision. After the resume the plugin can find out, by reading the run itself (section 3, question 2).
    • What it does to the three cases. A record is never on a closed value that its unfinished approval wrote, so no write has to take it off one, and none of the three cases depends on a later write landing. Only one write of the mirror still moves a record off a closed value: the pending of the first request of a new approval on a decided document, and at a first request the approval can simply be refused.
    • What it moves to the other side. Three things can leave a finished approval not yet closed, reading "in approval": a final write the app's rule refuses (the same under D5 as merged); a process that dies, or a node that fails, after the last decision and before the outcome is written; and a stale pending with no request open, which no person has a verb to end. Each fails open with a stale status, where D5 as merged fails closed on a decision nobody finished. That is the right side for this bound. The price is that the reconciler of question 2 carries correctness and is no longer a report.
    • What an end user sees. A document under a three-step approval reads "in approval" from submission until the last step is decided, and then "approved". On main it reads "approved" for a moment after each step.
    • What an app builder sees. Nodes that run after a decision see the field still pending. A record-change flow that fires on approved fires once on such an object, after the nodes behind the last decision have run. A node after the last step, in a flow that runs as the user, can write the record, where D5 as merged refuses it. No rule or hook of the app is ever set aside.
    • What it costs. About ten statements of ADR-0162 change (section 5). The request gains a field (Clause-②: yes). And from a decision until the outcome is written the record is open to callers unless the approval lock holds it, which D5 as merged did not need: question 5 recommends that the hold ship with the key.
    • Two timings of one mirror. A closing field waits for the end of its approval; every other mirror field is written as today. No app on main declares the key, so no shipped behaviour changes.

    Shape C: keep D5's timing, and cure

    The mirror writes each outcome at its decision, as merged. The plugin detects an approval that will not go on and writes the record off the closed value. Where a rule or a hook of the app refuses that write, the platform sets the app's controls aside for that one write. This is the first candidate the ADR names.

    • What it needs that P does not. A new engine exemption: reading 9 shows no switch sets aside the other validation rules or option visibility, and skipAutomations reaches only hooks bound from metadata. A hook registered in code that throws would still leave the record closed.
    • What an app builder sees. A rule or a hook of theirs does not hold against one platform write. It is the first write the platform would take an app's controls off on its own motion, with no administrator opting in.
    • What it costs. Clause-②: yes, Metadata-protocol: semantic for the rules and hooks concerned, a standing special case in the data layer, and the same detection and reconciler as P.

    Considered and not offered

    To report a refused write and leave the record closed until an administrator acts. It does not meet what ADR-0162 fixes ("the record is not left closed on that value") and runs against ruling 7205949718.

    A narrower timing of P

    Write at the decision where no later step of the approval can follow for that record, as read from the graph when the approval opens, and defer only where one can. A single-step approval and the last step of a linear flow then keep D5's timing exactly, and the reconciler is not on their path. I do not recommend it. A node after the last step would then be allowed to write the record or refused by the path the run took: on a flow whose second step a gateway can skip, the write lands when the step is skipped (the first step's outcome was deferred) and is refused when it is not (the second step's outcome was written at its decision). One rule an author can state is worth more than keeping the commonest path off the reconciler, and with the hold of question 5 a process that dies after the only step's decision leaves a document that is held and reads "in approval", not one that is open. The ADR revision should carry this paragraph either way.

    Recommendation

    P. Read on long-term soundness alone it is the shape with the fewest special cases: the approvals plugin keeps its own protocol and the data layer gains no exemption. Mainstream platforms model it the same way: a Salesforce approval process sets the outcome in its final approval actions, which run when the last step is decided, and keeps the record locked for the whole process. P takes both halves of that model only with the hold. The other axes do not turn it. Nobody is hit today. On loud against silent, P's failures are open documents with a stale status and a report, where C's residual is a closed document that reads approved.

    Self-check: on long-term soundness alone the pick is P. Do pull, error-loudness or surface turn it: no.

    3. The five questions

    Each is answered for shape P. Where shape C would answer differently, a line says so.

    Question 1. How a refused write of the mirror is shown, and to whom

    This is N24: the swallow is the same on every transition. The table is for a field the object closes on. "Keeps" is the value each test pins.

    Transition The write If it is refused, the field keeps What the platform does
    First request of an approval opens to pending, from any value, a closed one included the value it held; the record stays closed if it was Refuse the opening. The row is inserted first and the pending written second; on a refusal the row is voided with the status the platform already has for that (cancelled), no lock is taken, and the run fails at its first node with the app's own message, as item 7's refusal does. The other order could leave a decided document on pending with no request.
    A later request opens pending onto pending pending Nothing to cure. The build may skip a write that changes nothing.
    A returned request is resubmitted returned to pending returned, an open value Report.
    The outcome, once the approval is over pending to approved or rejected pending: decided in the request, and the document reading "in approval" Report once. The reconciler tries the write again while the mark of question 2 stands.
    Decision, outcome the object does not close on as today pending Report.
    Send-back pending to returned pending; the revise window is open because the pending lock has let go Report.
    Revision-limit auto-reject as a decision as a decision As a decision.
    Recall, override, dead-run sweep, and the abandonment of question 5 pending or returned to recalled or the put-back pending or returned Report once, and try again from the reconciler: without that the record keeps a stale pending that no person has a verb to end.

    No row leaves a record closed on a value its unfinished approval wrote. Under shape C the second row is approved to pending, and that row, and the put-back after an end between two steps, are where the set-aside would be used.

    How it is shown:

    Option Who sees it Cost
    a. An error log line, once for each failed write, with the consequence and the fix An operator reading logs None. It replaces the warn.
    b. A line on the request's timeline, with no actor, carrying the refusal's own message where it has one Everyone who can read the request: the submitter, the approvers, an administrator Small. The timeline already carries such notes as comment rows with no actor.
    c. A member on the door's answer, beside resumeError The person at the door, as a warning in the client A published contract member.
    d. A notice to the organization's administrators The people who can fix the rule A new notification topic, additive. The resolver for the organization's administrators exists.

    Recommended: a, b and d, all three for closing fields only. Not c: the person at the door cannot act on it, and b already shows it to them on the request.

    Question 2. How the plugin learns that an approval's run has ended, or will not go on

    Option What it catches What it misses
    a. At the door only An end inside the continuation of the request's own run, and a parent that strands A parent that is gone or could not be resumed (readings 3 and 6); a process that dies inside the passage; a host with no automation engine; a decision admitted because the liveness check could not read
    b. By a reconciler only All of them, where one runs Up to one scan interval late, and without the engine's own account of the failure
    c. Both (recommended) All of them, at once where the door can tell A host where no reconciler runs: see below
    d. A new callback from the automation service when a run ends All of them It is a new seam between two packages

    Recommended: c, built on four things.

    • The door reads the run, and does not trust the resume. After every resume the door reads the run that carries the record (below) through getRun and hasSuspendedRun, and asks its own table for a request of the approval on the record. It has four answers: finished, in progress, ended unfinished, and cannot tell yet. The last is for a run another replica is advancing, or one it cannot read. It then writes nothing and leaves the mark. The doors are every caller of #resumeRecordedOutcome (a decision, the SLA sweep's auto-decision, the revision-limit auto-reject, a send-back, a resubmit, #continueRestoredRun) and #recall, which resumes or cancels the run directly.
    • "Over" is judged for each record. An approval is over for a record when the run that carries that record has ended, or is parked where no step can follow (question 3), and no request of the approval is pending or returned on it. The run that carries a record is the root run, or the nearest map item run where the item is the record. Without this, an item under a map would wait for the last item's decision to get its outcome, and one item's failure would abandon the finished approvals of the items before it. Item 7's card pins that arm as allowed. This needs each request to record the run that carries its record, and item 7's first slice hands the root run only. Decide before that slice merges whether it records both.
    • A mark on the request that the store can filter on. The door sets it in the update that records a deferred decision and clears it when it has judged. The reconciler scans the mark, oldest first, so its scan is bounded. A recall, an override and the dead-run sweep clear it on the approval's earlier requests. The outcome is written only where the decided request is the approval's latest request of any status on the record: otherwise a first step approved, a second step recalled and a run that then completes would have the reconciler write approved onto a withdrawn document, against ruling 7201405662. A test pins that, and the same for a returned request recalled in its revise window. The mark is the one new field of this card.
    • The reconciler. It replaces the reader of stranded requests for approvals on a closing field. Beyond what the door judges, it places three states the reader skips today: a cancelled run; a run whose history says paused with the pause gone, which a process that died inside the passage leaves for good; and a run still parked at a subflow or map node whose child has ended, which nothing will ever resume. The last two need an age bound, which the build chooses and states. It writes as the recorded decider of the request, as the door would have: a write with no actor leaves record-change flows that run as the user without an identity, and the same event would behave differently by the path that wrote it.

    A host with no job service runs no sweep at all (reading 7). Two answers: refuse an approval on a closing field at its first request on such a host, with an error that says what is missing; or reconcile at boot only and say so in the docs. I recommend the refusal. It is the same kind of answer as item 7's check, and the bound of this card cannot be kept on a host where nothing reconciles.

    A decision recorded while its run cannot be resumed is rarer than the card's wording suggests, because #assertRunResumable refuses the decision before anything is written when the request's own run is gone or its flow was changed. What remains: the race after that check, a check that could not read and let the decision through, an engine without the liveness member, a host with no engine, a parent run that is gone, and a process that dies after the decision row lands.

    Question 3. How it tells a stop between two steps from one after the last step

    Option How it reads Where it is wrong
    T1. By the edge the decision took: is an approval step of the approval reachable from it Cheap A failure after a gateway that had already passed over the remaining steps reads "between"
    T2. By the place the run stopped or is parked: can a step of the approval still follow from that node (recommended) The place is the failed step in the run's history, the node a run is parked at, or the decided node where no later step was logged A stop on a branch that would later have skipped the remaining steps still reads "between"
    T3. The author marks the last step Exact A new metadata key, kept for good

    Recommended: T2, from a set stamped when the approval opens, and not from a re-read of the flow.

    • The stamp. Item 7's check reads the approval's flows at its first request and already works out which nodes stand between two steps. It stamps that set on the approval's requests as they open. T2 is then "the node is in the stamped set". A re-read at failure time would fail exactly when the reconciler runs: reading 12 shows the plugin cannot prove which body a run ran after a restart, and "between where it cannot tell" would abandon a finished approval whose tail failed just before one.
    • A pause as well as a stop. A wait or a screen after the last step is allowed. After the last decision the resume returns with the run parked there, and no approvals door will ever see that run again. A run parked on a node outside the stamped set is finished, and the door writes the outcome then.
    • A request with no stamp, opened before the release or in an approval item 7 could not place, is not judged: its outcome is written at the decision, as today. That is ADR-0162's own rule for a request the plugin cannot place.
    • A run that completes, or ends on an authored end, is finished, subject to N46 below. The conservative error of T2 costs a resubmission. The other error would close a document on an unfinished approval.

    Question 4. Where the decision of the earlier step stands afterwards

    Option What a reader sees Cost
    a. On its request and its audit trail, unchanged (recommended) The request still reads approved, with who decided and when. A line with no actor follows it: the approval did not go on, why, and the value the document was put back to None in the contract
    b. Rewrite the request to recalled The decision disappears from the record of what happened Against the standing ruling that a decision a person made is not rewritten
    c. A new request status Exact A new member of a published enum, which every reader has to classify

    Recommended: a. The document does not carry the earlier decision. The approval is marked abandoned on the request. #continueRestoredRun refuses an approval so marked, and its refusal tells the operator to cancel the restored run: without the refusal a later restore would open the next step on a document that has since been reopened, and perhaps submitted again; without the instruction the restore would leave a paused run that nothing continues.

    Question 5. What the platform then does with the record

    At an end between two steps the field holds pending and no request is open.

    Option What a user sees Cost
    a. Abandon at once (recommended) The document goes back to the value an abandoned approval leaves by item 7's order: recalled where the field declares it and the object does not close on it, otherwise the value at submit, the default, or empty, and never a closed value. The submitter is told and submits again. No administrator is needed. A passing fault costs a resubmission, and every step already decided is decided again: a fault at step four of five costs four approvals.
    b. Leave it in approval and wait for an administrator The document reads "in approval" with nobody asked. Its submitter cannot withdraw it, because a recall needs a pending or a returned request. A route for #continueRestoredRun, which has none, and an administrator's verb to abandon. ADR-0162 turned down the same picture for a pause.
    c. b for a repairable run, a for the rest Two rules The dead-run sweep already treats a failed run as dead without asking whether it is repairable.

    Recommended: a. It is the rule the platform has: a dead run abandons its approval. The door applies it when it can tell, and the reconciler otherwise.

    Two details the build pins:

    • Another approval on the record. Where a request of another approval is pending or returned on the record and mirrors onto the same field, the mirror writes nothing: the field is that approval's now. This is the card's test "a request already pending on the record", and the field keeps pending.
    • An end after the last step. The outcome is written and stands, also where the run failed in a node after the last step. A test pins it.

    The hold through the passage. Under P nothing holds the record from a decision until the next request opens or the outcome is written. Under D5 as merged that interval is a few store round trips, because the outcome closes the record at once. Under P it is as long as the nodes behind the decision take: a callout, a script, a child flow. An edit that lands there is then closed under "approved", and no approver saw it. ADR-0162 gives that as the reason for ruling 7201405662. So the window is a price of P, and main's behaviour today is the wrong baseline for it.

    Option What a user sees Cost
    a. The approval lock holds through the passage, for closing fields, and ships with the key (recommended) From submission to the end of the approval nobody else can change the document, and the lock read says "in approval" throughout The lock's three reads also honour the mark of question 2, so no second field. About one more PR before the key is released.
    b. Ship the key without it, and add it later A caller with edit rights can change a document between two steps, or after the last approval and before it closes Nothing now. Later it is a behaviour change for apps that have declared the key.
    c. Hold for every approval Apps that declare no closed state change too: a document that could be edited between two steps no longer can A shipped-behaviour change, for the release notes

    Recommended: a. Revision 1 of this note recommended b on the ground that nobody is hit today. That does not stand: the field is needed anyway, and after release the hold is harder to add. The hold's card answers two things. What releases it when the process dies: the reconciler, when it judges the mark. And which runs pass it: the pending lock passes the run that opened the request by its run id, and a parent run's nodes carry another, so the pass has to be by the approval's root run.

    N46. A failure the flow routes

    A flow can route a node's failure and complete without the next step having been asked. On which side of the bound does that fall?

    Option What it means Cost
    a. Always the author's routing The decision stands whenever the run completes A step that was reached and could not open is passed over, and the document reads approved
    b. Only a later step that could not open counts Any other node's routed failure is the author's routing A node on the way to a later step fails, its fault edge leads to an end, and the document closes as approved with a step never asked. What remains is a note to authors.
    c′. Any routed failure between two steps counts (recommended) A failure the flow routed, of a top-level node in the stamped set, after which the run ends with no further step of the approval opened, is an end between two steps. A later step that could not open counts however its failure was routed. The door reads the run's step log, which records the failure (reading 5), against the set question 3 stamps
    d. Refuse such an edge when the approval opens A seventh condition in item 7's check Amends the six conditions of ADR-0162, and takes away the pattern "no approver found, route to a fallback step"

    Recommended: c′. It refuses more than b and loosens nothing. On this card's parent the maintainer has twice chosen "the platform blocks it" over a note to authors (7201405662, 7205949718), and b's residual is a note to authors. An author who means "handled, go on without the later step" still has a way to say it: handle the failure inside a try_catch region and branch on a gateway. A later step that could not open is detected at the plugin's own door, by a durable note on the approval's latest request, so that detection does not depend on how the failure was routed. Four tests pin it: a later step that fails to open with a fault edge to an end (abandoned; the field keeps the put-back value); the same with a fault edge to a second step that opens (in progress; pending); another node that fails between two steps with a fault edge to an end (abandoned); and that node's failure handled in a try_catch region, after which a gateway ends the flow (finished; the outcome is written).

    4. What each answer touches

    Answer Loosens an app's own rules for a mirror write Changes shipped behaviour ADR-0162 text Clause-②
    Shape P No No (closing fields only) About ten statements (section 5) Yes: the mark on the request
    Shape C Yes: validation rules, option visibility and metadata hooks, for one write No None Yes
    Q1 refuse the first opening on a refused pending No. The app's rule holds, loudly No (closing fields only) Fits D5 No
    Q1 shown by a, b, d No No None No; the topic is additive
    Q2 door, mark and reconciler No No, kept to approvals on a closing field None Yes (the mark)
    Q2 refuse on a host with no job service No No (closing fields only) A host condition beside item 7's six No
    Q3 T2 from the stamp No No None No
    Q4 a, with the refusal in #continueRestoredRun No No (only approvals this rule abandons) None No
    Q5 a No No Fits D5: the outcome an abandoned request leaves No
    Q5 the hold, for closing fields No No Part of the revision The same mark
    N46 c′ No No Settles what the card left open No

    To the maintainer: the choice between P and C, because C loosens an app's rules and P revises a merged record and changes what a user sees during an approval; and the hold, because without it P ships the key with a window D5 as merged did not have. The rest are means the seat can rule. Question 5's answer a is the seat's, and the maintainer should see it beside the cards, because it is the most visible consequence for users. If the seat prefers N46 option b to c′, that choice goes to the maintainer.

    Seven things stay keyed to "the object closes on this value of this field", so that an object with no closedStates behaves as it does today: the deferral, the refused first opening, the error line and the timeline note, the reconciler's new arms, the host refusal, the refusal in #continueRestoredRun, and the hold.

    os-decision-facets

    • ① Long-term soundness: P removes a special case (no closed value in the middle of an approval, no exemption in the data layer); C adds one in the engine for good.
    • ② Pull today: none. The key is unreleased; reach is a multi-step approval on an object that closes on its outcome, when one of three faults happens.
    • ③ Loud against silent: under P each fault leaves a held document, a stale status and a report. Under C a hook registered in code can still leave a closed document that reads approved.
    • ④ Not adding surface: P adds one field on the request and no engine member or metadata key. C adds an exemption every later platform writer will ask to use.
    • Prior rulings read: mirrorstatusfield,approvalstatusfield,skipautomations,stranded → 0 hits; none; thread: not read (no --card); repo: objectstack-ai/objectstack. Read by hand: ADR-0162 D5 and its three rulings of 2026-11-26 (7200732942, 7201405662, 7205949718), and the rulings cited in approval-service.ts that a recorded decision is not rolled back and that the stranded reader reports and never rewrites.

    5. What shape P changes in ADR-0162

    About ten statements, across four sections. None is in the words of a maintainer ruling.

    • D5. "The mirror writes each request's outcome as it is decided." "A record is on a closed value of its approval field in four situations only", whose second situation goes. "Two passes of the pending lock do not carry over", for a node after the last step. The reasons given for conditions 5 and 6, which both rest on the record being closed between two steps. The premise of the first three bullets of "What the conditions do not reach". And "Approved again ... its request opens and the field holds pending once more".
    • Consequences. The sentence that includes the steps after an approval decision among refused writers; the sentence that a record is open again while the next step is pending; and two bullets under what it costs.
    • Alternatives. "Hold a step's outcome back until the approval is over" moves to chosen for closing fields, and the narrow form of "Set the object's validation rules aside" is decided against.
    • Execution. Item 7's "Between two steps is after one step's closed outcome", and item 8.

    The revision should also say what becomes of the two conditions. Condition 5's reason is gone under P: a node between two steps is no longer refused by this lock, and keeping the condition tells authors to elevate a flow for no reason, so I would drop it. Condition 6 still has a reason: a pause between two steps would hold a document "in approval" with nobody asked and no verb to end it, so I would keep it and restate why.

    It is one Tier H revision, and it comes before the build, as a revision of its own: the build's tests pin the revised statements.

    6. Build outline, once ruled

    For shape P with the recommended answers. Sizes are estimates. No landed PR of this kind exists to measure against.

    1. Before item 7's first slice merges: whether a request records the run that carries its record as well as its root run. And item 7's check stamps the between-set on the requests it opens.
    2. The ADR revision (Tier H).
    3. The mirror no longer swallows on a closing field (S). Question 1's table and its a, b, d. A refused pending at an approval's first request refuses the opening.
    4. The outcome when the approval is over (M to L). The mark, the deferred write, the door's four answers read off the carrying run, the note at a failed opening and the step-log reading (N46 c′), and the abandonment by item 7's order with its mark on the request.
    5. The reconciler (M). Its three arms, its scan of the mark, its writer, the administrators' notice, and the host refusal.
    6. The hold (S to M), on the same mark, before the key is released.
    7. Docs: the approvals guide, on item 7's docs slice, says what an author and an administrator see in each case, that a flow firing on approved fires once on such an object, and that a node after a decision reads pending.

    Needs first: item 7's first slice, and item 1's key on the same trunk branch. Tests are the card's "Done when" list, each recording the value the field keeps as question 1's table gives it, plus the pins named in questions 2, 3 and N46.

    7. What this note did not establish

    • Whether a refused update can land in part, where an after-phase hook throws.
    • The two age bounds of the reconciler.
    • That a failed item fails its map: read from the node's docblock ("sequential and fail-fast"), not run.
    • How the hold's pass reads a writer's root run inside the lock hook.
    • Nothing here was run. The build's first step is to pin readings 3, 4, 5 and 6 with tests.

    8. Found beside this card

    Two things on main, both read and not run. Each is a card of its own if the seat confirms it.

    • #notifyDecisionOutcome asks for a pending request on the decided request's own run. A step decided in a subflow child, whose parent then opens the next step under another run id, finds none, so the submitter is probably told "approved" while a further step is open.
    • #inspectStrandedRequests reads 500 unordered rows of every decided request, so on a deployment with more than 500 it stops seeing new strands.
  7. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Released · 2026-11-27T21:21Z — answering triage 7228343677 on the seat mailbox.

    This card's design round is done: design note 2 and the maintainer's two rulings are 7210179412 (2026-11-27T04:53Z), and ADR-0162's revision landed (#37817, PR #37829). The build is not in flight: no thread, branch or PR. The maintainer closed the seat's data area for new work at 2026-11-27T15:43Z, so the card goes back to pm:queue, unassigned.

    Resume-from: 7210179412. The two side findings in its §8 are already cards and landed (#37806 via PR #37925, #37808 via PR #37952). The build's first step is the note's own: pin readings 3–6 with tests.

  8. added
    pm:queue
    and removed
    pm:dispatched
    on Nov 27, 2026
  9. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim: PM loop round 10 · 2026-11-29T01:06Z
    Picked from pm:queue on the maintainer's order in this seat's project, verbatim: 「开一个专区,接手 area:data 并发3」 (area declaration 7247668950).
    Session: session_01L6bhgV6i8jfWwSXjpWJrjA
    Thread session: session_01L6bhgX7z5dcSkTqEAWNMsP
    Account: os-sales
    Branch: claude/project-thread-75nte3 (from claude/project-thread-yxheps at 5d8b45b7, the #37768 trunk; the draft PR's base is that trunk, never main)
    Domain: domain:server
    Seat: repo:objectstack#2
    Area: s2-data
    File surface: packages/plugins/plugin-approvals (the approval service's mirror write and the open path) and its tests; one changeset. Not the data engine's write path, which slice B of #37768 builds on the trunk.
    Container & model: M, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high (reason: the thread session serves effort high)
    Clause-②: no (no published schema or export changes; if the build adds an error code or an export, the thread reports it and the seat amends this line)
    Metadata-protocol: none
    Responsibility: design note 2 (7210179412) §7 first: tests that pin readings 3–6 as they stand; then §6 piece 2: a refused write of the status mirror on a closing field is no longer swallowed, and an approval whose first request's pending write is refused does not open. Question 3's T2 and N46 c′ need slice B of item 7 (#37766) and are not in this claim.
    Thread-read: 7228385149
    Serial constraints cleared: no open PR of this seat edits these files (seat read); the thread runs scripts/pm/overlap-check.mjs before its first push.

    The PR says Part of #37767.

  10. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 29, 2026
  11. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgX7z5dcSkTqEAWNMsP
    os-dev-report

    {
      "issue": 37767,
      "status": "done",
      "branch": "claude/project-thread-75nte3",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38443",
      "session": "session_01L6bhgX7z5dcSkTqEAWNMsP",
      "premise_still_valid": true,
      "summary": "As claimed (7248563615), head bda8482bf, base claude/project-thread-yxheps at 5d8b45b7 (the #37768 trunk; the PR targets it, never main). Two parts. (1) Design note §7: readings 3-6 pinned as they stand, test-only, on an object with no closed state; all four held as read (node after a decision strands, field keeps approved; NO_APPROVERS and DUPLICATE_REQUEST strand unrouted and complete down a fault edge with the step never asked; a parent cancelled above a pending child leaves the decision admitted, a clean door answer and one warn line, the parent's next step never asked; the dead-run sweep changes nothing after any). (2) Design note §6 piece 2: on a field the object closes on at approved or rejected, mirrorStatusField no longer swallows a refused write. At an approval's first request the pending is written right after the row; a refusal voids the row as cancelled, empties the approver index, notes the timeline and fails the run with the app's own message (no lock taken). Every other refused write is reported: error line, actor-less timeline line with the refusal's message, notice to the organization's administrators under the new topic approval.status_mirror_refused (keyed text in all 11 shipped locales; topic added to service-messaging's PLATFORM_NOTIFICATION_TOPICS). Objects with no closed state keep the old warn. Deviation from the claimed file surface: one line in packages/services/service-messaging (the topic list, which every fixed approval topic is on), plus two regenerated ledgers (tenant-audit census, engine-double ledger). No new error code and no new export: Clause-② no, Metadata-protocol none hold. Small decisions taken by the thread are listed in the PR's Acceptance notes (how 'first request' is read before item 7 slice B exists; a refused first opening logs warn and notifies nobody because the caller is told).",
      "tests": "plugin-approvals full vitest under the verify lock at 2953b1ba: Test Files 133 passed, Tests 2002 passed, VERDICT command-exit 0 (bda8482bf only regenerates two ledgers). New: approval-mirror-unfinished-readings.test.ts 6 passed; status-mirror-closing-field-refusal.integration.test.ts 8 passed. Reverse verification: approval-service.ts restored to 5d8b45b7 (committed fix first) -> 7 of 8 refusal tests fail, the control and the 6 reading pins pass; restored from HEAD -> 14 passed. service-messaging src/preference-options: 9 passed.",
      "gates": "pnpm --filter @objectstack/plugin-approvals typecheck exit 0 (check:test-typecheck OK, no new debt). eslint --no-inline-config on the 5 changed source files exit 0. overlap-check --base trunk: clean, 0 PR heads. dispatch-gates --commands fed the branch's own file list (deviation: the shallow checkout had no merge base with origin/main, so the script could not derive it): 71 run; first pass 64 green; check:tenant-audit-census and check:engine-double-contract red on generated ledgers this diff moves -> regenerated with --write, committed bda8482bf, green; check-adr-0087-registration and check-changeset-no-major refused on the shallow clone, green after git fetch --deepen=300; check:query-options-erasure exit 0. NOT MEASURED locally (prerequisite not met, CI runs them): check:i18n (workspace CLI not built), check:dual-build-cjs-loads (packages not built), check-plugin-teardown-shape --self-test (pinned fixture below the shallow graft). PR check-runs: not yet read at report time.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 — fleet-write relay pr_create (#38443, with assignee os-sales; body read back identical, 11041 bytes); this report comment via post-stamped. git push x2 (not REST).",
      "open_questions": [],
      "security_findings": "withheld",
      "out_of_scope_findings": ["carrier: none · noted, not filed: the session-context step 'request os-sales's review' was not sent, because the fleet-write header says the seat's own account is never requested on a pull as a reviewer; the seat hands off."]
    }
  12. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim amendment · 2026-11-29T01:57Z · amends claim 7248563615
    Writes: File surface, as the build measured it: beside packages/plugins/plugin-approvals (the approval service, its translations and two test files), one row in packages/services/service-messaging/src/preference-options.ts for the new administrator notification topic approval.status_mirror_refused, and two regenerated ledgers (docs/audits/2026-08-tenant-audit-write-call-sites.counts/plugins/plugin-approvals.md, scripts/engine-double-contract.pinned.json). No error code or export is added, so Clause-②: no and Metadata-protocol: none stand. Every other line of the claim stands.

  13. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Landed (part) and handed back · 2026-11-29T03:49Z

    PR #38443 (Part of #37767) merged into #37768's trunk claude/project-thread-yxheps at 2026-11-29T03:47Z (trunk head bfe2df88b), on the seat's ACCEPT (7249695759) and the maintainer's choice; it is not on main.

    • Design note 2 §7: readings 3–6 are pinned by six tests, each matching the note.
    • §6 piece 2: on an object whose closedStates closes the status field at approved or rejected, a refused write of the status mirror is no longer swallowed. A refused first pending voids the request as cancelled and fails the run with the app's own message, no lock taken; any other refused mirror write logs an error, writes a timeline line with no actor, and notifies the organization's administrators (approval.status_mirror_refused). Objects without closedStates behave as before. Contract review 7249166202 PASS.

    Left on this card: design note pieces 3 and 5 (show approved only once the whole approval is over; hold the lock from submission to the end, per the maintainer's rulings in 7210179412), and question 3's T2 and N46 c′, which need #37766's slice B. Review 7249166202 carries O1 (the trunk must not reach main before piece 3 lands), O2 (a fault edge on the first node routes around the refusal; cover it) and O3 (a throw inside the voiding write replaces the app's message).

    Release: the maintainer closed this seat's data area after the cards in hand (「当前任务处理完,合并后就下班」, 2026-11-29T01:59Z) and chose to hand back at a clean point (2026-11-29T03:47Z). Resume-from: claude/project-thread-yxheps at bfe2df88b; the next piece branches from the trunk and lands into it, as piece 2 did.

  14. added
    pm:queue
    and removed
    pm:dispatched
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:datadomain:serverpm:queuepriority:p2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions