Skip to content

perf: reduce runtime metadata hotpath churn#86659

Merged
steipete merged 2 commits into
mainfrom
perf/runtime-metadata-hotpaths
May 25, 2026
Merged

perf: reduce runtime metadata hotpath churn#86659
steipete merged 2 commits into
mainfrom
perf/runtime-metadata-hotpaths

Conversation

@steipete

@steipete steipete commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make loaded plugin metadata snapshots immutable and return the same frozen snapshot from the process memo instead of cloning on cache hits.
  • Reduce installed plugin package path churn by reusing persisted package file signatures where available while preserving realpath containment for package metadata hydration.
  • Add an identity cache for normalized Jiti alias maps and delay Discord realtime speaker-turn queue/log work until the first audio frame using deferred turn-context retention.

Verification

  • node scripts/run-vitest.mjs src/talk/turn-context-tracker.test.ts src/plugins/plugin-metadata-snapshot.memo.test.ts src/plugins/manifest-registry-installed.test.ts src/plugins/sdk-alias.test.ts src/plugins/installed-plugin-index-records.test.ts
  • node scripts/run-vitest.mjs src/plugins/plugin-metadata-snapshot.memo.test.ts
  • pnpm test extensions/discord/src/voice/manager.e2e.test.ts --testNamePattern "keeps realtime playback alive|interrupts realtime playback|does not interrupt realtime provider state"
  • pnpm lint --threads=8
  • pnpm exec oxfmt --check src/plugins/plugin-metadata-snapshot.ts src/plugins/plugin-metadata-snapshot.memo.test.ts src/plugins/manifest-registry-installed.ts src/plugins/installed-plugin-index-record-builder.ts src/plugins/sdk-alias.ts extensions/discord/src/voice/realtime.ts
  • pnpm tsgo:core
  • pnpm tsgo:extensions
  • pnpm build
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode commit --commit HEAD

Real behavior proof

Behavior addressed: CPU profile hotspots from repeated metadata snapshot cloning, repeated plugin path/signature work, Jiti alias normalization, and empty Discord realtime speaker turn churn.
Real environment tested: local OpenClaw checkout on macOS, Node/pnpm repo toolchain.
Exact steps or command run after this patch: focused Vitest plugin/talk tests, focused Discord realtime e2e tests, lint, oxfmt check, core and extension tsgo, full pnpm build, and autoreview.
Evidence after fix: focused plugin/talk tests passed 117 tests across 5 files plus metadata snapshot retest passed 27 tests; focused Discord realtime e2e passed 3 selected tests; lint, build, and type gates passed; autoreview reported no accepted/actionable findings.
Observed result after fix: metadata memo returns the same immutable snapshot without clone-on-hit, provided index inputs remain mutable for callers, symlink package metadata escape remains blocked, deferred turn tracking preserves audio-backed turns, and Discord realtime no-audio turns no longer enter the pending queue/log path.
What was not tested: live Discord voice traffic and a fresh CPU profile comparison after this exact patch.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: M maintainer Maintainer-authored PR labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: perf: reduce runtime metadata hotpath churn This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete steipete force-pushed the perf/runtime-metadata-hotpaths branch from 5cb9791 to e30ee7c Compare May 25, 2026 22:48
@steipete steipete merged commit 1d21224 into main May 25, 2026
99 checks passed
@steipete steipete deleted the perf/runtime-metadata-hotpaths branch May 25, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant