Pull requests / #1623
#1623 fix(serve): make context overflow errors recognizable
open · @hulkbig · 0 comentários · No GitHub
Descrição
Fixes #1615. ## Summary Prefix both context-overflow errors with `request exceeds the context window: ` so client overflow classifiers can recognize them. The existing token counts, no-truncation wording, and `max_tokens` / `fit_max_tokens` guidance remain intact. ## What changed - `serve/server.py`: message-only change in the two rejection branches. Admission rules, the eight-token context slack, fitting behavior, HTTP 400 status, and response schemas are unchanged. - `serve/test_context_overflow.py`: CPU-only HTTP regressions cover both branches through chat completions, Messages, and Responses, with streaming requested and disabled. Coverage includes the reported 150,722-token prompt / 131,072-token context, fitting enabled and disabled, one-token/zero-token room boundaries, and preserved prompt/budget limits. Rejected requests never reach generation. ## Validation - `python -m unittest serve.test_context_overflow serve.test_server.MaxTokens serve.test_server.FitMaxTokens serve.test_responses serve.test_request_hardening -q`: 60 tests, zero failures/errors, one skip. Independently rerun with the same result. - Replaying the new regression tests on unmodified `fb58e0d` produces 30 failed subtests for the missing phrase. - Compared 24 actual HTTP error payloads before/after: the added message prefix is the only payload difference. - Executed the unmodified [Pi overflow classifier](https://github.com/earendil-works/pi/blob/6fb2e7815167e6b19006fc526d1a5d0f5f998787/packages/ai/src/utils/overflow.ts) at `6fb2e7815167e6b19006fc526d1a5d0f5f998787` (package version 1.1.0, source blob `2c0a5dc6e7f51a092545e0304248d7f264a03c98`) using Node 24.19.0. All 48 baseline message forms were unrecognized; all 48 fixed forms were recognized (24 HTTP payloads, each as bare and HTTP-400-prefixed text). Two unrelated-error negative controls remained false. - Production AST comparison is identical after removing the two added prefixes. ## Test limits `python -m unittest discover -s serve -p 'test_*.py' -q` ran 596 tests with one error and 11 skips. The error is `test_server.AmdTelemetry.test_readings`: this host returns `None` from `psutil.disk_io_counters()`, causing `AttributeError: 'NoneType' object has no attribute 'read_bytes'` at `serve/telemetry.py:311`. The same error reproduces on untouched `fb58e0d` with `python -m unittest serve.test_server.AmdTelemetry.test_readings -v`. No shim was applied. Validation establishes recognition by that pinned Pi classifier. It does not exercise a full Pi agent compaction/retry cycle; the issue does not specify its Pi version.
No site
Links install, modelos, releases.