Repository navigation
[PR] fix(plugin): tag-echo degenerate retry now forbids the render tags (#7440) - #7441
ranxianglei wants to merge 2 commits into
Conversation
…7440) MODEL-FACING TEXT CHANGE: adds one new model-visible nudge (DEGENERATE_RETRY_NUDGE_TAG_ECHO) for the tag-echo degenerate-retry shape. The existing generic DEGENERATE_RETRY_NUDGE is byte-unchanged and still used for every other shape. When a model conditioned on tagged history emits ONLY <acp> render tags, the tag-echo filter empties the turn and the one-shot degenerate retry re-issues with the generic continuation nudge — which never mentions the tags. The model repeats the echo, the retry degenerates too, the pipe emits the #870 fatal error, and the host re-requests the same prompt into a loop (39 consecutive degenerate turns reported on gemini-4-neon-xhigh via the OpenCode chat-completions lane). The pipe now tells the refetch WHY the turn was empty via a hint (ContinuationRetryHint.sawStrippedEcho); the refetch picks the matching nudge: - tag-echo shape (only output was a stripped render tag): the new DEGENERATE_RETRY_NUDGE_TAG_ECHO, which names the discarded tags and forbids them — the one signal the model needs to break the echo. - every other degenerate shape (silent thought, draft/announce tail, zero-byte cut, reasoning-only cut): the unchanged generic nudge. Applies to both plugin pipes (chat + responses). The retry body still merges the nudge into the last user turn (cache-proof contract intact); only the nudge TEXT changes, and only for the tag-echo shape. Regression tests: the pipe passes the hint on a tag-echo turn and NOT on a silent-thinking turn; injectContinuationNudge / makeContinuationRefetch ship the tag-forbidding nudge on the wire when the hint is set and the generic nudge when it is absent; cache-proof pins the tag-echo nudge in the end-to-end refetch. Fixes #7440
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11170-pr.7441.ea08a86This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7441.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review supplement for the #7440 fix: the pipe-level hint tests only covered the chat pipe. The responses pipe (pipePluginResponsesWithStrip) carries the byte-identical hint line and the PR claims both pipes, so pin the positive direction there too: a tag-only echo turn passes {sawStrippedEcho: true} to the refetch.
(ai: vllm-qwen/qwen3.8-27b) Review of PR #7441 — pulled the branch, read the full diff against the pipe code, ran the targeted suites locally, and checked CI. Verdict: mergeable (human merge), pending CI on the new head. 查重 (dedup): 不重复 — the only open [PR] row targeting #7440 is this one. The sibling degenerate-retry PRs are distinct mechanisms: #5897 (opt-in switch + neutral wording), #6993 (terminal reachability / escape hatch), #4785 (draft-tail nudge wording), #7417 (turn-bleed, sibling of #7416). This PR (nudge selection by shape) is orthogonal to all of them; all four are still open, so no rebase pressure yet. Labels: mirror issue labeled on pickup (bug, opencode, p2, pr, scope/wiring); the GitHub PR already carries bug / p2 / scope/wiring / opencode. Verification① Direction. The fix targets the right layer. The retry mechanism itself works (one-shot retry, #870 fatal on second degeneration); the gap is that the refetch cannot tell why the turn was empty, so the tag-echo shape gets a nudge that never mentions the tags. Fixing nudge selection at the decision point (the pipe knows ② Regression review — existing behaviors on the touched paths, item by item:
③ Code. Clean. ④ Test quality. The new tests have teeth: both directions of the hint at the pipe level, both directions of the nudge selection at the wire level (real HTTP body capture), and the cache-proof end-to-end pin. Not tautologies — each would fail if the hint wiring or the nudge selection regressed. ⑤ Diff. 4 files, +170/−14, every line on-topic; no lockfile/generated churn, no unrelated changes. Review supplement (小问题直接修)One gap found in review, fixed on the spot as a labeled test-only commit:
CI
|
DEGENERATE_RETRY_NUDGE_TAG_ECHO) for the tag-echo degenerate-retry shape. The existing genericDEGENERATE_RETRY_NUDGEis byte-unchanged and still used for every other shape.What broke
When a model conditioned on tagged history emits only
<acp>render tags, the tag-echo filter empties the turn and the one-shot degenerate retry re-issues with the generic continuation nudge — which never mentions the tags. The model repeats the echo, the retry degenerates too, the pipe emits the #870 fatal error, and the host re-requests the same prompt into a loop (39 consecutive degenerate turns reported ongemini-4-neon-xhighvia the OpenCode chat-completions lane, #7440).The fix
The pipe now tells the refetch why the turn was empty via a hint (
ContinuationRetryHint.sawStrippedEcho); the refetch picks the matching nudge:DEGENERATE_RETRY_NUDGE_TAG_ECHO, which names the discarded tags and forbids them — the one signal the model needs to break the echo.Applies to both plugin pipes (chat + responses). The retry body still merges the nudge into the last user turn (cache-proof contract intact); only the nudge text changes, and only for the tag-echo shape.
Regression tests
injectContinuationNudge/makeContinuationRefetchship the tag-forbidding nudge on the wire when the hint is set and the generic nudge when it is absent.cache-proofpins the tag-echo nudge in the end-to-end refetch (its degenerate case is a tag-only echo).Notes
tag-echostrips<acp>tags in hallucinated\nuser\n<acp ...>turn bleed but forwards fake user prompt and trailingfunctionCalls #7416 / PR [PR] fix(loop): drop hallucinated turn-bleed tail in tag-echo filter #7417.Closes #7440