Skip to content

fix(state): serve session reads during startup integrity inspection - #186473

Merged
steipete merged 9 commits into
mainfrom
steipete/perf-micro-agent-startup-inspection-reads-20260919
Oct 28, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/perf-micro-agent-startup-inspection-reads-20260919

Conversation

@steipete

@steipete steipete commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After an unclean restart, agent-scoped reads failed or waited for the full database integrity scan even after the Gateway listener accepted connections. This change makes committed reads available during inspection while writes and interrupted-turn recovery retain full writable admission.

User Impact

Resolve/describe/list, board display, subscription, models, metadata, history, and registered plugin reads can use current-schema agent databases before inspection completes. No schema, storage format, configuration, or baseline changes.

Why This Change Was Made

The startup owner publishes a revocable read fact bound to the current inspection, physical database paths, and Gateway configuration. Reads retain schema, ownership, canonical-row, file-identity, quarantine, sharing, and visibility checks. They see committed SQLite snapshots, including committed WAL; this does not certify unchecked pages elsewhere. Failed inspection, cancellation, supersession, or retirement revokes readiness and invalidates cached topology. Early secrets/model publication runs under a read-only preparation scope, so callbacks cannot borrow writable startup authority.

Missing schema/index repairs still block readiness. Reads requiring mutation, including cold transcript restoration and abandoned queued-input reconciliation, wait for writable admission. Board action authorization retains its ordering. The default preparation waiter still waits for full completion; only explicit read callers opt in. The Gateway carries its registered read-method classification through authorization, including session-scoped models and plugin reads, without changing direct-key authorization policy.

A live test exposed a second blocker: Workboard's existing SQLite actor could share a carrier with synchronous agent integrity work. The existing broker now separates agent, generic/plugin, and shared-state carriers and their cold-open queues. Physical ownership and global admission budgets remain shared. Two agent and two generic carriers preserve independent-store progress; shared state keeps one. The normal maximum rises from three to five, and the retained-generation maximum from five to eight. The measured resource cost is reported below.

Evidence

A real built dev Gateway was seeded with 10,000 sessions, 1 GiB transcript payload (3,214,258,176-byte main database), five agents, 40 synthetic plugins, Workboard, and the Prometheus exporter. Five mock-provider streams were interrupted with SIGKILL, then an offline writer left unclean WAL. Five reconnecting clients negotiated only operator.read, with no admin grant. All five interrupted turns recovered exactly once in both arms.

Baseline: 4a5ec828b19c5207028faa9cdedb6528ae931c55. Final candidate: 36eb613700ef240c2d50761b084c9fafe12238da (parent bec3ad81da5568e05e5e55219b00c72bb4ee6e0a). The intervening main changes do not change database admission or carrier ownership; versions are labeled rather than presented as an identical-parent benchmark. The final probe adds sessionKey to the committed script's models.list request to exercise the non-admin scoped authorization path.

First-reconnect method Baseline Final candidate
sessions.list 19293 ms 179 ms
sessions.resolve 19241 ms 179 ms
sessions.describe 19242 ms 180 ms
board.get UNAVAILABLE 189 ms
sessions.messages.subscribe UNAVAILABLE 185 ms
models.list 14568 ms 244 ms
chat.metadata UNAVAILABLE 306 ms
chat.history UNAVAILABLE 367 ms
workboard.cards.list UNAVAILABLE 265 ms

All nine candidate reads succeed at least 10,352 ms before integrity completes. Baseline reads either return UNAVAILABLE or wait for full preparation. These are one-request startup observations, not percentile/throughput claims.

Main-agent phase Baseline Final candidate
Read readiness 19840 ms (full preparation) 4320 ms
Full writable preparation 19840 ms 17786 ms
Integrity check 12308 ms 11446 ms
Total native validation 12347 ms 11455 ms
SQLite open 1 ms 319 ms
Configuration 14 ms 7 ms
Schema 11 ms 11 ms
Registration 11 ms 6 ms
Background migration 1331 ms 1077 ms

Integrity is the dominant size-dependent cost: an earlier 256 MiB transcript baseline took 3,278 ms versus 12,506 ms with 1 GiB. Existing clean-close seals already skip clean-shutdown scans; this fix retains full unclean verification. SQLite open/WAL visibility is not the dominant measured phase. Restart host load (1/5/15) is 20.10/15.58/13.65 → 9.28/13.03/12.90 for baseline and 8.95/9.89/10.87 → 7.22/8.99/10.39 for candidate.

Workboard resource cost

Three fresh post-recovery diagnostic samples, with list/Workboard churn between samples. Every worker is covered. Heaps are live, not forced-GC retention; samples are correlated within one run and workers retire during the window.

Arm/sample RSS MiB Main heap MiB Worker heap MiB SQLite heap MiB Workers/SQLite Host load 1/5/15
base +35.2s 1560.4 327.0 717.7 193.5 19/3 12.80/14.35/13.33
base +65.2s 1477.7 329.5 592.0 172.0 16/3 10.48/13.63/13.10
base +95.3s 1234.0 330.9 567.9 171.9 15/3 9.28/13.03/12.90
candidate +40.2s 1633.2 330.4 722.4 211.6 20/4 7.78/9.49/10.66
candidate +70.3s 1461.3 334.5 617.1 195.2 17/4 7.06/9.15/10.49
candidate +100.4s 1342.4 335.9 593.7 195.9 16/4 7.22/8.99/10.39

Sample-mean RSS changes +3.86%, main heap +1.37%, worker heap +2.96%, SQLite heap +12.16%. The extra materialized SQLite worker is an explicit resource tradeoff for independent plugin progress. Different successful early-read work, host load, and worker retirement prevent a causal retention claim from this single startup pair. No A/A controls were run; these observations are not labeled an adverse verdict or hidden as a neutral memory result.

Load Comparison

The canonical harness completed eight 10-minute arms: timing AB/BA, then allocation AB/BA, with 10,800 sessions, 40 plugins, 65 WebSocket clients, and concurrent mock-provider tool/native-subagent turns. All arms completed 40 turns and 40 tool calls/results with zero client RPC errors. No load was sent to Team.

The frozen artifacts are parent 3bcca4f468ea966f8efa03d0ad24b859792b9dea and candidate f4cb9dccbabbcb0b00dfddab6d0c22b355d85bc1. These measurements cover the carrier/admission change at those revisions; later correctness fixes and rebases are verified separately below, not relabeled as measured builds.

Arm CPU % of one core Allocation MiB/s GC s/min Loop p99 ms (n) Client list p99 ms (n) Handler list p99 estimate ms (n) RSS/main/worker MiB Host load mean 1/5/15
timing 1 base 6.797 separate pass 0.116 28.115 (27609) 49.939 (1204) 29.840 (1173) 2526.5/525.4/1058.6 8.81/10.80/12.88
timing 1 candidate 6.808 separate pass 0.121 27.443 (27658) 31.196 (1202) 29.010 (1173) 2496.4/520.5/1054.3 8.49/8.41/10.09
timing 2 candidate 6.889 separate pass 0.124 27.738 (28476) 34.882 (1191) 30.386 (1173) 2374.7/554.6/1053.5 11.58/11.43/10.89
timing 2 base 6.453 separate pass 0.115 26.771 (27702) 30.014 (1204) 26.779 (1173) 2580.5/542.7/1057.6 8.33/9.28/10.00
allocation 1 base 7.009 17.990 0.203 27.345 (27551) 32.093 (1202) 28.806 (1173) 2626.4/546.3/1057.2 8.17/8.20/8.91
allocation 1 candidate 7.313 18.189 0.179 27.542 (27537) 33.693 (1202) 32.064 (1173) 2499.5/581.3/1045.3 5.82/6.90/7.91
allocation 2 candidate 7.305 18.188 0.181 27.902 (27502) 37.133 (1193) 34.479 (1173) 2547.0/584.9/1044.3 6.09/6.09/6.78
allocation 2 base 6.953 17.613 0.187 27.066 (27640) 32.542 (1193) 29.497 (1173) 2565.0/574.4/1049.1 8.69/8.13/7.54

Timing paired means: CPU +0.223 percentage points (+3.46%); total GC +7.12 ms/min; loop p99 +0.15 ms; client list p99 −6.94 ms; server-handler p99 estimate +1.39 ms (+5.34%, mixed signs). Allocation paired mean is +0.387 MiB/s (+2.18%). This is a startup availability improvement, not a steady-state CPU/allocation win. Achieved rates remain approximately 192 RPCs/min and four turns/min. No numerical rejection threshold is reached. Tail deltas with mixed signs are inconclusive, not adverse; no A/A controls were run or causal latency/memory wins claimed.

Timing GC counts (minor/incremental/major) are base 252/30/30 → candidate 256/30/30 in pair 1, and 247/26/26 → 254/30/30 in pair 2. Per-kind GC ms/min are 66.864/1.798/46.935 → 66.300/1.870/53.173 and 61.481/1.476/52.310 → 66.929/1.997/54.826. Maximum pauses are 21.729 → 30.461 ms and 31.271 → 35.732 ms; neither exceeds max(50 ms, 2× baseline). Major collection counts are below 50 and are context only. The +7.12 ms/min total GC delta is below the 50 ms/min materiality rule. Allocation-pass timing/GC values above are instrumented context, not timing gates.

Handler tails are first/last scrape histogram estimates (1,173 calls each), not exact samples; p99 lies in 25–30 ms buckets except timing candidate pair 2 (30–40 ms). Scrapes omit the final 10–15 seconds. RSS/main heap are end-of-run observations, worker heap is the last complete non-forced sample; these are not paired retention claims. All 35 workers were sampled. This provider-heavy workload has two SQLite carriers in both arms and does not materialize Workboard's extra carrier; the Workboard supplement above measures that separate cost.

Proof and Review

  • Native held-integrity regressions are red on baseline and green with stored-session identity preserved. Default/write waiters remain pending; failure, cancellation, supersession, invalid rows, missing indexes, escaped callbacks, and cached-topology revocation are covered. The generic registered-read authorization case was separately proven red/green.
  • Warm plugin reads block for the held scan on the old broker and progress after isolation. Cold plugin behavior, independent generic-store progress, global input limits, cross-class physical ownership, and generation cleanup remain covered.
  • Focused broker/native/generation checks: 79 passed, one Linux-only skip; rebased native/capacity files: 54 passed, one skip. Earlier owner/Gateway/board checks: 122 passed; auth/metadata: 22; default-waiter consumers: 97. Latest fixture/correction proof: 90 distinct passing tests, one Linux-only skip; final generic-read loop: six passed; final rebased teardown file: 21 passed. Counts overlap and are not summed into a suite total.
  • Changed-file lint/format, core/scripts typechecks, and export/import closure guards passed at their recorded revisions; exact-head PR CI provides broad proof. No Testbox lease was used under the lane's validation override. The final built runtime and live nine-read proof use the pushed head above.
  • Independent subagent review (autoreview route unavailable) is clean, including the latest integration and session-scoped model path. Hosted findings about default waiters, cached topology, and non-admin reads were corrected and regression-tested.
  • Runtime source delta: +363 lines; production plus proof scripts/types: +587; tests: −2. The new read/write contract and complete caller cutover require growth. The broker change itself is two net production lines. No baseline/ceiling was raised; the ratchet accepts the non-increasing test diff despite main's existing overage. The shared performance README is unchanged; usage lives in the script header.

The two update-CLI failures are inherited: both complete failing files ran with Bun and one worker on exact PR head 36eb6137 and unchanged main parent bec3ad81, producing 33 passed / 2 failed on each with identical signatures. update-cli.already-current.test.ts and update-cli.candidate-admission.test.ts expect Node 24.22.1 recovery guidance, while upstream #186589 restored the compatibility floor to 24.16.0. The intended refusal and no-side-effects assertions pass before the stale text comparison. This PR changes no update/runtime-policy files. Exact-head CI run: 40656449792.

Earlier CI exposed a duplicate synchronous fixture close before native borrowers drained; the redundant hook was removed in favor of the existing fixture owner. An attempted low-level missing-index negative control timed out because reads correctly wait for repair; the corrected authorization-boundary regression passes. Two older setup/reconciliation failures did not reproduce in five full-file runs on each revision and are recorded as non-reproducing, not claimed fixes. No CI rerun was used to chase green. One final-proof setup attempt failed because a relocated probe copy broke its child-loader path; it never reached restart and contributes no product measurement. The corrected probe location produced the complete final run above.

The remaining catalog-routing CI failure is also reproduced on unchanged main source: the complete codex-account-model-route.product-proof.e2e.test.ts file passes 3/3 against built candidate 36eb6137, while built baseline 4a5ec828 fails 1/3 with the identical catalog-generation supersession error (the other two cases pass). CI failed all three cases, so the baseline proves the shared failure signature, not equal failure frequency. The harness waits for zero pending agent refusals and completed startup before requesting models.list(refresh:true), outside this change's early-read interval. Prepared catalog/startup owners and test helpers are unchanged between that baseline and parent bec3ad81; the nearby model-merge change concerns route metadata, not generation retirement. This existing refresh race is not claimed fixed. Baseline setup first lacked a UI dependency link; after linking the task artifact to the same-lockfile dependencies, the prebuilt product run supplied the failure evidence. No source-only swap was used for built-Gateway attribution. All remaining failed CI jobs are therefore attributed to existing failures; security and other selected jobs passed. Landing uses the scoped inherited-failure exception.

@clawsweeper

clawsweeper Bot commented Oct 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 scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 28, 2026
@steipete
steipete marked this pull request as ready for review October 28, 2026 03:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T08:26:32.303457Z 36eb613 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.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 36eb613700ef240c2d50761b084c9fafe12238da
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/inherited-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/server-methods/request-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization-async.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/session-sharing-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/secrets/runtime-auth-store-admission.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR lets eligible session, metadata, model, and board reads proceed while startup integrity inspection continues to block writes.

Example: Reconnect after an unclean restart with a 3.21 GB current-schema agent database.

  • Before: The supplied Gateway run reports sessions.list taking 14,369 ms.
  • After: The supplied candidate run reports sessions.list returning persisted sessions in 223 ms while integrity inspection continues.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful production-path evidence supports the read improvement, but the premature recovery/cron wake is a blocking correctness regression.
Proof confidence 🐚 platinum hermit (4/6) The ordinary contributor proof gate is exempt for this maintainer-authored PR; supplied built-Gateway crash/restart observations exercise the changed read RPCs, while native held-integrity coverage checks pending writes and revoked readiness.
Patch quality 🧂 unranked krab (1/6) 3 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Session lists, conversation metadata, and boards wait or return unavailable while an otherwise readable database undergoes startup integrity inspection.
Reason: The maintainer-authored direction has clear user value and explicitly retains writable integrity checks without adding configuration or storage formats.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep open: this PR provides a useful startup-read improvement, but prematurely releases recovery and cron waiters and introduces two test defects.

Priority: P2
Reviewed head: 0f50066fd264e5c48d51a8d9df8521487c240c87

Before merge

  • Preserve full preparation waits for recovery and cron consumers (P1) - Changing the default wait to readReady also changes every unchanged waitForAgentDatabasePreparation caller. With an eligible database whose integrity scan is still running, recoverAfterAgentDatabasePreparation resumes, sees the writable refusal, skips its per-agent rediscovery, and settles without another completion callback. Cron's queued-launch continuation similarly resumes and fails assertAgentDatabaseAdmitted, entering its cancellation path. Preserve the original completion-observer contract and select early-read readiness explicitly for descriptive callers, or migrate every writable consumer while retaining terminal-failure and cancellation semantics.
  • Update the fleet fixture for publication before opening (P2) - The existing unsealed-fleet integration fixture wraps publishAgent with an allOpened wait, resolved only after every openAgent finishes. This new early-publication call occurs before openAgent, so the first eligible agent waits for opens it prevents from starting. Exact-head CI reports the fleet case timing out. Adapt the fixture to exercise early publication separately while retaining its opening-concurrency and generation-retention assertions.
  • Use the supported options argument for the parameterized timeout (P2) - The consolidated test now uses it.for, but retains the plain-it trailing numeric timeout. Vitest 5 requires the typed options argument for this parameterized declaration, so this introduces a test-type error. Put { timeout: 30_000 } before the callback, preserving the same timeout and assertions.

Findings

  • [P1] Preserve full preparation waits for recovery and cron consumers — src/state/agent-database-startup.ts:255-256
  • [P2] Update the fleet fixture for publication before opening — src/state/agent-database-startup.ts:545
  • [P2] Use the supported options argument for the parameterized timeout — src/state/openclaw-agent-execution.integrity.test.ts:474
Agent review details

How this fits together

The database startup owner publishes admission decisions consumed by Gateway handlers and SQLite workers; descriptive requests return committed snapshots while mutations await full preparation.

flowchart TD
  A[Gateway restart] --> B[Schema and ownership inspection]
  B --> C[Startup admission owner]
  C --> D[Read only workers]
  C --> E[Full integrity inspection]
  D --> F[Session and board responses]
  E --> G[Writable admission and recovery]
Loading

Technical review

Best possible solution:

Keep separate read readiness in the existing startup owner while preserving full-completion waits for recovery and mutation consumers.

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

The base source gates reads on full preparation, and the supplied real Gateway comparison demonstrates the delay; this review executed no target code.

Is this the best way to solve the issue?

The existing admission owner is the right boundary, but changing its default wait requires a complete consumer cutover that this patch misses.

Full review comments:

  • [P1] Preserve full preparation waits for recovery and cron consumers — src/state/agent-database-startup.ts:255-256
    Changing the default wait to readReady also changes every unchanged waitForAgentDatabasePreparation caller. With an eligible database whose integrity scan is still running, recoverAfterAgentDatabasePreparation resumes, sees the writable refusal, skips its per-agent rediscovery, and settles without another completion callback. Cron's queued-launch continuation similarly resumes and fails assertAgentDatabaseAdmitted, entering its cancellation path. Preserve the original completion-observer contract and select early-read readiness explicitly for descriptive callers, or migrate every writable consumer while retaining terminal-failure and cancellation semantics.
    Confidence: 0.99
  • [P2] Update the fleet fixture for publication before opening — src/state/agent-database-startup.ts:545
    The existing unsealed-fleet integration fixture wraps publishAgent with an allOpened wait, resolved only after every openAgent finishes. This new early-publication call occurs before openAgent, so the first eligible agent waits for opens it prevents from starting. Exact-head CI reports the fleet case timing out. Adapt the fixture to exercise early publication separately while retaining its opening-concurrency and generation-retention assertions.
    Confidence: 0.99
  • [P2] Use the supported options argument for the parameterized timeout — src/state/openclaw-agent-execution.integrity.test.ts:474
    The consolidated test now uses it.for, but retains the plain-it trailing numeric timeout. Vitest 5 requires the typed options argument for this parameterized declaration, so this introduces a test-type error. Put { timeout: 30_000 } before the callback, preserving the same timeout and assertions.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/state/openclaw-agent-execution.integrity.test.ts src/gateway/session-send-recovery.test.ts src/agents/bash-tools.exec-notify.test.ts src/cron/service.run-queue.test.ts
  • pnpm test src/gateway/server-agent-database-startup.test.ts src/gateway/server-agent-database-startup.preparation.test.ts
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.state-logging.json --incremental
  • pnpm check:changed
  • git diff --check

What I checked:

PR surface

Source +340, Tests 0, Docs +9, Other +110. Total +459 across 49 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 44 536 196 +340
Tests 3 496 496 0
Docs 1 20 11 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 1 129 19 +110
Total 49 1181 722 +459

Review metrics

Metric Value Why it matters
Production versus test growth Runtime source +340 net lines; tests and shared test support +0 net lines. The admission split and caller cutover justify focused runtime growth without introducing another startup owner.

Labels

Label changes:

  • add P2: The central improvement affects read availability during unclean startup of larger agent databases.
  • add merge-risk: 🚨 message-delivery: Releasing existing waiters at read readiness can skip saved-input rediscovery and cancel queued cron occurrences before writable admission.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🐚 platinum hermit and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The central improvement affects read availability during unclean startup of larger agent databases.
  • merge-risk: 🚨 message-delivery: Releasing existing waiters at read readiness can skip saved-input rediscovery and cancel queued cron occurrences before writable admission.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🐚 platinum hermit and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

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

Workflow

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

Reviewed October 27, 2026, 11:34 PM ET / October 28, 2026, 03:34 UTC.

@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch from 0f50066 to bf8d8ed Compare October 28, 2026 03:48

@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: bf8d8eda6e

ℹ️ 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/state/agent-database-startup.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch from bf8d8ed to 864275e Compare October 28, 2026 04:41

@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: 864275e512

ℹ️ 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/state/agent-database-startup.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch 3 times, most recently from a8314ff to 11923f9 Compare October 28, 2026 05: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: 11923f9cb3

ℹ️ 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/gateway/session-method-policy.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch from 11923f9 to 1bb2e2f Compare October 28, 2026 07:14

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

ℹ️ 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/gateway/session-method-policy.ts Resolved
@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch from 1bb2e2f to 0c61beb Compare October 28, 2026 07:47
Separate revocable read readiness from writable admission for existing current-schema agent databases. Keep full integrity checks and write ordering, while committed read-only snapshots serve session, board, model, and metadata requests.

Prove the owning boundary with held native integrity and a real Gateway crash/restart fixture. No schema or storage-format changes.
Keep plugin actors and agent preparation on separate bounded carriers so full startup integrity scans cannot block unrelated Workboard reads. Preserve shared physical ownership, global input limits, write admission and existing two-carrier generic progress.

The normal carrier maximum is five instead of three. Native held-scan regression and focused broker/generation checks pass; independent review is clean. Real Gateway restart and paired load proof follow before landing.
Migrate the PostgreSQL lifecycle benchmark to the private carrier class and retain the open-refusal test on agent peers. Preserve the pooled-worker recovery assertions. Focused refusal test, script typecheck, changed-file lint and independent review pass.
Use the existing authenticated Prometheus exporter to capture three fresh live memory observations after all interrupted turns recover. Keep incomplete worker heap coverage explicit and resource sampling separate from startup latency.

Changed-file lint, exact script typecheck, parser verification and independent review pass. Paired built-Gateway resource runs follow the immutable load campaign.
Classify resolve and metadata as database reads without changing direct-key authorization. Invalidate cached agent topology when early read admission is revoked, and prove both failures against held native inspection. Reconnect the live restart probe with read-only operator scope.
Keep startup read, write, failure and cancellation proof while sharing fixture disposal and removing redundant setup. Let the Gateway fixture drain native borrowers before closing state instead of closing it synchronously in a duplicate test hook. Preserve the existing test-line ceiling.
Carry the method registry read classification through session authorization without changing sharing policy or writable database admission. Cover a registered plugin read while integrity is held and reject it when schema repair is required.
@steipete
steipete force-pushed the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch from 0c61beb to 36eb613 Compare October 28, 2026 08:23
@steipete

Copy link
Copy Markdown
Contributor Author

Landing this exact head under the authorized inherited-failure exception. CI run 40656449792 has three failing test jobs plus its aggregate gate:

  • checks-node-changed-compact-large-11-2 and checks-node-changed-compact-large-13: stale Node recovery-guidance expectations. Both full update-CLI files produce the same 33 passed / 2 failed on head 36eb6137 and exact main parent bec3ad81 (24.22.1 expected, 24.16.0 actual after fix: keep updates working below recommended Node security patches #186589).
  • checks-node-changed-4: catalog-generation supersession in codex-account-model-route.product-proof.e2e.test.ts. Built candidate 36eb6137 passes all three cases; built main baseline 4a5ec828 fails one with the identical signature and passes two. CI fails three; equal failure frequency is not claimed. This test waits for completed startup before its explicit catalog refresh. Relevant generation owners are unchanged through parent bec3ad81.

All security and other selected CI jobs passed; independent review is clean. Final built startup proof passes all nine read-only RPCs 10.35 seconds before integrity completes, with five interrupted turns recovered exactly once. Full stress and resource evidence is in the PR body. No CI reruns or baseline increases.

@steipete
steipete merged commit 9f32d25 into main Oct 28, 2026
182 of 187 checks passed
@steipete
steipete deleted the steipete/perf-micro-agent-startup-inspection-reads-20260919 branch October 28, 2026 08:57
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…penclaw#186473)

* fix(state): serve session reads during startup integrity inspection

Separate revocable read readiness from writable admission for existing current-schema agent databases. Keep full integrity checks and write ordering, while committed read-only snapshots serve session, board, model, and metadata requests.

Prove the owning boundary with held native integrity and a real Gateway crash/restart fixture. No schema or storage-format changes.

* test(state): align startup fixtures with read admission phases

* fix(state): preserve full readiness for recovery waiters

* fix(state): isolate plugin reads from agent inspection

Keep plugin actors and agent preparation on separate bounded carriers so full startup integrity scans cannot block unrelated Workboard reads. Preserve shared physical ownership, global input limits, write admission and existing two-carrier generic progress.

The normal carrier maximum is five instead of three. Native held-scan regression and focused broker/generation checks pass; independent review is clean. Real Gateway restart and paired load proof follow before landing.

* test(state): finish SQLite carrier classification cutover

Migrate the PostgreSQL lifecycle benchmark to the private carrier class and retain the open-refusal test on agent peers. Preserve the pooled-worker recovery assertions. Focused refusal test, script typecheck, changed-file lint and independent review pass.

* test(perf): measure post-recovery Workboard worker resources

Use the existing authenticated Prometheus exporter to capture three fresh live memory observations after all interrupted turns recover. Keep incomplete worker heap coverage explicit and resource sampling separate from startup latency.

Changed-file lint, exact script typecheck, parser verification and independent review pass. Paired built-Gateway resource runs follow the immutable load campaign.

* fix(gateway): complete startup read admission for non-admin clients

Classify resolve and metadata as database reads without changing direct-key authorization. Invalidate cached agent topology when early read admission is revoked, and prove both failures against held native inspection. Reconnect the live restart probe with read-only operator scope.

* test(state): consolidate startup admission fixture lifetimes

Keep startup read, write, failure and cancellation proof while sharing fixture disposal and removing redundant setup. Let the Gateway fixture drain native borrowers before closing state instead of closing it synchronously in a duplicate test hook. Preserve the existing test-line ceiling.

* fix(gateway): retain registered read admission for plugin requests

Carry the method registry read classification through session authorization without changing sharing policy or writable database admission. Cover a registered plugin read while integrity is held and reject it when schema repair is required.
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: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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