Skip to content

Fix Active Memory memory-only recall latency#75200

Merged
clawsweeper[bot] merged 2 commits into
openclaw:mainfrom
SYU8384:codex/fix-active-memory-timeout-65309
May 4, 2026
Merged

Fix Active Memory memory-only recall latency#75200
clawsweeper[bot] merged 2 commits into
openclaw:mainfrom
SYU8384:codex/fix-active-memory-timeout-65309

Conversation

@SYU8384

@SYU8384 SYU8384 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes [Bug]: Active Memory blocks direct-chat turns for ~30s and times out across multiple model configurations #65309.
  • Keeps Active Memory’s memory-only subagent path, but makes the blocking recall path deterministic and cheaper.
  • Runs exactly one required memory-tool attempt inside the memory-only worker, falling back from memory_recall to memory_search when recall tooling is unavailable.
  • Separates the rich recall prompt from the actual memory-tool search query so channel/runtime metadata is not sent to QMD as the search string.
  • Keeps QMD on the fast direct lexical path for Active Memory and records whether QMD sync waits were skipped or fallback was used.
  • Treats empty memory results or empty summarizer output as NONE instead of injecting worker errors into the main prompt.

What this fixes

  • Active Memory could spend the reply-path budget on setup, QMD/mcporter search, or a worker that returned without useful memory-tool behavior.
  • Channel turns could therefore feel stalled even though the main agent was otherwise healthy.
  • The fix is provider-agnostic: it bounds and simplifies the memory-only worker path rather than depending on a specific model/provider behavior.

Validation

  • pnpm test extensions/active-memory/index.test.ts src/agents/pi-embedded-runner/run/attempt.test.ts src/agents/pi-embedded-runner/run.memory-only-forwarding.test.ts
  • pnpm test extensions/memory-core/src/memory/qmd-manager.test.ts extensions/memory-core/src/memory/search-manager.test.ts extensions/memory-core/src/tools.test.ts extensions/discord/src/monitor/provider.test.ts
  • pnpm exec oxfmt --check --threads=1 <touched files>
  • pnpm build
  • pnpm check:changed (local; Blacksmith CLI unavailable in this environment)

Live check

  • Gateway restarted and reported healthy.
  • Discord probe connected and send-capable.
  • A channel test showed queryChars=850, searchQueryChars=4, requiredFirstTool=memory_search, and requiredFirstToolQueryChars=4, with no fresh QMD command using the full channel/runtime metadata.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L labels Apr 30, 2026
@clawsweeper

clawsweeper Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

Summary
The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.

Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memory's blocking before_prompt_build hook, which awaits embedded recall before the main prompt is built. The linked issue adds concrete timeout logs from current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Next step before merge
No repair lane is needed because automerge is already enabled for this open PR and the review found no discrete fixup blocker.

Security
Cleared: The diff touches Active Memory prompt/query handling, tests, changelog text, and session slot keys; it does not add dependencies, workflows, secret handling, package-resolution changes, or new code-execution surfaces.

Review details

Best possible solution:

Ship the bounded Active Memory search-query behavior with regression coverage, while preserving the already-main session-slot reservation and keeping the fix scoped to recall query handling.

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

Yes for a source-level reproduction path: an eligible interactive turn reaches Active Memory's blocking before_prompt_build hook, which awaits embedded recall before the main prompt is built. The linked issue adds concrete timeout logs from current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Is this the best way to solve the issue?

Yes. The diff is a focused and maintainable fix for the observed metadata-heavy search-query path, with exact-head checks green; if live proof shows models ignore the prompt-only query instruction, a later code-enforced tool-argument seam would be the safer follow-up.

What I checked:

  • Current main still uses the full recall query: On current main, buildRecallPrompt accepts only config/query and appends the full query as Conversation context; there is no separate bounded searchQuery path. (extensions/active-memory/index.ts:940, 8b2bf7b2e9fd)
  • Current main blocks prompt building on recall: The before_prompt_build hook builds query from event.prompt/recent turns and awaits maybeResolveActiveRecall before returning prompt context, matching the linked latency path. (extensions/active-memory/index.ts:2816, 8b2bf7b2e9fd)
  • PR adds bounded search-query plumbing: The PR diff adds MAX_ACTIVE_MEMORY_SEARCH_QUERY_CHARS, buildSearchQuery, searchQuery plumbing into runRecallSubagent/maybeResolveActiveRecall, and prompt text telling the worker to use the bounded query for memory_search or memory_recall. (extensions/active-memory/index.ts:933, 24bf408e75d8)
  • PR covers channel metadata stripping: The added test verifies a Discord-style prompt keeps channel/runtime metadata in Conversation context while using only the latest user message as the bounded search query. (extensions/active-memory/index.test.ts:2870, 24bf408e75d8)
  • Session-slot portion already exists on main: Current main already reserves pendingFinalDelivery* session-entry slots, and GitHub commit history attributes that main change to fc7e2a1. (src/plugins/session-entry-slot-keys.ts:69, 8b2bf7b2e9fd)
  • Linked issue has concrete reports: The linked issue comments include repeated 20-30s Active Memory timeout reports across direct chat, Telegram, models, and versions, plus a prior ClawSweeper note identifying this PR as the active implementation candidate.

Likely related people:

  • Takhoffman: Introduced the Active Memory recall plugin and later updated the bundled memory_recall/memory_search tool contract used by this PR's recall worker path. (role: introduced behavior and adjacent owner; confidence: high; commits: b83726d13e33, f256eeba431b; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts, docs/concepts/active-memory.md)
  • vincentkoc: Recently maintained Active Memory timeout behavior and authored the already-main pending-delivery session slot reservation carried by this PR branch. (role: recent maintainer; confidence: high; commits: df9d26eb4335, fc7e2a10c8fc; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts, src/plugins/session-entry-slot-keys.ts)
  • hclsys: Recently fixed Active Memory embedded recall channel-context handling adjacent to this PR's channel/runtime metadata handling. (role: recent adjacent contributor; confidence: medium; commits: 081f873162c2; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts)
  • hyspacex: Authored the merged Active Memory timeout alignment/setup work that overlaps the linked recall-latency surface. (role: introduced adjacent timeout behavior; confidence: medium; commits: 891c7d9f1c1f; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts)
  • yelog: Added the Active Memory timeout circuit breaker, part of the current mitigation stack for repeated recall timeouts. (role: recent adjacent maintainer; confidence: medium; commits: 89cd2b63624b; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts)

Remaining risk / open question:

  • This read-only review did not run local tests or a live gateway/provider latency probe; it relies on source inspection, the PR-stated validation, and exact-head GitHub check-runs.
  • The bounded query is still conveyed through recall-worker prompt text rather than a code-enforced memory tool argument, so live behavior remains the main proof point.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 8b2bf7b2e9fd.

@SYU8384 SYU8384 closed this Apr 30, 2026
@SYU8384 SYU8384 reopened this May 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core channel: discord Channel integration: discord labels May 2, 2026
@SYU8384 SYU8384 changed the title Fix active memory timeout startup Fix Active Memory memory-only recall latency May 2, 2026
@SYU8384
SYU8384 force-pushed the codex/fix-active-memory-timeout-65309 branch from dac99a2 to 051bac2 Compare May 4, 2026 18:15
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed channel: discord Channel integration: discord extensions: memory-core Extension: memory-core agents Agent runtime and tooling size: XL labels May 4, 2026
@Takhoffman

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 4, 2026
@clawsweeper

clawsweeper Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper merged this PR after the passing review.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=24bf408e75d87081c8736f1df7fd06bc3b4f887e)
Merge status: merged by ClawSweeper automerge
Merged at: 2026-05-04T20:05:16Z
Merge commit: f2efe33afc5d

What merged:

  • The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
  • Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:

  • PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

The automerge loop is complete.

Automerge progress:

  • 2026-05-04 19:57:32 UTC review queued 24bf408e75d8 (queued)
  • 2026-05-04 20:04:59 UTC review passed 24bf408e75d8 (structured ClawSweeper verdict: pass (sha=24bf408e75d87081c8736f1df7fd06bc3b4f8...)
  • 2026-05-04 20:05:18 UTC merged 24bf408e75d8 (merged by ClawSweeper automerge)

@clawsweeper
clawsweeper Bot merged commit f2efe33 into openclaw:main May 4, 2026
110 checks passed
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408
Review: openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
@SYU8384
SYU8384 deleted the codex/fix-active-memory-timeout-65309 branch May 6, 2026 15:39
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408
Review: openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
greench-ai pushed a commit to greench-ai/nexisclaw that referenced this pull request May 12, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408e75d87081c8736f1df7fd06bc3b4f887e.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408e75d87081c8736f1df7fd06bc3b4f887e
Review: openclaw/openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408e75d87081c8736f1df7fd06bc3b4f887e.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408e75d87081c8736f1df7fd06bc3b4f887e
Review: openclaw/openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408e75d87081c8736f1df7fd06bc3b4f887e.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408e75d87081c8736f1df7fd06bc3b4f887e
Review: openclaw/openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408
Review: openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408
Review: openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Summary:
- The PR adds a bounded latest-message search-query section to Active Memory recall prompts, regression coverage for metadata stripping, a changelog entry, and pending-final-delivery session slot reservations.
- Reproducibility: yes. for a source-level reproduction path: an eligible interactive turn reaches Active Memo ... om current releases, but I did not run a live gateway/provider reproduction under the read-only constraint.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(plugins): reserve final delivery session slots

Validation:
- ClawSweeper review passed for head 24bf408.
- Required merge gates passed before the squash merge.

Prepared head SHA: 24bf408
Review: openclaw#75200 (comment)

Co-authored-by: SYU8384 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Active Memory blocks direct-chat turns for ~30s and times out across multiple model configurations

2 participants