Repository navigation
fix: surface DSH no-output-ceiling degraded budget on user-visible surfaces (#2904) - #2922
Merged
Merged
Conversation
…rfaces (#2904) A user custom model whose host never declared an output ceiling leaves all four sources of resolveKnownOutputCeiling empty (#1840), so restoreOutputBudget lifts a client-starved budget to a poisoned session high-water mark and every turn truncates at max-tokens. The only prior signal was a once-per-model log warn invisible to GUI hosts (#1158). - track the no-ceiling degraded state in restoreOutputBudget (single slot, last-model-wins); clear it when a ceiling appears or the active model's own budget recovers to a healthy value - surface it persistently on the /acp panel, the Web UI session page, and the /__bili/status JSON (outputBudgetDegraded); disappears when resolved - extend degenerateTurnWarning to length/max-output terminations that left nothing visible (log-only, no forwarded-byte change); wire the responses adapter's response.incomplete branch into it - document the DSH declaration-gated maxOutput reporting contract and its DSH-side fix home (TECHNICAL-NOTES.md + boundary note at dsh-native.ts) Closes #2904
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3260-pr.2922.50b64b3This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2922.tgz
npm install -g packageInstall instructions are refreshed on each push. |
added 2 commits
October 12, 2026 19:31
- OutputBudgetDegradedState was exported but referenced only inside side-request.ts, tripping the unused-exports gate (which then skipped the test + static-gates jobs); make it module-local. - soften the three user-facing strings: the marker value is the restored target (can be mid-range, not always ~249), so state replies 'may be cut off at the output limit' instead of asserting truncation, and note there is no authoritative ceiling backing the client estimate.
The outputBudgetDegraded field lives on /__bili/plugin/status?conversationId= (and the Web UI data source /__bili/sessions/<id>/detail), not on the instance-level /__bli/status. Correct the route in TECHNICAL-NOTES.md and the side-request.ts comment so readers don't look at the wrong endpoint. Docs + comment only, no functional change.
Owner
Author
PR review 收工结论(详细八问见 #2904 主线程;本 PR 即其交付物)。 做了什么
现状 / 结果
|
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.326-master.bfbdb23 # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2904 — DSH long session switched to a user custom model with no declared output ceiling (
deepseek-flash) → output budget restored to ~249 tokens → every turn reasoning-only, stopping atlength/max-tokens.Root cause. When all four sources of
resolveKnownOutputCeiling()are empty (no models.dev entry, no bili-configuredoutput, host never reportedmaxOutput),restoreOutputBudget()lifts a client-starved budget (<=200, driven down by DSH's raw-history estimate) to the session high-water mark — which on a long session has decayed to a poisoned low value. There is no floor. Model switching merely exposes it (a model with a known ceiling masks the poisoned water by flooring above it). The only prior signal was a once-per-model log warn, invisible to GUI hosts (#1158).This PR makes that degraded state visible and diagnosable; it does not change what bytes are forwarded.
Changes
src/server/side-request.ts):restoreOutputBudgetrecords a single-slotoutputBudgetDegraded {model, value, ts}onsession.metadatawhen it restores a starved budget with no known ceiling; clears it as soon as a ceiling appears or the active model's own budget recovers to a healthy (>200) value. Last-model-wins./acppanel line, Web UI session-detail banner, and the/__bili/plugin/status?conversationId=JSON fieldoutputBudgetDegraded.src/degenerate-turn.ts,src/loop/adapter-responses.ts):degenerateTurnWarningnow also fires for max-output terminations (length/max_tokens/MAX_TOKENS/incomplete/max_output_tokens) that left zero visible text and zero tool calls; the responses adapter's previously-silentresponse.incompletebranch feeds it. Log-only — no forwarded-byte change.TECHNICAL-NOTES.md+ boundary note atsrc/agent/dsh-native.ts): documents that DSH reportsmaxOutputonly when the model item explicitly declaresmaxTokens(provider defaults are not forwarded), why an undeclared custom model empties the ceiling chain, and that the real fix home is DSH-side (report its configured default).Behavior changes (disclosed)
/__bili/plugin/status?conversationId=JSONoutputBudgetDegraded(nullor{model,value,ts}); no existing field changedsession.metadatapersistenceoutputBudgetDegraded; survives restart; absent when healthy/acppanelOUTPUT BUDGET:line only while the active model is degraded[degenerate-turn] ... (max-output)warn class for truncated nothing-visible turnswriteOutputBudgettarget computation untouchedNo built-in quota floor added (#1842 decision preserved). No per-model budget isolation.
Config surface
None. No new config fields, env vars, or CLI flags.
Tests
tests/side-request-isolation.test.ts: regression test for the degraded-state lifecycle (set / clear-on-ceiling / clear-on-healthy / last-model-wins / born-dead verbatim-forward value).tests/tag-echo.test.ts:degenerateTurnWarningmax-output branch across provider reason vocabularies; guards (text/tool-call presence, non-limit reasons) still suppress.The immediate user workaround remains setting
maxTokenson the model item (or declaringproviders.<url>.models.<model>.outputin bili config); this PR does not remove the need for it — it makes the missing ceiling visible instead of silent.Closes #2904