Repository navigation
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.
Retrieve and inject Foundry static (user-profile) memories #1125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Retrieve and inject Foundry static (user-profile) memories #1125
Changes from all commits
5f8a4925f2c14f6c313093747b41File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retry-on-failure behavior diverges from the upstream Python provider.
Here, when the item-less static search fails,
initKeyis left unset so every subsequent turn re-issues the static search until it succeeds (per the "Leave the session uninitialized so the next turn retries" comment).Upstream
python/packages/foundry/agent_framework_foundry/_memory_provider.py(FoundryMemoryProvider.before_run) does the opposite: thetry/except/finallyblock setsstate["static_memories"] = []on failure and unconditionally setsstate["initialized"] = Truein thefinallyclause, so a failed static search is attempted only once per session and the provider silently proceeds with no static memories thereafter — it never retries on later turns.This is a meaningful parity gap: a persistently failing/unavailable memory store causes the Go provider to retry the item-less search on every turn indefinitely (extra latency/cost per turn), while Python fails once and moves on. Consider caching an "attempted" flag (with empty static memories) on failure, matching the Python
finallysemantics, unless the indefinite-retry behavior is an intentional Go-specific choice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This staticMemories helper leaves the session uninitialized on a failed item-less search so the next turn retries. The Python reference this PR states it's porting (
python/packages/foundry/agent_framework_foundry/_memory_provider.py,before_run) always setsstate["initialized"] = Truein afinallyblock regardless of success, caching an empty static-memory list and never retrying the item-less search again for that session (test_static_memories_only_retrieved_oncecovers this).So Go will keep re-issuing the item-less static search every subsequent turn after a transient failure, while Python treats the static fetch as one-shot best-effort per session. Since the PR explicitly aims to match the Python provider's caching semantics, consider setting the initialized flag (with an empty cached list) even on failure to match Python, or note this retry-on-failure behavior as an intentional Go-specific divergence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parity issue: static-memory failure retry policy diverges from the Python provider.
On a failed item-less static search, this leaves the session un-initialized ("Leave the session uninitialized so the next turn retries"), so every subsequent turn re-issues the static search until it succeeds.
The upstream Python provider does the opposite and does so deliberately. In
_memory_provider.py,before_runwraps the static search intry/except/finallyand setsstate["initialized"] = Truein thefinallyblock — i.e. regardless of success or failure — with the explicit comment "Mark as initialized regardless of success to avoid repeated attempts".state["static_memories"]is set to[]on failure. This is also asserted by the upstream testtest_static_memories_only_retrieved_once(and the failure-path test around line 293 intest_foundry_memory_provider.py), which expect exactly one static search per session even when it errors.Go's current behavior (retry on every turn after a failure) means a persistently-failing or slow memory store is hit with a static search on every single agent turn for the life of the session, which is a different reliability/cost profile than upstream intentionally chose.
Suggested fix: set
initKeytotrue(and cache an empty/nil static-memories slice) in theerr != nilbranch as well, so a failed static fetch is treated as "initialized" and not retried, matching the Python provider's documented behavior.Uh oh!
There was an error while loading. Please reload this page.