Repository navigation
Conversation
There was a problem hiding this comment.
Updated review of a0bb9b862b86688d719e8ec9c706b3e7264cd386: the earlier complexity-only rework request is withdrawn.
I checked the normal repository CI log for run 38017830710: 391 tests passed, 3 MiniMax integration tests skipped, with repository-wide Black and Flake8 passing. The source review preserves the four completion modes and current-turn continuations. The new regression intentionally retains rejected input; additional history/retry cases can follow up. No blocking correctness finding remains from this review. These are CI results, not a local or live-provider run.
Eigenwise
left a comment
There was a problem hiding this comment.
Checked a0bb9b862b86688d719e8ec9c706b3e7264cd386. The pending-input fix has regressions across all four completion modes and preserves current-turn continuations. Normal repository CI passed: 391 tests, with 3 MiniMax integration skips, plus Black and Flake8. The earlier complexity-only rework request is withdrawn.
max_context_tokenscurrently measures history before adding the new user input. A request that was within budget can therefore exceed the configured limit as soon as that input is appended, across all four completion APIs.Count the complete pending request after adding the input, and trim only older turns. Preserve the current turn: if the newest input plus the fixed context cannot fit, raise the existing
ValueErrorbefore calling the provider. This also preserves the current turn for continuations without a new input.Public API regressions cover
run,run_stream,run_async, andrun_async_stream, with both a request that fits after removing an older turn and an input that cannot fit. Token counting and provider completions are deterministic test doubles; no live provider call is required.Validation (Windows / Python 3.13): all 8 new regression cases fail on the original code; full suite after the fix: 391 passed, 3 credential-gated tests skipped. Repository-wide Black and Flake8 checks pass.
AI assistance: Codex assisted with reproduction, implementation, and verification. This changes the behavior of
max_context_tokens: oversized new inputs are now rejected locally rather than sent to the provider.