openclaw - 💡(How to fix) Fix Gateway memory pressure from unbounded bootstrap-cache retention

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…

The bootstrap-cache was retaining loaded workspace bootstrap bundles per session key without a practical cap. That made it a separate memory-retention issue from the session-store hydration problem.

The fix is to keep the cache bounded and evict older session keys instead of letting the gateway accumulate bootstrap snapshots forever.

Scope note: this issue write-up is limited to the bootstrap-cache updates in this branch. It explicitly excludes the separate session-store patch and the separate webgate patch from the other branch.

Root Cause

The core bug is an unbounded per-session bootstrap-cache in the runtime loader path.

Fix Action

Fix / Workaround

Scope note: this issue write-up is limited to the bootstrap-cache updates in this branch. It explicitly excludes the separate session-store patch and the separate webgate patch from the other branch.

The session-store patch is a separate submission track and should not be bundled into this issue.

RAW_BUFFERClick to expand / collapse

Gateway memory pressure from unbounded bootstrap-cache retention

Summary

The bootstrap-cache was retaining loaded workspace bootstrap bundles per session key without a practical cap. That made it a separate memory-retention issue from the session-store hydration problem.

The fix is to keep the cache bounded and evict older session keys instead of letting the gateway accumulate bootstrap snapshots forever.

Scope note: this issue write-up is limited to the bootstrap-cache updates in this branch. It explicitly excludes the separate session-store patch and the separate webgate patch from the other branch.

Evidence

  • The bootstrap loader caches loaded workspace bootstrap bundles by session key.
  • Without a cap, distinct session keys can accumulate resident cached bundles over time.
  • The issue is independent from the session-store cache retention problem.

Root Cause

The core bug is an unbounded per-session bootstrap-cache in the runtime loader path.

Fix Direction

  1. Cap the cache at a small bounded size.
  2. Evict oldest entries instead of retaining one bundle per session key forever.
  3. Keep active keys hot by refreshing on access.
  4. Add regression coverage that proves the cache stays bounded under churn.

Files Changed

  • /root/.openclaw/openclaw-fork-rebase/src/agents/bootstrap-cache.ts
  • /root/.openclaw/openclaw-fork-rebase/src/agents/bootstrap-cache.test.ts

Verification Notes

Runtime proof showed:

  • the cache starts empty
  • after 65 unique session keys, the cache stays capped at 64
  • the oldest key is evicted
  • reloading an evicted key reuses the cache without growing past the cap

The session-store patch is a separate submission track and should not be bundled into this issue.

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…

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 Gateway memory pressure from unbounded bootstrap-cache retention