Skip to content

Harden auto-recall with timeout and circuit breaker#254

Open
shardbigwhite-dotcom wants to merge 1 commit intoCortexReach:masterfrom
shardbigwhite-dotcom:fix/auto-recall-fail-safe
Open

Harden auto-recall with timeout and circuit breaker#254
shardbigwhite-dotcom wants to merge 1 commit intoCortexReach:masterfrom
shardbigwhite-dotcom:fix/auto-recall-fail-safe

Conversation

@shardbigwhite-dotcom
Copy link

Summary

  • bound auto-recall on before_agent_start with a small total timeout
  • add a lightweight circuit breaker after repeated recall failures
  • fast-fail the circuit immediately for known fatal retrieval/storage/config errors
  • skip recall safely instead of risking agent-start / Control UI stalls

Why

This addresses the failure mode described in #253: when retrieval is unhealthy, autoRecall should degrade to "no memory recall" instead of making the request appear hung.

Notes

  • startup self-checks were already fire-and-forget and time-bounded
  • this patch hardens the actual user-facing auto-recall path
  • package-lock changes were intentionally excluded from this PR

@AliceLJY
Copy link
Collaborator

Thanks for taking the time to contribute this! Really appreciate it. 🙏

There are merge conflicts with main at the moment. Would you mind rebasing your branch? Once the conflicts are resolved, we'll get this reviewed.

Let us know if you run into any issues!

AliceLJY added a commit to AliceLJY/memory-lancedb-pro that referenced this pull request Mar 23, 2026
…ntrol

Adds a new `recallMode` configuration option that provides finer control
over auto-recall behavior than the existing boolean `autoRecall` flag:

- "full": existing behavior — inject matching memories into context
- "summary": lightweight hint only — tells agent how many memories matched
  without consuming context budget; agent can call memory_recall on demand
- "off": disable auto-recall entirely

When `recallMode` is set, it takes precedence over `autoRecall`.
When neither is set, auto-recall remains off by default (no breaking change).

Motivation: in complex development sessions, auto-recall competes with
compact/compression for limited context budget, reducing signal-to-noise
ratio. Summary mode gives agents awareness of available memories without
the context cost. See Anthropic's "Effective Context Engineering" and
OpenAI's "Harness Engineering" for the underlying design principles.

Related: CortexReach#307 (autoRecallExcludeAgents), CortexReach#254 (auto-recall circuit breaker)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants