Skip to content

fix: prevent plugin metadata rescans from stalling Gateway - #125596

Merged
steipete merged 12 commits into
mainfrom
steipete/team-gateway-event-loop-stalls-f9eae0
Aug 18, 2026
Merged

steipete merged 12 commits into
mainfrom
steipete/team-gateway-event-loop-stalls-f9eae0

Conversation

@steipete

@steipete steipete commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Related: #125595

What Problem This Solves

Fixes chronic Gateway event-loop stalls caused by synchronous plugin metadata discovery on admitted agent turns. Under realistic plugin inventories, nested command, auth, model, skill, and tool preparation could reject the Gateway-owned metadata snapshot because the agent workspace or a derived runtime config differed, then rebuild and revalidate the full plugin graph on the Node main thread.

The production profile showed the consequence directly: repeated filesystem lstat/existsSync/manifest work, event-loop delays up to roughly 70 seconds, and downstream control RPC and native-hook timeouts.

Why This Change Was Made

Plugin execution is Gateway-lifecycle-owned, not agent-workspace-owned. This change makes that ownership explicit:

  • Gateway startup and hot reload select and publish one complete PluginMetadataSnapshot generation.
  • Prepared model and reply runtimes carry that exact generation into Gateway command admission, model selection, skill discovery, auth planning, embedded attempts, and plugin tool construction.
  • The immutable generation scope covers command preparation as well as execution. Nested config/workspace projections are run data and cannot reopen plugin discovery.
  • Prepared plugin tools consume their lifecycle-owned load context even when per-turn config or workspace objects differ.
  • Generic CLI/setup/runtime load contexts remain operation-local and no longer replace the process-current Gateway snapshot.
  • Direct standalone CLI/dev entrypoints retain their explicit cold-resolution path.

No public Plugin SDK, protocol, config, environment-variable, or storage contract changes.

User Impact

Gateway turns no longer synchronously rescan the plugin inventory after startup. Control traffic stays responsive during concurrent tool-enabled runs, and downstream hook relays are no longer starved behind tens of seconds of plugin filesystem work.

Evidence

Reproduction before the complete repair

Isolated built Gateway, eight concurrent tool-enabled turns, 100 config-path plugins, and eight distinct session workspaces:

  • 140 post-warmup metadata scans
  • 61.5 seconds of synchronous metadata scan time
  • benchmark timed out with an approximately 70-second liveness delay

An intermediate explicit-carrier build proved the remaining ownership gap rather than masking it: 96 scans / 41.6 seconds, with repeated multi-second readyz and sessions.list delays.

Final strict Gateway benchmark

Command:

node --import tsx scripts/bench-gateway-concurrency.ts --entry dist/entry.js --concurrency 8 --plugin-count 100 --workspace-fanout --tool-events --runs 1 --warmup 0 --cadence-ms 50 --timeout-ms 180000 --max-control-ms 500 --max-handshake-ms 1000 --output .artifacts/pr125596-gateway-concurrency-final.json

Result:

  • all 8 turns completed in 5.50 seconds
  • pluginMetadataScanCount: 0
  • pluginMetadataScanTotalDurationMs: 0
  • readyz max: 438.4 ms; no failed samples
  • sessions.list max: 438.2 ms; no failed samples
  • Control UI max: 660.6 ms; no failed samples
  • fresh Gateway handshake: 157.0 ms
  • event-loop delay p99 max: 411.8 ms

Source and test validation

  • Owner/runtime focused suites: 133 tests passed.
  • Agent command and embedded-runtime focused suites: 245 tests passed.
  • CLI attempt execution regression suite: 116 tests passed.
  • Explicit skill-command and workspace-skill suites: 163 tests passed.
  • The exact Gateway shard that previously timed out twice now passes all 418 tests locally.
  • node scripts/check-changed.mjs passed, including core/test typechecks, lint, import cycles, plugin boundaries, and ratchets.
  • pnpm build passed with no ineffective dynamic-import failure.
  • Fresh structured autoreview reported no actionable findings.

pnpm test:changed target discovery was stopped after remaining idle for more than 40 minutes without starting Vitest; exact-head CI remains required before merge.

Production LOC across the PR: +393/-336 (net +57). The retained growth is the private lifecycle-generation carrier, explicit skill-command propagation, and authority boundary; obsolete compatibility/revalidation paths were deleted. Tests: +476/-313.

The operator Gateway has not yet been changed. After merge, the exact landed build will be deployed to the authorized team Gateway and soaked against the production liveness, control-RPC, session-history, and native-hook measurements tracked in #125595.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 18, 2026 04:41
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 18, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 12:43 PM ET / 16:43 UTC.

ClawSweeper review

What this changes

The PR carries the Gateway’s startup-selected plugin metadata generation through agent, model, tool, and skill preparation so admitted turns do not synchronously rediscover plugins.

Regression provenance

Possible regression — probable (reproduction; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking patch defect found. This remains a P1 maintainer PR because it replaces Gateway hot-path metadata discovery with a lifecycle-owned generation; wait for exact-head CI before merging.

Priority: P1
Reviewed head: 47449a7be16e08114b46b967776f8b73f2965b68

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong after-fix runtime evidence and owner-boundary coverage support the repair; exact-head CI remains the merge gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides after-fix built-Gateway benchmark output showing zero metadata scans and responsive control-plane samples under concurrent plugin-heavy turns.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-fix built-Gateway benchmark output showing zero metadata scans and responsive control-plane samples under concurrent plugin-heavy turns.
Evidence reviewed 7 items Current-main failure boundary: Current main lets an operation-local plugin runtime load publish its metadata as the process-current snapshot, which is the source-level displacement described by the linked issue.
Producer-side repair: The PR retains operation-local metadata in the returned load context without publishing it globally, while Gateway startup passes its metadata into prepared runtime publication.
Admission propagation: Gateway agent execution loads the configured agent’s published runtime, rejects an absent generation visibly, and passes its config and generation into command dispatch.
Findings None None.
Security None None.

Live Verification

Command: node --import tsx scripts/bench-gateway-concurrency.ts --entry dist/entry.js --concurrency 8 --plugin-count 100 --workspace-fanout --tool-events --runs 1 --warmup 0 --cadence-ms 50 --timeout-ms 180000 --max-control-ms 500 --max-handshake-ms 1000 --output /tmp/pr125596-gateway-concurrency.json

Result: FAIL (partial) — step 4 expect_output pluginMetadataScanCount: 0: expected terminal output was not visible within 30 seconds: "pluginMetadataScanCount: 0"

node --import tsx scripts/bench-gateway-concurrency.ts --entry dist/entry.js --concurrency 8 --plugin-count 100 --workspace-fanout --tool-events --runs 1 --warm
up 0 --cadence-ms 50 --timeout-ms 180000 --max-control-ms 500 --max-handshake-ms 1000 --output /tmp/pr125596-gateway-concurrency.json
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-125596-1kReW1/target$ node --import tsx scripts/bench-gateway-concurrency.ts --entry dist/entry.js --concurrenc
y 8 --plugin-count 100 --workspace-fanout --tool-events --runs 1 --warmup 0 --cadence-ms 50 --timeout-ms 180000 --max-control-ms 500 --max-handshake-ms 1000 --o
utput /tmp/pr125596-gateway-concurrency.json
Error: gateway did not become ready
node:internal/modules/cjs/loader:1520
  throw err;
  ^

Error: Cannot find module '/tmp/clawsweeper-live-proof-125596-1kReW1/target/dist/entry.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1517:15)
    at wrapResolveFilename (node:internal/modules/cjs/loader:1071:27)
    at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1095:10)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1122:12)
    at Module._load (node:internal/modules/cjs/loader:1294:5)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v24.19.0

gateway stderr tail:
node:internal/modules/cjs/loader:1520
  throw err;
  ^

Error: Cannot find module '/tmp/clawsweeper-live-proof-125596-1kReW1/target/dist/entry.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1517:15)
    at wrapResolveFilename (node:internal/modules/cjs/loader:1071:27)
    at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1095:10)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1122:12)
    at Module._load (node:internal/modules/cjs/loader:1294:5)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v24.19.0
gateway output tail:
node:internal/modules/cjs/loader:1520
  throw err;
  ^

Error: Cannot find module '/tmp/clawsweeper-live-proof-125596-1kReW1/target/dist/entry.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1517:15)
    at wrapResolveFilename (node:internal/modules/cjs/loader:1071:27)
    at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1095:10)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1122:12)
    at Module._load (node:internal/modules/cjs/loader:1294:5)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v24.19.0

mock provider output tail:
mock-openai listening on 41857

    at runGatewaySample (/tmp/clawsweeper-live-proof-125596-1kReW1/target/scripts/bench-gateway-concurrency.ts:958:11)
    at async runBenchmarkSamples (/tmp/clawsweeper-live-proof-125596-1kReW1/target/scripts/bench-gateway-concurrency.ts:1033:17)
    at async main (/tmp/clawsweeper-live-proof-125596-1kReW1/target/scripts/bench-gateway-concurrency.ts:1055:16)
[bench-gateway-concurrency] FAILED (exit 1)
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-125596-1kReW1/target$ pnpm build
$ node --import tsx scripts/build-all.mts
[build-all] plugins:assets:build
node --import tsx scripts/bench-gateway-concurrency.ts --entry dist/entry.js --concurrency 8 --plugin-count 100 --workspace-fanout --tool-events --runs 1 --warm
up 0 --cadence-ms 50 --timeout-ms 180000 --max-control-ms 500 --max-handshake-ms 1000 --output /tmp/pr125596-gateway-con
… output truncated …

Assertions:

  • FAIL expect_output: pluginMetadataScanCount: 0

How this fits together

Gateway startup and reload publish plugin metadata alongside prepared model runtimes. Admitted agent turns consume that generation while preparing commands, skills, tools, and embedded execution, then return results through the Gateway.

flowchart LR
  A[Gateway startup or reload] --> B[Plugin metadata generation]
  B --> C[Prepared model runtime]
  C --> D[Admitted agent turn]
  D --> E[Commands tools and skills]
  E --> F[Gateway response]
Loading

Before merge

  • Resolve merge risk (P1) - The repair changes a possible long synchronous stall into a visible unavailable error when the configured runtime has not been published; exact-head startup, reload, and agent-dispatch checks must be green before merge.
  • Resolve merge risk (P1) - Production code is net +57 lines; the inspected private lifecycle carrier and explicit propagation justify the growth, but it remains an availability-sensitive repair surface.
  • Complete next step (P2) - No discrete repair finding remains; wait for exact-head CI and normal maintainer availability review.
Agent review details

Security

None.

PR surface

Source +66, Tests +166, Other -1. Total +231 across 74 files.

View PR surface stats
Area Files Added Removed Net
Source 52 403 337 +66
Tests 21 484 318 +166
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 74 887 656 +231

Review metrics

Metric Value Why it matters
Production versus test delta production +393/-336 (net +57); tests +476/-313; test-support/baseline +18/-7 The added production surface is the private lifecycle-generation carrier and propagation path; the test majority covers its owner boundaries.

Stored data model

Persistent data-model change detected: serialized state: src/agents/command/session-preparation.ts, serialized state: src/skills/runtime/session-snapshot.ts, unknown-data-model-change: src/plugins/current-plugin-metadata-snapshot.test.ts, vector/embedding metadata: src/agents/agent-project-settings-snapshot.ts, vector/embedding metadata: src/agents/agent-project-settings.bundle.test.ts, vector/embedding metadata: src/agents/command/model-selection.ts, and 33 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125595
Summary: This PR is the concrete candidate repair for the Gateway plugin-metadata rescan stall.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Wait for exact-head Gateway checks (recommended)
    Merge after the required checks for 47449a7 pass, confirming startup, hot reload, and admitted dispatch retain the published generation.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require all required checks on the current head to pass before merge.

Technical review

Best possible solution:

Keep one Gateway-owned metadata generation, use it through every admitted path, and merge only after exact-head checks confirm reload and dispatch never reopen cold discovery.

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

Yes—current main shows operation-local metadata publishing into the process-current slot, and the PR supplies a concrete built-Gateway concurrency benchmark; this review did not re-execute it.

Is this the best way to solve the issue?

Yes—the patch repairs the lifecycle owner and carries its prepared fact through consumers, rather than adding hot-path compatibility checks or a cold fallback.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The fix addresses Gateway stalls that can delay agent turns and control RPCs for tens of seconds.
  • merge-risk: 🚨 availability: A bad lifecycle handoff could make Gateway admission or reload fail instead of serving requests.
  • 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 (terminal): The PR body provides after-fix built-Gateway benchmark output showing zero metadata scans and responsive control-plane samples under concurrent plugin-heavy turns.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix built-Gateway benchmark output showing zero metadata scans and responsive control-plane samples under concurrent plugin-heavy turns.

Evidence

What I checked:

Likely related people:

  • steipete: Available blame attributes the current-main publishing behavior to this contributor, who also authored the complete repair series. (role: recent area contributor; confidence: high; commits: 7f0a87de1d1f, 47449a7be16e; files: src/plugins/runtime/load-context.ts, src/gateway/agent-turn/agent-run-execution-phase.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 (8 earlier review cycles)
  • reviewed 2026-08-18T04:47:21.302Z sha 7a4d555 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T11:34:28.660Z sha 9eedae63bc5e7565f41a352e9c8da5b61232255c :: found issues before merge. :: [P1] Keep slash-command skill discovery on the prepared generation
  • reviewed 2026-08-18T11:58:41.928Z sha af737ff2faec3649092d223f8f44edaa8a28cef2 :: needs changes before merge. :: [P1] Thread lifecycle metadata into skill-command discovery
  • reviewed 2026-08-18T12:23:14.810Z sha 5ca3fbb :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T12:47:24.333Z sha a7f97ae :: found issues before merge. :: [P1] Pass the generation into explicit skill-command discovery
  • reviewed 2026-08-18T13:07:13.806Z sha 4ceb6e0 :: needs changes before merge. :: [P1] Thread lifecycle metadata through all skill discovery
  • reviewed 2026-08-18T14:53:18.435Z sha 060fbb2dd57945b1a2331c6484a2a620b3e0c704 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T15:28:11.590Z sha e309eaa626a0a9e573bb20c1e7a5754e4bbd1e48 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL and removed size: S labels Aug 18, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Aug 18, 2026
@steipete
steipete force-pushed the steipete/team-gateway-event-loop-stalls-f9eae0 branch 2 times, most recently from af737ff to 756c15f Compare August 18, 2026 12:07
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 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 exact_review_queue).
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: 🐚 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for b9c5827652caec420edd2e7607229738603672ac:

  • Strict built-Gateway benchmark: 8/8 tool-enabled turns with 100 config-path plugins and workspace fanout; 3.16s total, pluginMetadataScanCount=0, readyz max 323.6ms, sessions.list max 323.3ms, fresh handshake 115.1ms.
  • Focused owner/agent/skill coverage passed (214 tests).
  • Exact previously timing-out Gateway shard passed all 418 tests.
  • Direct agent-method harness passed all 283 tests.
  • Final chat/session shard passed all 349 tests.
  • QA descendant cleanup regression passed 5 consecutive runs (8 tests each).
  • node scripts/check-changed.mjs passed, including core, core-test, extension-test typechecks, lint, plugin boundaries, import cycles, and ratchets.
  • pnpm build passed.
  • Fresh structured autoreview reported no actionable findings after every final repair.
  • Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/32165654135 is green: 192 passing checks, 0 failing, 0 pending.
  • Latest ClawSweeper source review found no actionable patch defect and rated the repair diamond-lobster; commits after its reviewed production head are test-fixture/flaky-test fixes only.

Known local proof gap: pnpm test:changed target discovery wedged before starting Vitest and was stopped after more than 40 minutes; focused suites and exact-head CI cover the final head.

The operator Gateway has not been changed yet. The authorized production deployment and soak follow merge; this comment does not claim live production proof.

@steipete
steipete merged commit fd216cb into main Aug 18, 2026
229 checks passed
@steipete
steipete deleted the steipete/team-gateway-event-loop-stalls-f9eae0 branch August 18, 2026 17:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
…125596)

* fix(plugins): preserve gateway metadata ownership

Generic runtime contexts no longer displace the Gateway lifecycle snapshot, preventing repeated synchronous plugin inventory validation on session hot paths.

* fix(gateway): reuse lifecycle plugin generation for turns

* test(agents): align static runtime lifecycle expectations

* test(gateway): refresh minimal runtime fixtures

* test(runtime): pass lifecycle metadata explicitly

* fix(skills): reuse gateway metadata for commands

* test(gateway): prepare reply runtime for agent RPCs

* style(agents): format rebased runtime preparation

* test(gateway): prepare runtime for direct agent RPCs

* test(gateway): provide direct agent runtime fixture

* test(gateway): prepare chat send reply runtime

* test(qa): await descendant process exit
steipete added a commit that referenced this pull request Aug 27, 2026
…untime registry (#130167)

First hook/cron isolated-run dispatch in a gateway process cold-loaded every
discovered plugin (~70 bundled providers) because the registry loader's
startup-scope fallback chain came up empty on that path and dropped
onlyPluginIds entirely. In dev checkouts each provider plugin loads from
TypeScript source through jiti's synchronous babel transform: a CPU profile of
a live 13-message gmail hook burst showed one contiguous 42.6s event-loop
block (36.2s extension module loading; amazon-bedrock 16.8s, opencode 13.1s),
the gateway HTTP server unresponsive for ~31s, and the fan-out handler's own
8s response deadline unable to fire - the livelock recorded in #130002.

The fallback chain now consults the process's active plugin registry before
giving up to full discovery: explicit base -> request-scope registry ->
metadata snapshot pluginIds -> active runtime plugin ids -> unrestricted.
resolveAgentRuntimePluginLoadPlan still adds the run's selected provider,
harness, memory, and context-engine owners on top, so any selected provider
outside the startup set keeps joining the immutable run generation. Hosts
with no active registry (pure library use) keep full discovery.

Live re-verification on the same rig: cold burst answered in 8.03s with the
designed 503 partial fan-out response, probe max latency 4.56s (was a 31.5s
outage), longest event-loop block 5.5s (was 42.6s), and only startup-registry
plugins load.

Follow-up of the gmail hook fan-out landing (#130002); same defect family as
the channel-path fix in #125596.
steipete added a commit that referenced this pull request Aug 27, 2026
…ated runs (#130581)

Hook dispatch and the cron scheduler rebuilt process-stable plugin metadata
on every isolated run: prepareCronRunContext reloaded a metadata snapshot
per run inside loadAgentRuntimePluginRegistryHandle (installed-plugin-index
safeHashFile ~2.2s, doctor contract artifact resolution ~1.8s, realpathSync
walks), and the embedded orchestrator rebuilt-and-froze another snapshot
plus a fresh prepared-runtime owner per run — ~5-6s aggregate synchronous
work across a 13-run gmail hook burst even after #130167 removed the cold
full-registry load.

The channel path already carries dispatchRuntime.pluginGeneration (#125596)
and the gateway agent RPC carries commandRuntimeContext.pluginGeneration.
This completes the same carry at the isolated-run owner:
prepareCronRunContext reuses the published model-catalog owner's
metadataSnapshot for the run registry handle, and runCronIsolatedAgentTurn
admits the published Gateway generation (static prepared-runtime lease +
withPreparedModelRuntimePluginGenerationScope with a borrow accessor,
mirroring runPreparedReply) so the embedded orchestrator reuses the
generation instead of rebuilding it. Standalone hosts and
startup/replacement races keep generation-free execution.

Live proof on an isolated dev gateway: plugins.metadata.scan timeline spans
stayed at the 22 startup scans across two full isolated cron runs (zero
per-run rebuilds); regression tests fail pre-fix.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…untime registry (openclaw#130167)

First hook/cron isolated-run dispatch in a gateway process cold-loaded every
discovered plugin (~70 bundled providers) because the registry loader's
startup-scope fallback chain came up empty on that path and dropped
onlyPluginIds entirely. In dev checkouts each provider plugin loads from
TypeScript source through jiti's synchronous babel transform: a CPU profile of
a live 13-message gmail hook burst showed one contiguous 42.6s event-loop
block (36.2s extension module loading; amazon-bedrock 16.8s, opencode 13.1s),
the gateway HTTP server unresponsive for ~31s, and the fan-out handler's own
8s response deadline unable to fire - the livelock recorded in openclaw#130002.

The fallback chain now consults the process's active plugin registry before
giving up to full discovery: explicit base -> request-scope registry ->
metadata snapshot pluginIds -> active runtime plugin ids -> unrestricted.
resolveAgentRuntimePluginLoadPlan still adds the run's selected provider,
harness, memory, and context-engine owners on top, so any selected provider
outside the startup set keeps joining the immutable run generation. Hosts
with no active registry (pure library use) keep full discovery.

Live re-verification on the same rig: cold burst answered in 8.03s with the
designed 503 partial fan-out response, probe max latency 4.56s (was a 31.5s
outage), longest event-loop block 5.5s (was 42.6s), and only startup-registry
plugins load.

Follow-up of the gmail hook fan-out landing (openclaw#130002); same defect family as
the channel-path fix in openclaw#125596.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…ated runs (openclaw#130581)

Hook dispatch and the cron scheduler rebuilt process-stable plugin metadata
on every isolated run: prepareCronRunContext reloaded a metadata snapshot
per run inside loadAgentRuntimePluginRegistryHandle (installed-plugin-index
safeHashFile ~2.2s, doctor contract artifact resolution ~1.8s, realpathSync
walks), and the embedded orchestrator rebuilt-and-froze another snapshot
plus a fresh prepared-runtime owner per run — ~5-6s aggregate synchronous
work across a 13-run gmail hook burst even after openclaw#130167 removed the cold
full-registry load.

The channel path already carries dispatchRuntime.pluginGeneration (openclaw#125596)
and the gateway agent RPC carries commandRuntimeContext.pluginGeneration.
This completes the same carry at the isolated-run owner:
prepareCronRunContext reuses the published model-catalog owner's
metadataSnapshot for the run registry handle, and runCronIsolatedAgentTurn
admits the published Gateway generation (static prepared-runtime lease +
withPreparedModelRuntimePluginGenerationScope with a borrow accessor,
mirroring runPreparedReply) so the embedded orchestrator reuses the
generation instead of rebuilding it. Standalone hosts and
startup/replacement races keep generation-free execution.

Live proof on an isolated dev gateway: plugins.metadata.scan timeline spans
stayed at the 22 startup scans across two full isolated cron runs (zero
per-run rebuilds); regression tests fail pre-fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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