Skip to content

perf(gateway): separate startup maintenance timing - #117577

Merged
vincentkoc merged 1 commit into
mainfrom
perf/kova-bootstrap-trace
Aug 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/kova-bootstrap-trace

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The source-performance startup trace reports the full Gateway startup-maintenance interval as plugins.bootstrap / plugins.load. Session, channel, and pairing maintenance therefore appears to be plugin-loading cost, which sends Kova follow-up work to the wrong owner.

Why This Change Was Made

Run startup maintenance through its own exported owner and measure it as startup.maintenance before the plugin-only plugins.bootstrap span. The existing maintenance concurrency, minimal-Gateway behavior, and device-before-node migration order remain unchanged.

User Impact

No product runtime behavior changes. Maintainers get accurate startup attribution, so future performance work can distinguish migration/maintenance cost from plugin loading.

Evidence

  • Kova hosted startup evidence showed plugins.bootstrap at roughly 281-301ms, while source inspection found the span also contained channel, session, and pairing maintenance.
  • Exact-head hosted source-performance run: https://github.com/openclaw/openclaw/actions/runs/30713929982
    • preparedRuntimeScaleMany: startup.maintenance=263.3ms, plugin-only plugins.bootstrap=33.8ms
    • fiftyStartupLazyPlugins: startup.maintenance=141.4ms, plugin-only plugins.bootstrap=52.7ms
    • the source artifact contains both spans independently across the startup scenarios
  • node scripts/run-vitest.mjs src/gateway/server-startup-plugins.test.ts src/gateway/server-startup-bootstrap.test.ts: 28/28 passed.
  • Targeted oxfmt --check, oxlint, and git diff --check: passed.
  • Autoreview: clean, no accepted/actionable findings.
  • The broad changed gate could not acquire a ready Testbox because the local Crabbox client/auth path is unavailable; local fallback was intentionally stopped when pnpm attempted linked-worktree dependency reconciliation. GitHub CI is the broad validation owner for this draft.

@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 1, 2026 19:01
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:55 PM ET / 19:55 UTC.

ClawSweeper review

What this changes

Separates channel, session, and pairing startup maintenance from plugin bootstrap so Gateway startup traces report startup.maintenance independently of plugins.bootstrap.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This PR is still necessary: current main retains the combined maintenance-and-plugin timing boundary. No blocking findings were identified; the patch preserves the maintenance sequence while making the trace attribute that work to a dedicated pre-plugin phase. Likely related people: Peter Steinberger (high confidence, current startup-boundary history) and Vincent Koc (high confidence, recent Gateway startup-performance work).

Priority: P3
Reviewed head: e44ee56a8f05360dc23db801d125990d3e6489ff

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch has a focused owner-boundary design, regression coverage for preserved lifecycle contracts, and exact-head hosted runtime evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body and supplied check context provide an exact-head hosted source-performance run showing independent startup.maintenance and plugins.bootstrap results.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body and supplied check context provide an exact-head hosted source-performance run showing independent startup.maintenance and plugins.bootstrap results.
Evidence reviewed 6 items Current-main behavior: Current main still runs maintenance inside the plugin-bootstrap owner, so the requested independent timing span has not already landed.
PR owner boundary: The PR extracts the unchanged channel, session, and ordered pairing maintenance block into runGatewayStartupMaintenance, leaving plugin activation and runtime loading in prepareGatewayPluginBootstrap.
Startup ordering: The new maintenance measurement is placed after worker-environment import and immediately before the existing plugin-bootstrap measurement, preserving their original relative order.
Findings None None.
Security None None.

How this fits together

Gateway startup imports worker state, performs channel/session/pairing maintenance, then builds plugin runtime state and the Gateway method list before the server binds. Startup tracing measures these phases so performance work is assigned to the owner that actually consumes the time.

flowchart LR
  Config[Startup configuration] --> Bootstrap[Gateway bootstrap]
  Bootstrap --> Maintenance[Channel session and pairing maintenance]
  Maintenance --> TraceA[startup maintenance trace]
  Maintenance --> Plugins[Plugin runtime bootstrap]
  Plugins --> TraceB[plugin bootstrap trace]
  Plugins --> Server[Gateway server ready]
Loading

Before merge

  • Complete next step (P2) - Keep this active member-authored PR on the normal maintainer landing path; no discrete automated repair is needed.
Agent review details

Security

None.

PR surface

Source +14, Tests +99. Total +113 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 28 14 +14
Tests 1 102 3 +99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 130 17 +113

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/gateway/server-startup-plugins.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the focused owner-boundary split, retaining the dedicated maintenance span and its regression tests for ordering, recovered channel configuration, and minimal-Gateway behavior.

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

Not applicable: this is an internal trace-attribution change, and the supplied exact-head hosted run directly reports the two resulting timing spans.

Is this the best way to solve the issue?

Yes. Extracting the existing maintenance block to a dedicated startup owner is the narrowest maintainable solution: measuring only around plugin bootstrap would retain the wrong attribution, while moving the work later would alter lifecycle behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 37e7307b0147.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body and supplied check context provide an exact-head hosted source-performance run showing independent startup.maintenance and plugins.bootstrap results.

Label justifications:

  • P3: The change improves internal startup-performance attribution without changing a documented user-facing runtime path.
  • 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. Sufficient (linked_artifact): The PR body and supplied check context provide an exact-head hosted source-performance run showing independent startup.maintenance and plugins.bootstrap results.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and supplied check context provide an exact-head hosted source-performance run showing independent startup.maintenance and plugins.bootstrap results.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Git blame attributes the combined maintenance block and the nearby bootstrap invocation on current main to this history boundary. (role: current startup-boundary author; confidence: high; commits: a88f3ffc9609, e4d1b7e0d38c; files: src/gateway/server-startup-plugins.ts, src/gateway/server-startup-bootstrap.ts)
  • Vincent Koc: Authored this PR and the recently merged Gateway startup-session performance change, establishing direct recent involvement in the same startup-performance neighborhood. (role: recent area contributor; confidence: high; commits: e44ee56a8f05, 27b1d04178f0; files: src/gateway/server-startup-bootstrap.ts, src/gateway/server-startup-plugins.ts, src/gateway/server-startup-session-migration.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-01T19:07:26.482Z sha e44ee56 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T19:12:49.335Z sha e44ee56 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T19:17:03.639Z sha e44ee56 :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

Exact-head merge proof for e44ee56a8f05360dc23db801d125990d3e6489ff is complete:

There is no persistent data-model change. The heuristic was triggered by migration references in the focused test; the patch changes no schema, storage shape, migration behavior, or persisted data.

This resolves the remaining CI and merge-risk checklist item. The ordinary maintainer landing decision is accepted.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Current-main merge preparation is complete for exact head e44ee56a8f05360dc23db801d125990d3e6489ff.

  • scripts/pr prepare-run 117577 completed successfully after refreshing main.
  • Hosted exact-or-recent-parent CI/Testbox gates passed at 2026-08-01 19:23 UTC.
  • The reviewed branch remains cleanly mergeable with current origin/main (c263c273c75008ed3d3e0788ffc8373726802ce4).
  • Review artifacts remain READY FOR /prepare-pr with zero findings.
  • The maintainer accepts the landing decision: startup maintenance remains the dedicated pre-plugin-bootstrap owner and startup.maintenance remains independently visible.
  • The stored-data heuristic is a false positive from migration terminology in the test surface; this PR changes no schema, storage shape, migration behavior, or persisted data.

This resolves the remaining current-base merge-risk and maintainer-decision items.

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

Current-main merge preparation is complete again for exact head e44ee56a8f05360dc23db801d125990d3e6489ff after #117525 landed.

  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 117577 completed successfully against origin/main containing 6531ca91f457a9fdcbc0005a59927ae68c763898.
  • Hosted exact-or-recent-parent gates passed.
  • Review artifacts remain READY FOR /prepare-pr with zero findings.
  • The exact-head Kova proof remains green and independently reports startup.maintenance and plugin-only plugins.bootstrap.
  • The stored-data heuristic is a false positive from migration terminology in the focused test; there is no schema, storage-shape, migration-behavior, or persisted-data change.
  • Maintainer merge decision: approved.

This resolves the durable review's current-main merge-risk and maintainer-decision items.

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

The stale review publisher has completed. Exact head remains e44ee56a8f05360dc23db801d125990d3e6489ff; current-main prepare, hosted gates, zero-finding review artifacts, stored-data false-positive resolution, and maintainer merge approval remain valid.

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

The owning review workflow and publisher are complete, but the PR still has an orphaned active lease marker that blocks fresh durable publication.

@clawsweeper stop

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞✅
Got it. ClawSweeper will leave this item for human review.

I added clawsweeper:human-review and paused the automation trail until a maintainer asks again.

@clawsweeper clawsweeper Bot added the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

The stale automation lease is now cleared. Please perform a fresh exact-head review of e44ee56a8f05360dc23db801d125990d3e6489ff.

Current-main prepare and hosted gates pass, repository-native review artifacts have zero findings, the stored-data heuristic is confirmed false, and the maintainer merge decision is approved.

@clawsweeper re-review

@vincentkoc vincentkoc removed the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

The PR-scoped human-review pause is cleared. Please publish a fresh durable exact-head review for e44ee56a8f05360dc23db801d125990d3e6489ff.

Current-main prepare and hosted gates pass, review artifacts contain zero findings, the stored-data heuristic is confirmed false, and the maintainer merge decision is approved.

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

Exact-head merge proof for e44ee56a8f05360dc23db801d125990d3e6489ff is complete:

  • GitHub CI: 77 passing checks, no failures or pending checks
  • exact-head Kova workflow passed: https://github.com/openclaw/openclaw/actions/runs/30713929982
  • hosted source artifact independently reports startup.maintenance and plugin-only plugins.bootstrap
  • preparedRuntimeScaleMany: 263.3ms maintenance vs 33.8ms plugin bootstrap
  • fiftyStartupLazyPlugins: 141.4ms maintenance vs 52.7ms plugin bootstrap
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 117577 completed successfully against current main at 27b1d04178f07f4b4094af9788135471a58aa963
  • git merge-tree --write-tree origin/main e44ee56a8f05360dc23db801d125990d3e6489ff completed without conflicts
  • review artifacts validated with READY FOR /prepare-pr and zero findings

There is no persistent data-model change. The heuristic was triggered by migration references in the focused test; the patch changes no schema, storage shape, migration behavior, or persisted data.

This resolves the remaining CI and merge-risk checklist item. The ordinary maintainer landing decision is accepted.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 1, 2026
@vincentkoc
vincentkoc merged commit 04ac671 into main Aug 1, 2026
195 of 215 checks passed
@vincentkoc
vincentkoc deleted the perf/kova-bootstrap-trace branch August 1, 2026 19:56
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 1, 2026
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5':
  fix(channels): preserve filters in offline status diagnostics (#117570)
  perf(gateway): separate startup maintenance timing (#117577)
  refactor(tests): deduplicate database-first guard fixtures (#117594)
  fix(cli): align sessions cleanup label summary by visible width (#117459)
  perf(gateway): skip empty session reconciliation (#117589)
vincentkoc added a commit that referenced this pull request Aug 1, 2026
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5':
  fix(channels): preserve filters in offline status diagnostics (#117570)
  perf(gateway): separate startup maintenance timing (#117577)
  refactor(tests): deduplicate database-first guard fixtures (#117594)
  fix(cli): align sessions cleanup label summary by visible width (#117459)
  perf(gateway): skip empty session reconciliation (#117589)
  refactor(ui): consolidate cron form control rendering (#117576)
  fix(memory): recover restored session freshness (#117548)
  fix(ui): preserve Talk transcript surrogate bounds
  fix(ui): harden Talk transcript marker bounds
  test(ui): cover bounded realtime Talk entries
  fix(ui): bound realtime Talk conversation text
vincentkoc added a commit that referenced this pull request Aug 1, 2026
* origin/main:
  perf(gateway): separate startup maintenance timing (#117577)
  refactor(tests): deduplicate database-first guard fixtures (#117594)
  fix(cli): align sessions cleanup label summary by visible width (#117459)
  perf(gateway): skip empty session reconciliation (#117589)
vincentkoc added a commit that referenced this pull request Aug 1, 2026
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5':
  fix(channels): preserve filters in offline status diagnostics (#117570)
  perf(gateway): separate startup maintenance timing (#117577)
  refactor(tests): deduplicate database-first guard fixtures (#117594)
  fix(cli): align sessions cleanup label summary by visible width (#117459)
  perf(gateway): skip empty session reconciliation (#117589)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* commit '58213dd5389737ff100c6286d110921defeb76e8':
  fix(channels): preserve filters in offline status diagnostics (openclaw#117570)
  perf(gateway): separate startup maintenance timing (openclaw#117577)
  refactor(tests): deduplicate database-first guard fixtures (openclaw#117594)
  fix(cli): align sessions cleanup label summary by visible width (openclaw#117459)
  perf(gateway): skip empty session reconciliation (openclaw#117589)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  perf(gateway): separate startup maintenance timing (openclaw#117577)
  refactor(tests): deduplicate database-first guard fixtures (openclaw#117594)
  fix(cli): align sessions cleanup label summary by visible width (openclaw#117459)
  perf(gateway): skip empty session reconciliation (openclaw#117589)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* commit '58213dd5389737ff100c6286d110921defeb76e8':
  fix(channels): preserve filters in offline status diagnostics (openclaw#117570)
  perf(gateway): separate startup maintenance timing (openclaw#117577)
  refactor(tests): deduplicate database-first guard fixtures (openclaw#117594)
  fix(cli): align sessions cleanup label summary by visible width (openclaw#117459)
  perf(gateway): skip empty session reconciliation (openclaw#117589)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* commit '58213dd5389737ff100c6286d110921defeb76e8':
  fix(channels): preserve filters in offline status diagnostics (openclaw#117570)
  perf(gateway): separate startup maintenance timing (openclaw#117577)
  refactor(tests): deduplicate database-first guard fixtures (openclaw#117594)
  fix(cli): align sessions cleanup label summary by visible width (openclaw#117459)
  perf(gateway): skip empty session reconciliation (openclaw#117589)
  refactor(ui): consolidate cron form control rendering (openclaw#117576)
  fix(memory): recover restored session freshness (openclaw#117548)
  fix(ui): preserve Talk transcript surrogate bounds
  fix(ui): harden Talk transcript marker bounds
  test(ui): cover bounded realtime Talk entries
  fix(ui): bound realtime Talk conversation text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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