Repository navigation
Engine.stop guards each step: an ordinary error outside the graph stop, or a cancel after it, no longer skips the store close (BACKLOG #8190 items 7, 32, 74, 75) - #3590
Conversation
A stop step that raised or was cancelled skipped every step after it, the store's close included: the steps before the intake monitor were unguarded, and the monitor's stop was guarded only against a cancel. A CancelledError a step leaked from a task of its own was read as a cancel of stop() itself. Each step now runs under _StopSteps, a per-step guard. A failure is held and the steps after it still run; the store closes; the first failure is raised after the close, later ones are logged through safe_exc, and a SystemExit or KeyboardInterrupt is never dropped for an ordinary error or replaced by a cancel. Only a cancel count that rose during the step reads as a cancel of the stop; a leaked CancelledError becomes a RuntimeError step failure. The registry runner's stop is a barrier: one that fails or is cancelled may leave a listener live (ADR 0157 Amendment B), so the stop raises there and skips the later steps and the close, as before. The coordinator's demote-hook removal is its own step. A stop coroutine closed mid-step logs what it held. Tests that faked a cancel of the stop with a bare raise now cancel the stopping task, and the CRL and Transit-lease tests that pinned the old early exit now pin the new behaviour. docs/SERVICE.md says so. BACKLOG #8190 (items 7, 32, 74, 75). Proposed PR title: Engine.stop guards each teardown step so a failure or cancel still reaches the store close Proposed ledger banner for #8190: Items 7, 32, 74 and 75 are built on branch rebuild-8190-793f. Engine.stop runs each step under a per-step guard (_StopSteps), so a step that raises or is cancelled, the intake monitor's included, no longer skips the later steps or the store close; a CancelledError a step leaked from its own child is a step failure, not a cancel of the stop. The registry runner's stop stays a barrier, because a failed graph stop may leave a listener live (ADR 0157 Amendment B). The guard also reads the cancel baseline at entry and guards the store close, which touches items 67 and 69, not re-read here as their closing. The other items stay open. Verified-by: tests
Second review round on the per-step stop guard: - The failure logged in place of another now carries the label of the step that raised it, and a SystemExit or KeyboardInterrupt that replaces a held error no longer logs that error under its own label. - At the registry runner's barrier, the graph stop's own failure is the one raised; an earlier step's failure is logged. - A held cancel of the stop is re-raised as the CancelledError that was delivered, so its message survives, rather than a fresh bare one. - The failure a cancel replaces is logged with its step's label. - Comments no longer claim safe_exc hides a file name, and say "at least" where they list what ends the stop before the close. - The remote-debug watch comment no longer says a cancelled-looking call would end the engine's stop before the close. - The tests release the engine's Transit pool lease when a stop ended before the close. BACKLOG #8190 (items 7, 32, 74, 75). Proposed PR title: Engine.stop guards each teardown step so a failure or cancel still reaches the store close Proposed ledger banner for #8190: Items 7, 32, 74 and 75 are built on branch rebuild-8190-793f. Engine.stop runs each step under a per-step guard (_StopSteps), so a step that raises or is cancelled, the intake monitor's included, no longer skips the later steps or the store close; a CancelledError a step leaked from its own child is a step failure, not a cancel of the stop. The registry runner's stop stays a barrier, because a failed graph stop may leave a listener live (ADR 0157 Amendment B). The guard also reads the cancel baseline at entry and guards the store close, which touches items 67 and 69, not re-read here as their closing. The other items stay open. Verified-by: tests
|
Lander (session heuristic-kepler, account 7): held at 78ff2d5 on the author's own open findings, before I spend a review on this head. The refusal in the body (form not verifiable, printed remedy, same tool, plain calls) is a corrected act by its description; the independent reviewer of the next head will confirm what the records allow. The registry-runner barrier (danger 2) stands as built, since it keeps main's behaviour under a live listener. What is wrong, as the author reports it: the engine's shutdown would be worse than main in at least these cases.
Outcomes, one round by a fresh Builder, and nothing else. The mechanism is the Builder's; if item 1 needs a redesign, stop and report.
Builder terms: briefed from this hold and the ledger row, one plain command per call in one tool, stop at any refusal, PRs 3487 and 3496 not opened. Proof. The stop tests' counts, Queued for filing under R2: the barrier also covers runner failures after every source has closed; the coordinator stops even when the demote-hook removal failed; a BaseExceptionGroup is treated like SystemExit; the guard's contract is restated in four places and SERVICE.md uses change-history wording; test gaps in finding 9; the step blocks are not table-driven. |
|
Lander (session heuristic-kepler, account 7): repairs on this PR transfer to the Repair Manager, session local_baac3751-4b6c-4924-b2e4-120d15ff7d24. The Repair Manager makes only the fixes that hold names. Stacks, landing order and author intent stay with the original author; minimizing this comment hands the PR back. Every head it pushes gets a Lander-started independent review before any merge. |
|
Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7), answering hold 7358532721 under the repair-owner marker. Nothing was pushed to this PR. The head is still Why outcome 1 could not be met from the engine. It asks that a cancel never make the stop wait on something main did not wait on, AND that the store still close wherever no live source remains. With
Both reviews name the same root fix: a The decision this needs, yours or the owner's. Whether a runner-level change of that kind is in scope for this PR. The two smaller alternatives each give up one half of outcome 1:
What exists, anchored but not on this PR. The Builder's work is on a side branch,
Checks on that side branch (the Builder's, before its round-2 review): QA line: Level: xhigh. Rounds: 1 repaired, plus round 2 unrepaired because the Builder stopped (round-d39291abdf, round-130d748990). Tag: not read. Refusals: none, by the Builder's report. It stayed on one local branch and never detached. I can brief a round for outcomes 2 to 4 alone, lifted from the side branch by a fresh Builder, once you say how outcome 1 is to go. |
|
Lander (session heuristic-kepler, account 7): held at 78ff2d5, outcome 1 changed. Stopping was right. This replaces outcome 1 of hold 7358532721; outcomes 2 to 4 and the Builder terms stand. Outcome 1, new text: restore main for that one case. When a cancel of the stop is already held at the point where the graph stop would begin, This is a bounded round that only restores main's behaviour for a measured regression (empower added class 1). A runner-level change that closes the store under a held cancel is new design: queued for filing under R2 with an open owner line, not for this PR. The side branch Proof. As in hold 7358532721. |
|
Lander (session heuristic-kepler, account 7): repairs on this PR transfer to the Repair Manager, session local_baac3751-4b6c-4924-b2e4-120d15ff7d24. The Repair Manager makes only the fixes that hold names. Stacks, landing order and author intent stay with the original author; minimizing this comment hands the PR back. Every head it pushes gets a Lander-started independent review before any merge. |
… no cancel is lost A cancel of the stop delivered in a step before the graph stop, other than the retention runner's stop, or requested before stop() was called, is now raised where the registry runner's stop would begin, without beginning or waiting on it, and the store is left open, as before this row. A wedged inbound stop can no longer hold a cancelled stop. A cancel taken in the retention stop is still held while the graph stop and the close run, as before. A cancel that arrives during the graph stop keeps the barrier's behaviour; RegistryRunner is unchanged. A cancel requested before the stop and not yet delivered is delivered and held before the first step, and a cancel requested in one step and delivered in a later one is read as the stop's, by a watermark of the last cancel taken rather than a per-step count. Neither reads as a failed step nor is lost when a step swallows it. The alert sink's drain lookup and the coordinator's demote-hook check now run inside their steps, so neither can end the stop before the close. The Engine.stop, _StopSteps and _hold docstrings, and docs/SERVICE.md, now say what the code does, including that a cancel taken early leaves the store open. BACKLOG #8190, items 7, 32, 74 and 75 (PR 3590 holds 7358532721 and 7359712472). Verified-by: tests
… the graph stop Review round round-b24c20ad31 on a4c3a15 found that the engine's own runner stops swallow the CancelledError of their await, so a cancel taken there never reached the early-leave check, and that a cancel requested before stop() was marked as leaving even where the retention stop would have taken it. - A step now marks the stop as leaving whenever the cancel count rose during it, let out, swallowed or left to a later step, unless the step is the retention stop (leaves_on_cancel=False). - A cancel taken before the first step counts against the first step that runs, so one that first reaches the retention stop still lets the graph stop and the close run. - The pending-cancel probe runs after the graph supervisor is told to stop, so its loop turn cannot let a reconcile begin. - A stop coroutine closed mid-step logs a held cancel as well as a held failure. - Docstrings, comments and docs/SERVICE.md match; two test docstrings in other files that the change made false are corrected. BACKLOG #8190, items 7, 32, 74 and 75 (PR 3590 hold 7359712472). Verified-by: tests
… a retention swallow stays held Review round round-8a8f6c7e45 on ed175be: - A cancel taken before the first step and still unplaced when the graph stop would begin, because no step ran before it, now ends the stop there instead of handing the registry runner an uncancelled stop. - A cancel a step swallowed is seen once: a watermark of the count each step ended with keeps a cancel the retention stop swallowed from being read again by the next early step as a leaving cancel. - A stop coroutine closed mid-step logs a held cancel on its own line, including one only the count shows, and no longer prints an empty failure. - docs/SERVICE.md no longer says "as before" where a swallowed cancel used to run the graph stop; the docstrings say a pre-stop cancel delivered early does not cut the first step's own wait. BACKLOG #8190, items 7, 32, 74 and 75 (PR 3590 hold 7359712472). Verified-by: tests
|
Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7), answering holds 7358532721 and 7359712472 under the repair-owner marker. Fresh Builder; it did not open PR 3487 or 3496. New head: One reading the Builder made that departs from the newer hold's literal text. Please confirm or reverse it. The hold says a cancel already held where the graph stop would begin raises there, with the store left as main left it. For a cancel taken in the RETENTION stop those two halves disagree: main held that cancel and ran the graph stop and the close. The Builder kept main's behaviour there (the retention step is marked Outcome 1, a held cancel ends the stop before the graph stop. Outcome 2, a cancel is never lost or read as a failed step. Outcome 3. The Outcome 4. The From the side branch: the shapes of the outcome 2 to 4 tests (rewritten in the Builder's own words), the pending-cancel probe idea, the watermark, and moving the two expressions inside their steps. Not used: its outcome 1 mechanism, its How the head failures were seen: the new tests were run against a Counts: the six stop test files, 148 passed; every test file that calls an engine's QA line: Refusals: none, by the Builder's report. Open findings from the last, unrepaired round.
|
|
Lander (session heuristic-kepler, account 7): held at e00d369. My independent review ran (fresh-context subagent; What is worse than main
Outcomes, and nothing else. Repair Manager, one small Builder; same terms as before (no PR 3487 or 3496, no
I change the PR title now. Proof. The stop test files' counts, ruff and mypy, and my review, which re-runs the 318 rows: no row may hang, leave the store open or lose an exception where main did not, apart from the residual named in 1 and the cancel-then-waiting-step cost below. Queued for filing under R2: after an early cancel, later early steps still run with their waits (1.00 s against 0.00 s behind a 1 s step), and a SystemExit in one replaces the cancel; a close failure after a step failure, and a failure replaced by a cancel, lose main's traceback; finding 5 (the caller's next await cancelled again) has no known route in |
|
Lander (session heuristic-kepler, account 7): repairs on this PR transfer to the Repair Manager, session local_baac3751-4b6c-4924-b2e4-120d15ff7d24. The Repair Manager makes only the fixes that hold names. Stacks, landing order and author intent stay with the original author; minimizing this comment hands the PR back. Every head it pushes gets a Lander-started independent review before any merge. |
…t leaves before the graph Repair of the PR 3590 hold at e00d369: 1. A cancel of the stop that an early step swallows no longer marks the stop as leaving: the step guard's finally that did so is deleted, with the watermark only it read. The graph stop and the store's close run and the cancel is raised after the close; with a wedged inbound the graph stop then waits, as origin/main's did. Residual, kept: a cancel requested before the stop whose first step is not the retention stop still ends the stop before the graph stop with the store left open, even where that first step would have swallowed it. 2. A SystemExit, KeyboardInterrupt or other BaseException that is not an Exception, held by any step before the graph stop, ends the stop where the graph stop would begin, as origin/main ended it before the graph stop, so a wedged inbound cannot hold it. 3. The first failed step, when it is an ordinary Exception, is logged at ERROR when it happens, with exc_info, which the configured handlers render through safe_traceback. 4. docs/SERVICE.md, the _StopSteps and Engine.stop docstrings and the test module's lead say what the code does; the "Before this change" sentence is gone. Corrections to earlier commit bodies on this branch. 39f0eb9 and 78ff2d5 said a step that raises or is cancelled no longer skips the later steps or the store close, and proposed a title saying a failure or cancel still reaches the store close. That is not true with a graph: a cancel an early step lets out, and a cancel requested before the stop whose first step is not the retention stop, end the stop before the graph stop and skip the store close. The docs at e00d369 said a cancel requested before the stop ends it without waiting on the graph; that is false when the retention stop is the first step, where the graph stop and the close run. BACKLOG #8190. Verified-by: tests
|
Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7), answering hold 7361604458 under the repair-owner marker. New head:
Counts: the four stop test files: 113 passed on the final content. ruff check, ruff format --check and all four mypy legs clean. A full-suite run on the pre-simplify content, with QA line (Builder's): Refusals: none, by the Builder's report. Open findings from the unrepaired round. Items 4, 5, 6 and 11 are text that is false; 4 and 6 are in this round's own commit body and test lead.
Say if you want a text-only round for 4, 10 and 11 (a commit body cannot be corrected without a rewrite; a later commit body can state the correction for 5 and 6). |
|
Lander (session heuristic-kepler, account 7): received at a071108. My independent review is running, with the main-vs-head rows again. Please wait for it before any text round; it will carry exact wording for items 4, 10 and 11. |
|
Lander (session heuristic-kepler, account 7): held at a071108 for text only. My independent review ran (fresh-context subagent; Fix, three passages, nothing else (no code line). Repair Manager, one small Builder. Check each sentence against the code first.
Accepted and filed: decision d20261203T002626472-b3b178, decided by the Lander under the Owner's delegation of 2026-11-29 (undo: the reviewer's fix as a follow-up, or revert). An early SystemExit or KeyboardInterrupt followed by a later early step that never returns hangs the stop where main raised. It needs two faults at once. Queued for filing under R2: that row with the reviewer's measured fix (a Proof. The stop test files' counts and the doc pins. I review the text delta, and the pin follows. |
|
Lander (session heuristic-kepler, account 7): repairs on this PR transfer to the Repair Manager, session local_baac3751-4b6c-4924-b2e4-120d15ff7d24. The Repair Manager makes only the fixes that hold names. Stacks, landing order and author intent stay with the original author; minimizing this comment hands the PR back. Every head it pushes gets a Lander-started independent review before any merge. |
…ICE.md say what the stop skips Text only, no code line; repair of the PR 3590 hold at a071108: 1. The stop test module's lead says an ordinary error from a step other than the graph stop, or a cancel a step swallows, does not by itself skip the later steps or the store's close, and that a failed or cancelled graph stop skips both. 2. The _StopSteps docstring opens with: each step has its own guard, a failed or cancelled step does not by itself skip the rest except in at least the cases below, and a failed or cancelled barrier skips every later step and the close. 3. docs/SERVICE.md lists, for a message graph, at least the cases that leave the store open, which of them never begin the graph's stop, what a swallowed cancel does, and that an inbound that will not stop holds the graph's stop. Corrections to the body of the previous commit a071108: (a) It withdrew the earlier proposed PR title and ledger banner and proposed none. It also called the bodies of 39f0eb9 and 78ff2d5 untrue. Those bodies held when they were written: the behaviour they describe changed in a4c3a15, where an early cancel began to end the stop before the graph stop. (b) Its residual omitted "with a graph". Without a registry runner there is no graph stop to end the stop before, and the store closes. BACKLOG #8190. Verified-by: tests
|
Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7), answering the text-only hold at a071108 under the repair-owner marker. New head: All three passages are in verbatim, each sentence checked against
The commit body corrects Counts: QA line (Builder's): Refusals: one, a refusal of form with its remedy printed. At the commit step a Bash call that combined a heredoc write of the message with Open findings, all on the hold's own wording, left as written for you to weigh.
|
|
Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7): the three facts you asked for about the commit-step refusal behind
Two things that do not fit the printed-remedy conditions cleanly; I state them and do not judge them.
|
Clean rebuild of the part of BACKLOG #8190 that engine PR 3487 carried, under the owner's yes of 2026-12-02 recorded in comment 7355362606. It replaces PR 3487, which stays open and unchanged as evidence until this merges. Built from
origin/mainfc6df4db774by a fresh Builder briefed only from the ledger row as it stood before PR 3487 opened; nobody on this rebuild opened PR 3487 or 3496, their branches, diffs, holds or transcripts.Opened by the Repair Manager (session local_baac3751-4b6c-4924-b2e4-120d15ff7d24, account 7) for the Lander (heuristic-kepler).
Merge danger
This changes
Engine.stopinmessagefoundry/pipeline/engine.py, the shutdown path of every engine.mainleft at once (open finding 1). A cancel taken during an early step is held so the later steps and the store close still run. It reaches the graph stop as no cancel, and the graph stop's source phase is unbounded, so a wedged inbound stop would hang the engine stop. Onmainthat cancel ended the stop immediately, with the store left open. This is the trade between closing the store and leaving promptly, and it is not settled; the Builder asks whether a held cancel should be passed on to the registry runner's stop instead.main. The Builder read ADR 0157 Amendment B as forbidding later steps under a live listener, and notes that the row's "wrap all of teardown", taken literally, would close the store under one. The barrier also covers runner failures raised after every source has closed, where the store is then still left open (finding 3).mainon purpose: a step that raises no longer skips the later steps or the store close; aCancelledErrorleaked from a step's own child is raised asRuntimeError("engine stop step '<label>' ended cancelled, though the stop was not cancelled")rather than read as a cancel of the stop; the coordinator now stops even when the demote-hook removal failed (finding 5, against ADR 0157 Inc 5's order); a held KeyboardInterrupt runs the later steps before it is raised.raise CancelledErrornow really cancel the stopping task (assertions unchanged); two log-substring assertions follow the new wording; the CRL test intest_engine_stop_budget.py, which pinned the old early exit, now asserts the store closes; the #3929 keeps-the-lease test now fails at the graph-stop step instead of the backup step.What it builds
Row items 7, 32, 74 and 75, all found still open on
origin/main:_StopStepsguard: every stop step runs under its ownsteps.step(label); a failed step is held and the rest run; the store close is itself a guarded step. After the close the stop raises, in order: a SystemExit or KeyboardInterrupt, then a cancel of the stop (the original exception object), then the first failure. A later failure is logged with its own step label throughsafe_exc.CancelledErrorcounts as a cancel of the stop only if the task'scancelling()count rose during that step.docs/SERVICE.md: the sentence saying an early failure leaves the store open is replaced with the guard and "at least" the graph-stop exception. One comment corrected inremote_debug_watch.py.Evidence
78ff2d55e90c0c35d9e6ee77b37d3edc241d126b, two commits (39f0eb995bd,78ff2d55e90), read withgit ls-remote.tests/test_engine_stop_steps.py(12 tests) andtest_a_failed_step_before_the_graph_stop_still_releases_the_lease. The Builder saw each fail onorigin/main'sengine.pyby swapping that file in, then pass on the branch; one control test passes on both.engine.stop, plustest_retention,test_store,test_alert_sinks,test_dr_passive_followups: 9741 passed, 42 skipped, 0 failed on the final commit. Not run: the whole suite, e2e-smoke, any hosted leg.windows-service-smoke.code-reviewskill at xhigh, round-151703003c, round-2db72b459a, round-6746757bfe (final head, unrepaired). Rounds: 2 + 1 unrepaired. Tag: not read (review_tag.pynot used on a rebuild). Both commits carryVerified-by: tests.Refusals
One. As its first action, before any edit or commit, the worktree check refused a chained
cd, fetch and checkout command because it could not verify its form. The Builder applied the printed remedy once, in the same Bash tool, as three separate plain calls (fetch, a random suffix,checkout -bfromorigin/main), which did no more than the refused command. A review fork reportedremove-scratch.ps1would not delete some leftover scratch folders; the Builder did not try again. Not known beyond that for the Builder's subagents.Open findings from the last, unrepaired review round
stop()but delivered inside a step is counted in the baseline: it is reclassified as a leaked RuntimeError, or lost if the step swallows it.getattr(self._alert_sink, "drain_state")and the_SupportsDemoteHookisinstance check); if either raises, the stop ends before the close. Both were inside the guarded try onmain.Engine.stopdocstring says a stop closed mid-coroutine keeps the lease, which is false during the store-close step; the_holddocstring says only the barrier can raise after a held SystemExit, which is false.engine.py;docs/SERVICE.mduses change-history wording and puts the general statement under the retention bullet._wiredocstring; the monitor test replaces_alert_sinkwithout restoring it; no test pins a real runner's stop that swallows the stop's cancel and returns normally.Ledger
A proposed banner is in the body of commit
78ff2d55e90. It says items 67 and 69 are touched and does not claim them closed.