Repository navigation
perf(gateway): move fleet skills discovery past readiness - #170933
Merged
steipete merged 3 commits intoOct 13, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 13, 2026 10:05
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
steipete
deleted the
steipete/perf-micro-startup-readiness-budget-20260919
branch
October 13, 2026 10:59
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 14, 2026
…70933) * perf(gateway): move fleet skills discovery past readiness * test(gateway): prove startup renewal stops after refusal * test(gateway): prune retired config mock allowances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Gateway startup waits for a fleet-wide skills scan even though workspace-scoped reads already prepare their own discovery, and early config selection imports the broader config facade for one snapshot read.
User Impact
Skills listeners register during startup; the initial fleet scan runs in the existing tracked post-ready maintenance task. On-demand workspace reads still await discovery. Main-session and subagent restart recovery remain intact, including interrupted turns. No config option, schema change, migration, or operator action is introduced; update/canary suppression and cleanup remain intact.
The early-runtime phase became much shorter, but overall readiness is neutral within observed variation. The <5-second readiness target is not met. Immediate agent acceptance and first replies remained below 10 seconds in all six synthetic runs. These measurements do not certify production timing.
Why This Change Was Made
Use the config IO factory directly with the same isolated environment, core-only validation, and observation policy. Keep recovery on its separate freshly cloned environment and retain future-version, reset, selection-hop, and drift checks. Register the skills listener before readiness, then join the initial scan inside the existing maintenance owner. Check closing after imports and after discovery so shutdown cannot start maintenance timers. Remove the unnecessary async import wrapper.
Production LOC delta: -1 (+19/-20, excluding tests, docs, and the generated mock ledger). No competing fast path, cache, or new lifecycle owner is added. The admission state snapshot stays unchanged: it binds recovery, schema admission, and plugin config to one generation. Removing it based on the earlier live-owner probe would weaken that contract.
Evidence
Three before and three after runs in an isolated Linux benchmark sandbox, restricted to CPU cores 64–127, 64 GiB, nice/idle I/O priority. Every command used the sandbox scope; no production database/config was read or copied. Synthetic fixture: 12 agent databases/workspaces, 6,000 sessions, 120,000 transcript events, 100,000 audit rows (half retained), 2,400 workspace files, config backup, bundled startup plugins, and a loopback mock inference provider. Gateways and mock providers bound only loopback ports >=40000. No Testbox/Crabbox allocation: focused local proof and PR CI follow the current validation rule.
/readyz200Readiness median: 15.21 → 14.92 seconds (neutral, -1.9%). Early-runtime median: 3409 → 28 ms. Acceptance median: 719 → 330 ms. First-reply median: 5.54 → 6.66 seconds; ranges overlap (5.36–7.18 vs 5.82–7.21 seconds), so this is not a first-reply speedup claim. Bootstrap/snapshot, session admission/projection, and remaining runtime/plugin work still dominate total readiness. Phases overlap, so table durations must not be summed; transcript maintenance stays post-ready and is not a readiness gate. Snapshot and recovery phases were investigated, not bypassed. The after measurements precede only deletion of the equivalent async import wrapper; PR CI builds the final source.
Validation:
oxfmton all seven changed files: passed.pnpm test src/gateway/server-startup-early.test.ts src/cli/gateway-cli/pre-bootstrap.reset-invalid-config.test.ts src/cli/gateway-cli/run.option-collisions.test.ts --maxWorkers=1: 63 tests passed, 207.34 s wall time including cold worker-fixture compilation.pnpm test src/gateway/server-startup-early.test.ts --maxWorkers=1after closing-guard change: 15 tests passed, 76.85 s wall time (65.31 s Vitest duration, primarily fixture compilation).pnpm test src/cli/gateway-cli/pre-bootstrap.process.test.ts --maxWorkers=1: 17 tests passed, 114.91 s wall time. Actual environment/recovery/selection flow proves unchanged state artifacts with and without backups, dotenv trust, reset/future-config safety, and authored drift refusal.cliStartupprofile: passed before and after. Full typecheck, suites, and E2E are delegated to PR CI.git diff --check: passed.The skills regression proves early startup completes without waiting for a blocked scan, maintenance joins the scan, and closing fences the scan/timers. A pre-change execution of that regression was not run. Existing lifecycle coverage checks listener notifications and watcher shutdown. Initial CI run 38381004830 passed the selected typechecks, lint, security, E2E, and the remaining changed test lanes. It failed the mock-export ratchet because two synthetic config factories lacked isolation comments (now added), plus four process-wide timer-count assertions in
startup-config-preflight.recovery.test.ts(24.52 s CI test duration). The unchanged recovery file passed all nine tests locally (89.62 s wall time).The recovery proof now observes the exact acquired startup migration lease: after refusal, advance fake time by one minute and verify no further heartbeat calls. Existing refusal, authority, unchanged config, and no backup repair checks stay intact, including the distinction between stale and replacement leases. This scopes proof to startup renewal shutdown; it does not claim process-wide timer cleanup or identify CI's extra timer. The revised full file passed nine tests locally (130.39 s wall, 118.66 s Vitest duration). Final source:
pnpm test src/commands/startup-config-preflight.recovery.test.ts --maxWorkers=1 -t 'refuses changed|does not restore a backup': four passed, five intentionally unselected, 80.24 s wall (65.86 s Vitest duration). CI run 38383349493 took 600 s elapsed and passed all 37 selected code-validation jobs, including recovery tests, types, lint, security, and E2E. Only the mock ledger ratchet failed: it required removing the two obsolete allowances for the removed facade mock and explicitly isolated factory. The canonicalpnpm check:test-mock-exports --base origin/main --prunegenerated exactly those two deletions (9709 → 9707 entries), reviewed independently; no allowances were added. Final CI run 38384962387, headad034ea5fc84f6229f241dfe68ebb0f76bbacf68: success, 42 executed jobs passed, no failures; 733 s elapsed including runner queues. Selected changed lanes, typechecks, lint, guards, docs, security, and E2E passed. No CI rerun or inherited-failure waiver was used. Independent subagent review of this CI repair found no actionable issues.