[PR #1675] [CLOSED] serve: say llama.cpp's phrase in the context-overflow 400 (#1615) #3602

Closed
opened 2026-11-07 15:29:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1675
Author: @nekomario28
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix-1615-overflow-phrase


📝 Commits (1)

  • bbfe6fe serve: say llama.cpp's phrase in the context-overflow 400 (#1615)

📊 Changes

2 files changed (+9 additions, -2 deletions)

View changed files

📝 serve/server.py (+6 -2)
📝 serve/test_server.py (+3 -0)

📄 Description

Fixes #1615.

Agent harnesses detect a context overflow by matching the error text against the phrases servers already use (llama.cpp's exceeds the available context size, OpenAI's exceeds the context window, context_length_exceeded, ...). Strata's two refusal messages matched none, so a prompt bigger than the context failed the turn instead of running the client's compact-and-retry.

Change

Both ValueErrors keep their wording and guidance and now also carry llama.cpp's phrase: the request exceeds the available context size. Docs and tests match the kept prefix (exceeds the context), so nothing else had to move.

Not done (the issue marks it optional): llama.cpp's "type": "exceed_context_size_error" + n_prompt_tokens/n_ctx fields — the emit sites all share the plain invalid_request_error shape and the text alone is enough for the reporter's matcher; happy to add the typed error if you'd like it.

Test plan

  • Extended test_explicit_budget_over_the_context_is_rejected (OpenAI + Anthropic 400s) and the room < 1 branch test to assert the phrase.
  • serve.test_server.MaxTokens + VisionTempFiles: 13 tests pass.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1675 **Author:** [@nekomario28](https://github.com/nekomario28) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-1615-overflow-phrase` --- ### 📝 Commits (1) - [`bbfe6fe`](https://github.com/Niko1221/Strata/commit/bbfe6fe67497e3cccbb75ec20976c2dea2ace913) serve: say llama.cpp's phrase in the context-overflow 400 (#1615) ### 📊 Changes **2 files changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+6 -2) 📝 `serve/test_server.py` (+3 -0) </details> ### 📄 Description Fixes #1615. Agent harnesses detect a context overflow by matching the error text against the phrases servers already use (llama.cpp's `exceeds the available context size`, OpenAI's `exceeds the context window`, `context_length_exceeded`, ...). Strata's two refusal messages matched none, so a prompt bigger than the context failed the turn instead of running the client's compact-and-retry. ## Change Both `ValueError`s keep their wording and guidance and now also carry llama.cpp's phrase: `the request exceeds the available context size`. Docs and tests match the kept prefix (`exceeds the context`), so nothing else had to move. Not done (the issue marks it optional): llama.cpp's `"type": "exceed_context_size_error"` + `n_prompt_tokens`/`n_ctx` fields — the emit sites all share the plain `invalid_request_error` shape and the text alone is enough for the reporter's matcher; happy to add the typed error if you'd like it. ## Test plan - Extended `test_explicit_budget_over_the_context_is_rejected` (OpenAI + Anthropic 400s) and the `room < 1` branch test to assert the phrase. - `serve.test_server.MaxTokens` + `VisionTempFiles`: 13 tests pass. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3602
No description provided.