mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
LiteLLM's pre-call context check rejects requests that are too large with HTTP 400 and a message like: ``` litellm.ContextWindowExceededError: litellm.BadRequestError: litellm._pre_call_checks: Context Window exceeded for given call. ... Max Input Tokens=262144, Got=265262 ... ``` None of the `OVERFLOW_PATTERNS` matched this wording, so `isContextOverflow()` returned false. As a result, the agent session never ran overflow compaction and retry, and the turn failed with the 400 error. This change adds `/context window exceeded/i` to `OVERFLOW_PATTERNS` and documents the error in the doc comment that lists providers. Testing: - Added a regression test in `packages/ai/test/overflow.test.ts` with the exact error message from the issue. It fails without the pattern and passes with it. - `node ../../node_modules/vitest/dist/cli.js --run test/overflow.test.ts` in `packages/ai`: 32 passed. - `npm run check` passes. - Running `isContextOverflow()` directly on the reported message returned `false` before this change and returns `true` after it. Fixes #11492 Requested by @rwachtler Co-authored-by: triagent <triagent@localhost> |
||
|---|---|---|
| .. | ||
| agent | ||
| ai | ||
| chord | ||
| codemode | ||
| coding-agent | ||
| durable | ||
| env | ||
| evals | ||
| mcp | ||
| telemetry | ||
| tui | ||