Skip to content

perf(state): preserve fast database reopen after shutdown deadlines - #160201

Merged
steipete merged 17 commits into
mainfrom
steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919
Sep 29, 2026
Merged

steipete merged 17 commits into
mainfrom
steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes unnecessary full agent-database integrity scans after a managed restart exhausts its drain budget and exits while unrelated cleanup is still pending. Related: #159753.

User Impact

Finished SQLite writers release their leases early enough to preserve the existing clean-restart witness. A crash during a write still requires the full admission gate. No configuration, schema, migration, or rollback change is required.

Why This Change Was Made

The previous process reached OpenClaw's own shutdown deadline and exited zero with cleanup incomplete. Native execution and ordinary session-reclamation workers retained idle connections for 30 minutes; their late shutdown close sat behind stalled sidecars. A synchronous exit callback could not finish asynchronous worker lease release.

Both existing owners now observe the one-way drain signal: idle connections retire immediately, and active connections close after accepted work settles. Canonical-validation scopes retain their existing ownership. Cancellation never certifies a receipt: the last lease must still finish its checkpoint and native close. A later cleanup writer uses ordinary admission and dirties the receipt again.

The lease owner logs agent database clean-close receipt: written or its skip reason, after commit. Stale admission logs owner-pid-dead or owner-start-time-changed and that the previous release was not observed. Agent leases have no expiry, boot ID, or generation field. Archive-worker diagnostics go to stderr so CLI JSON stays valid.

Evidence

Merge repair: current head 03e578aa9535

Merged main at 6391a9ad3311 and preserved the published 7089beb81c4d ancestry with ordinary merge commits and a fast-forward push. This worktree already contained an unpublished rebase when the repair began; no rebase or force-push was performed during this repair. Final tree: 794d37691c4c23a45db309b7d46dee0cefe403cb.

Resolved the integrity-timing conflict by retaining main's replacement suite from e5d45852792b (#160766), which deliberately removed the case changed by the older PR. Retained main's cursor icon-isolation mock from caf777893868 (#160807) alongside the PR's cleanup. Main's session-entry redesign (#160358) and maintenance admission changes (#160815) remain intact. The ancestry-reconnection commit has no tree changes; its tree exactly matches the reviewed and tested candidate. No additional production behavior or configuration was introduced.

Fresh proof ran through the installed Crabbox CLI on blacksmith-testbox / openclaw-check, lease tbx_01m3nkrdqm33wsh49bdq26kg4k (provisioning run). Before both validation commands, Git blob hashes verified all 19 PR paths, the integrity-test resolution, package files, and validation runners. Native sync overlays the candidate on its own Git checkout; checks used the exact merged base. Dependencies were installed once with pnpm install --frozen-lockfile. The lease was stopped after proof.

  • env CI=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --base 6391a9ad3311451c39f5d0653332d574513a5e3d -- <all 19 PR paths> passed in 25m13.402s. Core production types, all 27 test type groups, formatting, ratchets, dead-export scans, storage/boundary guards, and import cycles passed. Typed lint: 0 warnings/errors, 18 files, 22.0s.
  • The focused command below passed 346 tests across 11 files, with 321.23s summed suite wall time and 6m39.952s remote command time including required runtime/worker preparation. The runner's runtime build passed in 41.8s. Managed SIGTERM passed in 3.442s; idle/active reclamation-drain regressions passed in 1.024s / 0.972s.
  • oxfmt and git diff --check passed. Fresh independent Codex review was scoped-clean through P2, with no findings. The default connection failed without a verdict; the configured authenticated route completed with unchanged model selection and reviewer isolation.
node scripts/run-vitest.mjs \
  src/agents/main-session-recovery/main-session-restart-recovery.test.ts \
  src/channels/plugins/contracts/channel-import-guardrails.test.ts \
  src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.test.ts \
  src/config/sessions/session-accessor.sqlite-reclamation-reuse.test.ts \
  src/gateway/server-close.agent-databases.test.ts \
  src/gateway/server.chat-history-cursor.test.ts \
  src/gateway/setup-inference.first-signin.integration.test.ts \
  src/state/openclaw-agent-db.integrity-lease.test.ts \
  src/state/openclaw-agent-db.open-timing.test.ts \
  src/config/sessions/session-accessor.sqlite-maintenance-worker.test.ts \
  src/config/sessions/session-canonical-validation-readiness.test.ts --maxWorkers=1

The initial changed-check command used the Testbox's newer HEAD as its comparison base and stopped at an unrelated line-cap mismatch in session-accessor.test.ts; it was corrected to the pinned merged base without changing candidate source. The successful run reported the environment-variable base-budget comparison unavailable in its shallow Git history; the current count remained 476/476, and all selected guards completed. Non-fatal dependency build warnings and runner-portal sync timeouts did not affect validation or lease cleanup.

No new performance benchmark or published-updater proof was run for this integration-only repair. Historical measurements below remain evidence for their named heads: notably 114 → 0 synchronous integrity PRAGMAs after managed shutdown; they are not relabeled as measurements of this head. No live Gateway was modified.

Current-head CI 36520697644 is running on 03e578aa9535c33752698a500a8e4406213954df. GitHub reports the PR mergeable. No merge or auto-merge command was issued during this repair.

Previous integration, performance, update, and CI evidence

Final head: 7089beb81c4d, including the two CI fixture follow-ups below. Receipt-owner source remains unchanged from the rebased runtime proof.

Rebased onto 165fd29a4c1d0308a3dd264de40a9b755963b983; candidate ed9ce554b39efb737aa9a4f5a2f32bf61eb419ea. The only textual conflict was the cold-start chat.startup wait already present on main (with its explanatory comment, via #160366). Main's version is retained verbatim and the duplicate commit is dropped. The config-watcher fixture correction was also already on main. All three production commits are patch-identical, and the drain/lease/receipt owner files are byte-identical to previously green 2efc3a8e677c. Main's newer registry/config owners and planner repair are preserved.

Fresh proof uses blacksmith-testbox / openclaw-check, lease tbx_01m3mwjb62ez9hp9gqztan8eb4 (provisioning run). The native transport retains main as Git HEAD and overlays the unpublished candidate; exact checkout/base and SHA-256 checks bind all 18 PR paths, package files, and runners to this candidate. An initial head-only guard stopped before tests; checksum-bound validation then passed. Dependencies were installed once with pnpm install --frozen-lockfile. No heavy validation ran locally.

The reconstructed process fixture compares the same 68,395,008-byte synthetic store on one lease. Its independent baseline copy removes only drain retirement from the two writer owners, retaining current main, diagnostics, and type moves. Both variants use actual SIGTERM, exhausted drain, a real admitted reply claim through the abort-finalizer commit, stalled external cleanup, and the real 85-second watchdog under a synthetic 90-second service stop budget.

Measurement Retirement disabled Rebased candidate
Writer leases before SIGTERM → watchdog exit 2 → 2 2 → 0
Clean receipt before reopen 0 1
Integrity PRAGMAs on public reopen 114 0
Cold public open 130.794 ms 125.705 ms

The elapsed cold-open improvement in this single pair is 3.9%, smaller than the historical measurements below; the deterministic result remains removal of all 114 synchronous checks. Candidate warmed receipt reuse measured 0.097 ms, and a separate post-open schema/index probe measured 9.832 ms. Neither is a cold-open component timing. The SIGKILL-mid-write control kept a dirty receipt, ran 114 PRAGMAs / 14 ms of table checks, and rolled back the unfinished write. python3 /tmp/lane252d-compare.py /tmp/lane252d-proof.mts passed baseline managed restart, candidate managed restart, and candidate SIGKILL in 227.836 s remote command time. The temporary baseline cleaned itself up.

Focused suites passed 122 tests across 10 files, 183.62 s runner / 195.668 s remote command. Managed SIGTERM took 2.950 s; idle/active reclamation drain regressions took 1.380/1.511 s.

node scripts/run-vitest.mjs \
  src/state/openclaw-agent-db.integrity-lease.test.ts \
  src/state/openclaw-agent-db.open-timing.test.ts \
  src/state/openclaw-agent-db.integrity-cache.test.ts \
  src/state/openclaw-agent-execution.integrity.test.ts \
  src/state/openclaw-agent-execution.creation-witness.test.ts \
  src/state/openclaw-agent-execution.close-wedge.test.ts \
  src/config/sessions/session-accessor.sqlite-reclamation-reuse.test.ts \
  src/config/sessions/session-accessor.sqlite-reclamation-worker.test.ts \
  src/config/sessions/session-canonical-validation-readiness.test.ts \
  src/gateway/server-close.agent-databases.test.ts --maxWorkers=1

env CI=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --base HEAD -- <all 18 PR paths> passed on the same checksum-bound candidate in 28m23.853s. Core production types, all 26 test type groups, formatting, line/suppression guards, all dead-export scans, storage/schema/boundary checks, export checks, and import cycles passed. Typed lint reported 0 warnings/errors on 17 source files in 22.1s. git diff --check passed. The lease was stopped after proof.

Fresh independent Codex review is scoped-clean through P2. The default route failed without a report; the configured direct route completed with no findings and unchanged reviewer isolation. Runtime/package/updater proof below remains labeled with its originally tested commits; no package rebuild or published-driver rerun was requested for this patch-identical integration. No live Gateway was modified.

Conflict-repair CI 36486597970 on ed9ce554b39e failed only checks-node-changed-compact-large-2 plus the aggregate gate: the existing setup-inference.first-signin.integration.test.ts case exceeded 90 seconds. Diagnostics showed 72.728s inside Gateway startup/connect, then completed mocked device login, catalog, and embedded-probe requests before the wizard deadline. All Windows shards, extension bundles, UI E2E, and Docker seed passed; neither named infrastructure hold occurred.

The exact CI merge tree 3738b052fc8a7158e392a2140364463b9994a64d (main a46cde88785d plus ed9ce554b39e) was replayed on blacksmith-testbox / openclaw-check, lease tbx_01m3mzt3xerzmhknt2mkhfvhjv (provisioning). The captured five-group plan ran through node --import tsx scripts/ci-run-node-test-shard.mts, preserving group/file order, worker limits, serial plan execution, and eight-CPU affinity. It passed 160 tests, one Windows-only skip, in 11m17.401s including preparation. The unchanged sign-in case took 22.480s; this passing replay does not explain the original timeout.

The retained follow-up adds only plugins.allow: ["github-copilot"] to that provider-specific fixture. Its existing explicit configuration otherwise allowed unrelated default plugins to load. The real Gateway, setup RPC, device login, embedded probe, durable credential, hot-reload, and final model assertions stay intact, as does the 90-second timeout. No production code or assertion changed.

Paired standalone node scripts/run-vitest.mjs src/gateway/setup-inference.first-signin.integration.test.ts --maxWorkers=1 measurements, with identical temporary phase logging in both variants, showed startup/connect 32.782s → 9.419s, case time 40.025s → 24.064s, and runner wall 81.26s → 57.30s. Both passed every assertion. The paired command took 162.027s. Its first byte guard caught a transfer-added trailing newline before running tests; the corrected transfer matched the candidate SHA-256. This demonstrates reduced fixture startup cost, not a reproduced diagnosis of the CI timeout.

The final, instrument-free Gateway group passed 97 tests, one Windows-only skip in 325.26s runner; sign-in took 9.748s. The same merge-tree changed gate then found an inherited environment-count mismatch (485 vs 484) from main's Windows browser probe change 68a9ce03243a (#160432). That source and budget are untouched by this PR. The local Crabbox reporting wrapper stalled after recording the completed remote failure and was stopped; no remote test was interrupted. Validation continued on the published PR source plus the checksum-bound one-line fixture edit, whose count remains 484/484.

env CI=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --base HEAD -- src/gateway/setup-inference.first-signin.integration.test.ts passed on the checksum-bound published-head candidate in 5m24.699s: Gateway-root types passed in 67.2s, all formatting/declaration/dead-export/boundary guards passed, and typed lint reported 0 warnings/errors in 10.8s. git diff --check passed. The lease was stopped before committing.

Fresh independent review of the fixture change is scoped-clean through P2. The previously reviewed and tested receipt owners are unchanged. CI 36492961494 on 061359450b48 passed the sign-in follow-up but exposed a different fixture lifecycle failure in checks-node-changed-compact-small-17: EnvironmentTeardownError during ACP suite collection. The recorded import chain came from the preceding cursor test's nonblocking workspace-icon preparation. Its final two chat.startup calls launched those real promises, but cursor teardown joined only session readers and databases.

The cursor fixture now spies through the real icon-preparation function and joins its returned promises in finally before disposing its state. Assertions and optional-production behavior are unchanged. Shared history response typing keeps the file at 595 lines, five fewer than before; this follow-up adds no production code.

On blacksmith-testbox/openclaw-check, lease tbx_01m3n3bx2mdcf4cfe0dwm2sjvx, the captured original 14-file group passed 99 tests unchanged in 124.39s runner / 177.639s remote command on exact CI merge tree e324b99f905d4c7f46ab998180411e2c332a7646. This replay alone did not reproduce the teardown race. A disposable deterministic gate then retained both real icon preparations until the scenario's next event-loop turn: old source failed the named ownership assertion with 2 pending preparations at callback return; repaired source passed with 0 pending, still calling the real owner twice. Both probe paths joined their work even on failure. python3 /tmp/lane252d-icon-probe.py passed this negative/positive comparison in 121.874s remote time (baseline/candidate test commands 53.508s / 44.702s).

The instrument-free repaired 14-file group passed 99 tests in 110.37s. Intermediate typechecking caught incomplete response annotations in the nearby consolidation; the required array and discriminator types were restored without changing runtime behavior. Two subsequent source-sync attempts hit Blacksmith's two-minute checksum deadline before tests began; the stopped lease was replaced through the normal owner. Final source hash 1541aebd7edc92c6aebdc195d2cf0f9c65ad0bb8743d85dbe5a3940cd0a4259a passed node scripts/check-changed.mjs --base HEAD -- src/gateway/server.chat-history-cursor.test.ts on branch-based lease tbx_01m3n64xn9y6ss1wvabjas9qct: 5m11.968s, Gateway-server types 53.9s, typed lint 13.3s with zero warnings/errors, and all selected formatting/guard/dead-export checks. Intermediate lease tbx_01m3n5mbx9had7kke11xjfxpy3 and the final lease were also stopped.

Final independent review of the cursor cleanup is scoped-clean through P2, with no findings. Two earlier reviews were cancelled before verdict when static checking identified the intermediate type omissions; they are not counted as approvals. Fresh CI is pending on 7089beb81c4d; both earlier failures and their corrections remain recorded above. No merge command, workflow rerun, timeout increase, or empty proof push was used.

Earlier implementation, package/update, and CI evidence

The pre-integration process fixture on 5afe970abd5b used a 68,395,008-byte synthetic database, actual SIGTERM, exhausted restart/reply drain, an abort-finalizer write, stalled non-storage cleanup, and the real 85-second watchdog under a synthetic 90-second systemd stop budget. Both retained writer owners were present. Baseline and candidate shared the same Testbox; only those two owner files were restored from bb05e779e2a7 for the baseline, with final diagnostics and all siblings held constant.

Measurement Original owners Candidate 5afe970abd5b
Writer leases before SIGTERM → watchdog exit 2 → 2 2 → 0
Receipt before reopen dirty (0) clean (1)
Admission stale-lease, table gate (32 ms) cached witness
Synchronous integrity PRAGMAs on public open 114 0
Public cold-open wall 402.080 ms 197.169 ms

The candidate logged a written receipt after the abort-finalizer SQL commit and released both native writers before blocked external cleanup/watchdog exit. Intermediate incomplete checkpoints remained conservative; a later completed last close certified the receipt. Observed shutdown-owner lines included:

agent database clean-close receipt: checkpoint-incomplete
agent database clean-close receipt: written

The baseline reopen logged this for both surviving leases:

agent database stale lease: owner-pid-dead; previous release not observed

The same candidate's separate SIGKILL-mid-write control retained a dirty receipt, ran the full gate (15 ms, 114 PRAGMAs), and rolled back the unfinished write.

Receipt validation took 0.124 ms. A separate schema/index probe after public open took 16.787 ms. Total cold open is not under 10 ms. An earlier broader 10 ms probe assertion also failed (16.67 ms); receipt validation and total admission are distinct measurements.

This paired proof passed against 5afe970abd5b0130445dce9eb05743bd4bd03364 on blacksmith-testbox/openclaw-check, lease tbx_01m3ksx8tdc1vkyc5f5g9cvxky, in 255.34 seconds. It ran the checksum-bound comparison script invoking node --import tsx /tmp/lane252c-proof.mts driver stale managed for the baseline and node --import tsx /tmp/lane252c-proof.mts driver witness all for the candidate. The independent scratch copy was removed; the synced source remained clean.

The existing managed-SIGTERM Gateway regression now holds both writer types. It checks that abort settlement releases their leases while a sidecar is blocked, then verifies a clean receipt and cached reopen. New reclamation cases cover idle drain and drain during an accepted commit; both failed on the old owner because retirement never started. They also verify native worker exit, zero leases, committed data, and reopen without another full scan. No real sleeps, extra Gateway boots, or test-only production seams were added.

Final focused proof on tbx_01m3kp1tpg69pv8dg1fff3vf8r: node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-reclamation-reuse.test.ts src/config/sessions/session-accessor.sqlite-reclamation-worker.test.ts src/config/sessions/session-canonical-validation-readiness.test.ts src/gateway/server-close.agent-databases.test.ts --maxWorkers=1 passed 46 tests in 91.85s runner / 116.28s remote command including check selection. The new idle and active cases took 1.087s and 0.973s; the Gateway file took 51.30s including transform/setup and the three owner files took 37.51s. The final type/fixture split and real-IPC test observation were then verified on tbx_01m3kqh6s4brfbvgdce3cqj7bt: selected formatting, file-size, documentation, storage, boundary, export, import-cycle, lint, and type checks all passed. Core production types passed in 51.72s; Gateway and sessions test-type groups passed in 51.3s and 41.4s, with the final test-only change rechecked in 21.0s. Typed lint finished with zero warnings/errors. node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-reclamation-reuse.test.ts src/config/sessions/session-accessor.sqlite-mutation-worker.runtime.test.ts --maxWorkers=1 passed 25 tests in 70.82s runner; the final idle/active cases took 2.021s/1.978s. The continuation command, including remaining checks and tests, took 5m28.06s. Earlier failed attempts identified missing shallow Git refs, file-size limits, and the test method-capture lint issue; all were addressed without relaxing guards. The stalled history-fetch lease was stopped and the remaining checks used the published PR head as their explicit incremental comparison.

All heavy validation used the installed Crabbox CLI with provider blacksmith-testbox, profile openclaw-check. No local tests, builds, or typechecks ran.

  • tbx_01m3k7br2gn9ha7mwbh9ee71am: node scripts/check-changed.mjs --base HEAD -- <original seven paths> passed in 21m17s, including core types, all 25 required test type partitions, formatting, lint, storage guards, and import cycles. The Gateway/lease pair passed 20 tests (51.64s runner); six admission/lease siblings passed 74 tests (57.57s runner). The original process fixture passed in 1m41.6s.
  • tbx_01m3kjd5mj549s0ckmrg4f0vax: the five original CLI JSON failures, seven admission-timing cases, and five reclamation cases passed after archive-worker stderr routing. Formatting, typed lint, core types, selected test types, and import cycles passed.
  • tbx_01m3kp1tpg69pv8dg1fff3vf8r: the two new reclamation regressions failed on the old owner in 31.02s runner / 49.42s remote command. Source hashes bound the published base, reviewed unpublished correction, and dirty candidate because native targeted sync initially omitted the unpublished commit.

Published-updater × candidate proof passed on tbx_01m3ksx8tdc1vkyc5f5g9cvxky. The canonical node scripts/package-openclaw-for-docker.mjs packer built candidate 5afe970abd5b0130445dce9eb05743bd4bd03364 in 539s; tarball SHA-256: a06df3f081aa185e716f905f027cc26ff7003aa64315456b656909c0e8ae6c29. The installed published [email protected] created a real session/history in isolated operator state (3,960,832-byte shared database), then its unchanged updater ran openclaw update --tag file:<candidate.tgz> --yes --no-restart --json: ok, npm mode, 73.034s. The installed build commit matched the candidate exactly.

Candidate startup/history/write passed. The fixture initially attempted to import an intentionally unshipped qa-runtime module; that was a fixture error. It resumed on the same installed package and state using the matching source helper only to prepare the supervisor's native restart intent, without reinstalling or rerunning the updater. The corrected managed-restart/readmission segment passed in 31.207s: actual SIGTERM and exit zero, 1/1 clean receipts, preserved published history and candidate write, a successful subsequent write, one consumed receipt, and no stale-lease gate. All fixture children were joined and the lease was stopped. This is isolated package/update proof, not a production deployment.

Independent Codex reviews of the original fix, CLI-output correction, and reclamation completion were scoped-clean through P2. Integrated production head: 728bbac9576095d4e22cb362051c70bb39a53325, rebased onto 465fdd5adba67a2b8cef72fcc8c7fd688b7c9967 to resolve an actual conflict. git range-diff confirms the three production commits are patch-identical. Main had landed the equivalent requester clock repair in #160407; its version is retained verbatim and the duplicate was dropped from this PR.

CI run 36411439267 on 5afe970abd5b exposed a config-fixture race, requester timeout/duplicate-wake failures, and a guardrail no-output timeout. The config group now disables independent seed-file notifications while keeping real managed writes, cache, journals, and every assertion. Exact-merge replay passed 81 cases before the change; that passing replay does not erase the original failure. The repair passed 81 cases (214.62s runner), typed lint (30.2s), and Gateway test types (50.5s) on tbx_01m3kw0bw3tgg6dszs2v6dxyxb.

Requester tracing exposed a real worker-task timeout during a 151-second virtual-clock advance. Joining the retry at its stored deadline before crossing the rest of the same window passed all 18 cases, lint, and types; main now supplies that repair. The original native timeout and following duplicate did not recur in focused replays, so their cause remains unconfirmed.

The import guard retains all 20 cases and all AST assertions but uses the existing parser's 32-file batches. Paired two-CPU runs with the same 300-second no-output watchdog passed both variants: core assertion 18.258s → 11.865s, command 73.887s → 56.414s, with 12,046 inventory/parsed/asserted files. Final instrument-free code passed 20 cases, typed lint, canonical plugin-SDK test types, and size guards on the same lease. The CI watchdog timeout did not reproduce; this is a measured reduction in scan cost, not a proven diagnosis of that timeout.

Exact-head CI case costs from the five successful jobs in the 5afe970abd5b run were recovered: reclamation-reuse 24.405s (new idle/active cases 1.271s/1.148s), Gateway close 20.023s (managed SIGTERM 2.699s), integrity-lease 7.102s, open-timing 1.061s, mutation-worker runtime 0.002s. These are summed case times, not isolated file wall time.

Final integrated-head validation on 728bbac9576095d4e22cb362051c70bb39a53325 passed on blacksmith-testbox/openclaw-check, retained lease tbx_01m3m39157hj1ez25kngktw8r6:

  • Six focused execution/creation/close-wedge/lease/Gateway/reply-admission suites passed 72 tests (117.93s runner, 140.332s native command). Targeted typed lint and core/state-logging/Gateway-server/messaging type graphs passed.
  • Enhanced actual-SIGTERM/watchdog proof retained a real admitted reply generation claim through the abort-finalizer SQL commit, then used normal reply completion and its successor barrier to release the physical claim. Reclaimer close logged active-leases; final executor close logged written. Both leases were gone before blocked sidecar cleanup/watchdog exit. Managed reopen had clean_close=1, cached admission, 0 integrity PRAGMAs, and 97.750ms cold public open. Separate warmed probes after open measured 7.582ms schema/integrity validation and 0.025ms receipt reuse; these are not cold-open component timings. SIGKILL mid-write retained a dirty receipt, logged the stale dead owner, ran 114 PRAGMAs / 9ms of table checks, and rolled back the unfinished write.
  • Canonical package build completed in 7m44s, followed by passing tarball/import-graph checks. Artifact SHA-256: 8dbbc8b4ab148239e0d0e29b55aa2dc11776827d27247e4e5a48eac553eb8043. The installed published 2026.9.6 updater activated exact 728bbac in 87.827s, npm mode/status ok. Installed-candidate startup/history/write, native restart intent plus actual SIGTERM, 1/1 clean receipts, preserved history, receipt consumption, and subsequent write all passed. The serial runtime/package/update command completed in 13m11.115s, exit zero. The lease and all owned Gateway children were stopped.

CI follow-through exposed fixture and inherited-main failures, with no further production change in this lane. Main supplies the Telegram JSON-decoding repair (c582939c018c), initial-roster/readiness repairs (6b9da9dc028, f03d64f6a56, 94cbd1335dfb, e256cbef8ae0), retired voice-call guard removal (02a95db98aa1), heartbeat settlement repair (d9569745764f), and environment-budget correction (6e0d8aa1a0c4). These upstream versions are retained verbatim; duplicate local fixture edits were dropped.

The remaining recovery-fixture correction is commit 4a82911f3afe: await the existing durable admission observer instead of a one-second mock-call poll. That fixture now owns awaited scheduler cleanup in finally; all six callers migrate together, preserving state, RPC-count, and pre-admission cleanup assertions. The large test file shrinks. Original-order replays passed the 18-file heartbeat shard and full recovery file, so their original timing causes remain unconfirmed. The side-chat lost-request failure reproduced in a sibling table row; a held-roster probe verified Status focus before Owners existed and retained focus after roster admission. Its added Escape-close step failed separately; a revised probe using the existing filter toggle passed the entire original keyboard flow, including its original later Escape assertions.

Final retained-fixture proof passed on blacksmith-testbox/openclaw-check, lease tbx_01m3mjyz33zwh2dhzjzc62m02x, at published 11bfeaa51c42 plus the checksum-bound candidate. node scripts/run-vitest.mjs src/agents/main-session-recovery/main-session-restart-recovery.test.ts --maxWorkers=1 passed 222 tests in 188.16s runner / 209.64s wrapper. The equivalent local side-chat correction also passed all 24 cases in 33.56s before being replaced by upstream's broader shared helper. Targeted lint passed with zero warnings/errors (18.4s); canonical agents-other and UI-E2E type graphs passed (46.7s / 45.0s); line-cap, max-lines, environment census (484/484), and diff checks passed. Full serial command 399.789s, exit zero; lease stopped. The retained two recovery files exactly match the reviewed and tested bytes. Fresh review is scoped-clean through P2. Earlier proof on tbx_01m3mc9msjnbfn3vxj1xyyt3xq covered the original-order baselines and 265 candidate tests; that lease expired only after its completed checks were recorded.

Previous head: 2efc3a8e677c1a7cef10e711631fc7536b11e5f1. It preserves the tested 8c2fbeb36d1f correction and the subsequent external merge of main. The prior integration through 385ac2893544 repaired the named export-guard failure. The original drain/receipt owners and the two recovery-file hashes are unchanged by that integration. Runtime/package/updater evidence above names the commit actually tested; unrelated incoming main changes have not been repackaged here.

CI 36452900735 on 11bfeaa51c42 had only two substantive failures: the daemon facade's nine transparent lazy exports were reported as collisions (fixed by 385ac2893544), and Windows dependency installation failed before tests when the Matrix native-binary download returned HTTP 500 and its upstream error handler threw. No dependency patch, timeout increase, workflow rerun, or install-check bypass was added. The exact export guard passed on published 8c2fbeb36d1f using blacksmith-testbox/openclaw-check, lease tbx_01m3mm76gtnjsrp1mxsbq2fzpc: node --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mts, 33.461s guard / 199.846s native command including checkout/dependencies, exit zero. CI 36464875599 was cancelled when the branch was advanced externally; its last snapshot had 100 successful jobs and zero failed jobs. That is not a green completion. CI 36466301485 on 19cf7c1d449a ended with 163 successful jobs, a navigation-fixture failure, and a cancelled real-Gateway shard that had already recorded two 180-second delegation/media test timeouts; the aggregate gate failed. All five Windows shards and the export guard passed. No real-Gateway failure artifacts were retained. The receipt owners remain unchanged. The focused packaged-Gateway replay below passed unchanged; the original timeout causes remain unconfirmed.

The navigation fixture read the request count before transport readiness: both panes can enter loading while connection/initial-snapshot hydration is still pending. Commit 2efc3a8e677c awaits the existing chat.startup request observer before the exact one-request assertion; loading, response deferral, and both transcript assertions remain. On blacksmith-testbox/openclaw-check, lease tbx_01m3mrw11v1vbkva2nd95phd4f, env CI=1 OPENCLAW_UI_E2E_SKIP_REAL_GATEWAY=1 OPENCLAW_VITEST_MAX_WORKERS=3 OPENCLAW_VITEST_FS_MODULE_CACHE_WRITER=0 taskset -c 0,1,2,3 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner --maxWorkers=3 ui/src/e2e/chat-flow.navigation-presentation.e2e.test.ts passed all 10 tests: unchanged exact-CI-tree baseline 29.00s, candidate 28.79s (target case 1.163s → 1.117s). The CI race did not reproduce. Targeted lint (11.32s, zero warnings/errors), UI E2E types (50.4s), line guards, and diff checks passed; final serial command 114.537s, exit zero. Fresh independent review was scoped-clean through P2; lease stopped. Previous-head CI 36478122119 passed the navigation file 10/10 in 31.075s, including the changed case in 2.410s. The entire run completed successfully, including Docker seed E2E and openclaw/ci-gate. All nine mocked UI shards and both real-Gateway shards passed. No workflow rerun or empty push was used. The CI merge tree is d0b903bc642606786ca9c1caa1556080b077807e, combining this PR head with main 548a1b899fd09d7adc1580fabe6c8cfd3643ff82.

The two real-Gateway files passed unchanged on exact 2efc3a8e677c, provider blacksmith-testbox, profile openclaw-check, lease tbx_01m3mtpestw5ydj4sr7vrmvs7t (lease provisioning). After restoring missing dependencies once and preparing Chromium through its existing owner, OPENCLAW_BUILD_PRIVATE_QA=1 OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 pnpm build passed in 61.7s. With outer CI=true, the focused command was:

OPENCLAW_CAPTURE_UI_PROOF=0 OPENCLAW_VITEST_MAX_WORKERS=2 \
  node scripts/run-vitest.mjs run \
  --config test/vitest/vitest.ui-e2e-prebuilt.config.ts --configLoader runner \
  --maxWorkers=2 --reporter verbose --reporter ./scripts/lib/vitest-resource-reporter.mts \
  extensions/qa-lab/src/control-ui-openclaw-delegation.real-gateway.e2e.test.ts \
  extensions/qa-lab/src/control-ui-media-transcript.real-gateway.e2e.test.ts

Result: 2 files / 5 tests passed, 153.38s Vitest, zero unhandled errors; complete native command 381.628s, exit zero. Native approval took 48.987s, preceding media image 26.616s, PowerPoint 55.165s, and the two FullAccess cases 4.716s / 15.503s. The prebuilt owner verified runtime generation before and after. Node 24.19.0, eight CPUs, and two workers match the CI resource report. No source edits, tracing, assertion changes, or timeout changes were applied. Both original 180-second failures remain unreproduced; faster setup and case timings do not prove a fix or identify the original wait stage. The lease was stopped. Its separately linked provisioning workflow is cancelled after lease shutdown; the native proof command completed with exit zero, and the current-head repository CI run passed.

The earlier CI failures attributable to this PR were archive-worker diagnostics contaminating CLI JSON and a timing assertion counting unrelated receipt logs; both are fixed. Inherited merge-base failures were repaired separately on main: duplicate UI export (bb05e779e2a7), reliability-helper export (da2efd83b8a6), update-test Node path (8b549de1e0c7), Bun GC scheduling (c136ec631464), and custody-test expectations (fa90c83d1ab8). No duplicate base repairs are included here.

Production delta: 79 net lines, including a type-only extraction of the existing worker wire contract required by the file-size guard. Shared test fixtures were extracted with their assertions unchanged. The production Gateway was inspected read-only and was neither modified nor restarted. Fixtures use synthetic state and a synthetic systemd timeout response; they do not prove every possible blocked shutdown owner is eliminated. Active or unsettled writers, failed checkpoints, and failed cleanup retain conservative admission checks.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 06:30
@steipete
steipete enabled auto-merge (squash) September 28, 2026 06:34
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 12:38 AM ET / 04:38 UTC (Revision 21).

ClawSweeper review

What this changes

During Gateway restart drain, the branch closes settled agent and session-reclamation SQLite writers early, logs lease and receipt outcomes, and updates lifecycle documentation and tests.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still retains the writers that can prevent a clean restart receipt, and the earlier merged receipt work did not resolve that remaining path. The process, crash, and upgrade evidence supports this distinct fix; review found no actionable defect.

Priority: P2
Reviewed head: e74a4876099004edda45417597b669b249dc0e76

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong process and upgrade proof supports a sound owner-level fix, while the broad integration and fixture scope warrants normal maintainer review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed SQLite writer owners were exercised through actual managed SIGTERM and public reopen on Testbox: settled leases produced a clean receipt and removed the repeated integrity scans; SIGKILL during a write left a dirty receipt and ran the full gate. A published 2026.9.6 updater-to-candidate run preserved existing history and completed restart/readmission. The latest head leaves these production owners unchanged; no stored-data format changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed SQLite writer owners were exercised through actual managed SIGTERM and public reopen on Testbox: settled leases produced a clean receipt and removed the repeated integrity scans; SIGKILL during a write left a dirty receipt and ran the full gate. A published 2026.9.6 updater-to-candidate run preserved existing history and completed restart/readmission. The latest head leaves these production owners unchanged; no stored-data format changes.
Evidence reviewed 9 items Remaining current-main gap: The fetched main revision has no changes to the two writer owners relative to the pinned base; its retained workers still lack the introduced drain listeners.
Agent writer lifecycle: The last borrower closes its native generation during drain; an idle generation registers a disposable drain listener.
Reclamation writer lifecycle: Retained ordinary workers retire when idle during drain, while active work reaches the existing settlement path first.
Findings None None.
Security None None.

How this fits together

On a managed restart, the Gateway drains work while agent and session-maintenance workers may still hold SQLite connections. Their final lease release determines whether the next process can reuse a clean-close receipt or must run the full integrity gate.

flowchart LR
A[Managed restart] --> B[Gateway drain signal]
B --> C[Agent writer]
B --> D[Session maintenance writer]
C --> E[Lease and checkpoint owner]
D --> E
E --> F{Clean close receipt?}
F -->|Yes| G[Fast reopen]
F -->|No| H[Full integrity gate]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +79, Tests +178, Docs +18. Total +275 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 7 139 60 +79
Tests 12 342 164 +178
Docs 1 19 1 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 500 225 +275

Review metrics

Metric Value Why it matters
Production and test LOC production +139/-60; tests and support +342/-164 Production growth covers drain ownership, receipt diagnostics, and a moved type contract; lifecycle tests provide the main regression coverage.
Restart integrity checks 114 → 0 synchronous PRAGMAs The paired managed-restart process proof measures the intended fast-reopen effect while the killed-writer control still runs the full gate.

Root-cause cluster

Relationship: canonical
Canonical: #160201
Summary: The earlier merged PR established restart receipt reuse; this PR addresses the distinct retained-writer condition that can still prevent it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep final checkpoint and last-lease certification with the existing lease owner, and use Gateway drain to retire settled writers while interrupted writes retain full admission checks.

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

Yes. The supplied Testbox process fixture compares the retained-writer baseline and candidate through managed SIGTERM, a blocked sidecar, and public cold reopen; current main still has the baseline writer behavior.

Is this the best way to solve the issue?

Yes. The patch acts in the existing writer and lease owners, preserving the final checkpoint requirement and the full integrity gate for a killed writer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 33b10da45a8e.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded restart performance problem with no evidence of data loss or a blocked core workflow.
  • merge-risk: 🚨 compatibility: The change affects restart admission and existing updater state, which the published-updater and interrupted-write controls specifically exercised.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed SQLite writer owners were exercised through actual managed SIGTERM and public reopen on Testbox: settled leases produced a clean receipt and removed the repeated integrity scans; SIGKILL during a write left a dirty receipt and ran the full gate. A published 2026.9.6 updater-to-candidate run preserved existing history and completed restart/readmission. The latest head leaves these production owners unchanged; no stored-data format changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed SQLite writer owners were exercised through actual managed SIGTERM and public reopen on Testbox: settled leases produced a clean receipt and removed the repeated integrity scans; SIGKILL during a write left a dirty receipt and ran the full gate. A published 2026.9.6 updater-to-candidate run preserved existing history and completed restart/readmission. The latest head leaves these production owners unchanged; no stored-data format changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Arseniy Palagin: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (20 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T18:50:23.329Z sha 19cf7c1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T20:25:12.658Z sha 2efc3a8e677c1a7cef10e711631fc7536b11e5f1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T20:37:20.413Z sha 2efc3a8e677c1a7cef10e711631fc7536b11e5f1 :: blocked before merge. :: none
  • reviewed 2026-09-28T20:54:34.174Z sha 2efc3a8e677c1a7cef10e711631fc7536b11e5f1 :: blocked before merge. :: none
  • reviewed 2026-09-28T21:39:56.160Z sha ed9ce55 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T22:41:00.486Z sha 0613594 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-29T00:07:17.815Z sha 7089beb :: needs maintainer review before merge. :: none
  • reviewed 2026-09-29T04:24:48.942Z sha 03e578a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@steipete
steipete force-pushed the steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919 branch from 199ad25 to 243e3d6 Compare September 28, 2026 07:11
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 28, 2026
@steipete
steipete force-pushed the steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919 branch from c87c984 to 728bbac Compare September 28, 2026 13:27
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Sep 28, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: telegram Channel integration: telegram label Sep 28, 2026
@steipete
steipete force-pushed the steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919 branch from 3176f13 to d3f4f9a Compare September 28, 2026 15:12
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling app: web-ui App: web-ui and removed channel: telegram Channel integration: telegram labels Sep 28, 2026
Retire ordinary retained reclamation connections when Gateway drain commits, after accepted requests settle. Preserve canonical-validation scope ownership and prove native close, lease release, clean receipts, and cached readmission. Extend the managed SIGTERM fixture to include both retained writer owners.
Keep independent config file notifications out of approved-operation journal fixtures. Join real requester retry work before advancing its remaining virtual deadline window, and scan core import ASTs through the existing batched parser without changing inventory or assertions. Production behavior and timeout limits remain unchanged.
Replace the drain-recovery fixture clock poll with the existing durable admission observer. Let that fixture await scheduler stop in finally and migrate all callers together, preserving their state and RPC assertions.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 28, 2026
@steipete
steipete force-pushed the steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919 branch from 2efc3a8 to ed9ce55 Compare September 28, 2026 21:30
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Sep 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
Retire ordinary retained reclamation connections when Gateway drain commits, after accepted requests settle. Preserve canonical-validation scope ownership and prove native close, lease release, clean receipts, and cached readmission. Extend the managed SIGTERM fixture to include both retained writer owners.
Keep independent config file notifications out of approved-operation journal fixtures. Join real requester retry work before advancing its remaining virtual deadline window, and scan core import ASTs through the existing batched parser without changing inventory or assertions. Production behavior and timeout limits remain unchanged.
Replace the drain-recovery fixture clock poll with the existing durable admission observer. Let that fixture await scheduler stop in finally and migrate all callers together, preserving their state and RPC assertions.
Integrate main at 6391a9a while preserving drain-time writer retirement and the current maintenance admission owner. Keep the integrity timing suite from main after its retired case was removed. Verified on Blacksmith Testbox: changed checks passed; 346 focused tests passed across 11 files. Independent review found no actionable P0-P2 defects.
Reconnect the published PR head after the pre-existing local rebase without rewriting remote history. Keep main’s deliberate integrity-test removal and cursor icon isolation together with the PR cleanup. The resulting tree is byte-identical to the independently reviewed and Testbox-validated merge candidate.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 29, 2026
Backport main fix 743c2ce for the inherited check-lint-core-1 failure in CI 36520697644. Preserve all fixture records, ordering, and assertions. Blacksmith Testbox incremental checks passed and run-history.test.ts passed 10 tests; independent review found no actionable P0-P2 defects.
@steipete
steipete merged commit ba6b41f into main Sep 29, 2026
221 checks passed
@steipete
steipete deleted the steipete/perf-micro-witness-not-recorded-under-deployer-stop-20260919 branch September 29, 2026 04:50
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…penclaw#160201)

* perf(state): close idle writers during shutdown drain

* fix(state): keep receipt diagnostics out of CLI JSON

* fix(state): retire reclamation writers during shutdown drain

Retire ordinary retained reclamation connections when Gateway drain commits, after accepted requests settle. Preserve canonical-validation scope ownership and prove native close, lease release, clean receipts, and cached readmission. Extend the managed SIGTERM fixture to include both retained writer owners.

* test: stabilize CI fixtures and batch import guards

Keep independent config file notifications out of approved-operation journal fixtures. Join real requester retry work before advancing its remaining virtual deadline window, and scan core import ASTs through the existing batched parser without changing inventory or assertions. Production behavior and timeout limits remain unchanged.

* test(recovery): await durable admission and scheduler cleanup

Replace the drain-recovery fixture clock poll with the existing durable admission observer. Let that fixture await scheduler stop in finally and migrate all callers together, preserving their state and RPC assertions.

* test(gateway): scope first sign-in fixture to its provider

* test(gateway): join cursor workspace icon preparation

* perf(state): close idle writers during shutdown drain

* fix(state): keep receipt diagnostics out of CLI JSON

* fix(state): retire reclamation writers during shutdown drain

Retire ordinary retained reclamation connections when Gateway drain commits, after accepted requests settle. Preserve canonical-validation scope ownership and prove native close, lease release, clean receipts, and cached readmission. Extend the managed SIGTERM fixture to include both retained writer owners.

* test: stabilize CI fixtures and batch import guards

Keep independent config file notifications out of approved-operation journal fixtures. Join real requester retry work before advancing its remaining virtual deadline window, and scan core import ASTs through the existing batched parser without changing inventory or assertions. Production behavior and timeout limits remain unchanged.

* test(recovery): await durable admission and scheduler cleanup

Replace the drain-recovery fixture clock poll with the existing durable admission observer. Let that fixture await scheduler stop in finally and migrate all callers together, preserving their state and RPC assertions.

* test(gateway): scope first sign-in fixture to its provider

* test(gateway): join cursor workspace icon preparation

* test(cron): build history ordering records without a map spread

Backport main fix 11a8e2c for the inherited check-lint-core-1 failure in CI 36520697644. Preserve all fixture records, ordering, and assertions. Blacksmith Testbox incremental checks passed and run-history.test.ts passed 10 tests; independent review found no actionable P0-P2 defects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant