Fix read_cell_output incorrectly reporting all outputs as too large (#318148)
Two
related issues caused even tiny notebook cell outputs (e.g. 5 bytes)
to be replaced with "Output is too large to be used as context".
1. Inverted size check in `RunNotebookCellOutput`: `getCharLimit` converts
tokens to chars (×4), but it was applied to the byteLength side and
compared against a token count. Compare byteLength against
getCharLimit(tokenBudget / sizeLimitRatio) instead — the threshold was
16× too small.
2. Remove `ReadCellOutput` from `toolsCalledInParallel`. Tools in that set
are invoked eagerly with a sentinel `{ tokenBudget: 1 }` sizing on the
premise that they don't consume sizing info. `RunNotebookCellOutput`
does — it gates output on `sizing.tokenBudget` — so the sentinel made
every non-empty output trip the size check. Letting it use the normal
lazy path gives it the endpoint's real prompt budget. O
Oded S committed
93c53e6fc5c0da18cfd254ff7a35a14b2ffae6f6
Parent: bebfd1d
Committed by GitHub <noreply@github.com>
on 5/26/2026, 3:44:14 PM