Repository navigation
Commit db1e06b
committed
fix(core): instantiate each sub-client exactly once in _spawn_completion_context
Previously the first sub-client was constructed twice — once for
`other_backend_client` and again inside the registration loop. With
backends that hold expensive underlying state (HTTP connection pools,
async clients, OS sockets), the duplicate carried real cost; with
multi-backend Anthropic on macOS this showed up as a ~3-min hang at
iter 2 of every multi-backend trajectory. Usage tracking also merged
via dict.update, so the duplicate overwrote one of the two instances'
usage summaries.
Reuse `other_backend_client` for the first registration and only
construct the remaining sub-clients in the loop.1 parent a740331 commit db1e06b
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
212 | 219 | | |
213 | 220 | | |
214 | 221 | | |
| |||
0 commit comments