Skip to content

fix: preserve subagent outcomes across Gateway interruptions - #201544

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-restart-subagent-completion-silent-loss-20260919
Nov 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-restart-subagent-completion-silent-loss-20260919

Conversation

@steipete

@steipete steipete commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A Gateway restart can interrupt a completion-required subagent and silently retire its outcome, especially when the requester has already finished its turn. Separately, a transient failure before a direct completion is consumed can leave its input cancelled, making the scheduled retry fail permanently against the same input.

User Impact

User impact: requesters receive the interrupted child's “Gateway stopped” outcome after startup, and direct completions can retry transient failures before consumption. Intentional Stop and already-completed work retain their existing replay protection. No configuration or schema changes are required.

Why This Change Was Made

Shutdown now uses the existing terminal completion owner instead of intentional quiet-kill settlement. It captures the error and defers cleanup, preserving the required delivery obligation through restart. Direct completion turns now use the same processing receipts and safe cancelled-input retry as private and batched completions.

The production change is seven net lines: an explicit error outcome with deferred cleanup, and inclusion of direct completions in the existing receipt classification. No new retry loop, cache, or state owner. Requester-run turnover and source-owner guards are handled separately in #195275 and are untouched here.

Related: #198905, #199488, #199868, #201460, #195275.

Evidence

Real-Gateway restart regressions fail on the exact base and pass with this change: a running child reports its shutdown error to both a yielded requester and an already-finished requester; a recovered completion survives a transient access-policy failure and reaches the requester on retry. The assertions require the actual child outcome, so a generic restart prompt cannot satisfy them.

244 lifecycle/worker/restart-collector tests and 74 Gateway receipt, queued-registration and swarm-close tests pass. All 18 real-Gateway restart and completion-custody cases pass, including announcement crashes, private completions, busy requesters and stale settle wake recovery. pnpm check:changed passes, and isolated Codex review is clean through P2. Synthetic scale proof uses a 43.35 GiB database, 10,800 sessions, 4,300 runs and 62,000 files (1.116 GB), on APFS. Five interleaved A/A/B timing groups give shutdown-owner wall medians of 628/652/650 ms and CPU medians of 970/981/1002 ms; the unchanged A/A controls include a 1767 ms outlier, so no speedup is claimed. Three separate allocation-sampling groups show main-isolate allocation of 14.54/14.56/18.00 MB, about 24% extra for preserving canonical completion custody. Every candidate run retains 16/16 required outcomes; both base controls retain 0/16. Imports, fixture setup and hydration are outside timing. Allocation excludes worker heaps; CPU includes workers. This measures terminal settlement, not total restart downtime or btrfs behavior. The committed probe reproduces the measurement.

The generic historical “agent run aborted” message alone does not identify its aborting predicate. This change fixes the independently reproduced obligation and retry defects; it does not claim to establish that historical predicate.

CI attribution

Exact-head CI run 44431185416 has one inherited failure: src/gateway/chat-goal-created-authority.e2e.test.ts times out waiting for provider cancellation after users.setRole. It reproduces on CI’s exact main parent b7bf9150fa20bfe93cfe6a64b79c4f0f5ec4ce4e. The unchanged test passes on b400e8deed133ac0fa084072424fe1285f162952 and fails on its immediate successor ad550e953a9bcd81a424de087afed5823454ec97 (#201377). That change fixes authority for an admitted recovered continuation but leaves this test expecting mid-request role revocation. This is a main test-contract regression requiring follow-up, not dismissed as noise. This PR changes neither the failing test nor its recovery-authority owner. All other CI jobs pass or skip, including security-fast; all 18 restart cases also pass in CI. Local focused proof and pnpm check:changed are green. ClawSweeper’s final-head review has zero findings and zero open items. Landing uses the explicitly authorized inherited-failure exception; CI is not described as fully green.

Retain required shutdown errors through canonical completion settlement and enroll direct completion turns in existing processing receipts so transient pre-consumption failures can retry. Preserve intentional Stop and completed-receipt replay protection. Real-Gateway restart regressions fail on the parent and pass with the fix.
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: M labels Nov 19, 2026
@steipete
steipete marked this pull request as ready for review November 19, 2026 00:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T00:45:15.482342Z 93d4c44 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Please review the final head 93d4c44, focusing on shutdown completion custody and safe retries of direct completion inputs. All 18 real-Gateway restart cases, 318 focused owner tests, and pnpm check:changed pass; isolated Codex review is clean through P2. The source-owner guards changed separately by #195275 are untouched.

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves interrupted subagent outcomes for delivery after restart and enables safe retries of direct completion inputs.

Example: A requester finishes its turn while its child is running, then the Gateway restarts.

  • Before: Shutdown quietly retires the child's completion obligation, so the requester can miss its outcome.
  • After: The requester receives the child's recorded “Gateway stopped” error after startup.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation with useful production-path regression coverage; confidence is limited to source inspection and reported automated execution while exact-head CI remains pending.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; supplied evidence consists of reported Gateway subprocess regressions with a synthetic provider, without a separate runtime capture.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Requesters can miss an interrupted child's outcome, and a temporary pre-consumption failure can permanently strand direct completion delivery.
Reason: The maintainer-authored direction restores owed results through existing owners and preserves intentional cancellation and replay protection.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR narrowly repairs two completion-delivery defects still present on current main; review found no actionable introduced bug.

Priority: P2
Reviewed head: 93d4c44df0ed19ed4cca0b46be860b93da5866e7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The subagent registry settles child execution and retains completion obligations; Gateway turn admission persists and reconciles the inputs that deliver those outcomes to requester sessions.

flowchart TD
  A[Gateway shutdown] --> B[Subagent terminal owner]
  B --> C[Persisted completion obligation]
  C --> D[Startup completion recovery]
  D --> E[Requester turn admission]
  E --> F[Processing receipt]
  F --> G[Requester conversation]
Loading

Technical review

Best possible solution:

Use the existing terminal completion and processing-receipt owners to preserve delivery obligations while retaining Stop, consumption, and completed-receipt finality.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes both failure paths on fetched main, and the maintainer reports base-red/head-green Gateway regressions; this review did not independently execute them.

Is this the best way to solve the issue?

The patch is the smallest complete repair supported by the inspected paths: it corrects shutdown settlement and extends the existing receipt classification without adding a retry mechanism or competing state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 24cb73462fe3.

Provenance checked

  • Shutdown completion settlement changes intended behavior with a stated reason (9344233: The restart simplification intentionally made root resume input own reconciliation and settled children quietly without parent notices.)
  • Requester completion receipt classification keeps the original intent (70da467: A shared predicate ensured private and public settle turns recorded durable cancellation receipts; extending it to direct completions retains that intent.)
  • Restart regression expectations changes intended behavior with a stated reason (fix(sessions): preserve yielded roots across Gateway restarts #195661: Existing tests expected ordinary root reconciliation after children stopped; the revised assertions require delivery of the actual child outcome instead.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 18e257d adds src/gateway/agent-turn/agent-run-user-turn.ts:465 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 18e257d38139; files: src/gateway/agent-turn/agent-run-user-turn.ts)
  • Jason (Json): Raw commit 70da467 adds src/gateway/agent-turn/agent-run-user-turn.ts:371 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 70da467c9e49; files: src/gateway/agent-turn/agent-run-user-turn.ts)
  • Ayaan Zaidi: Raw commit cf21361 adds src/agents/subagents/registry/subagent-registry.ts:630 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: cf213616b987; files: src/agents/subagents/registry/subagent-registry.ts)

PR surface

Source +7, Tests +13, Docs +4, Other +187. Total +211 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 12 5 +7
Tests 2 44 31 +13
Docs 1 9 5 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 187 0 +187
Total 6 252 41 +211

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: The repair addresses lost completion outcomes and stranded retries in bounded Gateway interruption paths.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The repair addresses lost completion outcomes and stranded retries in bounded Gateway interruption paths.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 18, 2026, 7:47 PM ET / November 19, 2026, 00:47 UTC.

@steipete
steipete enabled auto-merge (squash) November 19, 2026 00:57
@steipete
steipete disabled auto-merge November 19, 2026 01:13
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI run 44431185416 has one inherited failure: src/gateway/chat-goal-created-authority.e2e.test.ts times out waiting for provider cancellation after users.setRole. It reproduces on CI’s exact main parent b7bf9150fa20bfe93cfe6a64b79c4f0f5ec4ce4e. The unchanged test passes on b400e8deed133ac0fa084072424fe1285f162952 and fails on its immediate successor ad550e953a9bcd81a424de087afed5823454ec97 (#201377). That change fixes authority for an admitted recovered continuation but leaves this test expecting mid-request role revocation. This is a main test-contract regression requiring follow-up, not dismissed as noise. This PR changes neither the failing test nor its recovery-authority owner. All other CI jobs pass or skip, including security-fast; all 18 restart cases also pass in CI. Local focused proof and pnpm check:changed are green. ClawSweeper’s final-head review has zero findings and zero open items. Landing uses the explicitly authorized inherited-failure exception; CI is not described as fully green.

@steipete
steipete merged commit 82e52b6 into main Nov 19, 2026
232 of 244 checks passed
@steipete
steipete deleted the steipete/perf-micro-restart-subagent-completion-silent-loss-20260919 branch November 19, 2026 01:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…w#201544)

Retain required shutdown errors through canonical completion settlement and enroll direct completion turns in existing processing receipts so transient pre-consumption failures can retry. Preserve intentional Stop and completed-receipt replay protection. Real-Gateway restart regressions fail on the parent and pass with the fix.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
…estart-custody pin

Upstream openclaw#200533 (703c82d) moved queued-input custody from the graceful
shutdown marker to the pending-input rows, so the marker is `{}` rather
than `{ queuedInputIds: [] }`. Case 3 of
subagent-registry.restart-terminal-custody (the root's resume input does
not stand in for a delegate's receipt) pinned the old shape: green at
chain head fa212db, red at ead2225, 11/11 here. The custody
assertions that follow are unchanged.

Carried to the pure candidate (stage 2): openclaw#200533 arrives with the 41bdde2
merge. On the merged head case 3 fails at the marker ({} vs
{ queuedInputIds: [] }); with this change it passes the marker and stops at
the separate upstream openclaw#201544 shutdown-outcome change (subagent-error vs
subagent-killed), which is held for 🌊's ruling and not changed here.

(cherry picked from commit 525e98d)
Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
… H1 custody against the sweeper (O3)

🌊's O3 ruling pins, carried to the pure candidate (stage 2): upstream's
restart sweeper settle (openclaw#200807/openclaw#200873) arrives with the 41bdde2 merge,
and the fork's activation settle (subagent-registry-restart-custody.ts) is
the same code here, so the precedence is kept only with its restart test.

- 0019d35 (verbatim): activation settles an earlier process's delegate
  before the sweeper, and its requester gets no second outcome; a plain
  sibling is the live-sweeper control.
- decc47c: the T3d H1 rows, inserted without the staging-only T3b/T3c
  chain pins that preceded them there.

On this tree: the new restart case passes; with the activation settle call
removed it is red at the post-activation receipt (expected terminal, got
running). The H1 file is 24/24 solo twice; T9/T9b showed the documented
1-of-2 load-timing flake in one paired run and were green on the rerun.
Cases 1 and 3 of the restart-custody file stay red on the separate upstream
openclaw#201544 shutdown-outcome change, held for 🌊's ruling.

(cherry picked from commit 0019d35)
(cherry picked from commit decc47c)
Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Retain required shutdown errors through canonical completion settlement and enroll direct completion turns in existing processing receipts so transient pre-consumption failures can retry. Preserve intentional Stop and completed-receipt replay protection. Real-Gateway restart regressions fail on the parent and pass with the fix.

(cherry picked from commit 82e52b6)

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Retain required shutdown errors through canonical completion settlement and enroll direct completion turns in existing processing receipts so transient pre-consumption failures can retry. Preserve intentional Stop and completed-receipt replay protection. Real-Gateway restart regressions fail on the parent and pass with the fix.

Backport fixture correction: register live execution custody in the restart collector fixture; production unchanged.

(cherry picked from commit 82e52b6)

Co-authored-by: RomneyDa <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
…resume

🌊's ruling on upstream openclaw#201544 keeps its delivery path: a graceful
shutdown completes a live child with the error "Gateway stopped", and the
requester receives that outcome after startup. Restart-terminal-custody
cases 1 and 3 still asserted the fork's earlier quiet kill
(subagent-killed, intentional_non_delivery) and were red at e7de8c3
on that assertion.

Both cases now run startup end to end through the real announce flow:
the shutdown, a new lifecycle, the root resume, and three sweeps. They
record what each requester receives at the delivery seam. Case 1 has one
live delegate. The root gets exactly one input, GATEWAY_RESTART_RESUME_TEXT,
which names no child and claims no completion. The requester gets exactly
one outcome for that child, and its rendered text is pinned in full
("status: failed: Gateway stopped", "session_id: unknown",
"(no output)"). The row ends delivered, never as a success. Case 3 adds an
unreached sibling. It still gets no notice in this commit, and both
custody receipts stay inspectable. O3's no-second-outcome case is
unchanged and green.

The delegate rows now carry requesterAgentId, as spawn always records it.
Restart completion recovery admits a pending child only by that field.
Without it the stopped child's outcome was never re-admitted in this
fixture.

Negative control: with the pre-openclaw#201544 quiet-kill shutdown restored
(markSubagentRunTerminated with suppressTaskDelivery), case 1 is red
("expected 'subagent-killed' to be 'subagent-error'"). Case 3 stays green
there because upstream openclaw#201706's restore repair re-owes the quiet-kill
row on boot. Item 4 of this lane handles that repair.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
🌊's ruling on upstream openclaw#201544, item 2: a sibling silently settled by
intentional_non_delivery must not disappear from the prince's account.
Show which children were stopped or not reached in the root resume, or
give each a mode-preserving terminal outcome, never both, and keep O3's
no-second-outcome guard.

This takes the second route. At e7de8c3 Gateway activation settled a
delegate the previous lifecycle left running as interrupted, then closed
it with suppressCompletionDelivery and intentional_non_delivery. A
delegate the bounded shutdown kill never reached, or one a crash
stranded, therefore produced no notice. The requester saw only the
root's generic resume input after a graceful stop, and nothing at all
after a crash.

The interruption is now the delegate's one outcome, owed to its
requester like the shutdown's own. The settle freezes no result text, as
the canonical error completion does, and leaves delivery pending.
Startup's restart completion recovery admits it under current authority
and resumes it. The registry announce flow then routes it by the
delegate's own return mode: direct, silent, silent-wake or targeted.
Under an in-process restart the custody is still live, so the outcome
goes out at activation. A row that owes nothing still finishes cleanup
at once. The root resume input is unchanged: it names no child, and no
child gets two outcomes.

Why not the root-resume list: GATEWAY_RESTART_RESUME_TEXT is
upstream-owned and constant, a crash has no root resume to carry a list,
and a list reaches only the root. A targeted or nested delegate returns
elsewhere, so a list could not honour its mode. Per-child outcomes take
the route the reached sibling already takes under openclaw#201544, and stay in
the continuation-owned restart custody.

Pins (restart-terminal-custody, rendered text at the delivery seams):
- Two siblings in one restart, one reached by the shutdown and one not.
  Each is accounted for once, alongside the root's one resume input. The
  direct case keeps both custody receipts inspectable. silent,
  silent-wake and targeted each carry both outcomes on their own route:
  no wake for silent, one silent-wake per outcome, and the target
  session, woken, for targeted.
- A crash-restored delegate owes one interrupted outcome, gets no root
  resume, and is never relaunched. The plain child keeps upstream's
  history and gets none.
- In-process restart: one outcome at activation.
- O3: the activation-settled delegate gets exactly one announce flow and
  one outcome, never the sweeper's "did not survive the restart". The
  plain child gets the sweeper's notice. Every child is accounted for
  once.
- The parent's inspection while the outcome is owed: the list and
  snapshot report the delivery as pending, and runtime facts list the row
  under "Child results awaiting delivery".

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 20, 2026
🌊's ruling on upstream openclaw#201544, item 3: "failed: Gateway stopped",
"(no output)" and "session_id: unknown" cannot distinguish a graceful
shutdown from a task failure or support reasoning about recovery. Give
the outcome an explicit graceful-stop reason, the delegate's identity,
and any retained partial state, or say plainly that none was retained.
Never fabricate a child id.

At db74f92 the requester's status line read "failed: Gateway
stopped" for a graceful stop and "failed: subagent run interrupted: the
Gateway restarted before it ended" for a restart interruption. The task
label and session key were the only identity, and "(no output)" did not
say whether anything had been kept.

The status label now names each case and stays within the event's
500-character status bound:
- graceful stop: "stopped by a graceful Gateway shutdown before run
  <runId> finished (recorded error: Gateway stopped). Not a task
  failure; the run was not resumed. ..."
- restart interruption (an unreached or crash-stranded delegate):
  "interrupted: the Gateway restarted before run <runId> ended, and no
  graceful shutdown reached it. Not a task failure; the run was not
  resumed. ..."
With no result: "No result or partial result was retained; any work it
saved before then stays in its child session. Inspect it before
re-dispatching or abandoning the task." A suppressed-effects child's
session is never cleaned up, so that holds on either cleanup mode. With
a captured result: "Its last output before then follows as a partial
result."

The run id comes from the registry row. session_id stays "unknown": with
child-session effects suppressed the announce does not read the session,
and nothing invents an id. The recorded "Gateway stopped" error stays
verbatim, so upstream's restart e2e cases that match on it still find
it. Every other outcome renders as before.

The label lives in the continuation-owned message builder. The one
upstream-owned file touched is subagent-announce.ts, a one-line fork
hunk that passes childRunId. The restart interruption error is exported
from the restart custody that records it.

Pins: restart-terminal-custody pins the full rendered requester text for
direct delivery and for silent, silent-wake and targeted returns, for
both reasons, through the real announce flow.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 20, 2026
…e a deploy

🌊's ruling on upstream openclaw#201544, item 4: before any deploy, audit the
target's older pending quiet-kill rows and prevent a surprise late
delivery from restore. Verify the migration on fixtures first.

The hazard: before openclaw#201544 a graceful shutdown ended a live child with
markSubagentRunTerminated(reason "Gateway stopped",
suppressTaskDelivery). That left delivery pending as a quiet kill. On
its first boot, upstream openclaw#201706's restore (subagent-registry-restore-
metadata.ts) re-owes every such row that is still pending, whenever the
restart that wrote it happened. A probe of the pre-merge fork head
bc7e568 confirms that those rows match the predicate as its shutdown
writes them and still match after its next activation. What later boots
do to them depends on the seat, so each owner has to count their own.

The predicate restore uses is now exported as
isUnrepairedShutdownQuietKill, unchanged; restore itself calls it. It
is the one definition, so the audit cannot drift from restore. This is
the only upstream-owned change in this commit and is a candidate
upstream contribution.

Operator surface, offline, beside fence-status and interrupt-fenced:
- openclaw continuations shutdown-notices [--json]: read-only. It is
  refused while a Gateway owns the state and reads through an
  artifact-preserving snapshot. It lists every row restore would re-owe
  (the predicate, minus rows whose child authority restore skips) with
  runId, child, requester, delegate or plain, and endedAt. It prints no
  task text.
- openclaw continuations settle-shutdown-notices --ended-before <time>:
  runs under exclusive local state ownership. First it writes a backup
  with each row exactly as stored plus what the settle will write
  (<stateDir>/backups/subagent-shutdown-notices/, 0600, fsynced). Then it
  closes each row that ended before the cutoff as an intentional
  non-delivery: delivery not_required, disposition
  intentional_non_delivery, suppressCompletionDelivery. It compares and
  swaps on the stored payload, never deletes a row, and starts no turn.
  Rows at or after the cutoff are kept, so the deploy's own stop is still
  delivered.
- settle-shutdown-notices --undo <backup>: puts back each row that is
  still exactly as the settle wrote it.

Pins, on fixtures written by the pre-openclaw#201544 shutdown call itself,
booted through this build's real restore, root resume and announce flow
(subagent-registry.shutdown-notices):
1. The count names the three re-owed rows, not the explicit Stop. On an
   unsettled seat the week-old rows are delivered late: the hazard.
2. After a settle with a cutoff between them, the requester receives
   only the root resume input and the deploy restart's one stopped
   delegate. The settled runs are neither deleted nor delivered. Each
   stays reachable by run id as ended by "Gateway stopped" with delivery
   not_required.
3. The undo restores the rows byte for byte, and restore then re-owes
   them as before.
The CLI case pins the receipts, the untouched store bytes for the count,
and the refusals (no instruction, an unparseable time).

The restart custody suites share their registry world through
subagent-registry.restart-custody.test-support.ts. The worker inventory
classifies the settle as a CLI one-shot (T3) and is regenerated.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 20, 2026
…esented CLI

🌊's ruling (msg 1573159410027733043): move `shutdown-notices` and
`settle-shutdown-notices` out of the CLI presented upstream and into
fleet-only deploy tooling. Item 4 stays a required pre-deploy audit and
settle gate, with its fixture proof and an exact-build receipt.

The gate now lives in karmaterminal/openclaw-bootstrap,
deploy/tools/subagent-shutdown-notices (8368a13629). It runs from the target
build's checkout and imports that build's own state paths, snapshot,
subagent_runs store and codec, child-authority check and offline owner gate.
So this tree exposes no command or export for it. Its fixture proof moved
with it. prove.sh runs the proof against an exact product SHA: fixtures
written by the pre-openclaw#201544 shutdown, the tool in cold processes, this
build's real restore and announce flow.

Removed from this tree, each restored to its e7de8c3 bytes:
- register.continuations.ts and its test: the two commands, their receipts
  and refusals. fence-status and interrupt-fenced are unchanged;
- subagent-registry-restore-metadata.ts: the predicate is inline again, so
  the file equals upstream 41bdde2 byte for byte;
- the worker inventory's T3 classification and the regenerated inventory;
- docs/cli/index.md's section and command tree entries.
Deleted: subagent-registry-shutdown-notices.ts and its suite. RFC §5.4.4
boundary 5 drops the sentence naming the commands. The restart custody
test-support no longer takes the older shutdown's kill as a parameter,
because only the moved suite passed one.

The test-lines record is re-measured: +428 over e7de8c3, down from +575.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…w#201544)

Retain required shutdown errors through canonical completion settlement and enroll direct completion turns in existing processing receipts so transient pre-consumption failures can retry. Preserve intentional Stop and completed-receipt replay protection. Real-Gateway restart regressions fail on the parent and pass with the fix.

Release adaptation: Reviewed canonical shutdown error and processing receipt custody; owns real restart test error assertion and collector regression.

(cherry picked from commit 82e52b6)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant