Repository navigation
Commit 7ff6549
committed
fix(proxy): address review P1/P2 — fresh Request per connect retry, unconditional Anthropic upstream on /v1/responses
- handler.ts: rebuild upstreamReq inside the connect-retry loop so every
attempt fetches with a fresh body stream (a reused Request is marked
bodyUsed after the first fetch, so attempts 2+ throw 'Request body
already used' before any I/O — dead retry exactly on start-plan, which
hits the plain pass-through path where dispatch does not rebuild the
Request). Skip retries once the client signal is aborted.
- responses-handler.ts: always translate Responses -> Chat -> Anthropic
for both plans. Previously start-plan built an OpenAI Chat body while
buildUpstreamURL now returns the live Anthropic messages endpoint,
which would post an OpenAI-format body to an Anthropic endpoint.
startPlan body transform (system blocks / cache_control) is preserved.
Review: TriDefender request-changes on PR TriDefender#34 (P1, P2). Nits P3/P4
(tests for the new resilience behaviors, README routing sync) follow
in a separate commit.1 parent b05f82d commit 7ff6549
2 files changed
Lines changed: 17 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
233 | 239 | | |
234 | 240 | | |
| 241 | + | |
235 | 242 | | |
236 | 243 | | |
237 | 244 | | |
| |||
241 | 248 | | |
242 | 249 | | |
243 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
147 | 150 | | |
148 | | - | |
| 151 | + | |
149 | 152 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 163 | | |
170 | | - | |
| 164 | + | |
171 | 165 | | |
172 | 166 | | |
173 | 167 | | |
| |||
0 commit comments