Repository navigation
Conversation
Two slow readers were holding both startup slots, so the timer deferred every sealed store behind them, including later copies of agents already inspected. Release those slots when the startup wait ends, keep reading clean-close caches while a child is busy, and collapse duplicate targets onto the first real path and agent id. Co-authored-by: Arca <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (2 earlier review cycles)
|
…slow-reader-slots Co-authored-by: Arca <[email protected]>
Keep sealed cache reads moving when a schema reader is slow, and hold fallback snapshot copies to the existing two-slot bound until cleanup finishes. Wait for a busy schema child without a lint suppression. Co-authored-by: Arca <[email protected]>
|
@clawsweeper re-review The body now includes live Gateway proof on a 41-agent sealed fleet: current main deferred all 41 agents in three starts, and this head deferred only the two slow stores, with — Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai |
|
🦞👀 Re-review progress:
|
|
Real-host evidence for the "needs proof" review, plus the case this change does not cover. Measured on a live host (OpenClaw 2026.10.3, Linux/WSL2, Node 24.22.1)17 agents, agent stores ~164–195 MB,
Why this change does not rescue this fleetOur stores report In other words: the PR fixes the ordering problem (healthy cached stores no longer queue behind slow readers), but it does not change the budget, so fleets whose stores are genuinely unsealed still defer the whole fleet. That is a separate request — making End-to-end impact the deferral causesWhile the agents are refused, the cron startup catch-up fires. On this host the
All with So the deferral itself is only half the story: whatever still gets refused at startup turns into a hard cron failure unless the run queue waits for admission. Two related reports opened with the full evidence:
|
…slow-reader-slots Co-authored-by: Arca <[email protected]>
Drop the test-only pending snapshot-slot accessor. The startup regression now waits for foreground settlement, the next snapshot copy, and cleanup through the preflight lifecycle and the snapshot preparation spy. Co-authored-by: Arca <[email protected]>
What Problem This Solves
Gateway startup can defer almost every agent when two agent databases need a slow schema reader, even when every other store has a valid clean-close seal and could be admitted right away.
User Impact
On a fleet where one or two agent stores are slow to inspect, only those stores are deferred at startup. The other sealed agents are admitted before the listener binds, instead of waiting for background preparation. The reported Gateway deferred 465 of 470 sealed agents. Startup still never runs more than two schema reader processes, and private fallback snapshots stay inside the same two-copy cap. A store that cannot be deferred still holds the foreground, as before.
Why This Change Was Made
#195291 orders clean-closed stores first, which fixes the case where unsealed stores sit at the head of the list. On a boot where every store is sealed, that order changes nothing. Two slow readers can still fill both inspection slots past the 5 second startup wait, and the timer then defers every index that has not finished. The startup list also holds each agent database more than once (configured, agent, and persistent registered paths), so later copies of agents that were already inspected were deferred again.
Startup inspection was bounded to two concurrent readers so a large agent fleet does not multiply child processes. That same change, commit 63e7363 / #139878, accepted at most two private fallback snapshots, because each one is a temporary disk copy. Releasing a startup slot when a reader is slow lets sealed stores admit from the in-process cache, while snapshot preparation and cleanup stay inside the two-slot cap until each copy is removed. A third snapshot waits.
This change does four things:
Admission checks,
canDefer, config, and public types are unchanged.Evidence
Shipped Gateway entry point (
openclaw gateway run). Isolated Linux machine with Node 24.22.1. The fleet was 41 agents created withopenclaw agents add, all with a valid clean-close seal, plus the default duplicate startup list (the baseline agentmaincannot be deleted, so the fleet is 41 rather than 40). The two first-sorted stores,aa-slow-1andaa-slow-2, were made to miss the in-process cache by editing their sealed metadata version. Each build was started three times from the same fleet.Compared SHAs:
c1cf9390ac356d96815dde3f6e10903602b149bd6f31ca28fa29229ed2cb6d6d95cca4145d264e63On this machine's SSD, even a 2 GiB store finished schema inspection in about one second, so the 5 second startup wait did not expire. For these measured starts, a test-only 6 second delay was added at the start of the built schema-inspection worker's request handler, identically on both builds, to stand in for slow disk reads. That delay is not product code and was not committed.
schemaProcessCountGET /healthz{"ok":true,"status":"live"}{"ok":true,"status":"live"}Readiness took about 11.5 seconds on every run because the slow readers were still in flight (
schemaInspectionCount=0at the readiness line). The Gateway became ready, nothing wedged, and it served/healthzon loopback after bind.Main run 1, readiness and a sample of the 41 deferral lines:
This head, run 1, readiness and the complete deferral set:
The live fleet produced no fallback snapshots (
schemaSnapshotCount=0on every official start, and no snapshot staging files during startup). The two-copy snapshot cap is therefore covered by the new lifecycle regression test,keeps fallback snapshot preparation and cleanup within two slots after startup release, and not by the live run.Other regression tests that fail on main:
defers only slow stores when later targets repeat an already inspected agent: targets[a, slow1, slow2, b, a2, b2]. Main defersslow1, slow2, b, a2, b2; with this change, onlyslow1, slow2.reads a clean-close cache while a schema reader child is still busy: on main the second read throwsAgent schema inspection worker is busy. With this change, it returns the cached inspection while the child is still running.These also passed: the scheduler, schema-inspection worker, preflight, lifecycle, prestart, and startup tests, plus
pnpm tsgo:core, oxlint, and oxfmt on the touched files. The new test lines are covered by an allocation underconfig/test-lines-allocations/.Startup compatibility (head
2ae086ac, upstreammainmerged at6d815d786f4)The test-only
pendingAgentDatabaseSnapshotSlotsexport is removed. The fallback-snapshot cap test now observes the lifecycle instead: foreground settlement while two copies are open, a third copy starting only after one cleanup, and all four copies cleaning up with a peak of two.src/state/openclaw-database-preflight.lifecycle.test.tsandopenclaw-database-preflight-agent-scheduler.test.ts: 17 passed. Core and test typecheck, oxlint, and oxfmt are clean on touched files.Fresh install on the branch head (
OpenClaw 2026.11.5 (2ae086a)), Linux:Upgrade from v2026.11.3 with settings and agent data kept. On
OpenClaw 2026.11.3 (847611d): baseline setup, agentsscribeandrevieweradded,mainidentity set to "Atlas 🗺️", one labeled session with a user message created on each agent, then a clean SIGINT shutdown (three clean-close receipts written). Then the same state directory was started on the branch head:On the first start after the upgrade, the stores have no clean-close proof from the new version (
stateIntegrityReason=no-proof), so the three agents are briefly deferred and recovered by background inspection. Configmeta.lastTouchedVersionmoved from 2026.11.3 to 2026.11.5. Identities, workspaces, session ids, labels, and messages were all kept. Model turns were not run because no model credential was configured.Closes #195269
— Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai