[PR #2959] [CLOSED] fix: ignore unrenderable optional prefix heads #4363

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2959
Author: @Tsury
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: fix/optional-prefix-template


📝 Commits (1)

  • abf37e3 fix: ignore unrenderable optional prefix heads

📊 Changes

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

View changed files

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

📄 Description

A valid conversation can return HTTP 400 when strata_prefix renders a partial head that the model template rejects. For example, a system message followed by a user message is valid, but {"messages": 1} renders only the system message. Templates requiring a user query raise TemplateRequestError: No user query found in messages. The same problem affects character prefixes ending in the system message.

Catch TemplateRequestError only while rendering the optional head and ignore that unusable prefix, as resolve_prefix already promises. Full-request template validation and malformed prefix errors remain unchanged. Requests without strata_prefix take the existing path. This also applies alongside #2874; the repair does not depend on its image support.

Validation on main 477ac13cbe8e582c20484871ce459d20d82df09d: the new regression fails before the fix with the template error, then all six SharedPrefix tests pass. It checks both message/character forms, unchanged prepared tokens, the diagnostic, and continued rejection of invalid full requests. A separate local check alongside #2874 covers text/image requests; 13 SharedPrefix/ImageMarkers tests pass. Python only; no native backend changed.


🔄 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/2959 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/optional-prefix-template` --- ### 📝 Commits (1) - [`abf37e3`](https://github.com/Niko1221/Strata/commit/abf37e3ff299a9ab7837e4c3a6e97b30ad9d2504) fix: ignore unrenderable optional prefix heads ### 📊 Changes **2 files changed** (+27 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+6 -2) 📝 `serve/test_server.py` (+21 -0) </details> ### 📄 Description A valid conversation can return HTTP 400 when `strata_prefix` renders a partial head that the model template rejects. For example, a system message followed by a user message is valid, but `{"messages": 1}` renders only the system message. Templates requiring a user query raise `TemplateRequestError: No user query found in messages.` The same problem affects character prefixes ending in the system message. Catch `TemplateRequestError` only while rendering the optional head and ignore that unusable prefix, as `resolve_prefix` already promises. Full-request template validation and malformed prefix errors remain unchanged. Requests without `strata_prefix` take the existing path. This also applies alongside #2874; the repair does not depend on its image support. Validation on main `477ac13cbe8e582c20484871ce459d20d82df09d`: the new regression fails before the fix with the template error, then all six `SharedPrefix` tests pass. It checks both message/character forms, unchanged prepared tokens, the diagnostic, and continued rejection of invalid full requests. A separate local check alongside #2874 covers text/image requests; 13 `SharedPrefix`/`ImageMarkers` tests pass. Python only; no native backend changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:35:09 +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#4363
No description provided.