Repository navigation
Commit 3f5b3d4
fix(devserver): honor request max_concurrency (#1072)
Follow-up to braintrustdata/braintrust#24075,
which made the playground and "+ Experiment" dialog send
`max_concurrency` to remote eval dev servers. This PR makes the dev
server honor it.
Companion JS SDK PR:
braintrustdata/braintrust-sdk-javascript#2730
### Context
The playground **Max concurrency** slider and the "+ Experiment" **Max
concurrency** field had no effect on remote eval tasks.
braintrustdata/braintrust#24075 (merged) made the UI send
`max_concurrency` in the `POST /eval` request to the dev server, but
`parse_eval_body` never read the field and `run_eval` built the
`EvalAsync` kwargs only from the registered evaluator, so it was
ignored. The value set on the Eval in code always won. A customer
lowered the slider to avoid Azure 429s and saw no change (Pylon 20534,
COR-288).
### Description
Parse `max_concurrency` from the eval request and pass it to
`EvalAsync`.
**The request value can lower the evaluator's limit but never raise it**
(`min(request, evaluator)`; if the evaluator sets no limit, the request
value applies). This is deliberate: the playground always sends a value
and the slider defaults to 10, so letting the request override outright
would silently raise every code-set limit below 10 (e.g.
`max_concurrency=5` → 10) as soon as users upgrade the SDK. The
trade-off is that the UI can't push concurrency *above* what's in code.
Other details:
- `null` or a missing value keeps the evaluator's limit, which also
covers older UIs that don't send the field.
- Fractional values are rounded down (the "+ Experiment" field is a free
number input validated only as `>= 1`). Values below 1 or non-numbers
are rejected with a 400.
### Testing
- New tests cover: request lowers the limit, request can't raise it,
request applies when the evaluator has no limit, null or omitted request
keeps the evaluator's limit, rounding down, and invalid values. They
fail without the fix and pass with it.
- `nox -s test_cli` passes (43 passed, 2 skipped); `make lint` is clean.
- End to end: ran the real dev server (`eval --dev`) from this branch
against a Braintrust org, with a 12-row eval whose task records how many
calls are in flight, and sent `POST /eval` requests shaped like the
playground's. Same run against the released Python 0.49.2 (PyPI) for
comparison:
| Evaluator limit in code | Request `max_concurrency` | Expected peak |
This branch | Released |
|---|---|---|---|---|
| 5 | 2 | 2 | **2** | 5 |
| 5 | 10 | 5 | 5 | 5 |
| 5 | `null` | 5 | 5 | 5 |
| 5 | omitted | 5 | 5 | 5 |
| 5 | 2.5 | 2 | **2** | 5 |
| none | 3 | 3 | **3** | 12 |
| none | omitted | 12 | 12 | 12 |
Refs: COR-288
Co-authored-by: Paul Tancre <paultancre@p-tancre.home>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent baf8d7a commit 3f5b3d4
3 files changed
Lines changed: 107 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
263 | 270 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
0 commit comments