Skip to content

improve(gateway): speed up pristine plugin-heavy startup [AI]#106195

Merged
steipete merged 2 commits into
mainfrom
codex/gateway-perf-safe-round-3
Jul 13, 2026
Merged

improve(gateway): speed up pristine plugin-heavy startup [AI]#106195
steipete merged 2 commits into
mainfrom
codex/gateway-perf-safe-round-3

Conversation

@steipete

@steipete steipete commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Closes #106194

What Problem This Solves

Fixes an issue where users starting a Gateway against a pristine state root would wait for unrelated core legacy-migration detector imports when local plugins were configured. Plugin-heavy first starts paid this cost even though no core state existed to migrate.

Why This Change Was Made

The Gateway now captures the physically pristine core-state fact before selection can create runtime files, then carries it through the existing bootstrap seam. Startup skips only core migration discovery when that fact remains safe; plugin-owned doctor migrations still run, and existing core state, external session stores, $include, or stateful core config retain the full migration path.

This keeps one canonical migration boundary and adds no cache, config, protocol, persistence, compatibility shim, or fallback.

User Impact

Newly provisioned Gateways become ready sooner, especially with many local plugins. Existing installations and migration behavior are unchanged.

Release note: Faster first Gateway startup for plugin-heavy configurations.

Evidence

Controlled Blacksmith Testbox A/B: 7 measured runs, 2 warmups, p50.

  • 50 manifest plugins: /readyz 4911.3 ms -> 4242.9 ms (-13.6%); bootstrap 2711.2 ms -> 2289.9 ms (-15.5%).
  • 50 startup-lazy plugins: /readyz 4603.2 ms -> 4287.0 ms (-6.9%); bootstrap 2741.9 ms -> 2426.6 ms (-11.5%).
  • Default config: /readyz 3184.7 ms -> 3039.7 ms (-4.6%); bootstrap remained flat (143.7 ms -> 143.1 ms).

Exact rebased-head proof at ed243b617059 on direct AWS Crabbox cbx_8df19c39207d (run):

  • pnpm build
  • 111 tests across command bootstrap, execution startup, guarded recovery, pristine-state planning, doctor migration routing, and the plugin SDK surface contract
  • touched-file oxlint
  • 3-run benchmark confirmation on the AWS host: default /readyz p50 4797.5 ms; 50 plugins 7509.1 ms; 50 startup-lazy plugins 7260.3 ms

Pre-commit autoreview: clean, no accepted/actionable findings. GitHub review's same-path recovery edge is fixed by revalidating the final guarded config without repeating physical-state discovery.

AI-assisted implementation; maintainer-reviewed behavior and proof.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: S maintainer Maintainer-authored PR labels Jul 13, 2026

@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: 3458f92e91

ℹ️ 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/cli/gateway-cli/pre-bootstrap.ts
@steipete
steipete force-pushed the codex/gateway-perf-safe-round-3 branch from 3458f92 to 4b2a540 Compare July 13, 2026 08:41
@steipete
steipete force-pushed the codex/gateway-perf-safe-round-3 branch 2 times, most recently from 1264ba7 to c7edaa3 Compare July 13, 2026 09:03

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

ℹ️ 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/commands/doctor/shared/pristine-startup-state.ts
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 21da0790d4ff86ba7e51ec588333cafb25601dd5, but the PR head is now ed243b61705999d1247c3dd9ee537698ed907f36. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

@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: 21da0790d4

ℹ️ 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/cli/run-main.ts
@steipete
steipete force-pushed the codex/gateway-perf-safe-round-3 branch from 21da079 to ed243b6 Compare July 13, 2026 09:20
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at ed243b61705999d1247c3dd9ee537698ed907f36.

Proof:

  • Controlled Blacksmith Testbox A/B (7 measured runs, 2 warmups): 50 manifest plugins /readyz -13.6% and bootstrap -15.5%; 50 startup-lazy plugins /readyz -6.9% and bootstrap -11.5%; default bootstrap flat.
  • Direct AWS Crabbox cbx_8df19c39207d, run run_9cb4f2539051: pnpm test for five focused Gateway/doctor files plus test/scripts/plugin-sdk-surface-report.test.ts (111 tests), touched-file oxlint, pnpm build, and three-case startup benchmark; all passed.
  • Fresh autoreview: clean, no accepted/actionable findings.
  • GitHub review recovery finding fixed in src/cli/gateway-cli/pre-bootstrap.ts:648 with regression coverage in src/cli/gateway-cli/run.option-collisions.test.ts:449; thread resolved.
  • Repo-native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 106195: hosted exact-head gates passed.

Known proof gaps: none.

@steipete
steipete merged commit 843e3c7 into main Jul 13, 2026
110 checks passed
@steipete
steipete deleted the codex/gateway-perf-safe-round-3 branch July 13, 2026 09:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

wm0018 pushed a commit to wm0018/openclaw that referenced this pull request Jul 14, 2026
…aw#106195)

* perf(gateway): skip absent core startup migrations

* fix(gateway): revalidate recovered startup config
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 14, 2026
…aw#106195)

* perf(gateway): skip absent core startup migrations

* fix(gateway): revalidate recovered startup config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway pristine startup loads unrelated core migration detectors

1 participant