fix(recall): keep stable empty recall wrapper#329
Conversation
|
Hi @Arreboi06 👋, |
c77cf18 to
21de932
Compare
Implementation note for reviewersThis update keeps PR #329 focused on issue #120 and rewrites the branch into a reviewable fix: 1 commit, scoped only to prompt-cache stability and recall-history cleanup. Why this addresses #120The regression described in #120 is caused by dynamic recall context changing the prompt shape across turns, which hurts prefix-matching prompt caches used by OpenAI-compatible providers. This PR fixes the TencentDB-Agent-Memory side of that problem by introducing a stable cache contract:
Why this is intentionally scopedThe original PR branch had unrelated adapter SDK changes mixed into the diff. This branch now excludes that unrelated work and only contains the issue #120 cache optimization. That should make review and merge much easier. This PR provides the correct structured output for cache-aware placement. If OpenClaw wants to place stable additions before a host-side VerificationVerified locally:
The new behavior tests cover:
This keeps the implementation small while directly targeting the high-impact cache-hit regression reported in #120. |
21de932 to
28792cb
Compare
|
Triage note: #375 is now the canonical scoped runtime mitigation for #120. This PR overlaps on cache-friendly recall context and history cleanup, but introduces additional Recommendation: re-scope as a follow-up only if stable wrapper behavior is still needed after #375. Avoid bundling Gateway response contract changes into the #120 OpenClaw runtime mitigation. |
28792cb to
92d962d
Compare
|
Re-scoped this PR according to the triage note. I removed the broader #120 baseline scope from #329:
The branch now contains only a small follow-up candidate: This is intended to complement #375 rather than compete with it. #375 remains the canonical scoped runtime mitigation for #120; #195 remains the Gateway/Hermes split-context work. Verification after re-scope:
|




Summary
Re-scoped per reviewer triage: #375 is now the canonical scoped runtime mitigation for #120, and #195 already owns Gateway/Hermes context splitting.
This PR is no longer trying to be the #120 baseline fix. It is a small follow-up candidate for the one behavior not covered by that baseline: keeping the existing
<relevant-memories>dynamic recall wrapper stable when an L1 search runs but returns zero hits.Review map
The diff is intentionally small. The quickest review path is:
src/core/hooks/auto-recall.ts<relevant-memories>wrapper only for attempted zero-hit recallsrc/core/hooks/__tests__/stable-wrapper.test.tsWhat changed
<relevant-memories>...</relevant-memories>block when recall search is attempted and returns no L1 memories.What this deliberately does not change
recall.cacheOptimizationconfig knobs.Why this is a follow-up to #375
#375 addresses the canonical OpenClaw runtime mitigation for #120: dynamic recall placement and history cleanup. This PR only adds the stable-wrapper detail so prefix-matching cache providers do not see the recall prompt layout alternate between "has wrapper" and "no wrapper" on L1 hit vs zero-hit turns.
The implementation stays inside
performAutoRecalland distinguishes:Verification
npm test -- src/core/hooks/__tests__/stable-wrapper.test.tsfailed before implementation becauseprependContextwasundefinedfor zero-hit recall.npm test -- src/core/hooks/__tests__/stable-wrapper.test.ts-> 3 tests passed.npm test-> 5 test files passed, 70 tests passed.npm run build-> plugin build and script TypeScript builds passed.git diff --check origin/main...HEAD-> passed.Build note: tsdown prints a Node.js v22.17.0 deprecation warning, but the build exits successfully.