Fix generate_stream error in ClientV2 #725
Open
+36
−5
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.
Problem
Both the fern-generated Client and ClientV2 assign to self._raw_client. The .fernignore'd wrapper
ClientV2inherits from both, so its _raw_client parameter was getting set to the V2 only (since it is constructed last).Fix
Create a proxy raw client that will delegate to the v2 and fall back to v1 raw client.
Note
Low Risk
Small, localized change to client initialization and attribute delegation; primary risk is subtle routing of raw client attributes between v1 and v2.
Overview
Fixes
ClientV2/AsyncClientV2method loss caused by_raw_clientbeing overwritten when initializing both v1 and v2 client bases.Adds a
_CombinedRawClientproxy and updates both constructors to capture the v1 raw client, initialize v2, then replace_raw_clientwith a delegating wrapper (v2-first, v1 fallback) to keep legacy calls likegenerate_streamworking. Tests add a small assertion thatgenerateandgenerate_streamremain available onClientV2.Written by Cursor Bugbot for commit 21a6e5b. This will update automatically on new commits. Configure here.