[PR #3234] [CLOSED] [Engine] loop guard: recover on the sampling raise when no effort sentence is there to splice #4515

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3234
Author: @Yunado
Created: 10/19/2026
Status: ❌ Closed

Base: main ← Head: loop-guard-low-recovery


📝 Commits (1)

  • 6714bad serve: recover a repeated reasoning on the sampling raise when no effort sentence matches

📊 Changes

2 files changed (+15 additions, -7 deletions)

View changed files

📝 docs/DETAILS.md (+5 -2)
📝 serve/server.py (+10 -5)

📄 Description

The problem and the result. "reasoning_loop_recovery": "recover" detects a repeated reasoning and then does nothing when the prompt carries no effort sentence to swap: a low-effort request, or a client that sends no effort sentence at all, leaves focused_recovery_prompt returning None and the caller (if recover_prompt is not None: break) silently keeps generating. A production loop at low burned 29,476 output tokens with reasoning_recoveries=0 while the detector itself reported coverage 1.0. With this change such a run recovers on the sampling raise the resume block already performs (temperature to at least 1.0, presence penalty to at least 1.5): it resumes from the same ids with no splice.

The approach. serve/server.py, three hunks in the guarded block: a spliced init next to looped; when focused_recovery_prompt returns None, recover_prompt becomes ids + generated, spliced goes False, and the loop breaks the same way a splice does; the recovery line in the server window says "on the sampling raise alone" instead of the low-effort-instruction wording. docs/DETAILS.md: the recover bullet says the splice needs the exact xhigh sentence, and without it the resume is the sampling raise alone. The xhigh splice, "stop" and the default path (both keys off) are byte-identical; requests with images never took the recovery and still do not.

Validation.

  • passed: py_compile on serve/server.py; two assertions on a fake tokenizer (one id per character, one special token): focused_recovery_prompt returns None for a low-effort render (the trigger of the new branch), and the xhigh splice is unchanged (low in, xhigh out).
  • failed: none.
  • not run: a live looped session end to end (the changed behavior is the live resume itself; it needs a real looped generation with a server).

Limits. At low there is no sentence left to splice down to, so the sampling raise is the only lever; if it does not break the loop the request finishes as "length" as it does today. The change is behind the existing opt-in key and cannot fire when it is off.

Environment: e88ee39d (v0.2.0-beta-12), Windows 11 Pro, Python 3.12.0, RTX 5090.


🔄 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/3234 **Author:** [@Yunado](https://github.com/Yunado) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `loop-guard-low-recovery` --- ### 📝 Commits (1) - [`6714bad`](https://github.com/Niko1221/Strata/commit/6714bad63ae900e132339904df4c58ceae0a7f14) serve: recover a repeated reasoning on the sampling raise when no effort sentence matches ### 📊 Changes **2 files changed** (+15 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+5 -2) 📝 `serve/server.py` (+10 -5) </details> ### 📄 Description **The problem and the result.** ``"reasoning_loop_recovery": "recover"`` detects a repeated reasoning and then does nothing when the prompt carries no effort sentence to swap: a low-effort request, or a client that sends no effort sentence at all, leaves ``focused_recovery_prompt`` returning None and the caller (``if recover_prompt is not None: break``) silently keeps generating. A production loop at low burned 29,476 output tokens with ``reasoning_recoveries=0`` while the detector itself reported coverage 1.0. With this change such a run recovers on the sampling raise the resume block already performs (temperature to at least 1.0, presence penalty to at least 1.5): it resumes from the same ids with no splice. **The approach.** ``serve/server.py``, three hunks in the guarded block: a ``spliced`` init next to ``looped``; when ``focused_recovery_prompt`` returns None, ``recover_prompt`` becomes ``ids + generated``, ``spliced`` goes False, and the loop breaks the same way a splice does; the recovery line in the server window says "on the sampling raise alone" instead of the low-effort-instruction wording. ``docs/DETAILS.md``: the recover bullet says the splice needs the exact xhigh sentence, and without it the resume is the sampling raise alone. The xhigh splice, ``"stop"`` and the default path (both keys off) are byte-identical; requests with images never took the recovery and still do not. **Validation.** - passed: ``py_compile`` on serve/server.py; two assertions on a fake tokenizer (one id per character, one special token): ``focused_recovery_prompt`` returns None for a low-effort render (the trigger of the new branch), and the xhigh splice is unchanged (low in, xhigh out). - failed: none. - not run: a live looped session end to end (the changed behavior is the live resume itself; it needs a real looped generation with a server). **Limits.** At low there is no sentence left to splice down to, so the sampling raise is the only lever; if it does not break the loop the request finishes as "length" as it does today. The change is behind the existing opt-in key and cannot fire when it is off. **Environment**: e88ee39d (v0.2.0-beta-12), Windows 11 Pro, Python 3.12.0, RTX 5090. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:36 +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#4515
No description provided.