Skip to content

perf(tui): skip plugin metadata + provider catalog on remote TUI startup#84686

Merged
RomneyDa merged 3 commits into
mainfrom
no-plugin-validation-tui-side
May 21, 2026
Merged

perf(tui): skip plugin metadata + provider catalog on remote TUI startup#84686
RomneyDa merged 3 commits into
mainfrom
no-plugin-validation-tui-side

Conversation

@RomneyDa

@RomneyDa RomneyDa commented May 20, 2026

Copy link
Copy Markdown
Member

BEFORE

image

AFTER

image

Summary

Cold openclaw tui against a remote gateway froze the TUI's event loop for tens of seconds after first render. CPU profile showed the dominant cost was provider catalog resolution (runProviderCatalog, resolveProviderSyntheticAuthWithPlugin, lstat, open), with secondary cost in plugin manifest snapshot loading via config validation.

Neither of these is needed in remote mode — the TUI is a thin WebSocket client that queries the gateway over RPC for models, slash commands, agents. Both were leaking into the TUI process through two distinct mechanisms:

1. Plugin-aware config validation triggered by getRuntimeConfig()
src/tui/tui.ts:451getRuntimeConfig()loadConfig()validateConfigObjectWithPlugins()loadPluginMetadataSnapshot() (200k+ sync file reads).

createConfigIO already supported pluginValidation: "skip" (used by readConfigFileSnapshot); it just wasn't reachable from the runtime entrypoints. This PR threads an opt-in skipPluginValidation through getRuntimeConfig / loadConfig. The TUI passes skipPluginValidation: !isLocalMode.

2. Top-level eager warmup in src/agents/context.ts
The module fired void ensureContextWindowCacheLoaded() at module-eval time for non-skip-listed CLI commands. The TUI transitively imports this module, so the warmup ran on every TUI startup — cascading into ensureOpenClawModelsJsonresolveImplicitProvidersrunProviderCatalog, plus credential reads via resolveProviderSyntheticAuthWithPlugin. It also called getRuntimeConfig() without the skip flag, pinning the full snapshot and nullifying (1).

This PR removes the top-level side effect and triggers the warmup explicitly from EmbeddedTuiBackend.start(), so it only fires when an in-process agent runtime actually needs it.

Mode behavior

  • Remote TUI (openclaw tui): no plugin metadata load, no provider catalog work, no models.json materialization. Config validation still runs in raw-shape mode (validateConfigObjectRaw + basic defaults) — enough for connection settings, session prefs, agent ID resolution.
  • Embedded TUI (openclaw tui --local, chat, terminal): unchanged. Full plugin validation runs (in-process agent runtime needs it), and the context window cache is warmed by the embedded backend's start().
  • Gateway boot, other CLI commands: unchanged — they were already on the warmup skip list.

Verification

  • pnpm tsgo:core --noEmit clean
  • Targeted tests pass:
    • src/tui/tui.test.ts — 46/46
    • src/tui/embedded-backend.test.ts + src/agents/context.lookup.test.ts — 92/92 combined
    • src/config/io.meta.test.ts + src/config/runtime-snapshot.test.ts — 10/10

Real behavior proof

  • Behavior addressed: cold openclaw tui (remote mode) freezes ~55s on event loop after first render
  • Real environment tested: CPU profile captured before the warmup-move commit confirmed the dominant cost was runProviderCatalog / resolveProviderSyntheticAuthWithPlugin, with loadPluginMetadataSnapshot secondary. Post-fix cold-start timing not yet captured.
  • Exact steps or command run after this patch: pnpm tsgo:core --noEmit; node scripts/run-vitest.mjs src/tui/tui.test.ts src/tui/embedded-backend.test.ts src/agents/context.lookup.test.ts src/config/io.meta.test.ts src/config/runtime-snapshot.test.ts
  • Evidence after fix: typecheck clean; 148 targeted tests pass
  • Observed result after fix: code paths verified via tests; cold-start time-from-render-to-responsive-input measurement to be captured manually
  • What was not tested: end-to-end manual openclaw tui cold-start timing against a warm gateway; --local mode regression check (chat/terminal aliases auto-enable local and now rely on embedded backend's start() for warmup); behavior when openclaw.json references plugins that don't exist (errors that previously surfaced at TUI startup will now only surface gateway-side / on first plugin use in remote mode)

Architectural notes

This is point (1) and a follow-up boundary cut from the architectural analysis: the remote-mode TUI doesn't need the provider catalog, plugin manifest registry, models.json, or plugin-aware config validation — the gateway owns all of that and serves it over RPC. The only legitimate config work in remote mode is reading openclaw.json, raw-shape validation, and basic defaults (connection URL, session settings, agent ID).

Two mechanisms were leaking gateway-side work into the TUI process; both are now gated. Further cleanup (e.g. deleting the now-unused shouldEagerWarmContextWindowCache + helpers) is left to a follow-up.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • 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.

Summary
The PR adds a skipPluginValidation runtime-config option, uses it for non-local TUI startup, and moves context-window cache warmup into EmbeddedTuiBackend.start().

Reproducibility: no. high-confidence live timing reproduction was run in this read-only pass. Source inspection does show current main reaches full plugin-aware config loading and import-time context warmup on the remote TUI startup path.

PR rating
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Summary: The patch is narrow and source-consistent with no blocking findings, with the main remaining question being maintainer acceptance of the compatibility tradeoff.

Rank-up moves:

  • Attach a cold remote TUI timing run against a warm gateway if maintainers want stronger performance proof.
  • Confirm the deferred plugin-validation behavior is acceptable for remote TUI before merging.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

Real behavior proof
Not applicable: The external contributor proof gate does not apply to this MEMBER maintainer-labeled PR, though a cold remote TUI timing run would still reduce merge risk.

Mantis proof suggestion
A short terminal or desktop recording can directly show the remote TUI first-render-to-responsive-input timing claim. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: record cold openclaw tui against a warm remote gateway and show first-render-to-responsive-input timing before and after this PR.

Risk before merge

  • Compatibility label rationale: remote openclaw tui would no longer surface plugin-aware config validation errors or warnings during client startup; those diagnostics move to the gateway path or first plugin use.
  • The PR body reports targeted tests and source-path proof, but says post-fix cold remote TUI timing and local/embedded runtime smoke proof were not captured yet.
  • The startup improvement still depends on no earlier full getRuntimeConfig() call pinning a plugin-validated runtime snapshot in the same remote TUI process.

Maintainer options:

  1. Keep label and accept remote-only deferral (recommended)
    Merge with the compatibility label if maintainers agree that remote TUI is a thin client and does not need to fail during startup for plugin-owned config diagnostics.
  2. Require proof before accepting the tradeoff
    Ask for a cold remote TUI timing run plus a quick local/embedded smoke before merge so the performance win and unchanged local runtime behavior are visible.
  3. Preserve startup validation semantics
    If remote TUI must keep surfacing plugin config problems at startup, pause this patch and move plugin validation off the first-render event loop instead.

Next step before merge
Maintainer review should decide whether to keep the compatibility label and accept deferred remote-TUI plugin validation; there is no narrow automated repair indicated by this pass.

Security
Cleared: The diff only changes internal TypeScript config/TUI startup paths and does not add dependencies, scripts, workflow permissions, package metadata, or new secret handling.

Review details

Best possible solution:

Land the remote-only skip if maintainers accept deferred plugin-aware validation for TUI clients; otherwise preserve startup diagnostics through a nonblocking/background validation path instead of skipping them.

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

No high-confidence live timing reproduction was run in this read-only pass. Source inspection does show current main reaches full plugin-aware config loading and import-time context warmup on the remote TUI startup path.

Is this the best way to solve the issue?

Mostly yes: the patch uses an existing plugin-validation skip seam at the remote TUI boundary and preserves full validation for embedded mode. The only open solution question is whether maintainers accept moving remote-client plugin diagnostics out of startup.

Label justifications:

  • P2: This is a normal-priority TUI performance fix with a limited but real startup behavior tradeoff.
  • merge-risk: 🚨 compatibility: Merging changes when remote TUI reports plugin-aware config problems, deferring diagnostics that previously appeared during client startup.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🌊 off-meta tidepool, patch quality is 🐚 platinum hermit, and The patch is narrow and source-consistent with no blocking findings, with the main remaining question being maintainer acceptance of the compatibility tradeoff.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external contributor proof gate does not apply to this MEMBER maintainer-labeled PR, though a cold remote TUI timing run would still reduce merge risk.

What I checked:

  • Current remote TUI config path: On current main, runTui() reads config with plain getRuntimeConfig(), so remote and local TUI share the full runtime config load path before this PR. (src/tui/tui.ts:446, cd019cfa412b)
  • Current full plugin validation path: Current loadConfig() calls createConfigIO().loadConfig(), and the config loader invokes validateConfigObjectWithPlugins() with the default plugin-validation mode plus a metadata snapshot loader. (src/config/io.ts:1608, cd019cfa412b)
  • Compatibility impact of skip mode: validateConfigObjectWithPluginsBase() returns success immediately when pluginValidation === "skip"; the plugin-aware diagnostics below that point include unknown channels, plugin config schema errors, missing plugins, and disabled plugin config warnings. (src/config/validation.ts:939, cd019cfa412b)
  • PR remote-only skip: The PR changes runTui() so non-local mode calls getRuntimeConfig({ skipPluginValidation: true }), while local/embedded mode keeps full validation. (src/tui/tui.ts:446, 835fc2fa6904)
  • PR warmup relocation: The PR removes the import-time eager context-window warmup from src/agents/context.ts and calls ensureContextWindowCacheLoaded() from embedded TUI startup instead. (src/agents/context.ts:222, 835fc2fa6904)
  • Author-noted compatibility tradeoff: The PR body explicitly lists as untested that configs referencing missing plugins will no longer error at remote TUI startup and will instead surface gateway-side or on first plugin use. (835fc2fa6904)

Likely related people:

  • steipete: High-volume history across the touched TUI/config/context files, including runtime config state, plugin/config compatibility, and TUI refactors. (role: recent area contributor; confidence: high; commits: 89a4f2a34ecc, fb580b551ef6, 8727338372b4; files: src/config/io.ts, src/config/validation.ts, src/tui/tui.ts)
  • vincentkoc: Recent commits specifically shaped config-load performance and context warmup/import-side-effect behavior, which is the central boundary in this PR. (role: startup/config performance contributor; confidence: high; commits: 009f494cd945, e31dfa989764, 120c384f0020; files: src/agents/context.ts, src/config/io.ts, src/config/validation.ts)
  • vignesh07: History shows repeated TUI behavior and responsiveness fixes, making this person a useful adjacent reviewer for remote/local TUI startup changes. (role: TUI area contributor; confidence: medium; commits: 61a0b0293104, fca0467082cb, b4cdffc7a429; files: src/tui/tui.ts, src/tui/embedded-backend.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against cd019cfa412b.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Neon Clawlet

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: sniffs out flaky tests.
Image traits: location merge queue dock; accessory commit compass; palette amber, ink, and glacier blue; mood determined; pose sitting proudly on a smooth stone; shell matte ceramic shell; lighting clean product lighting; background tiny shells and proof notes.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Neon Clawlet in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 20, 2026
@RomneyDa RomneyDa changed the title perf(tui): skip plugin-aware config validation on remote TUI startup perf(tui): skip plugin metadata + provider catalog on remote TUI startup May 20, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

A few follow-up candidates for further reducing remote-mode TUI work:

  • Defer EmbeddedTuiBackend import. src/tui/tui.ts:31 static-imports it, which pulls gateway server code (server-model-catalog, session-reset-service, sessions-patch, etc.) into every TUI process. A *.runtime.ts lazy boundary or await import() gated on isLocalMode would drop the module-eval cost in remote mode.
  • Gate lookupContextTokens warmup. src/agents/context.ts:285 still triggers void ensureContextWindowCacheLoaded() on cache miss. Worth checking whether anything on the remote TUI path calls it — if so, the warmup leaks back in lazily.
  • Remove dead helpers. shouldEagerWarmContextWindowCache, isLikelyOpenClawCliProcess, getCommandPathFromArgv, and SKIP_EAGER_WARMUP_PRIMARY_COMMANDS in src/agents/context.ts have no production caller now (only tests). Safe to delete along with the corresponding tests.
  • Channel state probes (src/channels/plugins/{package-state-probes,persisted-auth-state,configured-state}.ts) — confirm none fire on the remote TUI path; gate any that do.
  • materializeRuntimeConfig defaults that depend on manifestRegistry — in skip mode this is called with manifestRegistry: undefined. Worth a quick audit to confirm applyContextPruningDefaults and applyModelDefaults degrade gracefully and don't silently produce wrong defaults for the remote TUI's config view.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels May 20, 2026
RomneyDa added 3 commits May 20, 2026 15:22
Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config
…d backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
@RomneyDa RomneyDa force-pushed the no-plugin-validation-tui-side branch from f1115ce to 835fc2f Compare May 20, 2026 22:23
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper pls provide explanation for the compatibility merge risk label, or remove it

@clawsweeper

clawsweeper Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper is taking a look at your question.

I asked ClawSweeper to answer this maintainer mention in the next review comment. Tiny claws, bounded scope: this is a read-only assist pass unless it produces one of the existing structured safe-action markers.

Request: pls provide explanation for the compatibility merge risk label, or remove it

@RomneyDa RomneyDa merged commit d91ef6b into main May 21, 2026
99 checks passed
@RomneyDa RomneyDa deleted the no-plugin-validation-tui-side branch May 21, 2026 00:43
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…tup (openclaw#84686)

* perf(tui): skip plugin-aware config validation on remote TUI startup

Cold `openclaw tui` against a remote gateway was synchronously calling
loadPluginMetadataSnapshot() via getRuntimeConfig() -> loadConfig() ->
validateConfigObjectWithPlugins(), pulling the full plugin metadata
snapshot (200k+ file reads) onto the TUI's event loop. The TUI itself
never consumes plugin metadata in remote mode; it queries the gateway
over RPC. The work was being done purely to validate the config and
then thrown away.

Thread an opt-in `skipPluginValidation` flag through getRuntimeConfig()
and loadConfig() (createConfigIO already supports pluginValidation: "skip";
it just wasn't reachable from the runtime entrypoints). The TUI passes
skipPluginValidation: !isLocalMode so:

- Remote-mode TUI: no plugin metadata load, no event-loop freeze after
  first render
- Embedded (--local) mode: unchanged; the in-process agent runtime
  still gets a fully validated config

* remove verbose comments

* perf(tui): move context cache warmup from module top-level to embedded backend

agents/context.ts fired ensureContextWindowCacheLoaded() unconditionally
at module-eval time for non-skip-listed CLI commands. The TUI transitively
imports this module, so the warmup ran on every TUI startup including
remote-mode, cascading into ensureOpenClawModelsJson -> resolveImplicitProviders
-> runProviderCatalog and dominating the cold-start freeze (CPU profile
showed ~55s of resolveProviderSyntheticAuthWithPlugin, lstat, open, etc.).

It also pre-emptively called getRuntimeConfig() without skipPluginValidation,
pinning the full snapshot and nullifying the skip flag added on this branch.

Remove the top-level side effect and trigger the warmup explicitly from
EmbeddedTuiBackend.start(), which only runs when an in-process agent
runtime actually needs the cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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