Skip to content

Surface transient memU backend outages instead of silently returning no memories#180

Open
serxa wants to merge 1 commit into
mainfrom
serxa/memu-backend-resilience
Open

Surface transient memU backend outages instead of silently returning no memories#180
serxa wants to merge 1 commit into
mainfrom
serxa/memu-backend-resilience

Conversation

@serxa

@serxa serxa commented Jul 17, 2026

Copy link
Copy Markdown
Member

Problem

memU runs its LLM client with SDK retries disabled (max_retries=0), so a transient backend blip — HTTP 429/5xx, or the shared proxy returning auth_unavailable / a revoked-OAuth error on 401/403 — fails the memU call immediately. The main agent SDK rides such blips out via its own retries; memU does not. The result was silent data-loss:

  • memory_recall caught the error and returned an empty list, rendered by the tool layer as "No relevant memories found." — indistinguishable from a genuine miss. The agent then proceeds as if it has no relevant memory: silent amnesia.
  • memorize failed and reported only a generic failure.

Fix

  • Add MemoryBackendUnavailable and _is_transient_llm_error() — detects 429/5xx by status, plus the proxy's auth_unavailable / revoked signatures on 401/403, falling back to parsing Error code: NNN from the message so it stays decoupled from the openai import.
  • Retry the memU LLM call on transient errors only, with short backoff (0.5/1.5/3.0s). Genuine hangs still fail fast via the existing per-attempt wait_for; non-transient errors re-raise immediately.
  • On a real outage, recall / memorize / memorize_file raise MemoryBackendUnavailable, and the tool layer surfaces it loudly — telling the agent memory is DOWN (not empty), so it flags/reconstructs instead of concluding "no memories".

Normal-path behavior is unchanged and there is nothing to configure — the new path only triggers during a transient backend error, where the previous behavior was silent.

Testing

Full test suite: 1547 passed, 2 skipped.

…no memories

memU disables SDK retries (max_retries=0), so a transient proxy/auth blip (429/5xx or the proxy 'auth_unavailable'/revoked-OAuth signature on 401/403) failed the call immediately. recall then returned an empty list — rendered as "No relevant memories found." and indistinguishable from a genuine miss (silent amnesia); memorize reported only a generic failure.

Add MemoryBackendUnavailable + _is_transient_llm_error(), retry transient errors with short backoff (0.5/1.5/3.0s; genuine hangs still fail fast via the existing wait_for), and surface real outages loudly in recall/memorize so the agent knows memory is DOWN, not empty. Normal path unchanged; nothing to configure.

Co-Authored-By: Claude Opus 4.8 <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.

1 participant