fix(core): Preserve AI proxy property references#22474
Open
psh4607 wants to merge 1 commit into
Open
Conversation
psh4607
force-pushed
the
fix/ai-proxy-stable-references
branch
3 times, most recently
from
July 22, 2026 04:25
1445eaf to
e002cf1
Compare
psh4607
marked this pull request as ready for review
July 22, 2026 04:54
psh4607
force-pushed
the
fix/ai-proxy-stable-references
branch
from
July 22, 2026 05:50
e002cf1 to
8d957e5
Compare
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.
AI integration deep proxies now reuse nested proxies and wrapped methods while the underlying property is unchanged. This makes repeated property access referentially stable for OpenAI and Google GenAI clients, while still refreshing a cached entry when an SDK property is replaced.
Anthropic is unchanged because the current
developimplementation instruments its methods in place and no longer uses this deep-proxy path.Root cause
Each
gettrap created a new nested proxy, instrumented wrapper, or bound function on every access. Caching functions alone would not cover repeated nested access because the intermediate proxies were also recreated.Focused regression coverage checks stable nested objects, instrumented methods, proxy-result methods, and non-instrumented bound methods.
Fixes #22355