Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/server/dsh-compaction-guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ export type Refusal = { status: number; body: unknown };
const REFUSAL_MESSAGE =
`dsh native compaction call refused by billion-context: bili owns compression on this lane (#1729, cf. #1772/#1206). ` +
`A landed dsh compaction checkpoint durably shadows the raw conversation history, which destroys the proxy's compression substrate. ` +
`To run dsh native compaction on this lane anyway, opt in explicitly: "allowDshCompaction": true in the bili config or env BILI_ALLOW_DSH_COMPACTION=1 (#2028).`;
`No action is needed: your conversation is intact and bili compresses automatically as turns grow too large — if the session is currently over its window, it starts folding on the next turn (#3453). ` +
`If you still want dsh native compaction on this lane, opt in explicitly: "allowDshCompaction": true in the bili config or env BILI_ALLOW_DSH_COMPACTION=1 (#2028).`;

/** Protocol-shaped refusal body (mirrors the #554 side-request guard shape so
* clients render it natively). 422: a policy refusal of this one request — not
Expand Down
5 changes: 5 additions & 0 deletions tests/dsh-compaction-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ test("refusal bodies carry the marker reason and are non-retryable", () => {
assert.equal(openai.status, 422);
assert.equal(openai.body.error.retryable, false);
assert.match(openai.body.error.message, /#1729/);
// #3499: the refusal must tell the user what to do INSTEAD (keep using the
// lane; over-window sessions fold on the next turn), not only how to force
// the refused behavior — the incident user read the bare opt-in as "the fix".
assert.match(openai.body.error.message, /No action is needed/);
assert.match(openai.body.error.message, /starts folding on the next turn/);
const anthropic = dshCompactionRefusal("anthropic") as { status: number; body: { error: { message: string } } };
assert.equal(anthropic.status, 422);
assert.match(anthropic.body.error.message, /durably/);
Expand Down
Loading