Skip to content

fix(sqlite): move WAL and serving-owner checks off the Gateway main thread - #184275

Merged
steipete merged 9 commits into
mainfrom
steipete/perf-micro-main-sync-fs-under-writeback-20260919
Oct 26, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/perf-micro-main-sync-fs-under-writeback-20260919

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Gateway main-thread stalls caused by synchronous filesystem checks during WAL diagnostics and SQLite ownership admission. During slow metadata writeback, these checks could block unrelated requests even though the database work itself belonged to a worker.

User Impact

Periodic WAL inspection now awaits filesystem operations. Ordinary serving-owner SQLite dispatch requests a fresh physical ownership check from the existing heartbeat worker, then rechecks the same live authority immediately before native admission. Slow I/O delays the affected operation while other Gateway work can continue.

A confirmed WAL mismatch still terminates before cleanup. Checkpoints, native close/deserialize, and dependent cleanup cannot overtake a pending scan. Idle eviction retains its handle, lease, and admission facts and retries after inspection. Ownership replacement, unlink, release, projection changes, or verifier loss still refuse admission. Successful ownership checks are never reused across requests.

Why This Change Was Made

The existing WAL owner runs the asynchronous procfs/sidecar scan, rechecks suspected descriptor reuse, and joins inspection during shutdown. The native SQLite disposal owner supplies the guard used by close, replacement, and agent retirement; it runs before clean-close sealing or admission invalidation.

The captured database-access owner supplies asynchronous preparation and a request-specific final authority guard. The first retained read consumes the successfully verified canonical-path fact instead of repeating two synchronous ownership probes; retargeted aliases still resolve and check their new destination. Generic SQLite broker dispatch, specialized session archive/reclamation requests, and asynchronous credential operations consume that contract. Credential path resolution is asynchronous while preserving invocation order for aliases. Expired heartbeat-timer recovery also uses asynchronous I/O and settles before shutdown completes.

No schema, dependency, configuration, or public API change. Synchronous bootstrap/schema, native cleanup, immediate sleep recovery, unregistered offline admission, and separate synchronous management-effect/SDK APIs retain their existing contracts. This PR does not claim all Gateway filesystem work is eliminated. Warm admission-fact lookup and reader diagnostics already perform no filesystem operations.

Measurement

Acceptance was declared before measurement: preserve custody and containment, remove main-thread stalls under injected I/O, and disclose relocated CPU/allocation cost. Five alternating base/candidate runs per owner, 2,000 operations each, separate CPU and sampled-allocation passes. Benchmark usage lives in each script's header; the shared perf README is unchanged.

Owner measurement, median of five Base Candidate
WAL: queued heartbeat, 5 ms injected per FS operation 845.35 ms 0.262 ms
WAL: whole delayed scan 844.74 ms 842.11 ms
WAL: main-thread CPU / 2,000 scans 73.42 ms 125.15 ms
WAL: sampled allocation / scan 111,403 B 219,845 B
Ownership: host sync FS calls / 2,000 admissions 16,000 0
Ownership: queued heartbeat, 20 ms injected per host FS operation 191.902 ms 0.133 ms
Ownership: main-thread CPU / 2,000 admissions 120.781 ms 92.481 ms
Ownership: process CPU / 2,000 admissions 131.211 ms 253.401 ms
Ownership: sampled host allocation / admission 6,870 B 2,199 B
Ownership: sampled total host + worker allocation / admission 6,870 B 7,483 B

This is a responsiveness repair, not a total-CPU/allocation improvement. WAL adds approximately 26 microseconds CPU and 106 KiB sampled allocation at its existing 30-minute cadence. Ownership adds approximately 61 microseconds process CPU and 613 sampled bytes per admission; host allocation falls about 68%, total allocation rises about 9%. Ownership main-thread CPU paired signs were mixed, so that median is context rather than a throughput claim.

WAL heartbeat ranges: 820.77–1120.53 ms before, 0.208–0.812 ms after; host one-minute load 60.97–81.85. Ownership ranges: 187.374–212.289 ms before, 0.118–0.158 ms after; host load 58.43–61.45. WAL uses 128 synthetic proc descriptors and two sidecars, with the same 135 FS operations per healthy scan. Ownership uses the shared serving owner used by session/plugin dispatch. These are owner measurements, not whole-Gateway load or p99 results. The benchmark's ownership delay applies to host calls; real-worker delayed verification is separately covered by regression tests. No Team activity or production-state access.

Evidence

Real broker regressions fail on the baseline's synchronous owner reads, then pass with the fix. They delay the actual heartbeat worker, exercise changed custody, and reopen SQLite to prove rejected writes were not committed. All three expired-timer regressions fail on baseline synchronous openSync. Focused ownership/heartbeat/broker/credential coverage passed 94 tests, specialized worker consumers 30, and final heartbeat coverage 31.

WAL regressions fail on baseline synchronous proc enumeration and cover healthy scans, mismatches, closed/reused descriptors, shutdown containment, checkpoint ordering, and native retirement. The idle-eviction regressions fail before the disposal guard because the native database closes while inspection is pending. The fixed tests require the native handle, lease, and admission facts to survive until inspection resolves; a healthy result subsequently permits eviction.

Earlier WAL-only CI exposed timer assumptions in sibling checkpoint, reclamation, admission, and state-open tests. They now await the existing scheduler instead of assuming timer firing completes asynchronous I/O. Those focused files passed on Node and pinned Bun; Linux CI passed all 54 WAL tests. One earlier mocked Control UI disclosure assertion failed and did not recur; it is not claimed fixed here. Combined-head CI exposed three more synchronous fixture assumptions: close during inspection, cancel before first worker dispatch, and reclamation maintenance scheduled during COMMIT. The fixtures now await actual admission boundaries and preserve native lock, retained-lease, cancellation, and shutdown assertions. Focused Node validation passes all 225 tests across five affected files; the four SQLite files also pass all 61 tests on pinned Bun. Scoped lint and independent review are clean. All lane files remained byte-identical through rebase. The unrelated reasoning-capability assertion is fixed upstream by #184414 and included through rebase. The final head must pass its own CI. On head 78f3f27, the discarded-environment pre-bootstrap case failed identically on the branch and its unchanged base. PostgreSQL memory rebuild returned an empty result in CI but passed five isolated full-file runs on both that head and CI’s main parent; attribution remains unresolved because the changed transport is on its path. The test now preserves unavailable/error diagnostics before reducing search results to paths; this is not claimed as a PostgreSQL repair. All seven PostgreSQL product tests pass with the strengthened diagnostic assertion on the rebased candidate, using a disposable local container and one test worker.

The final retained-read regression fails on 78f3f27 with two synchronous ownership probes and passes with zero. All 25 real-owner tests pass, including retained maintenance, ownership loss, and an alias retargeted to a different database under maintenance. Independent review caught and fixed alias-key publication before commit.

Scoped formatting/lint, the core typecheck, export collision check, and required closure checks passed. Focused local tests and PR CI provide proof under the requested fast-path protocol; no full Gateway stress campaign or Testbox lease.

Independent subagent review (autoreview route unavailable) found and fixed shutdown, checkpoint-overtake, and native-retirement ordering issues. The ownership cutover has a clean P0–P2 review. A proposed startup-inode finding was retracted after inspecting fs-safe's existing exact-byte/token contract; no stronger requirement was invented. The configured autoreview route refused before inference and operator configuration was not changed.

Final native-retirement proof: all 22 lease-owner tests pass on both Node and pinned Bun, including both delayed-scan eviction cases. The final WAL and native Kysely-cache files also pass (91 tests, five Linux-only skips on macOS). Fixture cleanup awaits the real maintenance worker, whose separate lease can legitimately outlive idle eviction of the original host handle.

Runtime production delta is +376 lines: asynchronous scan/request settlement, containment before native disposal, and async timer recovery with retained native/sleep-recovery contracts require that growth. The two standalone benchmarks add 386 lines of proof tooling; the requested non-test/non-doc total is +762 lines. There is no retained synchronous ordinary-dispatch or periodic-scan fallback. Existing heartbeat, disposal, resource-registry, and writer-queue owners remain authoritative.

Known residual: native runtime leases used by project checkout/clone, plugin/package lifecycle, and GitHub publication/OAuth still reach synchronous state ownership assertions. They need migration through the existing async lease owner and awaited effect preparation while retaining final synchronous guards. These are real runtime paths, not SDK-only exceptions; that follow-up is separate from this reviewed diagnostic/worker-dispatch cutover.

@clawsweeper

clawsweeper Bot commented Oct 26, 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 scripts Repository scripts size: M labels Oct 26, 2026
@steipete
steipete marked this pull request as ready for review October 26, 2026 06:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:53:17.838311Z 0f7f932 New commits
ℹ️ 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.

@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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR makes WAL inspection asynchronous and moves serving-owner verification into the existing heartbeat worker.

Example: A SQLite admission encounters filesystem calls delayed by 20 ms each.

  • Before: The reported benchmark delays unrelated host work by about 192 ms.
  • After: The reported benchmark reduces that delay to about 0.133 ms while ownership verification completes off-thread.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-level repair with meaningful containment and custody coverage, but two affected fixture families still fail on the exact reviewed head.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (none): For this maintainer-authored change, the inspected production-path broker harness covers allowed writes and replacement or release during delayed real-worker verification, then checks persisted rows; ordinary shipped-entry-point proof is outside the maintainer gate, and no full-Gateway performance result is claimed.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Slow filesystem metadata operations can stall unrelated Gateway requests during WAL diagnostics and serving-owner admission.
Reason: The maintainer-authored direction addresses measured blocking work, preserves the existing owners, and explicitly accepts the disclosed CPU and allocation tradeoff.

Merge readiness

⛔ Needs changes before merge - 2 items remain

This PR addresses a concrete responsiveness problem and fixes the earlier checkpoint, retirement, and scheduler findings; two additional sibling fixtures fail on the reviewed head and need focused repairs.

Priority: P2
Reviewed head: 01124e3e98eb2991a755506c8980d40cf540314e

Before merge

  • Synchronize reclamation cleanup fixtures with the asynchronous scan (P2) - On Linux, the new awaited sidecar scan makes the reclamation-maintenance preload's fire-and-forget periodic() return before vacuum and its injected COMMIT failure occur. The foreground reclaim can therefore settle before native-events.json exists. Current-head CI reports this exact ENOENT in all six pre/post cleanup cases. Adapt the fixture to coordinate scan completion and actual maintenance admission before asserting cleanup, preserving the rollback, native-exit, lease, and follower-ordering assertions.
  • Wait for the head request to post before testing queued revocation (P2) - The new await in dispatch yields before posting even when offline access preparation completes immediately. In sqlite-worker-shared-state-admission.test-support.ts, the queued-revocation case starts both writes and immediately revokes their shared authority, so the head is now rejected before dispatch as well. Current-head CI consequently observes zero execute posts at line 309 instead of one. Wait for the head's actual dispatch or admission before revoking the queued request, retaining the assertion that the revoked write never reaches storage.

Findings

  • [P2] Synchronize reclamation cleanup fixtures with the asynchronous scan — src/infra/sqlite-wal.ts:512
  • [P2] Wait for the head request to post before testing queued revocation — src/infra/sqlite-worker-broker-reply.ts:88-91
Agent review details

How this fits together

SQLite lifecycle and admission owners sit between Gateway requests and native database operations, checking custody and ordering maintenance, writes, and disposal.

flowchart TD
  A[Gateway request] --> B[Captured database access]
  B --> C[Heartbeat worker verification]
  C --> D[Live admission guard]
  D --> E[SQLite worker operation]
  F[Async WAL inspection] --> G[Maintenance and disposal owner]
  G --> E
Loading

Technical review

Best possible solution:

Keep the existing ownership and disposal cutover, and adapt the two remaining fixture families to await the actual asynchronous boundaries.

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

Current main synchronously enumerates procfs and checks ownership during dispatch, establishing the blocking path; current-head CI independently demonstrates the two fixture failures without running target code during this review.

Is this the best way to solve the issue?

Reusing the heartbeat, WAL, disposal, and admission owners is a coherent repair that preserves containment and live authority; the remaining work belongs in affected fixtures rather than production fallbacks.

Full review comments:

  • [P2] Synchronize reclamation cleanup fixtures with the asynchronous scan — src/infra/sqlite-wal.ts:512
    On Linux, the new awaited sidecar scan makes the reclamation-maintenance preload's fire-and-forget periodic() return before vacuum and its injected COMMIT failure occur. The foreground reclaim can therefore settle before native-events.json exists. Current-head CI reports this exact ENOENT in all six pre/post cleanup cases. Adapt the fixture to coordinate scan completion and actual maintenance admission before asserting cleanup, preserving the rollback, native-exit, lease, and follower-ordering assertions.
    Confidence: 0.98
  • [P2] Wait for the head request to post before testing queued revocation — src/infra/sqlite-worker-broker-reply.ts:88-91
    The new await in dispatch yields before posting even when offline access preparation completes immediately. In sqlite-worker-shared-state-admission.test-support.ts, the queued-revocation case starts both writes and immediately revokes their shared authority, so the head is now rejected before dispatch as well. Current-head CI consequently observes zero execute posts at line 309 instead of one. Wait for the head's actual dispatch or admission before revoking the queued request, retaining the assertion that the revoked write never reaches storage.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1e07f2fedbdd.

Provenance checked

  • WAL timer-entry containment changes intended behavior with a stated reason (perf(gateway): avoid chat stalls during WAL maintenance #158570: Inspection remained synchronous so containment preceded identity admission and stale native cleanup.)
  • Fatal sidecar mismatch handling keeps the original intent (89eb6c1: Closing a stale connection could damage the replacement database family, requiring termination without SQLite cleanup.)
  • Captured database admission keeps the original intent (10154a2: Reuse admitted canonical paths while retaining current ownership and per-job authority checks.)
  • Heartbeat recovery and update compatibility keeps the original intent (e98a15b: Older updater parents must retain custody when loading newer heartbeat workers with a different clock contract.)
  • Sleep and clock-change recovery keeps the original intent (d0554f4: Expired timestamps require physical custody verification rather than permanent fencing after sleep or clock changes.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/config/sessions/session-accessor.sqlite-reclamation-maintenance.test.ts --maxWorkers=1
  • pnpm test src/infra/sqlite-worker-shared-state.test.ts --maxWorkers=1
  • pnpm test src/infra/sqlite-wal.test.ts src/infra/sqlite-worker-broker.test.ts --maxWorkers=1
  • git diff --check
  • Verify the repaired head's affected CI checks.

What I checked:

Likely related people:

  • Vincent Koc: Raw commit e98a15b adds src/infra/gateway-state-owner-heartbeat.runtime.ts:18 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e98a15b7d695; files: src/infra/gateway-state-owner-heartbeat.runtime.ts)

PR surface

Source +374, Tests +510, Docs +16, Other +386. Total +1286 across 32 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 15 567 193 +374
Tests 13 604 94 +510
Docs 2 16 0 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 2 386 0 +386
Total 32 1573 287 +1286

Review metrics

Metric Value Why it matters
Production versus regression coverage Runtime production +567/-193; tests/support +604/-94. Production growth implements asynchronous verification, settlement, and containment through existing owners; the tests cover distinct custody, shutdown, checkpoint, alias, and retirement failures.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded Gateway responsiveness repair with two concrete sibling-test regressions remaining.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish. Replaced prior rating: 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-26T06:24:13.471Z sha a637f5207f108d293678011b7425d3d1fd2976d3 :: needs changes before merge. :: [P2] Await asynchronous inspection in the remaining Linux WAL fixtures
  • reviewed 2026-10-26T07:09:10.443Z sha 6a472f1 :: needs changes before merge. :: [P2] Await the scheduler in shared-state checkpoint recovery coverage

Reviewed October 26, 2026, 4:54 AM ET / 08:54 UTC (Revision 3).

@steipete
steipete force-pushed the steipete/perf-micro-main-sync-fs-under-writeback-20260919 branch from a637f52 to 1e89f10 Compare October 26, 2026 06:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e89f10218

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/infra/sqlite-wal.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-main-sync-fs-under-writeback-20260919 branch from 1e89f10 to 6a472f1 Compare October 26, 2026 07:03
@steipete

Copy link
Copy Markdown
Contributor Author

Fixed the checkpoint ordering finding: one owner-held inspection flag now excludes scheduled ticks, deferred admission, and explicit checkpoint/reclaim/close work while the sidecar scan is pending. Confirmed mismatch containment still runs before shutdown cleanup.

The new tracked and untracked SQLite regressions both failed on a premature PASSIVE checkpoint before the fix. Node and pinned Bun now each pass 53 focused tests (five Linux-only cases skipped on macOS). Independent review of the repair is clean; CI is running on the updated head.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 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. and removed 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 Oct 26, 2026
@steipete
steipete force-pushed the steipete/perf-micro-main-sync-fs-under-writeback-20260919 branch from 6a472f1 to 3521c79 Compare October 26, 2026 07:27
Reuse the existing heartbeat worker for fresh per-request physical custody checks, then recheck current owner authority before native admission. Move expired timer renewal to async filesystem operations while preserving synchronous native and sleep-recovery contracts.

Fault-injected owner heartbeat delay falls from 192 ms to 0.133 ms. Main-thread allocation falls about 68%, with approximately 61 microseconds more process CPU and 613 sampled bytes per admission. Focused regressions, scoped checks, and independent review passed.
Guard native close and replacement before dependent cleanup. Idle eviction keeps its handle, admission facts, and lease while inspection is pending, then retries through the existing timer.

The delayed-scan idle regressions fail before this repair. The complete lease-owner file passes 22 tests on Node and Bun; WAL and Kysely consumer tests pass. Independent review is clean.
@steipete
steipete force-pushed the steipete/perf-micro-main-sync-fs-under-writeback-20260919 branch from 78f3f27 to 0f7f932 Compare October 26, 2026 10:37
@openclaw-barnacle openclaw-barnacle Bot added the extensions: memory-core Extension: memory-core label Oct 26, 2026
@steipete
steipete merged commit 05a0dd8 into main Oct 26, 2026
150 of 156 checks passed
@steipete
steipete deleted the steipete/perf-micro-main-sync-fs-under-writeback-20260919 branch October 26, 2026 11:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged reviewed head 0f7f932721f67af59de71c73efd5cb6479657bcf under the maintainer's inherited-failure exception.

CI run 40308838028 completed with 60 successful jobs, including all three PostgreSQL conformance shards. Its only failing test was src/cli/gateway-cli/pre-bootstrap.process.test.ts → “prepares recovery safely for discarded clobbered environment”: expected tokenPresent: false, received true, with exit code zero and the proxy retained. The same focused Bun test failed with that identical assertion on unchanged main base 54408a978fc91fd20130b6f904534b47c8dfe25a and the prior reviewed branch head. This SQLite change does not modify that bootstrap path. The aggregate CI gate is red because of that inherited test.

The latest PR context/evidence check passed in 40309478707; earlier failed/cancelled metadata checks were superseded. Both review threads are resolved. Independent subagent review (autoreview route unavailable) and the final 25 real-owner tests are clean. The previous head's PostgreSQL empty-result failure did not recur on this head; it is not claimed fixed by this PR.

The native workspace preflight selects a separate canonical checkout outside the lane's authorized workspace. The explicitly authorized exact-head REST squash fallback was used; no CI rerun or configuration change was used to force a passing result.

steipete added a commit that referenced this pull request Oct 26, 2026
Since #184275 the Linux WAL split-brain inspection runs asynchronously on the
periodic maintenance tick. Interruption tests advance the fake clock past that
tick, so a synchronous close in teardown could race a pending inspection and
throw. Close through the orderly async lifecycle first.
steipete added a commit that referenced this pull request Oct 26, 2026
Move MCP mutations, personal GitHub credential publication, transcript exports, recovery cleanup, and borrowed cleanup identity checks through existing async owners. Preserve original custody, physical identity and birthtime, final publication guards, and accepted-write settlement. Resolve runtime owner paths and close-checkpoint diagnostics asynchronously.

Follow-up to #184275. Five alternating 2,000-check owner samples reduced total process CPU by 62% and sampled allocation by 62%; injected slow filesystem heartbeat delay fell from 491 ms to 0.095 ms. Focused behavior, core typecheck, lint, closure checks, and independent review passed.
steipete added a commit that referenced this pull request Oct 26, 2026
Move MCP mutations, personal GitHub credential publication, transcript exports, recovery cleanup, and borrowed cleanup identity checks through existing async owners. Preserve original custody, physical identity and birthtime, final publication guards, and accepted-write settlement. Resolve runtime owner paths and close-checkpoint diagnostics asynchronously.

Follow-up to #184275. Five alternating 2,000-check owner samples reduced total process CPU by 62% and sampled allocation by 62%; injected slow filesystem heartbeat delay fell from 491 ms to 0.095 ms. Focused behavior, core typecheck, lint, closure checks, and independent review passed.
steipete added a commit that referenced this pull request Oct 26, 2026
…ests (#184586)

* perf(sqlite): keep runtime lease checks off the Gateway main thread

Move MCP mutations, personal GitHub credential publication, transcript exports, recovery cleanup, and borrowed cleanup identity checks through existing async owners. Preserve original custody, physical identity and birthtime, final publication guards, and accepted-write settlement. Resolve runtime owner paths and close-checkpoint diagnostics asynchronously.

Follow-up to #184275. Five alternating 2,000-check owner samples reduced total process CPU by 62% and sampled allocation by 62%; injected slow filesystem heartbeat delay fell from 491 ms to 0.095 ms. Focused behavior, core typecheck, lint, closure checks, and independent review passed.

* test(sqlite): align lease fixtures with current ownership guards

Retain the same cancellation predicate in synchronous and awaited MCP fixture checks. Expect the broker physical-identity refusal after lease cleanup moved to its existing admission owner, preserving the original database lease-row assertion.

* fix(sqlite): preserve physical custody through async lease checks

* fix(sqlite): scope captured identity to its admitted lifetime

* fix(sqlite): publish observed heartbeat loss before returning

* test(sqlite): prepare MCP authorization subprocess before its deadline
steipete added a commit that referenced this pull request Oct 26, 2026
* fix(update): support direct extended-stable upgrades

Normalize verified 2026.9.33/34 physical database inventories inside candidate
Doctor, attribute migrations with committed generations, and return physical
receipts to the older updater. Keep explicit candidate inspections current and
preserve strict checks for changed data, intervening commits, and replacements.

Complete agent schema preparation before ordinary readers enter, and preserve
the source cron selector when a released updater snapshots a rehearsal copy.
No new schema, durable state, configuration, or ordinary-reader exclusion.

Supersedes the approach in #182129.

* test(gateway): stop WAL maintenance before closing watcher test state

Since #184275 the Linux WAL split-brain inspection runs asynchronously on the
periodic maintenance tick. Interruption tests advance the fake clock past that
tick, so a synchronous close in teardown could race a pending inspection and
throw. Close through the orderly async lifecycle first.

* test(update): match the path-qualified migration refusal message
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…hread (openclaw#184275)

* fix(sqlite): avoid Gateway stalls during WAL sidecar scans

Await periodic sidecar identity inspection without blocking the Gateway main thread. Preserve fatal containment before shutdown cleanup, and recheck suspected mismatches after descriptor close or reuse. Includes delayed-filesystem regression proof and a reproducible responsiveness benchmark.

* test(sqlite): await asynchronous WAL inspection before admission assertions

* fix(sqlite): block checkpoints during WAL sidecar inspection

* test(sqlite): await scheduled checkpoint recovery

* fix(sqlite): verify serving ownership off the main thread

Reuse the existing heartbeat worker for fresh per-request physical custody checks, then recheck current owner authority before native admission. Move expired timer renewal to async filesystem operations while preserving synchronous native and sleep-recovery contracts.

Fault-injected owner heartbeat delay falls from 192 ms to 0.133 ms. Main-thread allocation falls about 68%, with approximately 61 microseconds more process CPU and 613 sampled bytes per admission. Focused regressions, scoped checks, and independent review passed.

* fix(sqlite): retain native custody during WAL inspection

Guard native close and replacement before dependent cleanup. Idle eviction keeps its handle, admission facts, and lease while inspection is pending, then retries through the existing timer.

The delayed-scan idle regressions fail before this repair. The complete lease-owner file passes 22 tests on Node and Bun; WAL and Kysely consumer tests pass. Independent review is clean.

* test(sqlite): wait for asynchronous maintenance admission

* fix(sqlite): reuse worker-verified custody for retained reads

* test(memory): retain PostgreSQL search failure diagnostics
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…ests (openclaw#184586)

* perf(sqlite): keep runtime lease checks off the Gateway main thread

Move MCP mutations, personal GitHub credential publication, transcript exports, recovery cleanup, and borrowed cleanup identity checks through existing async owners. Preserve original custody, physical identity and birthtime, final publication guards, and accepted-write settlement. Resolve runtime owner paths and close-checkpoint diagnostics asynchronously.

Follow-up to openclaw#184275. Five alternating 2,000-check owner samples reduced total process CPU by 62% and sampled allocation by 62%; injected slow filesystem heartbeat delay fell from 491 ms to 0.095 ms. Focused behavior, core typecheck, lint, closure checks, and independent review passed.

* test(sqlite): align lease fixtures with current ownership guards

Retain the same cancellation predicate in synchronous and awaited MCP fixture checks. Expect the broker physical-identity refusal after lease cleanup moved to its existing admission owner, preserving the original database lease-row assertion.

* fix(sqlite): preserve physical custody through async lease checks

* fix(sqlite): scope captured identity to its admitted lifetime

* fix(sqlite): publish observed heartbeat loss before returning

* test(sqlite): prepare MCP authorization subprocess before its deadline
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
)

* fix(update): support direct extended-stable upgrades

Normalize verified 2026.9.33/34 physical database inventories inside candidate
Doctor, attribute migrations with committed generations, and return physical
receipts to the older updater. Keep explicit candidate inspections current and
preserve strict checks for changed data, intervening commits, and replacements.

Complete agent schema preparation before ordinary readers enter, and preserve
the source cron selector when a released updater snapshots a rehearsal copy.
No new schema, durable state, configuration, or ordinary-reader exclusion.

Supersedes the approach in openclaw#182129.

* test(gateway): stop WAL maintenance before closing watcher test state

Since openclaw#184275 the Linux WAL split-brain inspection runs asynchronously on the
periodic maintenance tick. Interruption tests advance the fake clock past that
tick, so a synchronous close in teardown could race a pending inspection and
throw. Close through the orderly async lifecycle first.

* test(update): match the path-qualified migration refusal message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. cli CLI command changes docs Improvements or additions to documentation extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant