Repository navigation
Commit 5f53236
Eva
fix(buzz-agent): reserve the provider's actual summary completion cap in the handoff input budget
Review follow-up (PR #5248, atishpatel): the previous commit doubled
OpenRouter's top-level max_tokens to 16384 (text budget + reasoning
budget) but build_handoff_prompt still reserved only 8192 output tokens
when sizing the input. At the maximum constructed prompt, input plus the
actual completion allowance could exceed the configured context window
by 8192 — making the summarizer itself context-reject exactly when a
handoff is needed.
Introduce summary_completion_cap(provider, budget): 2x for OpenRouter
(where reasoning gets its own equal budget), unchanged for Anthropic,
OpenAI, Databricks, and DatabricksV2 (whose summary bodies request the
caller's budget as-is). openrouter_summary_body and
build_handoff_prompt both derive from it, so the wire cap and the input
reservation cannot drift apart again. A regression test pins the join:
budget + fixed prompt + actual completion cap <= window at the
1-byte/token upper bound, and asserts the old single reservation
observably violates it.
Also per review suggestion: HANDOFF_SYSTEM_PROMPT now says 'Keep the
visible plain-text summary under N tokens' with N derived from
HANDOFF_MAX_OUTPUT_TOKENS via format!, removing the duplicated literal
and the ambiguity about whether hidden reasoning counts against the
figure.
Verification:
- cargo test -p buzz-agent (425 unit + 110 integration, all pass)
- cargo fmt / clippy clean
Co-authored-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Signed-off-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>1 parent bb2fedd commit 5f53236
2 files changed
Lines changed: 108 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
| |||
170 | 182 | | |
171 | 183 | | |
172 | 184 | | |
173 | | - | |
| 185 | + | |
174 | 186 | | |
175 | 187 | | |
176 | 188 | | |
| |||
331 | 343 | | |
332 | 344 | | |
333 | 345 | | |
334 | | - | |
| 346 | + | |
335 | 347 | | |
336 | 348 | | |
337 | 349 | | |
| |||
513 | 525 | | |
514 | 526 | | |
515 | 527 | | |
516 | | - | |
| 528 | + | |
517 | 529 | | |
| 530 | + | |
518 | 531 | | |
519 | 532 | | |
520 | 533 | | |
| |||
526 | 539 | | |
527 | 540 | | |
528 | 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 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
529 | 607 | | |
530 | 608 | | |
531 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
2240 | 2258 | | |
2241 | 2259 | | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
2246 | 2264 | | |
2247 | 2265 | | |
2248 | 2266 | | |
| |||
2264 | 2282 | | |
2265 | 2283 | | |
2266 | 2284 | | |
2267 | | - | |
| 2285 | + | |
2268 | 2286 | | |
2269 | 2287 | | |
2270 | 2288 | | |
| |||
0 commit comments