Skip to content

fix(plugins): reuse gateway lifecycle metadata and isolate plugin state - #114476

Merged
steipete merged 8 commits into
mainfrom
codex/plugin-lifecycle-profile-cache
Jul 27, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/plugin-lifecycle-profile-cache

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The gateway repeatedly rediscovered installed plugins, rescanned native SDK aliases, rebuilt provider metadata, and reused a few plugin-derived values outside the gateway lifecycle that actually owns them. Agent-scoped registry activation could also incorrectly change gateway-owned RPC authorization, session actions, board grants, and handler dispatch.

Design and Compatibility

  • Keep one existing gateway-owned plugin metadata generation. Prepare discovery, provider ownership, and native resolver data once per compatible gateway lifecycle; retire derived process-local memos at the canonical plugin install, update, or reload boundary.
  • Cache manifests only for bundled and verified immutable Nix plugin roots. Mutable external roots, missing manifests, alternate workspaces, named profiles, configuration policies, and SDK parent roots remain fresh and isolated.
  • Pin gateway RPC dispatch, authorization, session actions, host hooks, and board capabilities to the gateway registry rather than the temporarily active agent registry.
  • Preserve first-wins channel registration and evaluate a failing native plugin exactly once without breaking supported ESM or missing-dependency fallback.
  • Keep the original safe recursive metadata freeze, cover hostile Map, Set, accessor, cycle, and Proxy graphs, and expose plugins.metadata.freeze as its own diagnostic span. Real V8 measurements rejected an additional deep-freeze cache, so this change deliberately keeps one lifecycle-owned metadata cache rather than introducing a second one.
  • All caches are bounded, process-local derived state. This change adds no database, schema, migration, persistence, configuration key, environment variable, public SDK contract, or CLI flag.

Same-Machine Gateway Performance

Baseline 08b1ff73e2f35ef02eb5530d700f017f44c974b4; PR 67bb8be275955addb1e65af8700215f11840d222. Both revisions were built and measured on the same 16-vCPU Linux Blacksmith Testbox with the pinned Node 24 and pnpm 11 toolchain. Each production dist/entry.js startup case used one warmup and the median of three measured runs.

Startup case Baseline /readyz Final /readyz Change
Default gateway 6072.3 ms 7045.5 ms +16.0%
Channels disabled 3074.9 ms 3043.2 ms -1.0%
50 eager plugins 8297.9 ms 8240.9 ms -0.7%
50 lazy plugins 9366.5 ms 8556.6 ms -8.6%

The default end-to-end readiness sample is 16.0% slower; this benchmark includes the separately deferred model-runtime sidecar, which alone takes about 3.8–4.3 seconds. This change therefore does not claim a universal cold-start speedup. The measurable wins are bounded plugin discovery, 8.6% faster 50-plugin lazy startup, 20.3% faster channel-disabled restart recovery, 5.6% faster 50-plugin restart recovery, and correct gateway-generation ownership.

Actual process restarts used the same production gateway, three restarts per case, and zero failed readiness probes.

Restart case Baseline /readyz recovery Final /readyz recovery Change
Channels disabled 1622.4 ms 1292.4 ms -20.3%
50 eager plugins 1707.4 ms 1611.3 ms -5.6%

The final revision was additionally verified with real V8 CPU profiles and pnpm dev --profile plugin-lifecycle-audit gateway run, including a successful live /readyz request.

Validation

  • 1,347 passing assertions across 39 focused plugin, gateway, provider, channel, SDK, contract, and CLI test files, including all 523 assertions in the complete 22-file non-isolated plugin shard.
  • Core test TypeScript check: node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo.
  • pnpm plugin-sdk:surface:check: all 142 public SDK entrypoints.
  • Full production pnpm build and private-QA gateway source-performance build.
  • Same-machine baseline and final startup, V8 CPU, RSS, actual restart, and named-profile development gateway proof.
  • Fresh independent whole-branch autoreview: no accepted or actionable findings.
  • GitHub Actions and the canonical maintainer preparation and merge gates.

AI

AI-assisted implementation and review. Findings were verified against complete owner modules, gateway entry points, callers, sibling implementations, upstream loader behavior, security boundaries, focused regression tests, and actual production gateway measurements.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 09:18
@steipete
steipete requested a review from a team as a code owner July 27, 2026 09:18
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 7:31 AM ET / 11:31 UTC.

ClawSweeper review

What this changes

This PR reuses stable plugin metadata and native resolver work during gateway startup, clears retained caches when plugin lifecycle state changes, and keeps gateway-owned routes, authorization, session actions, and dashboard capabilities isolated from agent-scoped registries.

Merge readiness

⛔ Blocked until real behavior proof is added - 6 items remain

Keep this PR open for human review. The patch has no concrete source-level blocker in the reviewed decision paths, but it changes process-wide plugin caching, lifecycle invalidation, gateway authorization, session actions, and provider metadata; the supplied body still lacks inspectable after-fix behavior proof, and the protected maintainer label requires explicit handling.

Priority: P2
Reviewed head: 67bb8be275955addb1e65af8700215f11840d222
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch has focused regression coverage and substantial successful CI signal, but its broad lifecycle change still lacks inspectable real behavior proof.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR describes live profiling, gateway restarts, and a named-profile readiness check, but the body and supplied comments contain no inspectable redacted terminal output, logs, profile artifact, linked result, screenshot, or recording showing the after-fix behavior. Add proof for the exact head and redact private paths, endpoints, IPs, and credentials; updating the PR body should trigger a fresh review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR describes live profiling, gateway restarts, and a named-profile readiness check, but the body and supplied comments contain no inspectable redacted terminal output, logs, profile artifact, linked result, screenshot, or recording showing the after-fix behavior. Add proof for the exact head and redact private paths, endpoints, IPs, and credentials; updating the PR body should trigger a fresh review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Gateway ownership boundary: The branch switches gateway method dispatch and scope resolution to gateway-pinned registries, rather than the mutable active registry, so agent-scoped plugin loads cannot replace attached gateway handlers or operator scopes.
Session and dashboard boundary: The branch uses the gateway-pinned session-extension registry for board bindings, board actions, UI descriptors, and session actions; focused tests cover replacing the active registry after the gateway registry is pinned.
Cache lifecycle design: The PR registers cache clearing with the plugin metadata lifecycle for provider-auth aliases, facade module locations, native resolver roots, managed catalog data, and tool descriptors, rather than adding a second global snapshot.
Findings None None.
Security None None.

How this fits together

Plugin discovery builds metadata and a runtime registry used by gateway request dispatch, provider selection, session actions, and dashboard capabilities. The gateway should retain its own attached plugin extensions while agent-scoped activation can temporarily replace the active registry for an agent run.

flowchart LR
  Config[Plugin configuration] --> Discovery[Manifest and install discovery]
  Discovery --> Metadata[Plugin metadata snapshot]
  Metadata --> Registry[Plugin runtime registry]
  Registry --> Gateway[Gateway routes and authorization]
  Agents[Agent-scoped activation] --> Active[Active agent registry]
  Gateway --> Pinned[Gateway-pinned extensions]
  Active --> Pinned
  Pinned --> Clients[Sessions, dashboard, providers]
Loading

Decision needed

Question Recommendation
After real install/reload proof is attached, should this broad plugin lifecycle cache and gateway-registry isolation change be accepted as the canonical runtime behavior? Review after runtime proof: Require redacted startup, reload, and readiness evidence for the exact head, then review the cache lifecycle and gateway-pinning design as one change.

Why: The protected maintainer label and cross-cutting compatibility surface require a human to confirm that the proposed lifecycle boundary is the intended long-term ownership model.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR describes live profiling, gateway restarts, and a named-profile readiness check, but the body and supplied comments contain no inspectable redacted terminal output, logs, profile artifact, linked result, screenshot, or recording showing the after-fix behavior. Add proof for the exact head and redact private paths, endpoints, IPs, and credentials; updating the PR body should trigger a fresh review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - A process-wide cache that is not invalidated on every real install, update, profile change, or hot reload can retain an obsolete manifest, provider alias, resolver root, or tool descriptor until restart.
  • Resolve merge risk (P1) - Gateway-pinned routing and session-extension registries intentionally prevent agent-scoped replacement; real proof should show that normal gateway authorization, dashboard actions, and session actions still follow the attached gateway after lifecycle reload.
  • Resolve merge risk (P1) - The PR body claims live startup and readiness measurements, but no inspectable redacted artifact currently proves the after-fix behavior on the submitted head.
  • Complete next step (P2) - A contributor-supplied real runtime artifact and explicit human review are required; this is not a safe automated repair task.
Agent review details

Security

None.

PR surface

Source +170, Tests +1844. Total +2014 across 36 files.

View PR surface stats
Area Files Added Removed Net
Source 16 353 183 +170
Tests 20 1906 62 +1844
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 36 2259 245 +2014

Review metrics

None.

Stored data model

Persistent data-model change detected: persistent cache schema: src/plugin-sdk/facade-runtime.test.ts, persistent cache schema: src/plugin-sdk/facade-runtime.ts, persistent cache schema: src/plugins/discovery.ts, persistent cache schema: src/plugins/plugin-module-loader-cache.test.ts, persistent cache schema: src/plugins/plugin-sdk-native-resolver.test.ts, persistent cache schema: src/plugins/plugin-sdk-native-resolver.ts, and 23 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Attach real lifecycle evidence (recommended)
    Before merge, attach redacted terminal output, logs, profiles, or a recording that shows the exact head completing startup, plugin reload or invalidation, and /readyz with a real plugin profile.
  2. Pause for a narrower split
    If the combined cache and gateway-ownership change cannot be demonstrated together, split the independently safe repair from the broader lifecycle redesign.

Technical review

Best possible solution:

Add redacted after-fix evidence from a real plugin install or reload plus a gateway readiness run that demonstrates cache reuse and correct invalidation, then complete human review of the gateway-pinning behavior against the exact head.

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

No high-confidence live reproduction is attached. The source-level regression cases are clear from the added tests: replace the active registry after pinning the gateway registry, or retire plugin metadata and confirm aliases, manifests, and resolver state refresh.

Is this the best way to solve the issue?

Unclear. Reusing the existing plugin metadata lifecycle is a plausible ownership boundary and the patch adds focused coverage, but the combined cache and gateway-isolation approach needs inspectable real runtime proof before it can be called the best fix.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a meaningful plugin and gateway correctness/performance change, but the supplied evidence does not establish an urgent user-facing regression.
  • merge-risk: 🚨 compatibility: The branch changes lifecycle-owned process caches and plugin discovery behavior that existing installations rely on during install, update, reload, and startup.
  • merge-risk: 🚨 session-state: Gateway-pinned session actions, control-UI descriptors, and dashboard capabilities must remain correctly associated when an agent-scoped registry becomes active.
  • merge-risk: 🚨 auth-provider: Provider static catalogs and provider-auth alias caching are reused across the plugin metadata lifecycle and can affect provider resolution after changes.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR describes live profiling, gateway restarts, and a named-profile readiness check, but the body and supplied comments contain no inspectable redacted terminal output, logs, profile artifact, linked result, screenshot, or recording showing the after-fix behavior. Add proof for the exact head and redact private paths, endpoints, IPs, and credentials; updating the PR body should trigger a fresh review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Gateway ownership boundary: The branch switches gateway method dispatch and scope resolution to gateway-pinned registries, rather than the mutable active registry, so agent-scoped plugin loads cannot replace attached gateway handlers or operator scopes. (src/gateway/server-methods.ts:898, 67bb8be27595)
  • Session and dashboard boundary: The branch uses the gateway-pinned session-extension registry for board bindings, board actions, UI descriptors, and session actions; focused tests cover replacing the active registry after the gateway registry is pinned. (src/gateway/board-host-tools.ts:79, 67bb8be27595)
  • Cache lifecycle design: The PR registers cache clearing with the plugin metadata lifecycle for provider-auth aliases, facade module locations, native resolver roots, managed catalog data, and tool descriptors, rather than adding a second global snapshot. (src/plugins/plugin-metadata-lifecycle.ts:1, 67bb8be27595)
  • Process-cache compatibility surface: Plugin discovery replaces package-manifest mtime polling with lifecycle-owned bounded caching, while the loader borrows current metadata only for compatible process-owned scope; this is the main compatibility-sensitive behavior to prove in a real install/reload flow. (src/plugins/discovery.ts:602, 67bb8be27595)
  • Proof and CI state: The PR body reports profiles, readiness checks, and 1,344 assertions, but no terminal output, redacted logs, profile artifact, recording, or linked live result is inspectable. The supplied check state shows many static and focused checks successful while part of the test matrix remains in progress. (67bb8be27595)
  • Review continuity: The prior completed ClawSweeper cycle at 172f17c reported no code findings and requested the same missing real-behavior proof; the current head adds test-isolation work but no supplied proof artifact. (172f17c0c6f4)

Likely related people:

  • steipete: Authored the eight commits in this PR, including the cache lifecycle, gateway isolation, and test-isolation changes; current-main provenance could not be established from the available read-only review data. (role: active plugin-lifecycle contributor; confidence: low; commits: 0f91496bfa82, 33cd9dc5e7d9, 4cf17effdee4; files: src/plugins/discovery.ts, src/plugins/plugin-metadata-snapshot.ts, src/gateway/server-methods.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted live startup, reload/invalidation, and /readyz evidence for the exact head.
  • Let the remaining CI matrix finish and retain the result with the proof artifact.

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 (5 earlier review cycles)
  • reviewed 2026-07-27T09:25:09.319Z sha 1e06412 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T10:19:42.640Z sha 33cd9dc :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T10:32:25.074Z sha 01087b1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T10:56:36.146Z sha da05511 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T11:19:33.325Z sha 172f17c :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 27, 2026
@steipete steipete changed the title fix(plugins): speed up gateway startup and prevent stale plugin state fix(plugins): reuse gateway lifecycle metadata and isolate plugin state Jul 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head plugin lifecycle proof for 67bb8be275955addb1e65af8700215f11840d222.

Reproducible same-machine production gateway measurement

Both revisions ran on the same fresh 16-vCPU Linux Blacksmith Testbox, using Node v24.18.0, the repository-pinned pnpm 11.15.1, the unchanged dependency lockfile, the real production dist/entry.js, an identical benchmark fixture, one warmup, and three measured startup samples. The pre-change baseline is 08b1ff73e2f35ef02eb5530d700f017f44c974b4.

OPENCLAW_BUILD_PRIVATE_QA=1 node scripts/build-all.mjs sourcePerformance
node --import tsx scripts/bench-gateway-startup.ts \
  --case default --case skipChannels \
  --case fiftyPlugins --case fiftyStartupLazyPlugins \
  --runs 3 --warmup 1 --timeout-ms 45000
node --import tsx scripts/bench-gateway-startup.ts \
  --case fiftyPlugins --case fiftyStartupLazyPlugins \
  --runs 1 --warmup 0 --timeout-ms 45000 \
  --cpu-prof-dir /tmp/openclaw-plugin-lifecycle-cpu
node --import tsx scripts/bench-gateway-restart.ts \
  --case skipChannels --case fiftyPlugins \
  --runs 1 --warmup 0 --restarts 3 \
  --timeout-ms 45000 --post-ready-delay-ms 250
pnpm dev --profile plugin-lifecycle-audit gateway run \
  --port '<ephemeral>' --bind loopback --auth none \
  --tailscale off --allow-unconfigured

Median production startup:

Startup case Baseline /readyz Final /readyz Change
Default gateway 6072.3 ms 7045.5 ms +16.0%
Channels disabled 3074.9 ms 3043.2 ms -1.0%
50 eager plugins 8297.9 ms 8240.9 ms -0.7%
50 lazy plugins 9366.5 ms 8556.6 ms -8.6%

The default end-to-end readiness sample is 16.0% slower; this benchmark includes the separately deferred model-runtime sidecar, which alone takes about 3.8–4.3 seconds. This change therefore does not claim a universal cold-start speedup. The measurable wins are bounded plugin discovery, 8.6% faster 50-plugin lazy startup, 20.3% faster channel-disabled restart recovery, 5.6% faster 50-plugin restart recovery, and correct gateway-generation ownership.

Actual three-restart recovery:

Restart case Baseline /readyz recovery Final /readyz recovery Change
Channels disabled 1622.4 ms 1292.4 ms -20.3%
50 eager plugins 1707.4 ms 1611.3 ms -5.6%

Live named development gateway:

Named dev gateway ready: profile=plugin-lifecycle-audit port=<ephemeral>
GET /readyz -> 200

Lifecycle and security proof

  • src/plugins/discovery.test.ts: bundle/Nix immutable-root caching, mutable external plugin freshness, negative/missing manifests, and exact lifecycle invalidation.
  • src/plugins/loader.runtime-registry.test.ts and src/plugin-sdk/facade-runtime.test.ts: persisted install records, process environment versus custom named profiles, workspaces, missing artifacts, and metadata generation isolation.
  • src/plugins/plugin-sdk-native-resolver.test.ts: one alias preparation per verified canonical host root without sharing plugin parents or bypassing SDK boundaries.
  • src/plugins/plugin-module-loader-cache.test.ts: a real compiled plugin's top-level side effect and native failure occur exactly once; supported ESM and missing-dependency fallback stay intact.
  • src/plugins/plugin-metadata-snapshot.test.ts: fresh snapshot ownership, reload invalidation, cyclic values, Map/Set mutation, closure-backed accessors, forged Proxy descriptors, and non-isolated Vitest module loading.
  • src/plugins/management-service.lifecycle-cache.test.ts: hosted catalog retirement uses a partial metadata mock; the non-isolated plugin worker retains correct provider-discovery and lookup-table mock ownership across all 22 plugin files.
  • src/plugins/management-service.lifecycle-cache.test.ts, src/gateway/server-reload-handlers.test.ts, and src/gateway/config-reload.test.ts: installation, update, atomic generation replacement, process-cache retirement, and gateway reload.
  • src/channels/plugins/registry.test.ts: first-wins channel registration and matching ownership provenance.
  • src/gateway/server-methods.plugin-gateway-dispatch.test.ts, src/gateway/method-scopes.test.ts, src/plugins/contracts/session-actions.contract.test.ts, and src/gateway/server-methods/board.plugin-capabilities.test.ts: agent-scoped registry replacement cannot shadow gateway RPC handlers, authorization scopes, session actions, or dashboard grants.

Exact-head gates

Focused regression suite: 1,347 assertions, 39 test files, pass
Core test TypeScript: pass
Plugin SDK public surfaces: 142/142, pass
Production build: pass
Private-QA source-performance build: pass
Real V8 gateway CPU profiling: pass
Production gateway restart proof: 3 restarts per case; 0 readiness failures
Named-profile development gateway /readyz: pass
Fresh complete-branch independent autoreview: no actionable findings

All metadata, resolver, provider, and descriptor caches here are bounded process memory owned by the existing plugin lifecycle. There are no persistent cache files, new SQLite tables, schema-version changes, migrations, new configuration surfaces, or environment variables.

@steipete
steipete merged commit 3fb201c into main Jul 27, 2026
124 checks passed
@steipete
steipete deleted the codex/plugin-lifecycle-profile-cache branch July 27, 2026 11:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 28, 2026
…te (openclaw#114476)

* fix(plugins): reuse gateway metadata and preserve reload isolation

* test(plugins): split lifecycle regressions and simplify gateway dispatch

* perf(plugins): reuse proven immutable snapshot graphs

* test(plugins): isolate snapshot lifecycle regression mocks

* perf(plugins): retain one gateway metadata cache

* test(plugins): preserve frozen proxy descriptor invariants

* test(plugins): isolate lifecycle metadata mock ownership

* test(plugins): bind shared worker mocks before module evaluation
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (#102494/#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (#84381): malformed injection was not human
  SIGTERM report #71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (#88159, superseded by #168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 7dccff5.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature #95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit 65f18d6 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…#173036)

* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (openclaw#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (openclaw#84381): malformed injection was not human
  SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (openclaw#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (openclaw#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 89f8219.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit ca10460 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant