Skip to content

fix(active-memory): isolate recall lane#80255

Merged
osolmaz merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-79026
May 29, 2026
Merged

fix(active-memory): isolate recall lane#80255
osolmaz merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-79026

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Active Memory recall could block itself during prompt building.
The parent reply and the recall subagent could use the same queue lane, so recall waited behind the work that was waiting for recall.
This change puts recall on its own active-memory lane and adds a regression test for that call.

Fixes #79026.
Related: #72015.

What Changed

The runtime change is intentionally small.
Recall still runs during before_prompt_build; it just no longer competes with the parent session lane.

  • Added a named active-memory recall lane.
  • Passed that lane to runEmbeddedAgent for Active Memory recall.
  • Added a test that asserts the embedded recall call includes lane: "active-memory".

Real behavior proof

Behavior addressed: Active Memory recall no longer shares the parent main lane during prompt-build recall.

Real environment tested: Fresh local macOS smoke from the cleaned PR branch. It used pnpm gateway:dev, OPENCLAW_SKIP_CHANNELS=1, Active Memory enabled, Memory Core enabled, and scripts/e2e/mock-openai-server.mjs as a local OpenAI-compatible loopback model endpoint.

Exact steps or command run after this patch: Created an isolated OPENCLAW_HOME, wrote a temporary config with gateway.http.endpoints.chatCompletions.enabled=true, started the loopback model server, started the local dev gateway, then sent a real webchat turn through POST /v1/chat/completions with session agent:main:direct:proof-80255-fresh.

Evidence after fix: Runtime output from the fresh smoke:

verdict=pass
environment=local macOS OpenClaw dev gateway + loopback OpenAI-compatible model
gatewayPort=19817
modelPort=20817
readyStatus=200
httpStatus=200
elapsedMs=651
assistant_reply=OPENCLAW_E2E_OK_80255_FRESH
mockRequestCount=2
2026-05-29T20:52:12.721+08:00 [plugins] active-memory: agent=main session=agent:main:direct:proof-80255-fresh activeProvider=loopback activeModel=loopback-chat start timeoutMs=30000 queryChars=42 searchQueryChars=42
2026-05-29T20:52:12.928+08:00 [plugins] active-memory: agent=main session=agent:main:direct:proof-80255-fresh activeProvider=loopback activeModel=loopback-chat done status=ok elapsedMs=209 summaryChars=27

Observed result after fix: The gateway returned HTTP 200 with OPENCLAW_E2E_OK_80255_FRESH. Active Memory logged start and done status=ok during the turn, finishing recall in 209ms with no prompt-build timeout.

What was not tested: This smoke did not use a hosted external model provider or a real channel app such as Telegram/Discord. An AWS Crabbox focused rerun was attempted earlier, but the box lost network/DNS/SSH during the run (run_f1a17d6fa03a, lease cbx_d5bb40661343), so it was not counted as passing proof.

Testing

Focused local validation passed after the cleanup.

git diff --check
node scripts/run-vitest.mjs extensions/active-memory/index.test.ts -t "runs recall on a dedicated active-memory lane"

Fresh local smoke also passed as described above.

Risks

Risk is low because this only changes the queue lane for Active Memory's embedded recall subagent.
It does not change memory search behavior, provider selection, channel delivery, or plugin defaults.

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 29, 2026, 8:47 AM ET / 12:47 UTC.

Summary
The PR adds a dedicated Active Memory embedded recall lane and a regression assertion that the recall subagent is called with that lane.

PR surface: Source +2, Tests +14. Total +16 across 2 files.

Reproducibility: yes. Source inspection shows current main calls runEmbeddedAgent from Active Memory recall without a lane while the embedded runner defaults missing lanes to main; I did not run a live current-main repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Embedded recall lane: 1 explicit lane added. This PR changes runtime scheduling for Active Memory recall, which matters for gateway availability beyond normal unit-test correctness.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Have a maintainer explicitly accept the shared Active Memory recall lane or request an agent/session-scoped lane before merge.

Risk before merge

  • [P1] The new active-memory queue lane is process-wide and command lanes default to one concurrent task, so slow concurrent recall work can still delay prompt-build recall; this is an availability tradeoff for maintainers, not a blocking defect in the narrow self-deadlock fix.

Maintainer options:

  1. Land the narrow lane isolation (recommended)
    Maintainers can accept the shared active-memory lane as an incremental fix for the self-deadlock while tracking broader concurrency and nonblocking behavior separately.
  2. Scope the lane before merge
    If maintainers want to avoid process-wide recall serialization now, change the lane to an agent- or session-scoped value and add focused concurrent prompt-build coverage.

Next step before merge

  • [P2] The remaining action is maintainer acceptance of the Active Memory lane scope and normal merge handling; there is no narrow automation repair to queue.

Security
Cleared: The diff only adds a literal lane value and a focused test; it does not touch dependencies, workflows, auth, secrets, lockfiles, downloads, or package execution paths.

Review details

Best possible solution:

Land the narrow lane isolation if maintainers accept the shared recall-lane tradeoff, and keep broader fail-open or per-agent concurrency work tracked under #72015.

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

Yes. Source inspection shows current main calls runEmbeddedAgent from Active Memory recall without a lane while the embedded runner defaults missing lanes to main; I did not run a live current-main repro in this read-only review.

Is this the best way to solve the issue?

Yes, with a maintainer tradeoff. Passing a non-main lane is the narrow maintainable fix for this self-deadlock; broader fail-open or per-agent concurrency behavior belongs in the related reliability work.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 6235720c8aee.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix local gateway logs showing a real chat-completions request returned HTTP 200 with Active Memory start/done lines and no prompt-build timeout.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes after-fix local gateway logs showing a real chat-completions request returned HTTP 200 with Active Memory start/done lines and no prompt-build timeout.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The linked bug can stall prompt building and delay or fail real user replies when Active Memory recall self-blocks.
  • merge-risk: 🚨 availability: The diff intentionally changes queue-lane scheduling for pre-prompt recall, and concurrent slow recall behavior can affect gateway responsiveness.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes after-fix local gateway logs showing a real chat-completions request returned HTTP 200 with Active Memory start/done lines and no prompt-build timeout.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix local gateway logs showing a real chat-completions request returned HTTP 200 with Active Memory start/done lines and no prompt-build timeout.
Evidence reviewed

PR surface:

Source +2, Tests +14. Total +16 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 0 +2
Tests 1 14 0 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 16 0 +16

What I checked:

  • Current main still uses the default embedded-run lane: Active Memory's current runRecallSubagent call on main invokes runEmbeddedAgent without a lane, so the embedded runner receives no caller-specific lane for recall. (extensions/active-memory/index.ts:2530, 6235720c8aee)
  • Embedded runner defaults missing lane to main: runEmbeddedAgent resolves globalLane from params.lane, and resolveGlobalLane returns main when the lane is absent or blank. (src/agents/embedded-agent-runner/run.ts:473, 6235720c8aee)
  • Prompt-build recall is awaited on the user-visible path: The Active Memory before_prompt_build hook awaits maybeResolveActiveRecall, so recall queue stalls can delay prompt construction for the parent turn. (extensions/active-memory/index.ts:3118, 6235720c8aee)
  • PR branch applies the requested narrow lane change: The PR head adds ACTIVE_MEMORY_RECALL_LANE = "active-memory", passes it to runEmbeddedAgent, and adds a test expecting that lane. (extensions/active-memory/index.ts:2541, ab3b684b2fea)
  • Queue-lane availability risk is real but bounded: Arbitrary command lanes are process-local queue states and default to maxConcurrent: 1, so the new lane intentionally serializes Active Memory recall work unless maintainers later add a scoped lane or concurrency control. (src/process/command-queue.ts:187, 6235720c8aee)
  • Current-head branch provenance: The checked-out PR commit is ab3b684b2feaddaf9f2f6cec88a05c82b947d60e, authored and committed by Onur Solmaz on 2026-05-29T12:27:20Z, and it only modifies the Active Memory plugin and its test. (ab3b684b2fea)

Likely related people:

  • steipete: The available current-main blame for both the Active Memory recall helper and embedded-runner lane wrapper points to Peter Steinberger's current-main snapshot commit. (role: recent area contributor; confidence: medium; commits: 1b138d3f38c5; files: extensions/active-memory/index.ts, src/agents/embedded-agent-runner/run.ts)
  • osolmaz: The current PR head commit that adds the dedicated Active Memory lane and regression test was authored and committed by Onur Solmaz. (role: recent repair author; confidence: medium; commits: ab3b684b2fea; files: extensions/active-memory/index.ts, extensions/active-memory/index.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@greptileai

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@greptileai

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

Real behavior proof

  • Environment: Linux x86_64, Node 22
  • Tests: pnpm test extensions/active-memory/index.test.ts — all tests pass
  • Type check: pnpm check:changed — type + lint + format green
  • Behavior confirmed: Active Memory recall subagents now run on a dedicated lane, preventing prompt-build hooks from self-blocking behind the main turn
  • Changed files: 3 files, +17/−0 (active-memory/index.ts, index.test.ts, CHANGELOG)

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 11, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I updated the PR body with focused Active Memory behavior proof and the exact passing test output.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels May 11, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I updated the PR body with the required Real behavior proof fields: behavior, environment, steps, evidence, observedResult, and notTested.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper

clawsweeper Bot commented May 12, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

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. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 29, 2026
@osolmaz
osolmaz force-pushed the feat/issue-79026 branch from 630953d to ab3b684 Compare May 29, 2026 12:29
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 29, 2026
@osolmaz osolmaz changed the title fix #79026: active-memory recall subagent can deadlock on the main lane inside before_prompt_build fix(active-memory): isolate recall lane May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels May 29, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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. labels May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 29, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 29, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 29, 2026
@osolmaz
osolmaz merged commit b5bc752 into openclaw:main May 29, 2026
175 of 193 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

active-memory recall subagent can deadlock on the main lane inside before_prompt_build

2 participants