Skip to content

fix(memory): keep gateway responsive after startup - #119710

Merged
vincentkoc merged 1 commit into
mainfrom
fix/memory-warmup-responsiveness-20260805
Aug 5, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/memory-warmup-responsiveness-20260805

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Related: #119087

Follow-up to #119676.

What Problem This Solves

Fixes an issue where operators could see multi-second health, first-device, and config.get RPC stalls after the Gateway reported ready because memory-core started unsolicited index initialization five seconds later.

Why This Change Was Made

The prior delay moved the contention window but did not remove it. This change deletes the startup memory-manager warmup and keeps initialization demand-driven at the memory owner boundary.

Builtin memory search already performs a synchronous bootstrap when its index is empty and always schedules dirty refresh on search. QMD keeps its existing backend-owned boot policy. No memory configuration, storage, or search contract changes.

Repair summary:

  • root cause: the post-ready startup hook loaded and synchronized every configured builtin memory manager without a memory operation
  • architectural owner: memory-core manager lifecycle
  • canonical fix: initialize the manager only when a memory operation requests it
  • removed paths: startup timer, lifecycle generation guards, warmup sync, and their obsolete tests
  • production delta: -72 lines
  • sibling coverage: builtin first-search bootstrap and QMD boot policy remain unchanged

This PR was prepared with AI assistance. I reviewed the code, owner contracts, and runtime evidence.

User Impact

The Gateway remains responsive after readiness instead of pausing later for background memory initialization. The first real memory search owns any required index bootstrap through the existing search contract.

Evidence

Matched packaged sourcePerformance probe, exact latest main e69c3df2361b38285917c29b0c90867c75b8ebe9 versus this branch, five measured samples plus one warmup per case:

RPC latest main p50 / max candidate p50 / max
connected health --json 3,110 / 9,208 ms 801 / 847 ms
fresh-device health --json 1,499 / 3,077 ms 767 / 823 ms
config get gateway.port 5,249 / 6,769 ms 1,113 / 1,638 ms

Punchcard-Session: coral-workshop-workshop-3f

Punchcard-Session: coral-workshop-workshop-3f
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: M maintainer Maintainer-authored PR labels Aug 5, 2026
@vincentkoc vincentkoc self-assigned this Aug 5, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 5, 2026 18:48
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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 repository_dispatch).
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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 3:32 PM ET / 19:32 UTC.

ClawSweeper review

What this changes

The PR removes delayed memory-manager warmup after Gateway startup so managers initialize only when a memory operation needs them.

Regression provenance

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

Merge readiness

✅ Ready for maintainer review

No blocking finding: this is a focused owner-boundary repair for post-ready Gateway stalls, and the protected member-authored PR should remain open for normal maintainer landing review.

Priority: P1
Reviewed head: f2b7a98d690886adf3bef57eccc95d73f07cea6f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative repair with source-confirmed owner boundaries and detailed packaged-performance evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides exact-head packaged post-ready RPC measurements.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides exact-head packaged post-ready RPC measurements.
Evidence reviewed 6 items Post-ready work is owner-local: Current main schedules a five-second gateway-start timer that enumerates agents, creates their memory managers, and synchronizes builtin managers without a memory request.
Patch removes the sole warmup path: The PR deletes the timer, lifecycle cancellation, all-agent manager acquisition, builtin startup sync, and its registration while retaining lazy runtime capability registration.
Builtin first search remains safe: An empty builtin index synchronously bootstraps during search, then schedules dirty refresh from the search owner; the tool path acquires the manager only when the memory tool runs.
Findings None None.
Security None None.

How this fits together

The memory-core plugin supplies Gateway memory tools and backend managers. Its old startup hook created and synchronized managers after readiness, competing with Gateway health and configuration RPCs; searches already own first-use initialization.

flowchart LR
  A[Gateway starts] --> B[Memory-core lifecycle]
  B --> C{Memory operation requested?}
  C -->|No| D[Gateway RPCs remain responsive]
  C -->|Yes| E[Memory manager resolves]
  E --> F[Backend bootstrap and search]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -72, Tests -223. Total -295 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 72 -72
Tests 2 4 227 -223
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 4 299 -295

Review metrics

Metric Value Why it matters
Production versus test LOC production -72; tests +4/-227 The patch deletes the timing workaround and its obsolete lifecycle coverage rather than adding another startup path.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-core/index.test.ts, unknown-data-model-change: extensions/memory-core/index.ts, vector/embedding metadata: extensions/memory-core/index.test.ts, vector/embedding metadata: extensions/memory-core/index.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one demand-driven manager lifecycle: Gateway startup should not initialize memory indexes, while each backend retains its documented first-use bootstrap behavior.

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

Yes: current main's five-second Gateway-start hook creates and synchronizes every configured builtin manager, while the supplied packaged probe exercises the same post-ready RPC window.

Is this the best way to solve the issue?

Yes: removing unsolicited work at the memory lifecycle owner is better than further delaying it, because builtin and QMD already have demand-driven initialization contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The repaired path can stall or time out health and configuration RPCs after Gateway readiness.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides exact-head packaged post-ready RPC measurements.

Label justifications:

  • P1: The repaired path can stall or time out health and configuration RPCs after Gateway readiness.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides exact-head packaged post-ready RPC measurements.

Evidence

What I checked:

  • Post-ready work is owner-local: Current main schedules a five-second gateway-start timer that enumerates agents, creates their memory managers, and synchronizes builtin managers without a memory request. (extensions/memory-core/index.ts:280, e69c3df2361b)
  • Patch removes the sole warmup path: The PR deletes the timer, lifecycle cancellation, all-agent manager acquisition, builtin startup sync, and its registration while retaining lazy runtime capability registration. (extensions/memory-core/index.ts:250, f2b7a98d6908)
  • Builtin first search remains safe: An empty builtin index synchronously bootstraps during search, then schedules dirty refresh from the search owner; the tool path acquires the manager only when the memory tool runs. (extensions/memory-core/src/memory/manager.ts:1149, e69c3df2361b)
  • QMD policy is already demand-driven: QMD manager creation and boot policy are backend-owned, its first-session search sync remains local, and the docs explicitly state that Gateway startup keeps QMD lazy until first use. Public docs: docs/concepts/memory-qmd.md. (docs/concepts/memory-qmd.md:71, e69c3df2361b)
  • Regression provenance: History identifies merged PR 119676 as introducing the delayed warmup; it is contained in current main and in the latest release tag. (extensions/memory-core/index.ts:280, 824d1706801f)
  • After-fix behavior evidence: The PR body supplies exact-head packaged source-performance results with passing post-ready health, fresh-device health, and configuration RPC samples; GitHub artifact retrieval was unavailable to this read-only worker. (f2b7a98d6908)

Likely related people:

  • vincentkoc: Authored the merged delayed-warmup change and this follow-up removal. (role: recent area contributor; confidence: high; commits: 824d1706801f, f2b7a98d6908; files: extensions/memory-core/index.ts)
  • steipete: History includes the QMD Gateway-laziness work that establishes the sibling backend policy preserved by this change. (role: adjacent owner; confidence: medium; commits: 2b811fe6d9e3, e873a7f955; files: extensions/memory-core/src/memory/qmd-manager-base.ts, docs/concepts/memory-qmd.md)

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.

@vincentkoc
vincentkoc merged commit 5eb7edd into main Aug 5, 2026
198 checks passed
@vincentkoc
vincentkoc deleted the fix/memory-warmup-responsiveness-20260805 branch August 5, 2026 19:35
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 5, 2026
…cope

* origin/main: (70 commits)
  fix(clickclack): preserve MIME extension for unnamed uploads (openclaw#119646)
  fix(memory): keep post-ready RPCs responsive (openclaw#119710)
  fix(browser): preserve locale, timezone, and device overrides (openclaw#119695)
  fix(agents): stop messaging dedupe from dropping final replies that quote a short tool send (openclaw#118178)
  test(agents): batch code mode budget proof (openclaw#119699)
  fix(memory): keep gateway RPCs responsive during startup (openclaw#119676)
  improve(ui): trail transient session status beside row actions (openclaw#119560)
  refactor(msteams): consolidate channel action target resolution (openclaw#119632)
  fix: tail context answers the current user message (openclaw#117364)
  fix(whatsapp): exercise descriptor-safe credential persistence (openclaw#119621)
  fix(diagnostics-otel): route OTLP endpoints by signal (openclaw#101655)
  refactor(skills): consolidate workshop transcript and record normalization (openclaw#119643)
  fix(video): harden DashScope task and media lifecycle (openclaw#117303)
  refactor(transcripts): consolidate persistence and export ownership (openclaw#119634)
  fix: preserve ClickClack discussion state contracts (openclaw#118851)
  fix(matrix): retire shared E2EE clients safely (openclaw#119570)
  refactor(cron): unify catch-up persistence and payload encoding (openclaw#119636)
  refactor(ui): centralize composer attachment and capability controls (openclaw#119650)
  refactor(daemon): consolidate managed service lifecycle ownership (openclaw#119647)
  fix(browser): honor explicit navigation timeouts across browser drivers (openclaw#119654)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
Punchcard-Session: coral-workshop-workshop-3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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