openclaw - 💡(How to fix) Fix [Bug]: Subagent registry hot reads clone the persisted run map [5 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Subagent registry hot reads clone the full persisted run map on cache hits, adding CPU and GC pressure to gateway hot paths.

Root Cause

Subagent registry hot reads clone the full persisted run map on cache hits, adding CPU and GC pressure to gateway hot paths.

Fix Action

Fixed

Code Example

Representative profile chain: structuredClone -> cloneSubagentRunRecord -> cloneSubagentRunMap -> loadSubagentRegistryFromDisk -> getSubagentRunsSnapshotForRead. Current source evidence pointed at src/agents/subagent-registry-state.ts and src/agents/subagent-registry.store.ts read paths.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Subagent registry hot reads clone the full persisted run map on cache hits, adding CPU and GC pressure to gateway hot paths.

Steps to reproduce

  1. Run a long-lived OpenClaw gateway workload with active session, subagent, and plugin metadata traffic.
  2. Capture a CPU profile and diagnostics timeline.
  3. Inspect the profile/timeline for the call chain described in the evidence below.

Expected behavior

Hot read-only registry paths should reuse the cached immutable registry view and avoid cloning the whole persisted run map unless an isolated mutable copy is required.

Actual behavior

Profile evidence shows subagent registry read chains spending time in structuredClone via cloneSubagentRunMap under loadSubagentRegistryFromDisk and getSubagentRunsSnapshotForRead.

OpenClaw version

Current main source checkout before the linked fix branch; exact release build is NOT_ENOUGH_INFO.

Operating system

NOT_ENOUGH_INFO

Install method

Source checkout / development workflow.

Model

NOT_ENOUGH_INFO

Provider / routing chain

NOT_ENOUGH_INFO

Additional provider/model setup details

Not model-specific; this is a gateway/session/plugin hot-path performance issue.

Logs, screenshots, and evidence

Representative profile chain: structuredClone -> cloneSubagentRunRecord -> cloneSubagentRunMap -> loadSubagentRegistryFromDisk -> getSubagentRunsSnapshotForRead. Current source evidence pointed at src/agents/subagent-registry-state.ts and src/agents/subagent-registry.store.ts read paths.

Impact and severity

Affected: long-running gateway and subagent workloads. Severity: Medium-High. Frequency: repeated hot reads in the captured profile. Consequence: avoidable CPU and GC work on registry lookups.

Additional information

Public issue extracted from local redacted performance evidence under /mnt/c/OpenClaw/bugs/BUG-039-subagent-registry-read-path-clones-the-full-persisted-run-map-on-hot-reads. Private session labels, transcript paths, setup names, and raw local paths were not included.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Hot read-only registry paths should reuse the cached immutable registry view and avoid cloning the whole persisted run map unless an isolated mutable copy is required.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Subagent registry hot reads clone the persisted run map [5 pull requests]