Skip to content

feat: add error handling to VertexAiMemoryBankService.search_memory#5707

Open
vietnamesekid wants to merge 2 commits into
google:mainfrom
vietnamesekid:feat/vertex-memory-bank-error-handling
Open

feat: add error handling to VertexAiMemoryBankService.search_memory#5707
vietnamesekid wants to merge 2 commits into
google:mainfrom
vietnamesekid:feat/vertex-memory-bank-error-handling

Conversation

@vietnamesekid
Copy link
Copy Markdown

What's the problem?

search_memory iterates over memory entries from the Vertex AI API but had no error handling. If one entry was malformed or the iterator threw mid-stream, the whole call would blow up and drop everything collected so far.

What changed?

Added two layers of defense inside the iterator loop:

  • Per-entry (AttributeError): skips bad entries and logs a warning so the rest still come through
  • Iterator-level (Exception): if the stream fails partway, we return whatever we already collected instead of raising

Also added guards for a few edge cases I noticed while looking at this:

  • memory is None
  • fact is empty/None
  • update_time is None (just sets timestamp=None rather than crashing)

Test plan

  • test_search_memory — happy path unchanged
  • test_search_memory_empty_results — empty results unchanged
  • test_search_memory_skips_entry_with_none_memory
  • test_search_memory_skips_entry_with_empty_fact
  • test_search_memory_handles_missing_update_time
  • test_search_memory_skips_malformed_entry
  • test_search_memory_returns_partial_results_on_iterator_error

@vietnamesekid vietnamesekid force-pushed the feat/vertex-memory-bank-error-handling branch from 043e287 to 6d02714 Compare May 15, 2026 03:10
@vietnamesekid vietnamesekid force-pushed the feat/vertex-memory-bank-error-handling branch from 6d02714 to 5cc51db Compare May 15, 2026 03:13
@rohityan rohityan self-assigned this May 18, 2026
@rohityan rohityan added services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc needs review [Status] The PR/issue is awaiting review from the maintainer labels May 18, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @vietnamesekid , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan rohityan requested a review from DeanChensj May 18, 2026 19:07
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @DeanChensj , can you please review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review [Status] The PR/issue is awaiting review from the maintainer services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants