Commit 58cf64d
Add provider model and token limit overrides to ProviderConfig (#966)
* Add token limit and model override fields to ProviderConfig
Adds the following optional fields to ProviderConfig across all SDKs:
- modelId: well-known model ID for agent config + token limit lookup
- wireModel: model name sent to the provider API for inference
- maxPromptTokens: prompt token cap (triggers compaction)
- maxOutputTokens: response token cap
Both modelId and wireModel default to the session's configured model when unset.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add tests for new ProviderConfig fields
Extends existing provider-forwarding/serialization tests across all 4 SDKs
to cover modelId, wireModel, maxPromptTokens, and maxOutputTokens.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add E2E tests for ProviderConfig model and token limit overrides
Adds two end-to-end tests per SDK (Node, Python, Go, .NET) that exercise the new ProviderConfig fields against the replaying CAPI proxy:
- should_forward_provider_wire_model_and_max_output_tokens: verifies wireModel overrides the wire request model and maxOutputTokens is forwarded as max_tokens.
- should_use_provider_model_id_as_wire_model: verifies modelId acts as the wire model when wireModel is unspecified and SessionConfig.Model is omitted.
Also adds MaxTokens to the Go and .NET ChatCompletionRequest harness types so the assertion is observable, and ships two shared snapshot YAMLs under test/snapshots/session_config/.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Drop unverifiable max_tokens assertion from BYOK wire model E2E test
The OpenAI BYOK provider code path in the CLI does not echo the
configured maxOutputTokens as max_tokens on the wire request body
(it's used internally for token budgeting and only appears on
Anthropic-style requests). The new wire model E2E test asserted on
max_tokens in the captured chat completion request, which always
returned undefined/nil and failed across all four SDKs.
Rename the test to `should forward provider wire model'' and drop
the wire-side max_tokens assertion. The test still sets
maxOutputTokens to confirm the SDK serializes the field without
errors; per-SDK unit tests already cover ProviderConfig serialization
in detail. Also drop the now-unused MaxTokens field from the Go and
.NET harness ChatCompletionRequest types.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename MaxPromptTokens to MaxInputTokens and clarify ProviderConfig docs
Renames the SDK-facing ProviderConfig field across all four languages while preserving the wire JSON key as maxPromptTokens:
- .NET: MaxPromptTokens -> MaxInputTokens (JsonPropertyName unchanged)
- Go: MaxPromptTokens -> MaxInputTokens (json tag unchanged)
- Python: max_prompt_tokens -> max_input_tokens (wire conversion in _convert_provider_to_wire_format unchanged)
- Node: maxPromptTokens -> maxInputTokens; adds a small toWireProviderConfig helper in client.ts that remaps the field before sending session.create / session.resume.
Also rewrites the doc comments for modelId, wireModel, maxInputTokens, and maxOutputTokens to make the priority order clear: WireModel falls back to ModelId falls back to SessionConfig.Model, and ModelId drives both runtime configuration lookup and the wire model when WireModel is unset.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Windows teardown flake in ClientE2ETests
Remove 'using var' from three ClientE2ETests that also call ForceStopAsync in their finally block. The double-disposal (using Dispose → DisposeAsync → ForceStopAsync, plus the explicit ForceStopAsync) races on Windows when the CLI process/pipes are mid-teardown, causing OperationCanceledException to bubble up and fail an otherwise-passing test.
Matches the existing pattern in SessionFsE2ETests where ForceStopAsync is wrapped in try-catch to swallow teardown-only exceptions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert "Fix Windows teardown flake in ClientE2ETests"
This reverts commit 6c794c4.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 1832d0a commit 58cf64d
16 files changed
Lines changed: 492 additions & 3 deletions
File tree
- dotnet
- src
- test
- E2E
- Unit
- go
- internal/e2e
- nodejs
- src
- test
- e2e
- python
- copilot
- e2e
- test/snapshots/session_config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1528 | 1528 | | |
1529 | 1529 | | |
1530 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1531 | 1565 | | |
1532 | 1566 | | |
1533 | 1567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
241 | 297 | | |
242 | 298 | | |
243 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
326 | 405 | | |
327 | 406 | | |
328 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
862 | 881 | | |
863 | 882 | | |
864 | 883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
| |||
788 | 800 | | |
789 | 801 | | |
790 | 802 | | |
791 | | - | |
| 803 | + | |
792 | 804 | | |
793 | 805 | | |
794 | 806 | | |
| |||
931 | 943 | | |
932 | 944 | | |
933 | 945 | | |
934 | | - | |
| 946 | + | |
935 | 947 | | |
936 | 948 | | |
937 | 949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
1506 | 1536 | | |
1507 | 1537 | | |
1508 | 1538 | | |
| |||
0 commit comments