Skip to content

fix(subagents): recover healthy agents during slow database checks - #176916

Merged
steipete merged 12 commits into
mainfrom
steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919
Oct 19, 2026
Merged

steipete merged 12 commits into
mainfrom
steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A full integrity check for one agent delays restart recovery for healthy agents.

User Impact

Healthy agents recover while another agent's database is checking. The pending agent retains the existing typed, retryable inspection response; its recovery and cron maintenance resume after admission publishes availability. No ordinary database access bypasses the integrity gate.

Current main already publishes Gateway readiness before these observers. This change preserves that behavior and makes recovery independent. Runs within one requester session retain mailbox order and wait together when that session depends on the pending agent. Independent sessions owned by the same parent agent recover separately. Main-session recovery and periodic subagent retention sweeping still join the startup recovery tail. Required/default-agent readiness policy is unchanged.

Why This Change Was Made

Remove the fleet-wide reader prewarm and cron preparation barriers. Delivery recovery, exec notifications, and subagent activation retain independent tails; requester sessions preserve their internal order. Discovery excludes unavailable physical stores before acquiring readers, retaining healthy siblings behind custom selectors. Partial recovery omits uncreated stores without changing normal or legacy discovery. Cron retries on the existing availability publication; terminal admission refusals do not schedule minute polling. Shutdown joins accepted tails, and the existing interrupted-run coordinator prevents duplicate settlement.

The real Gateway reproduction exposed a second cause: assigning a new database actor by actor count could strand it on the worker performing the full integrity scan, even though another worker finished 29 ms later. New actors now join the first completing healthy carrier's existing FIFO, even when its next queued command has already started. This avoids starvation under steady traffic without adding a queue or requiring an idle window. This preserves the worker limit, global open ordering, cancellation, and admission authority.

Runtime code grows by 234 lines to retain per-requester recovery cohorts and carry unavailable-store exclusions across discovery. The old fleet barriers and recovery-only sweep branch are removed. There is no new availability owner, worker pool, cache, configuration option, schema, or stored-format migration. The benchmark extends the existing startup driver. The requested non-test/non-doc diff is 841 additions and 257 deletions (+584), including the benchmark and its README; runtime alone is 485 additions and 251 deletions (+234).

Evidence

The healthy-agent recovery regression fails on the original recovery boundary. The native broker regression holds the actual integrity PRAGMA on one carrier and requires newly opened healthy agents to prepare before release: it times out with the old placement and passes with this repair. Broker cancellation tests verify that cancelling a waiting opener leaves accepted jobs running.

The broker repair passed 175 focused cases across 10 files, with one existing skip. Final review repairs passed 119 recovery/cron cases, 26 benchmark cases, and 15 inventory/discovery cases. Negative controls demonstrated requester-session blocking, terminal-refusal polling, healthy shared-store exclusion, missing-sibling discovery failure, and benchmark false success before their respective repairs. Changed-file formatting/lint passed. One core native typecheck passed earlier; exact-head PR CI owns final broad checks and type validation. Fresh independent reviews found no actionable P0–P2 issues.

Earlier CI identified affected worker fixtures and an obsolete mock allowance. These were repaired with focused proof, including all five Board settlement cases; no CI rerun was used to chase green. Final CI caught the parameterized regression’s trailing numeric timeout, unsupported by Vitest 5 it.for; the declaration now uses its typed options argument, retaining the same timeout and all assertions. Its 23 cases passed again (50.51 s wrapper wall time, including worker preparation); changed-file formatting/source-only lint and independent review passed. The corrected test-typecheck passed in run 39206009661. That run then exposed a cross-session ordering assumption in the failed-requester retry fixture: both children resumed correctly, in the opposite order. The assertion now requires exactly one call per child, with unchanged post-retry count and separate strict same-session ordering coverage. All 23 cases passed again in 32.72 s wrapper wall time; formatting, source-only lint and fresh independent review passed.

Final review found two further defects, both repaired with red/green regressions. The worker-completion regression now uses real reply settlement followed by synchronous successor dispatch; it reproduced starvation, then all 12 lifecycle cases passed after reservation of the completed carrier. A held database-preparation test reloads the requester's concurrency limit from 2 to 1 while the child limit stays 3; it reproduced premature activation, then verified the child waits for an active sibling to release capacity and retains original requester custody. Recovery reads current concurrency at enqueue and removes the obsolete carried config parameter. All 17 broker cases and 24 queued-recovery cases passed together in 58.10 s wrapper wall time. Changed-file formatting/source-only lint and fresh independent P0–P2 review passed. CI then rejected the controlled config mock because its changed factory no longer matched the old allowance. Added the required isolation explanation and removed exactly that obsolete allowance; runtime and test behavior are unchanged. Changed-file format/lint and a fresh independent review passed. Run 39209917581 then exposed a held-inspection fixture deadlock: the fixture awaited recovery activation before releasing the database preparation it now correctly waits for. That unresolved activation contaminated 15 later cases. The single original case reproduced a 120-second timeout. The fixture now uses two sequential startup owners, stops and joins the first before reset, and retains no-wake/unchanged-custody/exactly-one-wake assertions. The corrected case passed in 10.51 s wrapper wall time; all 33 requester-wake cases then passed in 85.77 s, including the 15 former cascade failures. This existing product-flow file exercises mailbox, database admission, durable custody and restart together; its full-file cost is recorded rather than hidden by a timeout change. Changed-file format/lint and a fresh independent P0–P2 review passed. Runtime is unchanged by this fixture repair. While this head had 89 successful CI checks and one PostgreSQL shard still running, main advanced and conflicted in cron maintenance and the requester fixture. Main #177080 carries the old aggregate startup wait through detached notifications; this lane removes that superseded wait and its parameter plumbing, keeping its four notification/late-preparation scenarios under the independent-retention contract. Main #177033 refactored requester fixtures; the repair now uses those shared helpers while retaining two sequential startup owners and stop/drain-before-reset. The cron runtime is byte-identical to the previously tested lane head. All 15 real-store cron cases passed; the adapted 17 lifecycle cases and all 33 requester-wake cases passed in 76.30 s combined wrapper wall time. Changed-file format/lint and fresh independent P0–P2 review passed. Final integrated-head CI completed. All selected Node, UI E2E, PostgreSQL, production-type, lint, architecture, and security jobs passed. The unrelated Control UI test-type failure and its resulting aggregate failure are attributed below.

Measurement acceptance rule: two concurrent baseline/candidate pairs with CPU halves swapped; identical fresh synthetic state per side, one 512 MiB agent database without its clean-close seal, four small agent databases, five independent requester sessions belonging to one healthy parent agent, and a labeled 10-second preload hold before the real full integrity scan. Every healthy agent must recover before the candidate's slow gate passes; the slow agent must recover afterward; readiness must not regress beyond paired noise. Compare candidate minus baseline within each pair.

Measured on an isolated Linux sandbox (Node 26.8.2). Both pairs ran concurrently under the exclusive measurement lock, with baseline/candidate on CPUs 96–111/112–127 for pair 7 and the halves swapped for pair 8. Times below are seconds since Gateway launch; deltas are candidate minus baseline.

Observation Pair 7 base Pair 7 candidate Δ Pair 8 base Pair 8 candidate Δ
Readiness 5.610 5.591 -0.020 5.368 5.341 -0.027
Last healthy recovery 16.976 6.933 -10.042 16.704 6.547 -10.156
bench-fast-01 16.625 6.896 -9.730 16.404 6.473 -9.930
bench-fast-02 16.834 6.933 -9.901 16.609 6.547 -10.062
bench-fast-03 16.885 6.911 -9.973 16.669 6.473 -10.196
bench-fast-04 16.976 6.924 -10.051 16.704 6.483 -10.220
bench-slow 17.020 16.047 -0.973 16.773 15.781 -0.992
Slow integrity gate passes 15.775 15.769 -0.007 15.533 15.502 -0.030

Median paired change: last healthy recovery −10.099 s (16.840 s → 6.740 s, 60.0% less time); readiness −0.023 s, neutral at this scale. Every candidate healthy agent recovered before the slow integrity gate passed; the slow agent recovered strictly afterward. Both sides reported zero admission errors. The strict harness rejected both baselines only for late healthy recovery (exit 1) and accepted both candidates (exit 0). Both pair drivers and all four Gateways completed with exit 0, including controlled shutdown. No shared-state WAL checkpoint warning appeared in these four output tails.

Measured cost: peak RSS was 1,790 → 1,927 MiB and 1,793 → 1,939 MiB, a paired median increase of 140.9 MiB (+7.9%). CPU was 16 → 16 and 16 → 15 CPU-seconds, from coarse whole-second process accounting. This establishes recovery independence, not a memory optimization. Only two paired samples were collected; no general throughput or steady-state memory claim is made.

Measured source pins: baseline 30937ee666735b1bfd1c453b6a723a8828a15f1a, candidate 1c33e046d3b815c756b3b65922633d4d5595693f, identical harness SHA-256 74b2428052aa6151469b026097793d2bca7719b9b6811f1b9ac8d273df3de820. Both sourcePerformance builds passed (56 s and 58 s). Existing sandbox dependencies were reused with matching build/runtime lock inputs, including the previously SHA-512-verified official @openclaw/proc-safe 0.4.2 artifacts; omitted example/lint-only dependencies are outside this benchmark. Subsequent lane changes added the config-mock explanation, obsolete-allowance removal, requester-wake restart-fixture repair, and detached-notification fixture coverage, then rebased onto main (preserving its fixture refactor). They change tests and their allowance only; measured runtime patches are unchanged. These are the explicitly pinned runtime measurements; final-head CI validates the later integrated head.

The synthetic slow DB was 538,923,008 bytes after close; each healthy DB was 659,456 bytes. The labeled preload hold was 10 seconds, followed by the actual full scan (observed extra gate time 101–129 ms, including observation/scheduling overhead). Build/fixture work ran sequentially on CPUs 64–95. Fresh independent state and ports were used for every side. Recorded CPU busy time (including measured work) was 8.64%/8.77% across the two halves in pair 7 and 8.38%/8.65% in pair 8; this is context, not a run-validity gate. Observed pre-stage Dirty peaked at 145,828 KiB. Baseline reader prewarm took 343/335 ms and delivery discovery 9,309/9,329 ms; candidate reader prewarm was zero and discovery 41/38 ms. Aggregate activation still includes the pending slow agent, so per-agent timestamps establish independence.

Reproduce with the existing driver, building each pinned source with OPENCLAW_BUNDLED_PLUGIN_BUILD_IDS=browser GIT_COMMIT=<pin> node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance, then:

node --import ./scripts/tsx.mjs scripts/bench-gateway-startup.ts \
  --case slowAgentDatabase --fixture-root "$FIXTURE" --seed-only \
  --agent-database-mib 512 --agent-gate-delay-ms 10000
# Run both sides concurrently with the same START_AT under the exclusive lock,
# pinning each to its 16-core half; swap halves for the second pair.
node --import ./scripts/tsx.mjs scripts/bench-gateway-startup.ts \
  --case slowAgentDatabase --fixture-root "$FIXTURE" --entry dist/entry.js \
  --runs 1 --warmup 0 --timeout-ms 90000 --start-at "$START_AT" --output "$RESULT"

The isolated Gateway benchmark observes readiness, per-agent recovery, and admission-error counts. Typed pending-session behavior is retained from the admission owner; focused discovery/cron tests cover pending stores and resumption. The benchmark does not schedule cron jobs or send live model/channel traffic. Fixtures are synthetic and bounded, not a replay of a 44 GiB production database. No local broad suite or validation lease was used. The focused E2E wrapper initially started automatic build preparation; that process was stopped, and both focused runs used its supported OPENCLAW_E2E_SKIP_BUILD=1 setting.

Final-head CI attribution

Run 39217398292, attempt 1, tests PR head 2ab13faf5319a687461f506d35fb7e6a38a913e9 through merge 2b4499ddef77590dc4e2468cc47e78f1cb162c92, whose ordered parents are main 908d45c487955317da4653b95881279c8c23d624 and that PR head. The only substantive failure observed is check-test-types-core-2:

src/gateway/server-methods/control-ui.test.ts(485,7): error TS2353:
Object literal may only specify known properties, and 'load' does not exist in type 'SubscriptionDeps'.

The stale test property came from main #177038 (de2700c9946ff95f05c6be9b1d6d47289077a211). The test and its direct type owner, src/gateway/control-ui-session-pr-subscriptions.ts, are byte-identical on the exact main parent, tested merge, and PR head (Git blobs 5750baf6a3a3d86e3656ed18b6839a351bfec31f and 6aaabc1b9fd4e713ec35f3d715c2ab68b2c8fd93). Neither file belongs to this lane's diff.

The existing isolated Linux sandbox reproduced the same TS2353 on both exact sources with native tsrs and node scripts/run-tsgo.mjs -p .lane-1445-control-ui.tsconfig.json --pretty false. That config extends the committed gateway-methods shard, includes only the failing test, and retains all 14 inherited ambient/generated inputs and 164 source path mappings. Baseline and tested merge both exited 2 in 4.801 s and 4.405 s. Both also emitted the same three missing-UI-dependency diagnostics (@noble/ed25519 twice and @noble/hashes/sha2.js once); this is named-error attribution, not a clean full-shard reproduction. Initial runs with missing inherited configs were rejected as setup failures and are not used as proof. No CI rerun, extra install, or broad local validation was used.

Final accounting: all 91 jobs in CI run 39217398292 completed (65 succeeded, 24 skipped, and two failed: the named test-type shard plus its aggregate gate). All three PostgreSQL conformance shards passed. The full PR rollup had 94 successful checks at final inspection. The informational failure table calls the type shard “new” against an earlier scheduled main run without comparing selected scope; the exact-main-parent reproduction above supplies the independent attribution. Landing uses the explicitly authorized inherited-failure exception; CI is not reported as green.

@clawsweeper

clawsweeper Bot commented Oct 19, 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.

@steipete
steipete marked this pull request as ready for review October 19, 2026 04:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-19T07:47:29.304957Z 2ab13fa 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 19, 2026
@steipete
steipete marked this pull request as draft October 19, 2026 04:41
@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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets healthy agents recover independently while another agent’s database integrity check remains pending.

Example: Restart five agents while bench-slow has a 512 MiB database and a controlled 10-second integrity-check delay.

  • Before: The last healthy agent recovered at a paired median of 16.840 seconds.
  • After: The last healthy agent recovered at 6.740 seconds, before the slow integrity gate passed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Production-path proof supports the central behavior, both prior blockers have focused repairs, and source inspection found no remaining actionable defect; pending CI still controls landing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied isolated Linux Gateway runs exercise persisted interrupted-run recovery during a held real SQLite integrity scan, with healthy-before-gate and slow-after-gate observations, zero admission errors, and controlled shutdown; all changed runtime blobs match the measured candidate.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After a Gateway restart, healthy agents wait for another agent’s slow database integrity check before their unfinished work recovers.
Reason: The maintainer-approved direction has demonstrated recovery value, preserves integrity and requester ordering, and explicitly accepts the measured peak-memory tradeoff.

Merge readiness

✅ Ready for maintainer review

Both previous findings are fixed, and no remaining actionable defect was found in this PR’s introduced diff. Keep it open for the pending checks on the reviewed head.

Priority: P2
Reviewed head: 69490f7761fb8ae68c060877866e034b4dc5bd46

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway startup restores persisted subagent obligations through requester-session activation, session-store discovery, and the SQLite worker broker; admitted work proceeds through the existing recovery and execution owners.

flowchart TD
  A[Gateway restart] --> B[Independent recovery tails]
  B --> C[Requester session cohorts]
  B --> D[Available store discovery]
  C --> E[Agent database preparation]
  D --> F[SQLite broker FIFO]
  E --> F
  F --> G[Recovered sessions and maintenance]
Loading

Technical review

Best possible solution:

Retain the independent recovery cohorts and existing admission owners, with ordinary landing gated by successful checks on this head.

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

Current-main source retains both blocking mechanisms, and the supplied isolated Gateway comparison demonstrates the resulting recovery delay; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch removes unnecessary fleet barriers, partitions work by requester session, and reuses canonical admission, queues, and recovery owners without introducing a competing runtime service.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Startup reader barrier and recovery ordering changes intended behavior with a stated reason (fix(sessions): wait for subagent restoration before restart recovery #174134: Recovery waited for restored inventory and prepared readers to prevent premature or incorrectly ordered admission.)
  • Cron startup preparation barrier changes intended behavior with a stated reason (1b7dd0b: Avoid maintenance accessing agent databases before startup admission; the replacement skips unavailable stores and resumes through existing availability publication.)
  • Requester activation and retry custody keeps the original intent (f4bb84b: Failed requester transfers must retain their obligations without blocking unrelated work or launching restored runs twice.)
  • SQLite carrier selection changes intended behavior with a stated reason (70abbe7: Centralize worker-capacity and actor-placement decisions in the existing lifecycle owner; the patch changes placement to avoid a carrier occupied by an integrity scan while preserving capacity and FIFO owners.)
  • Captured requester identity and dispatch authority keeps the original intent (fd2a6ca: Restored queued work retains its original requester identity and revalidates current authority at execution admission.)
  • Recovery target discovery keeps the original intent (d1d4342: Keep recovery discovery in worker-owned reads; exclusions narrow physical candidates without adding a second discovery owner.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Reviewed introduction and policy: Read the introduced merge-base-to-head diff and applicable root, agents, Gateway, docs, scripts, and test instructions; applied simplification and test-value review without edits or target-code execution. The maintainer-notes directory is absent. (AGENTS.md:1, 69490f7761fb)
  • Current main still contains the blocking path: Fetched main still prewarms all recovery readers before delivery, exec, and subagent recovery, and assigns saturated-pool database actors by actor count. (src/gateway/server-startup-observers.ts:108, d958966b09ea)
  • Busy-carrier finding resolved: Acquisition selects the first completing carrier even after synchronous successor dispatch, rechecks cancellation and caller authority, and then uses the existing bounded queue; the regression exercises real reply settlement and preserves accepted peer jobs. (src/infra/sqlite-worker-broker-lifecycle.ts:137, 69490f7761fb)
  • Current-concurrency finding resolved: Restored collectors read canonical requester concurrency immediately at enqueue. The delayed-preparation regression lowers the requester limit from 2 to 1, keeps the child limit at 3, and requires an occupied requester slot to release before dispatch. Existing metadata restoration preserves captured requester ownership. (src/agents/subagents/registry/subagent-registry-restore.ts:270, 69490f7761fb)
  • Production Gateway proof and accepted tradeoff: The PR body records two swapped-core baseline/candidate Gateway pairs: every healthy candidate recovered before the real integrity gate passed, the slow agent recovered afterward, and admission errors remained zero. The maintainer explicitly records the 140.9 MiB peak-RSS increase and limits the claim to recovery independence. (1c33e046d3b8)
  • Measured runtime preserved: GitHub tree blob identities for every changed runtime module at the measured candidate match the reviewed checkout, confirming that the test-only follow-up and rebase preserve the measured implementation. (69490f7761fb)

Likely related people:

  • Peter Steinberger: Raw commit 413b3d9 adds src/infra/sqlite-worker-broker-lifecycle.ts:114 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 413b3d992f83; files: src/infra/sqlite-worker-broker-lifecycle.ts)
  • Josh Avant: Raw commit fd2a6ca adds src/agents/subagents/registry/subagent-registry-restore.ts:349 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: fd2a6caa89df; files: src/agents/subagents/registry/subagent-registry-restore.ts)

PR surface

Source +244, Tests +481, Docs +51, Other +315. Total +1091 across 39 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 14 478 234 +244
Tests 20 697 216 +481
Docs 3 55 4 +51
Config 0 0 0 0
Generated 0 0 0 0
Other 2 321 6 +315
Total 39 1551 460 +1091

Review metrics

Metric Value Why it matters
Runtime versus regression coverage Runtime +478/-234 lines; tests +697/-216 lines Runtime growth supports requester-session cohorts and physical-store exclusions; regression coverage addresses distinct recovery, discovery, cancellation, and carrier-progress failures.
Configuration surface 5 benchmark-only flags; 0 runtime configuration options The added controls prepare and synchronize the opt-in startup experiment without adding Gateway settings.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Slow integrity checks delay otherwise healthy restart recovery, with a bounded production Gateway reproduction and no demonstrated core-runtime outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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-19T04:56:54.628Z sha 4f11fb6 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-19T06:09:23.053Z sha 744396660921f16f23f58dfda794e918edfe3ba3 :: needs changes before merge. :: [P2] Reserve queue position for opens waiting on busy carriers | [P2] Refresh configuration after database preparation settles

Reviewed October 19, 2026, 2:33 AM ET / 06:33 UTC (Revision 3).

@steipete
steipete force-pushed the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch from 4f11fb6 to 1a8913e Compare October 19, 2026 04:58
@steipete
steipete marked this pull request as ready for review October 19, 2026 04:58

@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: 1a8913e51e

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

@steipete
steipete force-pushed the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch from 1a8913e to 2dbd394 Compare October 19, 2026 05:08

@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.

ℹ️ 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 scripts/bench-gateway-startup.ts Resolved
Comment thread scripts/bench-gateway-startup.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch 2 times, most recently from d9283db to 1891d68 Compare October 19, 2026 05:43
@steipete

Copy link
Copy Markdown
Contributor Author

All five review findings are fixed and their threads resolved. The final body now includes both successful concurrent, swapped-core measurement pairs, the RSS tradeoff, and the benchmark limitations. Independent reviews are clean; final CI is running on 1891d68ca095e13a4ce535763bc1ce195a94dc8f after correcting the Vitest parameterized timeout declaration.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@steipete
steipete force-pushed the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch from 69490f7 to 819f01d Compare October 19, 2026 07:15
Remove the all-agent reader prewarm barrier and activate restored requester
cohorts independently. Recovery discovery and cron skip typed pending stores;
cron retries when the existing admission owner publishes availability.
Wait for already-pending native preparation before admitting a read to shared
workers, preserving integrity, read-only admission and request cancellation.
Shutdown still joins accepted recovery tails and concurrent recovery cannot
settle the same runtime owner twice.

Regression coverage fails on the old recovery and read-admission boundaries.
Focused tests, changed-file lint/format and core typecheck passed; broad and
exact-head validation runs in PR CI. The bounded synthetic Gateway benchmark
uses a real integrity scan with an explicit delayed gate.
Wait for an available carrier before assigning new database actors, so a
healthy agent does not queue behind another agent's full integrity scan.
Preserve worker limits, admission authority, and accepted command ordering.

Cover native held-integrity isolation and waiting-opener cancellation, remove
the superseded reader wait, and exercise four healthy agents in the startup
benchmark. Consolidate existing native fixture setup without weakening proof.
Reserve the first completing healthy SQLite carrier instead of requiring an
idle window after its reply dispatches queued work. Existing bounded queues
retain FIFO and cancellation without starving newly admitted actors.

Read the requester's current Swarm concurrency policy when delayed recovery
enqueues a collector, preserving captured requester custody. Remove the
unused config snapshot from the resume callback.

Regression proof reproduces both starvation and stale-limit activation on
the previous code, then exercises the fixes with existing broker and queued
recovery coverage. No integrity or admission checks are bypassed.
@steipete
steipete force-pushed the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch from 819f01d to 2ab13fa Compare October 19, 2026 07:39
@steipete
steipete merged commit 4645923 into main Oct 19, 2026
158 of 161 checks passed
@steipete
steipete deleted the steipete/perf-micro-ready-decoupled-from-slow-agent-db-20260919 branch October 19, 2026 08:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged under the explicitly authorized inherited-CI-failure exception for exact head 2ab13faf5319a687461f506d35fb7e6a38a913e9.

CI run 39217398292, attempt 1, completed all 91 jobs: 65 passed, 24 skipped, and two failed—the Control UI test-type shard and its aggregate gate. All PostgreSQL conformance shards, selected Node/UI tests, production types, lint, architecture guards, and independent security checks passed. Independent review is clean and all review threads are resolved.

The sole root failure is control-ui.test.ts(485,7) TS2353: the stale load property is absent from SubscriptionDeps. It reproduces on exact main parent 908d45c487955317da4653b95881279c8c23d624 and exact tested merge 2b4499ddef77590dc4e2468cc47e78f1cb162c92 (exit 2, 4.801 s / 4.405 s). The test and type owner are byte-identical on both and the PR head; main #177038 introduced the stale property. Both narrow sandbox runs also had the same three missing UI dependency diagnostics, so this is attribution of the named failure, not a clean full-shard claim. The informational classifier used an older scheduled-main result without comparing scope; exact-parent evidence establishes inheritance. Full source pins, method, limitations, and benchmark results are in the PR body. No CI rerun was used.

Healthy recovery improved from 16.840 s to 6.740 s in two concurrent paired measurements; readiness was neutral, and peak RSS increased by 140.9 MiB. Pending stores remain behind their real integrity gate. The proof used bounded synthetic state with a labeled 10-second hold, rather than a replay of the production-sized database.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…penclaw#176916)

* fix(subagents): recover healthy agents while another database opens

Remove the all-agent reader prewarm barrier and activate restored requester
cohorts independently. Recovery discovery and cron skip typed pending stores;
cron retries when the existing admission owner publishes availability.
Wait for already-pending native preparation before admitting a read to shared
workers, preserving integrity, read-only admission and request cancellation.
Shutdown still joins accepted recovery tails and concurrent recovery cannot
settle the same runtime owner twice.

Regression coverage fails on the old recovery and read-admission boundaries.
Focused tests, changed-file lint/format and core typecheck passed; broad and
exact-head validation runs in PR CI. The bounded synthetic Gateway benchmark
uses a real integrity scan with an explicit delayed gate.

* test(cron): adapt recovery regression to current fixtures

* fix(sqlite): keep agent opens off busy integrity carriers

Wait for an available carrier before assigning new database actors, so a
healthy agent does not queue behind another agent's full integrity scan.
Preserve worker limits, admission authority, and accepted command ordering.

Cover native held-integrity isolation and waiting-opener cancellation, remove
the superseded reader wait, and exercise four healthy agents in the startup
benchmark. Consolidate existing native fixture setup without weakening proof.

* test(sqlite): align worker fixtures and prune obsolete allowance

* fix(recovery): isolate requester sessions and terminal refusals

* fix(recovery): retain healthy shared-store siblings

* test(subagents): use typed parameterized timeout options

* test(subagents): allow independent requester resume order

* fix(recovery): preserve open FIFO progress and current swarm limits

Reserve the first completing healthy SQLite carrier instead of requiring an
idle window after its reply dispatches queued work. Existing bounded queues
retain FIFO and cancellation without starving newly admitted actors.

Read the requester's current Swarm concurrency policy when delayed recovery
enqueues a collector, preserving captured requester custody. Remove the
unused config snapshot from the resume callback.

Regression proof reproduces both starvation and stale-limit activation on
the previous code, then exercises the fixes with existing broker and queued
recovery coverage. No integrity or admission checks are bypassed.

* test(subagents): document isolated recovery config mock

* test(subagents): drain pending recovery before restart fixture reset

* test(cron): preserve detached notification recovery coverage
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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL 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