Fix memU memorize failing silently on Bedrock provider - #36
Merged
Conversation
When the provider is Bedrock (AWS), anthropic_api_base_url and effective_api_key are both empty — Bedrock uses IAM auth, not API keys. memU's OpenAISDKClient requires both, so every memorize call failed with "Connection error" while recall (local SQLite + embeddings) still worked. Add a _BedrockLLMClient adapter that wraps AsyncAnthropicBedrock and implements memU's LLM client interface (.chat(), .summarize(), .embed()). After MemoryService init, placeholder OpenAISDKClient instances are replaced with real Bedrock-backed clients. All 6 code paths that touch LLM clients are updated: - initialize() — detect Bedrock, use placeholder creds for validation - _inject_bedrock_clients() — replace placeholders post-init - _make_bedrock_client() — factory using Nerve's provider config - _instrument_llm_timeouts() — skip httpx Layer 1 for Bedrock - _probe_api_health() — use adapter's chat() for health checks - _reset_llm_clients() — re-inject Bedrock clients after eviction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pufit
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memorizesilently fails with "Connection error" because memU'sOpenAISDKClientrequiresbase_url+api_key— both empty under Bedrock (IAM auth)_BedrockLLMClientadapter wrappingAsyncAnthropicBedrockthat implements memU's LLM client interface (.chat(),.summarize(),.embed())MemoryServiceinit, placeholderOpenAISDKClientinstances are replaced with real Bedrock-backed clientsinitialize(),_inject_bedrock_clients(),_make_bedrock_client(),_instrument_llm_timeouts(),_probe_api_health(),_reset_llm_clients()Test plan
Injected Bedrock LLM client for profile 'default/fast/memorize')memorizecall succeeds end-to-end (was: "Failed to memorize", now: "Memorized: ...")memory_recallreturns the newly memorized item