diff --git a/docs/configuration.ja.md b/docs/configuration.ja.md index d4db72f588..25b595708d 100644 --- a/docs/configuration.ja.md +++ b/docs/configuration.ja.md @@ -289,6 +289,7 @@ | `compress.nudgeDecisionMaxTokens` | number | 200 | — | nudgeModelDecided が使用するモデル決定サイドコールの出力予算(トークン数)。0 より大きい必要がある。 | | `compress.requireNudge` | boolean | off (unset) | — | 無促のモデル主導圧縮の禁止 (#5683/#5943):NUDGE CREDIT がライブでない限り、compress 呼び出しは拒否される — 最後にモデルに実際に到達した圧縮ナッジ(助言、決定ディレクティブ、緊急注入はすべて発行;"gated"/"vetoed"/"skipped" は発行しない)によって発行された 20 モデルラウンドのウィンドウ。各新しい注入で更新され、ナッジされないモデルラウンドごとに 1 ずつ減衰する(非モデルリクエスト形状はそれをオープンに保つ)。成功した折りたたみはクレジットを消費しないため、ナッジの推奨クリーンアップを複数ラウンドにわたって完了することは依然として合法である。拒否は、折りたたむ代わりにモデルにエラーレシートを送る。bili 自身のオーバーフローバックストップ折りたたみは免除される。自分で折りたたむモデル(例: qwen 27b)向け;プロバイダー/モデルごとにスコープを限定できる。明示的に有効化されない限りオフ。 | | `compress.requireRecommendation` | boolean | off (unset) | — | 範囲外のモデル主導圧縮の禁止 (#5683):提出されたすべての範囲は、bili が現在折りたたみを推奨している範囲内に留まらなければならない — ナッジテキストと acp_status が示すのと同じライブ折りたたみ可能セット(存在する場合、このリクエストの準備時オファー、それ以外の場合はライブ再計算)。判定はカバレッジによる:推奨スパンの細分化は合格し、アクティブなブロックにすでに折りたたまれたメッセージ(既存のサマリーを更新する再折りたたみ)は免除される。他のライブメッセージを含む範囲は、問題のあるスパンを特定するエラーレシートとともに全体として拒否される。明示的に有効化されない限りオフ。 | +| `compress.postComPressTail` | boolean | off (unset) | — | 圧縮成功レシート内での「続けて折りたたむ」推奨 (#7318):残り折りたたみ可能範囲リストと『Uncovered history remains』監査ノートを印刷するのは有効化時のみ;デフォルト OFF では両方とも出ない(コンテキスト最小停止シグナルには影響なし)。有効化時は、未カバー履歴ノットはナッジ注入サイクルごとに最大 1 回のみ発火し、新しい注入が再オープンする (#6522/#6526)。レシート毎の再推奨が明示的な停止要求を無視した無限折りたたみループを誘発したためデフォルト OFF。 | | `compress.streamSummary` | boolean | false (unset) | — | 事前チェックの要約を、最初の試行からストリーミング(SSE)コールとして実行することを強制する。エラー駆動の自己学習は、ストリーミングを強制するアップストリームを独自に処理する(非ストリーミング要約での 400 はワンショット SSE プローブをトリガーする、#2494)が、ゲートウェイタイムアウト(例: Cloudflare HTTP 524)では決してアームしない:bili とオリジンの間にそのようなゲートウェイがある場合にこれを設定するか、単に 1 回のプローブ往復をスキップするために設定する。 | | `compress.preserveRecentMessages` | number | 3 | — | 最新のメッセージは、折りたたみからソフト保護される。 | | `compress.preserveRecentTokens` | number | kernel ≈5000 | — | 最新のトークンはフォールドからソフト保護される。 | diff --git a/docs/configuration.md b/docs/configuration.md index b689c12494..3f09486717 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -292,6 +292,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed | `compress.nudgeDecisionMaxTokens` | number | 200 | — | Output budget (tokens) of the model-decision side call used by nudgeModelDecided. Must be > 0. | | `compress.requireNudge` | boolean | off (unset) | — | Forbid UNPROMPTED model-initiated compression (#5683/#5943): a compress call is refused unless a NUDGE CREDIT is live — a window of 20 MODEL rounds minted by the last compression nudge that actually reached the model (advisory, decide-directive and emergency injections all mint; "gated"/"vetoed"/"skipped" never do), refreshed by each new injection and decayed one per un-nudged model round (non-model request shapes hold it open). Successful folds do NOT consume the credit, so finishing a nudge's recommended cleanup over several rounds stays legal. Refusal sends the model an error receipt instead of folding; bili's own overflow backstop folds are exempt. For models that fold on their own (e.g. qwen 27b); can be scoped per provider/model. Off unless explicitly enabled. | | `compress.requireRecommendation` | boolean | off (unset) | — | Forbid OUT-OF-BOUNDS model-initiated compression (#5683): every submitted range must stay within what bili currently recommends folding — the same live compressible set the nudge text and acp_status show (this request's prepare-time offer when present, else a live recompute). Judgment is by COVERAGE: subdividing a recommended span passes, and messages already folded into active blocks (refolds updating an existing summary) are exempt. A range carrying any other live message is refused whole with an error receipt naming the offending span(s). Off unless explicitly enabled. | +| `compress.postComPressTail` | boolean | off (unset) | — | Recommend 'fold more' inside the SUCCESS compress receipt (#7318): the remaining-offer range list and the 'Uncovered history remains' audit note are printed only when enabled; off by default the receipt carries neither (the context-minimum stop signal is unaffected). When enabled, the uncovered-history note fires at most once per nudge-injection cycle and a fresh injection re-opens it (#6522/#6526). Off because per-receipt re-recommendation drove models into endless fold loops against explicit stop requests. | | `compress.streamSummary` | boolean | false (unset) | — | Force preflight summarization to run as a streaming (SSE) call from the first attempt. The error-driven self-learn handles stream-mandating upstreams on its own (any 400 on a non-streaming summary triggers a one-shot SSE probe, #2494) but NEVER arms on gateway timeouts (e.g. Cloudflare HTTP 524): set this where such a gateway sits between bili and the origin, or simply to skip the one probe round-trip. | | `compress.preserveRecentMessages` | number | 3 | — | The most recent messages stay soft-protected from folds. | | `compress.preserveRecentTokens` | number | kernel ≈5000 | — | The most recent tokens stay soft-protected from folds. | diff --git a/docs/configuration.zh-CN.md b/docs/configuration.zh-CN.md index 0f6f411e39..f6d7adfbec 100644 --- a/docs/configuration.zh-CN.md +++ b/docs/configuration.zh-CN.md @@ -292,6 +292,7 @@ | `compress.nudgeDecisionMaxTokens` | number | 200 | — | nudgeModelDecided 所用模型决策 side call 的输出预算(token)。必须 > 0。 | | `compress.requireNudge` | boolean | off (unset) | — | 禁止未提示的模型主动压缩(#5683/#5943):只有 nudge 信用存活时才允许 compress——即距最近一次真正送达模型的压缩提醒不超过 20 个 MODEL 轮的窗口(advisory、模型自决指令、紧急提醒都算铸券;"gated"/"vetoed"/"skipped" 不算);每次新注入刷新窗口,每个未提示的模型轮衰减 1(非模型请求形态既不刷新也不衰减)。成功折叠**不消耗**信用,分几轮压完 nudge 推荐的剩余范围仍然合法。否则拒绝并回错误回执;bili 自己的溢出兜底折叠不受影响。针对会自行乱压的模型(如 qwen 27b),可按 provider/model 单独开启。默认关闭。 | | `compress.requireRecommendation` | boolean | off (unset) | — | 禁止越界的模型主动压缩(#5683):提交的每个范围必须落在 bili 当前推荐折叠的集合内——即 nudge 文案与 acp_status 展示的同一份实时可压缩列表(有本轮 prepare 快照用快照,否则实时重算)。按「覆盖」判定而非精确相等:把推荐跨度拆小段通过;已折进活跃块的消息豁免(重折已有块更新摘要合法)。范围里含任何其他仍存活的消息则整体拒绝,回执点名越界跨度并指向 acp_status。默认关闭。 | +| `compress.postComPressTail` | boolean | off (unset) | — | 在压缩成功回执里推荐「继续压缩」(#7318):剩余可折叠范围列表与「Uncovered history remains」审计提示仅在开启时打印;默认关闭时两者都不出现(上下文已到底的停止信号不受影响)。开启后,未覆盖历史提示每个 nudge 注入周期最多发一次,新注入会重新打开(#6522/#6526)。之所以默认关闭:回执里反复推荐曾驱使模型无视用户停止指令无限折叠。 | | `compress.streamSummary` | boolean | false (unset) | — | 强制 preflight 摘要从首次尝试起就走流式(SSE)请求。要求流式的上游现在由错误驱动自学习自动处理(非流式摘要的任何 400 都会触发一次性 SSE 探测,#2494),但网关超时(如 Cloudflare HTTP 524)永远无法触发自学习:在此类网关位于 bili 与源站之间时设置此项,或用于省去一次探测往返。 | | `compress.preserveRecentMessages` | number | 3 | — | 最近的消息软保护、免于折叠。 | | `compress.preserveRecentTokens` | number | kernel ≈5000 | — | 最近的 token 软保护、免于折叠。 | diff --git a/src/compress-settings.ts b/src/compress-settings.ts index 687f10f32d..8fccde8f36 100644 --- a/src/compress-settings.ts +++ b/src/compress-settings.ts @@ -81,6 +81,7 @@ export function mergeCompress( nudgeDecisionMaxTokens: pick("nudgeDecisionMaxTokens"), requireNudge: pick("requireNudge"), requireRecommendation: pick("requireRecommendation"), + postComPressTail: pick("postComPressTail"), preserveRecentMessages: pick("preserveRecentMessages"), preserveRecentTokens: pick("preserveRecentTokens"), minCompressRangeChars: rangeOf(model) ?? rangeOf(provider) ?? rangeOf(global), diff --git a/src/config.ts b/src/config.ts index d5cba295e0..31c4c0cd00 100644 --- a/src/config.ts +++ b/src/config.ts @@ -339,6 +339,23 @@ export type CompressSettings = { * offending span(s). Host-only; off unless explicitly enabled at some * level. Deepest level wins PER FIELD across global → provider → model. */ requireRecommendation?: boolean; + /** #7318: the model-visible "fold more" recommendation in the SUCCESS + * compress receipt — the remaining-offer range list (with the one-call + * hint) after a partial fold, and the "Uncovered history remains" audit + * note, which fires at most once per nudge-injection cycle (#6522). When + * false or absent (DEFAULT) the success receipt carries no fold + * recommendation at all: only the verbatim "No compressible ranges + * remain" stop signal when the offer is genuinely exhausted (and honest + * silence while material uncovered mass remains, #4331). Off by default + * because per-receipt re-recommendation drove models into endless fold + * loops against explicit user stop requests (#7318: 200+ folds in one + * night; #6522/#5872 same family), each fold rewriting the context + * prefix and re-billing the prompt-cache tail. The per-turn growth nudge + * (KDD #8, `compress.injectNudge`) is a separate channel and is NOT + * affected by this knob. Host-only (never passed to the kernel); opt-in. + * Deepest level wins PER FIELD across global → provider → model, like + * every other compress field. */ + postComPressTail?: boolean; /** Trailing messages never offered for compression * (kernel `preserveRecentMessages`). */ preserveRecentMessages?: number; @@ -2564,7 +2581,7 @@ const KNOWN_TOP_LEVEL_KEYS = new Set([ const COMPRESS_SETTING_FIELDS = new Set([ "modelContextLimit", "maxContextLimit", "emergencyThresholdPercent", "nudgeGrowthTokens", "minPressureBenefitTokens", "requireUsageSampleForPressure", "maxEstimateHoldRounds", "tierNudgeTokens", "nudgeModelDecided", "nudgeDecisionMaxTokens", - "requireNudge", "requireRecommendation", + "requireNudge", "requireRecommendation", "postComPressTail", "preserveRecentMessages", "preserveRecentTokens", "minCompressRange", "minCompressRangeChars", "outputHeadroomMaxPct", "tiers", "protectedLatestTools", "protectedTools", @@ -3343,7 +3360,9 @@ export function parseCompressSettings(v: unknown): (CompressSettings & { injectT } // #5683: unprompted/out-of-bounds compression policy gates — plain booleans, // off unless explicitly set (an explicit false at a deeper level disables). - for (const key of ["requireNudge", "requireRecommendation"] as const) { + // #7318: postComPressTail is the same species — plain boolean, off unless + // explicitly enabled (default-off recommendation surface). + for (const key of ["requireNudge", "requireRecommendation", "postComPressTail"] as const) { if (!(key in obj)) continue; if (typeof obj[key] !== "boolean") ok = false; else out[key] = obj[key]; diff --git a/src/server/handle.ts b/src/server/handle.ts index 82b4dc21ce..a3d4e59067 100644 --- a/src/server/handle.ts +++ b/src/server/handle.ts @@ -3394,8 +3394,23 @@ async function handleRequest( nudgeInjected: prepared.nudgeOutcome === "injected", requireNudge: preparedCs?.requireNudge === true, requireRecommendation: preparedCs?.requireRecommendation === true, + postComPressTail: preparedCs?.postComPressTail === true, modelRound: !countTokens && !responsesCompact && !prepared.codexForge && !prepared.threadsLane, }); + // #6522: an ACTUAL injection re-opens the uncovered-history note + // latch (postCompressTail, src/stream.ts). A fresh nudge is a new + // "context is big enough — compress while you are at it" moment, + // so the receipt may note the uncovered runs once more in this + // cycle; folds without a new injection stay silent (anti-nag, + // #6522 loop). Only the post-gate delivery fact "injected" + // resets — the same fact that mints the nudge credit above; + // "gated"/"vetoed"/"skipped" never reached the model and never + // re-open the note. The note itself only exists while + // compress.postComPressTail is on (#7318) — with it off this + // latch is inert. + if (prepared.nudgeOutcome === "injected") { + session.uncoveredReceiptNoted = false; + } // A locally-served codex compaction forge never reaches an // upstream: preflight would burn summarization rounds for a // reply that is already forged (#3008 prompt form). diff --git a/src/session.ts b/src/session.ts index ca5e7cddf3..9754b2811d 100644 --- a/src/session.ts +++ b/src/session.ts @@ -717,6 +717,18 @@ export type Session = { * model keeps re-fetching. Bounded by trimRetrieveCounts; lost on restart * (advisory signal only). */ retrieveCountsByRef?: Map; + /** #6522 in-memory only (NOT persisted): the "Uncovered history remains" + * receipt note has already fired in the current nudge-injection cycle. + * The note fires once per cycle — repeating it after every successful + * fold drove models into an infinite compress→note loop (#6522). Each + * ACTUAL nudge injection (nudgeOutcome === "injected", stamped in + * src/server/handle.ts) re-opens the latch: a fresh nudge is a new + * "big enough, compress while you are at it" moment. The same detail + * stays available on demand via acp_status(scope:"uncompressed"). + * Lost on restart (at most one extra note). #7318: only read while + * compress.postComPressTail is on; with the recommendation off the note + * never fires and the latch is inert. */ + uncoveredReceiptNoted?: boolean; /** In-memory only (NOT persisted): request-only injections riding the * nudge channel. Since the GHSA jc6g v2 rework, acp_retrieve delivers its * full text in the tool result itself — this carrier now only serves diff --git a/src/stream.ts b/src/stream.ts index bd38ae7d71..b074b1d456 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -737,7 +737,21 @@ function postCompressTail(ctx: RewriteCtx, cleanSuccess: boolean, submitted: Arr const remaining = ctx.lastNudge ? base.filter((r) => !submitted.some((s) => spansOverlap(r.startRef, r.endRef, s.startRef, s.endRef))) : base; + // #7318: the receipt's "fold more" recommendation — the remaining-offer + // range list AND the uncovered-history note — is opt-in via + // compress.postComPressTail (default OFF, stamped per round on + // session.transient by src/server/handle.ts). Re-advertising ranges after + // every successful fold drove models into endless fold loops against + // explicit user stop requests (#7318: 200+ folds in one night; #6522 and + // #5872 are the same family), each fold rewriting the context prefix and + // re-billing the prompt cache. The per-turn growth nudge (KDD #8) is a + // separate channel and is untouched by this knob. The verbatim stop + // signal below is NOT part of the recommendation — it stays in both + // modes; with the recommendation off, ranges still outstanding mean the + // receipt says nothing (no list, no "no ranges remain" claim). + const recommend = unpromptedGateOf(ctx.session).postComPressTail; if (remaining.length > 0) { + if (!recommend) return ""; return `\n\nCurrent compressible ranges (use these refs exactly as listed):\n${formatRanges(remaining, [])}\n${ONE_CALL_HINT}`; } // A tier-distillation nudge means block-boundary compress calls (bN..bM) are @@ -766,7 +780,36 @@ function postCompressTail(ctx: RewriteCtx, cleanSuccess: boolean, submitted: Arr const totalMsgs = runs.reduce((s, r) => s + r.count, 0); const totalTok = runs.reduce((s, r) => s + r.tokens, 0); if (totalTok >= UNCOVERED_RECEIPT_FLOOR_TOKENS) { - return `\n\nUncovered history remains — all offered ranges are folded, but ${totalMsgs} msg(s) across ${runs.length} run(s), ${shortTokenCount(totalTok)} tok, sit outside every active block and are not in this call's offer: ${describeUncoveredRuns(runs)}. The context is not at its minimum (runs may sit below the fold-size gate — named for visibility, not as fold suggestions); inspect with acp_status(scope:"uncompressed").`; + // #7318: recommendation off -> honest silence: no re-nag, and + // no "already at its minimum" claim while material mass sits + // uncovered (#4331). + if (!recommend) return ""; + // #6522 anti-nag latch: notify at most ONCE per nudge-injection + // cycle. Re-emitting the note after every subsequent successful + // fold drove models into an infinite compress→note loop — as the + // session grows the newly offered ranges sit INSIDE the big + // uncovered tail run, so each fold split/shrunk a run and a + // span-level "changed set" check still re-fired. The note is + // advisory and the same detail stays available on demand via + // acp_status(scope:"uncompressed") (read-only, no gate), so one + // notice per cycle is enough. Each ACTUAL nudge injection + // (src/server/handle.ts, nudgeOutcome === "injected") re-opens + // the latch: a fresh nudge means the context grew big enough + // again, a new compress-while-you-are-at-it moment. Restart + // resets the latch (in-memory field) — at most one extra note. + if (!ctx.session.uncoveredReceiptNoted) { + ctx.session.uncoveredReceiptNoted = true; + return `\n\nUncovered history remains — all offered ranges are folded, but ${totalMsgs} msg(s) across ${runs.length} run(s), ${shortTokenCount(totalTok)} tok, sit outside every active block and are not in this call's offer: ${describeUncoveredRuns(runs)}. The context is not at its minimum (runs may sit below the fold-size gate — named for visibility, not as fold suggestions); inspect with acp_status(scope:"uncompressed").`; + } + // Latch already fired this cycle but material mass still sits + // uncovered (totalTok >= floor): stay silent, do NOT fall + // through to the "No compressible ranges remain" claim below — + // that would assert the context is at its minimum while a + // >=floor run sits outside every active block (#4331 honesty; + // the pre-#7318 code always returned the note here, never the + // minimum claim). The detail stays available on demand via + // acp_status(scope:"uncompressed"). + return ""; } } } catch { diff --git a/src/unprompted-gate.ts b/src/unprompted-gate.ts index cd88ebc104..c2c94f84ff 100644 --- a/src/unprompted-gate.ts +++ b/src/unprompted-gate.ts @@ -1,7 +1,9 @@ // #5683: unprompted-compression policy gates. Two opt-in knobs // (compress.requireNudge / compress.requireRecommendation) refuse model-initiated // compress calls that bili did not ask for. The per-round FACTS they judge on -// are stamped at prepare (src/server/handle.ts) onto session.transient — +// (plus the #7318 postComPressTail setting, which postCompressTail in +// src/stream.ts reads for the receipt recommendation gate) are stamped at +// prepare (src/server/handle.ts) onto session.transient — // in-memory only, re-stamped every model round — and read here by applyRanges // (src/stream.ts), the single execution point for every model-initiated compress // across all lanes (proxy loop + POST /__bili/plugin/tool). @@ -31,6 +33,10 @@ interface UnpromptedGate { armed: boolean; requireNudge: boolean; requireRecommendation: boolean; + /** #7318: the compress.postComPressTail setting for this route — the + * model-visible "fold more" recommendation in the success receipt + * (remaining-offer range list + uncovered-history note). Default OFF. */ + postComPressTail: boolean; } /** Stamp-side facts, one per prepare. `nudgeInjected` is THIS ROUND'S delivery @@ -41,6 +47,7 @@ interface UnpromptedGateStamp { nudgeInjected: boolean; requireNudge: boolean; requireRecommendation: boolean; + postComPressTail?: boolean; modelRound?: boolean; } @@ -51,9 +58,10 @@ export interface UnpromptedGateState { credit: number; requireNudge: boolean; requireRecommendation: boolean; + postComPressTail: boolean; } -const OFF: UnpromptedGate = { armed: false, requireNudge: false, requireRecommendation: false }; +const OFF: UnpromptedGate = { armed: false, requireNudge: false, requireRecommendation: false, postComPressTail: false }; export function storeUnpromptedGate(session: Session, stamp: UnpromptedGateStamp): void { const t = session.transient ?? (session.transient = {}); @@ -70,6 +78,7 @@ export function storeUnpromptedGate(session: Session, stamp: UnpromptedGateStamp credit: Math.max(0, credit), requireNudge: stamp.requireNudge === true, requireRecommendation: stamp.requireRecommendation === true, + postComPressTail: stamp.postComPressTail === true, }; } @@ -82,5 +91,6 @@ export function unpromptedGateOf(session: Session): UnpromptedGate { armed: Number.isFinite(g.credit) && g.credit > 0, requireNudge: g.requireNudge === true, requireRecommendation: g.requireRecommendation === true, + postComPressTail: g.postComPressTail === true, }; } diff --git a/tests/compress-fingerprint-refold.test.ts b/tests/compress-fingerprint-refold.test.ts index a1dec5c6fe..942e6fdfb5 100644 --- a/tests/compress-fingerprint-refold.test.ts +++ b/tests/compress-fingerprint-refold.test.ts @@ -10,6 +10,7 @@ import type { CompressionState, CoreMessage } from "acp-kernel"; import { assignRefs, createCore, createInitialState, defaultConfig, emptyRefMap } from "acp-kernel"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; import { parseCompressInput } from "../src/compress-tool.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { resolveDecompress } from "../src/decompress-shared.ts"; import { SessionStore, _setStoreForTest } from "../src/persist.ts"; @@ -17,7 +18,7 @@ type Ctx = Omit & { log: (m: string) => void; logs: string[] function makeCtx(): Ctx { const logs: string[] = []; - return { + const ctx: Ctx = { core: createCore(), config: defaultConfig(200000), messages: [] as CoreMessage[], @@ -37,6 +38,10 @@ function makeCtx(): Ctx { log: (m: string) => { logs.push(m); }, logs, }; + // #7318: these tests assert the legacy recommendation tail — opt into + // compress.postComPressTail (default is now OFF). + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); + return ctx; } /** n small alternating messages appended AFTER the case's own turns so every diff --git a/tests/compress-recovery-ranges.test.ts b/tests/compress-recovery-ranges.test.ts index db6d4ae9dd..4591d8b8e5 100644 --- a/tests/compress-recovery-ranges.test.ts +++ b/tests/compress-recovery-ranges.test.ts @@ -6,6 +6,7 @@ import { parseCompressInput } from "../src/compress-tool.ts"; import { SessionStore, _setStoreForTest } from "../src/persist.ts"; import { getSession } from "../src/session.ts"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { liveCompressionRanges } from "../src/acp-status.ts"; function spanContains(start: string, end: string, n: number): boolean { @@ -27,6 +28,8 @@ function makeCtx(count: number, preserveRecentMessages = 5): RewriteCtx { })); const session = getSession(`compress-recovery-${randomUUID()}`); session.state.messageRefs = assignRefs(messages, { existing: emptyRefMap(), nextIndex: 0 }).map; + // #7318: legacy recommendation tail (default is now OFF). + storeUnpromptedGate(session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); return { core: createCore(), config: defaultConfig(200000, { preserveRecentMessages, preserveRecentTokens: 0 }), diff --git a/tests/compress-span-hint.test.ts b/tests/compress-span-hint.test.ts index fe784c456c..6516e771df 100644 --- a/tests/compress-span-hint.test.ts +++ b/tests/compress-span-hint.test.ts @@ -7,6 +7,7 @@ import type { CoreMessage } from "acp-kernel"; import { createCore, createInitialState, defaultConfig, assignRefs, emptyRefMap, deactivateBlock } from "acp-kernel"; import { parseCompressInput } from "../src/compress-tool.ts"; import { applyRanges, compressibleSpanHint, type RewriteCtx } from "../src/stream.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { liveCompressionRanges } from "../src/acp-status.ts"; import { SessionStore, _setStoreForTest } from "../src/persist.ts"; @@ -20,7 +21,7 @@ const MESSAGES = Array.from({ length: 80 }, (_, i) => ({ function makeCtx(): Ctx { const logs: string[] = []; - return { + const ctx: Ctx = { core: createCore(), config: defaultConfig(200000, { preserveRecentMessages: 5, preserveRecentTokens: 0 }), messages: MESSAGES, @@ -40,6 +41,10 @@ function makeCtx(): Ctx { log: (m: string) => { logs.push(m); }, logs, }; + // #7318: these tests assert the legacy recommendation tail — opt into + // compress.postComPressTail (default is now OFF). + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); + return ctx; } /** refs m00001..m00080 + one ACTIVE kernel block covering m00001..m00020 */ diff --git a/tests/compress-success-tail.test.ts b/tests/compress-success-tail.test.ts index fc661fdda2..dff3ef12c2 100644 --- a/tests/compress-success-tail.test.ts +++ b/tests/compress-success-tail.test.ts @@ -4,6 +4,7 @@ import type { CoreMessage, CompressibleRange, NudgeDecision } from "acp-kernel"; import { createCore, createInitialState, assignRefs, emptyRefMap, defaultConfig } from "acp-kernel"; import { parseCompressInput } from "../src/compress-tool.ts"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; // #1387: post-compress success tail — remaining-ranges snapshot (pi #420) and // explicit stop signal (pi #521). Cross-host wording must stay verbatim. @@ -14,7 +15,7 @@ type Ctx = Omit & { log: (m: string) => void; logs: string[] function makeCtx(messages: CoreMessage[], overrides?: Record): Ctx { const logs: string[] = []; - return { + const ctx: Ctx = { core: createCore(), config: defaultConfig(200000, overrides as never), messages, @@ -34,6 +35,10 @@ function makeCtx(messages: CoreMessage[], overrides?: Record): log: (m: string) => { logs.push(m); }, logs, }; + // #7318: these tests assert the legacy recommendation tail — opt into + // compress.postComPressTail (default is now OFF). + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); + return ctx; } function withRefs(ctx: Ctx): Ctx { diff --git a/tests/issue3302-sparse-ref-tombstones.test.ts b/tests/issue3302-sparse-ref-tombstones.test.ts index 1e8127f1d0..8da439105f 100644 --- a/tests/issue3302-sparse-ref-tombstones.test.ts +++ b/tests/issue3302-sparse-ref-tombstones.test.ts @@ -6,6 +6,7 @@ import { parseCompressInput } from "../src/compress-tool.ts"; import { SessionStore, _setStoreForTest } from "../src/persist.ts"; import { getSession, reapDestroyedSubstrate } from "../src/session.ts"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { recordProbeFailures } from "../src/loop/core.ts"; _setStoreForTest(new SessionStore({ enabled: false })); @@ -21,6 +22,8 @@ function makeCtx(count: number, preserveRecentMessages = 5): RewriteCtx & { mess })); const session = getSession(`issue3302-${randomUUID()}`); session.state.messageRefs = assignRefs(messages, { existing: emptyRefMap(), nextIndex: 0 }).map; + // #7318: legacy recommendation tail (default is now OFF). + storeUnpromptedGate(session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); return { core: createCore(), config: defaultConfig(200000, { preserveRecentMessages, preserveRecentTokens: 0 }), diff --git a/tests/issue4227-compression-observability.test.ts b/tests/issue4227-compression-observability.test.ts index cd50ecd24d..3d4d0797b1 100644 --- a/tests/issue4227-compression-observability.test.ts +++ b/tests/issue4227-compression-observability.test.ts @@ -6,6 +6,7 @@ import type { Session } from "../src/session.ts"; import { getCacheLedger } from "../src/cache-ledger.ts"; import { parseCompressInput } from "../src/compress-tool.ts"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { preflightCompress, type PreflightDeps } from "../src/preflight.ts"; import { ConfiguredSummaryPlan } from "../src/external-summary-runtime.js"; @@ -38,7 +39,7 @@ type Ctx = Omit & { log: (m: string) => void; logs: string[] function makeCtx(messages: CoreMessage[], overrides?: Record): Ctx { const logs: string[] = []; - return { + const ctx: Ctx = { core: createCore(), config: defaultConfig(200000, overrides as never), messages, @@ -58,6 +59,10 @@ function makeCtx(messages: CoreMessage[], overrides?: Record): log: (m: string) => { logs.push(m); }, logs, }; + // #7318: these tests assert the legacy recommendation tail — opt into + // compress.postComPressTail (default is now OFF). + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); + return ctx; } function withRefs(ctx: Ctx): Ctx { @@ -178,6 +183,9 @@ test("#4227 wiring: internal-lane receipts judge on the round's own offer, not t pendingRetrievals: [], createdAt: Date.now(), lastSeen: Date.now(), blockContents: new Map(), inFlight: 0, persisted: false, }; session.stats.lastInputTokensSource = "usage"; // usage-grade: statusInputBaseline returns it verbatim + // #7318: the recommendation tail is opt-in (default OFF) — this suite asserts the + // legacy tail, so enable compress.postComPressTail on the wiring session. + storeUnpromptedGate(session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); const logs: string[] = []; const deps: PreflightDeps = { core, session, config, prompts: defaultPrompts, protocol: "responses", diff --git a/tests/issue4331-uncovered-history.test.ts b/tests/issue4331-uncovered-history.test.ts index 24eb374e26..05699717c1 100644 --- a/tests/issue4331-uncovered-history.test.ts +++ b/tests/issue4331-uncovered-history.test.ts @@ -5,6 +5,7 @@ import { assignRefs, coveredMessageIds, createCore, createInitialState, defaultC import { parseCompressInput } from "../src/compress-tool.ts"; import { applyRanges, type RewriteCtx } from "../src/stream.ts"; import { handleAcpStatus } from "../src/acp-status.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; import { describeUncoveredRuns, shortTokenCount, uncoveredHistoryRuns } from "../src/uncovered.ts"; // #4331: "no compressible ranges remain" fired while large mid-history spans sat @@ -23,7 +24,7 @@ type Ctx = Omit & { log: (m: string) => void; logs: string[] function makeCtx(messages: CoreMessage[], overrides?: Record): Ctx { const logs: string[] = []; - return { + const ctx: Ctx = { core: createCore(), config: defaultConfig(200000, overrides as never), messages, @@ -43,6 +44,10 @@ function makeCtx(messages: CoreMessage[], overrides?: Record): log: (m: string) => { logs.push(m); }, logs, }; + // #7318: these tests assert the legacy recommendation tail — opt into + // compress.postComPressTail (default is now OFF). + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); + return ctx; } function withRefs(ctx: Ctx): Ctx { diff --git a/tests/issue7318-post-compress-tail.test.ts b/tests/issue7318-post-compress-tail.test.ts new file mode 100644 index 0000000000..91b1aeb1db --- /dev/null +++ b/tests/issue7318-post-compress-tail.test.ts @@ -0,0 +1,200 @@ +// #7318: the "fold more" recommendation in the SUCCESS compress receipt — the +// remaining-offer range list and the "Uncovered history remains" audit note — +// is opt-in via compress.postComPressTail, DEFAULT OFF. Per-receipt +// re-recommendation drove models into endless fold loops against explicit user +// stop requests (0.1.216: 200+ folds in one night; #6522/#5872 same family). +// Both gate directions are pinned here (#3617): +// OFF (default, no stamp): no range list, no uncovered note, no false +// minimum claim; the verbatim stop signal survives for drained sessions. +// ON (explicit): legacy range list; the uncovered note fires at most once +// per nudge-injection cycle and a fresh ACTUAL injection re-opens it +// (#6522). +import { test } from "node:test"; +import assert from "node:assert/strict"; +import type { CompressibleRange, CoreMessage, NudgeDecision } from "acp-kernel"; +import { assignRefs, createCore, createInitialState, defaultConfig, emptyRefMap } from "acp-kernel"; +import { parseCompressInput } from "../src/compress-tool.ts"; +import { applyRanges, type RewriteCtx } from "../src/stream.ts"; +import { parseCompressSettings } from "../src/config.ts"; +import { mergeCompress } from "../src/compress-settings.ts"; +import { storeUnpromptedGate } from "../src/unprompted-gate.ts"; + +const RANGES_HEADER = "Current compressible ranges (use these refs exactly as listed):"; +const UNCOVERED_HEADER = "Uncovered history remains"; +const NO_RANGES_REMAIN_TEXT = "No compressible ranges remain — the context is already at its minimum; continue the task without compressing."; +const SUMMARY = "SUMMARY-PAYLOAD-LONG-ENOUGH-FOR-THE-KERNEL-SUMMARY-MINIMUM-LENGTH-CHECK-OK"; +const MSGS_PER_TURN = 9; + +type Ctx = Omit & { log: (m: string) => void; logs: string[] }; + +// makeCtx deliberately stamps NOTHING: an unstamped session is the DEFAULT +// configuration (postComPressTail off), which is exactly what this suite pins. +function makeCtx(messages: CoreMessage[], overrides?: Record): Ctx { + const logs: string[] = []; + return { + core: createCore(), + config: defaultConfig(200000, overrides as never), + messages, + session: { + id: "issue7318-test", + meta: {}, + stats: { requests: 0, tokensSaved: 0, inputTokens: 0, cachedTokens: 0, outputTokens: 0, cacheSamples: 0, lastInputTokens: 100000, compressCreditTokens: 0, contextTokens: 0, retrieveCalls: 0, retrieveHits: 0, retrieveMisses: 0, storedBytes: 0, storeBytesSaved: 0, rangeRestores: 0 }, + metadata: {}, + state: createInitialState(), + createdAt: Date.now(), + lastSeen: Date.now(), + blockContents: new Map(), + inFlight: 0, + persisted: false, + pendingRetrievals: [], + }, + log: (m: string) => { logs.push(m); }, + logs, + }; +} + +function withRefs(ctx: Ctx): Ctx { + const res = assignRefs(ctx.messages, { existing: emptyRefMap(), nextIndex: 0 }); + ctx.session.state.messageRefs = res.map; + return ctx; +} + +function enableRecommendation(ctx: Ctx): void { + storeUnpromptedGate(ctx.session, { nudgeInjected: false, requireNudge: false, requireRecommendation: false, postComPressTail: true }); +} + +function runApply(ctx: Ctx, args: unknown): string { + return applyRanges(parseCompressInput(args), ctx).text; +} + +function offerRange(startRef: string, endRef: string, count: number, tokens = 8000): CompressibleRange { + return { startRef, endRef, count, tokens, chars: tokens * 4, toolPct: 0, textPct: 100 }; +} +function setOffer(ctx: Ctx, ranges: CompressibleRange[], tier: number | null = null): void { + ctx.lastNudge = { compressibleRanges: ranges, tier } as unknown as NudgeDecision; +} + +function turnMsgs(turn: number, payloadChars: number, toolName: string): CoreMessage[] { + const id = (k: number) => `t${turn}_${k}`; + const fill = "x".repeat(payloadChars); + return [ + { id: id(0), role: "user", contentType: "text", text: `User request for turn ${turn}. ${payloadChars > 0 ? fill.slice(0, 200) : ""}` }, + { id: id(1), role: "assistant", contentType: "reasoning", text: `Reasoning for turn ${turn}. ${payloadChars > 0 ? fill.slice(0, 200) : ""}` }, + { id: id(2), role: "assistant", contentType: "text", text: `Assistant answer for turn ${turn}. ${fill}` }, + ...[0, 1, 2].flatMap((k): CoreMessage[] => [ + { id: id(3 + k * 2), role: "assistant", contentType: "tool-call", toolName, toolCallId: `tc_${turn}_${k}`, text: JSON.stringify({ input: `${toolName} step-${k} ${fill.slice(0, 600)}` }) }, + { id: id(4 + k * 2), role: "tool", contentType: "tool-result", toolName, toolCallId: `tc_${turn}_${k}`, text: `result of ${toolName} step-${k}: ${fill.slice(0, 600)}` }, + ]), + ]; +} + +function buildSession(turns: number, payloadChars: number, toolName: string): CoreMessage[] { + const out: CoreMessage[] = []; + for (let t = 0; t < turns; t++) out.push(...turnMsgs(t, payloadChars, toolName)); + return out; +} + +const refAt = (i: number) => `m${String(i + 1).padStart(5, "0")}`; +const turnSpan = (fromTurn: number, toTurn: number): { startRef: string; endRef: string } => ({ + startRef: refAt(fromTurn * MSGS_PER_TURN), + endRef: refAt((toTurn + 1) * MSGS_PER_TURN - 1), +}); + +function foldArgs(spans: Array<{ startRef: string; endRef: string }>) { + return { content: spans.map((s) => ({ startId: s.startRef, endId: s.endRef, summary: SUMMARY })) }; +} + +test("#7318 P1 (default OFF): partial fold — no range list, no stop claim, no note", () => { + const ctx = withRefs(makeCtx(buildSession(12, 4000, "bash"), { preserveRecentMessages: 3, preserveRecentTokens: 100 })); + const first = turnSpan(0, 3); + const second = turnSpan(4, 7); + setOffer(ctx, [offerRange(first.startRef, first.endRef, 36), offerRange(second.startRef, second.endRef, 36)]); + const out = runApply(ctx, foldArgs([first])); + assert.ok(out.startsWith("[Compressed"), `expected success receipt, got: ${out.slice(0, 160)}`); + assert.ok(!out.includes(RANGES_HEADER), "off by default: the remaining-offer list must not be re-advised:\n" + out); + assert.ok(!out.includes(NO_RANGES_REMAIN_TEXT), "ranges still outstanding — the stop claim must not fire:\n" + out); + assert.ok(!out.includes(UNCOVERED_HEADER), "no uncovered-history note while the recommendation is off:\n" + out); +}); + +test("#7318 P2 (default OFF): offer exhausted + mid-history hole — honest silence, no note and no false minimum claim", () => { + // 40 turns; fold turns 1..16 and 28..39, leaving turns 17..27 (~10.9K tok) + // as a mid-history hole above the receipt floor. + const ctx = withRefs(makeCtx(buildSession(40, 4000, "bash"), { preserveRecentMessages: 3, preserveRecentTokens: 100 })); + const left = turnSpan(1, 16); + const right = turnSpan(28, 39); + setOffer(ctx, [offerRange(left.startRef, left.endRef, 137), offerRange(right.startRef, right.endRef, 108)]); + const out = runApply(ctx, foldArgs([left, right])); + assert.ok(out.startsWith("[Compressed"), `expected success receipt, got: ${out.slice(0, 160)}`); + assert.ok(!out.includes(UNCOVERED_HEADER), "off by default: no re-nag:\n" + out); + assert.ok(!out.includes(NO_RANGES_REMAIN_TEXT), "no 'already at its minimum' claim while material mass sits uncovered (#4331 honesty):\n" + out); + assert.ok(!out.includes(RANGES_HEADER), "no range list:\n" + out); +}); + +test("#7318 P3 (default OFF): offer exhausted + drained tail — the verbatim stop signal survives", () => { + // 12 turns, fold turns 0..10; the untouched final turn sits exactly inside + // the protected zone, so the audit finds no leakable mass. + const ctx = withRefs(makeCtx(buildSession(12, 4000, "write"), { preserveRecentMessages: 9, preserveRecentTokens: 0 })); + const span = turnSpan(0, 10); + setOffer(ctx, [offerRange(span.startRef, span.endRef, 99)]); + const out = runApply(ctx, foldArgs([span])); + assert.ok(out.startsWith("[Compressed"), `expected success receipt, got: ${out.slice(0, 160)}`); + assert.ok(!out.includes(RANGES_HEADER) && !out.includes(UNCOVERED_HEADER), "no recommendation of any kind:\n" + out); + assert.ok(out.includes(NO_RANGES_REMAIN_TEXT), "the #1387 contract stop signal is NOT part of the recommendation and must survive in off mode:\n" + out); +}); + +test("#7318 N1 (explicit ON): partial fold — the legacy remaining-offer list is restored", () => { + const ctx = withRefs(makeCtx(buildSession(12, 4000, "bash"), { preserveRecentMessages: 3, preserveRecentTokens: 100 })); + enableRecommendation(ctx); + const first = turnSpan(0, 3); + const second = turnSpan(4, 7); + setOffer(ctx, [offerRange(first.startRef, first.endRef, 36), offerRange(second.startRef, second.endRef, 36)]); + const out = runApply(ctx, foldArgs([first])); + assert.ok(out.startsWith("[Compressed"), `expected success receipt, got: ${out.slice(0, 160)}`); + assert.ok(out.includes(RANGES_HEADER), "on: the remaining offer must be listed:\n" + out); + assert.ok(out.includes(second.startRef) && out.includes(second.endRef), "the outstanding span must be named:\n" + out); +}); + +test("#7318 N2 (explicit ON): the uncovered note fires at most once per injection cycle; a fresh injection re-opens it (#6522)", () => { + const ctx = withRefs(makeCtx(buildSession(40, 4000, "bash"), { preserveRecentMessages: 3, preserveRecentTokens: 100 })); + enableRecommendation(ctx); + const left = turnSpan(1, 16); + const right = turnSpan(28, 39); + setOffer(ctx, [offerRange(left.startRef, left.endRef, 137), offerRange(right.startRef, right.endRef, 108)]); + // Fold 1 (offer exhausted) -> the note fires and latches the session. + const out1 = runApply(ctx, foldArgs([left, right])); + assert.ok(out1.startsWith("[Compressed"), `fold 1: ${out1.slice(0, 160)}`); + assert.ok(out1.includes(UNCOVERED_HEADER), "first note expected:\n" + out1); + assert.equal(ctx.session.uncoveredReceiptNoted, true, "latch must be a session field"); + // Fold 2: a span INSIDE the uncovered hole splits the run — the latch keeps + // the receipt quiet (the #6522 loop step). The remaining hole is still + // above the receipt floor, so the receipt must stay SILENT — it must not + // fall through to the "No compressible ranges remain" claim, which would + // assert the context is at its minimum while material mass sits uncovered + // (#4331 honesty; the pre-#7318 code always returned the note here). + const mid = turnSpan(18, 20); + setOffer(ctx, [offerRange(mid.startRef, mid.endRef, 27)]); + const out2 = runApply(ctx, foldArgs([mid])); + assert.ok(out2.startsWith("[Compressed"), `fold 2: ${out2.slice(0, 160)}`); + assert.ok(!out2.includes(UNCOVERED_HEADER), "second fold must not re-nag:\n" + out2); + assert.ok(!out2.includes(NO_RANGES_REMAIN_TEXT), "latched + hole still above floor: honest silence, no false minimum claim (#4331):\n" + out2); + // A fresh ACTUAL nudge injection (nudgeOutcome === "injected" in + // src/server/handle.ts) re-opens the latch — the next qualifying fold may + // note the uncovered runs once more in the new cycle. + ctx.session.uncoveredReceiptNoted = false; + const late = turnSpan(21, 23); + setOffer(ctx, [offerRange(late.startRef, late.endRef, 27)]); + const out3 = runApply(ctx, foldArgs([late])); + assert.ok(out3.startsWith("[Compressed"), `fold 3: ${out3.slice(0, 160)}`); + assert.ok(out3.includes(UNCOVERED_HEADER), "re-opened cycle: the note may fire once more:\n" + out3); +}); + +test("#7318 unit: config surface — parseCompressSettings accepts booleans only, mergeCompress deepest-wins", () => { + assert.equal(parseCompressSettings({ postComPressTail: true })?.postComPressTail, true); + assert.equal(parseCompressSettings({ postComPressTail: false })?.postComPressTail, false); + assert.equal(parseCompressSettings({})?.postComPressTail, undefined, "absent = default off"); + assert.equal(parseCompressSettings({ postComPressTail: "yes" }), undefined, "non-boolean rejects the whole compress block"); + assert.equal(mergeCompress({ postComPressTail: true }, undefined, { postComPressTail: false }).postComPressTail, false, "model level wins over global"); + assert.equal(mergeCompress(undefined, { postComPressTail: true }, undefined).postComPressTail, true, "provider level wins over global"); + assert.equal(mergeCompress({ postComPressTail: true }, undefined, undefined).postComPressTail, true, "global level alone"); + assert.equal(mergeCompress(undefined, undefined, undefined).postComPressTail, undefined, "unset everywhere = off by default"); +}); diff --git a/website/config-reference/compress.yaml b/website/config-reference/compress.yaml index 5215abd1c4..d455fba52d 100644 --- a/website/config-reference/compress.yaml +++ b/website/config-reference/compress.yaml @@ -147,6 +147,17 @@ entries: desc_ja: "範囲外のモデル主導圧縮の禁止 (#5683):提出されたすべての範囲は、bili が現在折りたたみを推奨している範囲内に留まらなければならない — ナッジテキストと acp_status が示すのと同じライブ折りたたみ可能セット(存在する場合、このリクエストの準備時オファー、それ以外の場合はライブ再計算)。判定はカバレッジによる:推奨スパンの細分化は合格し、アクティブなブロックにすでに折りたたまれたメッセージ(既存のサマリーを更新する再折りたたみ)は免除される。他のライブメッセージを含む範囲は、問題のあるスパンを特定するエラーレシートとともに全体として拒否される。明示的に有効化されない限りオフ。" site_en: "Forbid out-of-bounds compression (off by default): only ranges bili currently recommends may be folded; subdividing a listed span or refolding an existing block stays legal." site_zh: "禁止越界压缩(默认关闭):只允许折叠 bili 当前推荐的范围;拆分推荐跨度、重折已有块更新摘要仍合法。" + - key: compress.postComPressTail + type: boolean + default: "off (unset)" + group: compress + id: cw.ptail + render: compress-row + desc_en: "Recommend 'fold more' inside the SUCCESS compress receipt (#7318): the remaining-offer range list and the 'Uncovered history remains' audit note are printed only when enabled; off by default the receipt carries neither (the context-minimum stop signal is unaffected). When enabled, the uncovered-history note fires at most once per nudge-injection cycle and a fresh injection re-opens it (#6522/#6526). Off because per-receipt re-recommendation drove models into endless fold loops against explicit stop requests." + desc_zh: "在压缩成功回执里推荐「继续压缩」(#7318):剩余可折叠范围列表与「Uncovered history remains」审计提示仅在开启时打印;默认关闭时两者都不出现(上下文已到底的停止信号不受影响)。开启后,未覆盖历史提示每个 nudge 注入周期最多发一次,新注入会重新打开(#6522/#6526)。之所以默认关闭:回执里反复推荐曾驱使模型无视用户停止指令无限折叠。" + desc_ja: "圧縮成功レシート内での「続けて折りたたむ」推奨 (#7318):残り折りたたみ可能範囲リストと『Uncovered history remains』監査ノートを印刷するのは有効化時のみ;デフォルト OFF では両方とも出ない(コンテキスト最小停止シグナルには影響なし)。有効化時は、未カバー履歴ノットはナッジ注入サイクルごとに最大 1 回のみ発火し、新しい注入が再オープンする (#6522/#6526)。レシート毎の再推奨が明示的な停止要求を無視した無限折りたたみループを誘発したためデフォルト OFF。" + site_en: "Off by default: the success receipt stops re-advising remaining foldable ranges and the uncovered-history note. Enable compress.postComPressTail to restore the recommendation (then at most once per nudge cycle)." + site_zh: "默认关闭:成功回执不再推荐剩余可折叠范围、不再发未覆盖历史提示。开启 compress.postComPressTail 可恢复推荐(开启后每个 nudge 周期最多一次)。" - key: compress.streamSummary type: boolean default: "false (unset)" diff --git a/website/docs/index.html b/website/docs/index.html index c9f6eeeb80..a86bfe9fad 100644 --- a/website/docs/index.html +++ b/website/docs/index.html @@ -194,6 +194,7 @@

compress — every knob

nudgeDecisionMaxTokensnumberOutput budget (tokens) of the model-decision side call (default 200). Must be > 0. requireNudgebooleanForbid unprompted compression (off by default): a model compress call is refused unless a nudge credit is live — a delivered nudge opens a 20-model-round window, refreshed by each new nudge; the refusal returns an error receipt instead of folding. requireRecommendationbooleanForbid out-of-bounds compression (off by default): only ranges bili currently recommends may be folded; subdividing a listed span or refolding an existing block stays legal. + postComPressTailbooleanOff by default: the success receipt stops re-advising remaining foldable ranges and the uncovered-history note. Enable compress.postComPressTail to restore the recommendation (then at most once per nudge cycle). streamSummarybooleanForce streaming (SSE) summarization from the first attempt — stream-mandating upstreams now self-heal via a one-shot SSE probe on any non-streaming 400 (#2494); kept as the escape hatch for gateways that time out long non-streaming calls (e.g. Cloudflare 524), which the self-learn cannot detect, or to skip the one probe round-trip. preserveRecentMessagesnumberKernel default 3 (tuned 5 → 3, #3058): the most recent messages stay soft-protected from folds. preserveRecentTokensnumberKernel default ≈5000: the most recent tokens stay soft-protected from folds. diff --git a/website/main.js b/website/main.js index 120fbff9f1..f56f126d83 100644 --- a/website/main.js +++ b/website/main.js @@ -74,6 +74,7 @@ "cw.ndmt": "Output budget (tokens) of the model-decision side call (default 200). Must be > 0.", "cw.rnug": "Forbid unprompted compression (off by default): a model compress call is refused unless a nudge credit is live — a delivered nudge opens a 20-model-round window, refreshed by each new nudge; the refusal returns an error receipt instead of folding.", "cw.rrec": "Forbid out-of-bounds compression (off by default): only ranges bili currently recommends may be folded; subdividing a listed span or refolding an existing block stays legal.", + "cw.ptail": "Off by default: the success receipt stops re-advising remaining foldable ranges and the uncovered-history note. Enable compress.postComPressTail to restore the recommendation (then at most once per nudge cycle).", "cw.ssm": "Force streaming (SSE) summarization from the first attempt — stream-mandating upstreams now self-heal via a one-shot SSE probe on any non-streaming 400 (#2494); kept as the escape hatch for gateways that time out long non-streaming calls (e.g. Cloudflare 524), which the self-learn cannot detect, or to skip the one probe round-trip.", "cw.prm": "Kernel default 3 (tuned 5 → 3, #3058): the most recent messages stay soft-protected from folds.", "cw.prt": "Kernel default ≈5000: the most recent tokens stay soft-protected from folds.", @@ -332,6 +333,7 @@ "cw.ndmt": "模型决策 side call 的输出预算(token,默认 200)。必须 > 0。", "cw.rnug": "禁止未提示压缩(默认关闭):只有 nudge 信用存活(送达的提醒开启 20 个模型轮窗口,新提醒刷新窗口)才允许模型调用 compress,否则拒绝并回错误回执。", "cw.rrec": "禁止越界压缩(默认关闭):只允许折叠 bili 当前推荐的范围;拆分推荐跨度、重折已有块更新摘要仍合法。", + "cw.ptail": "默认关闭:成功回执不再推荐剩余可折叠范围、不再发未覆盖历史提示。开启 compress.postComPressTail 可恢复推荐(开启后每个 nudge 周期最多一次)。", "cw.ssm": "强制摘要从首次起走流式(SSE)——要求流式的上游现在通过任何非流式 400 上的一次性 SSE 探测自愈(#2494);保留作为会掐断长非流式调用的网关(如 Cloudflare 524)的逃生通道(自学习无法感知该场景),也可用于省去一次探测往返。", "cw.prm": "内核默认 3(5 → 3,#3058):最近消息软保护、免于折叠。", "cw.prt": "内核默认约 5000:最近的 token 软保护、免于折叠。",