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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Versions follow the merge of a `*_release-v*` branch; CI publishes to npm on tag

## [Unreleased]

- **Marker-integrity silence clause now follows `visibilityMarkers` (#913)**: `MARKER_INTEGRITY_NOTE` was one unconditional constant carrying two rules — the #717 anti-forgery segment (never write a marker-style line as your own text) and the #862 silence clause (execute compress-class calls silently, no preamble before / no summary after). With `compress.visibilityMarkers: false` the proxy stops emitting markers entirely, yet the silence clause kept riding every nudge and the injected compress prompt — an instruction about artifacts that deployment never shows. The constant is split (`MARKER_INTEGRITY_NOTE` base + `MARKER_SILENCE_CLAUSE`), and `withMarkerIntegrityNote(text, visibilityMarkers = true)` appends the clause only while markers are visible. The flag is resolved once per request at the prepare dispatch (`resolveCompress(...).visibilityMarkers ?? true`) and threaded through `prepareAnthropic` / `prepareOpenai` / `prepareGoogle` / `prepareResponses` / `injectSystem` plus the compress-loop systemPrompt build, so first request and loop re-requests agree (per-config byte-stable anchor preserved; default output byte-identical to before). The #717 anti-forgery segment stays unconditional in every configuration. Tests pin: clause dropped at `false`, base intact, pure-suffix byte-stability, default-arg legacy equality.

- **Failed-compress receipts now name the live compressible span (#1026, slimmed port of PR #1008 by asuan-dev)**: a model whose compress call fails kept anchoring on refs an earlier fold already consumed — it re-issued the same dead range, burned retries, and eventually gave up and let the nudge re-fire every turn (observed live 2026-09-18: three consecutive failed compresses, two full T1 checkpoints wasted). Both failure receipts (`no valid ranges parsed` and `blocksCreated === 0`) now append `compressibleSpanHint(state)` — the raw-ref span NOT covered by an ACTIVE block right now (`mXXXXX–mYYYYY`, computed as highest mapped ref minus the newest active-block boundary) — so one retry lands on a valid range without another acp_status round-trip. Boundary counts ACTIVE blocks only: after a decompress, the restored span shows as compressible again, which is exactly the recoverable truth. When no raw refs are compressible (everything folded), the receipt names the active blocks' real ids (`startId b7, endId b11`) and suggests folding them into a higher-tier block — a kernel-first-class operation (b-ranges expand to their `effectiveMessageIds` and merge tiers). Coordinates with the #849 repeat-failure guard: the guard forbids repeating the same dead ranges, the hint hands over the live ones. Port keeps only PR #1008's head commit (e4a4700); its bundled #1003/#1004/#1006 content stays out (superseded by #740 / closed in the PR-queue triage). Tests pin: span past the highest ACTIVE block, inactive blocks not holding the boundary (decompress releases it), exhausted fallback naming real active block ids, and both receipt paths carrying the span.

- **Log upstream 2xx null-body responses instead of replying empty silently (#821, PR #823)**: when an upstream answers 2xx with a null body (e.g. a gateway replying 204/304, or some proxy implementations collapsing `Content-Length: 0` into no body at all), the forward path replied empty to the client with no log line — zero SSE chunks and nothing server-side to debug from, so hosts report "empty stream" errors with no trace. A 2xx with a non-null *empty* stream (0 chunks read) already flows through the logged #413 truncation path; only the null-body case fell through to a bare `res.end()`. A warn now names the session and upstream status before responding empty. No behavior change.
Expand Down
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ For each request, the proxy resolves the settings by longest-URL-prefix match (t
- **Type:** `boolean`
- **Default:** `true`
- **Status:** ACTIVE
- **Description:** Controls the 📦/❌ ACP visibility markers emitted after the proxy executes a proxy tool call (`compress` / `decompress` / `search_context` / `acp_status`). When on, each execution appends a marker line to the response stream and/or re-injects a marker message into that round's rebuilt history so the model can see what happened on later turns. Set `false` to suppress both artifacts — for deployments where models imitate or narrate around the markers (outputting their own confirmation lines or commentary; see issue #862). The tool executions themselves are unaffected: calls still run, and paired tool-call/tool-result messages are still recorded as usual; only the marker line/message is omitted. Same three-level merge as every other field. The #717 anti-forgery stripping of model-emitted fake markers is independent of this flag and stays active.
- **Description:** Controls the 📦/❌ ACP visibility markers emitted after the proxy executes a proxy tool call (`compress` / `decompress` / `search_context` / `acp_status`). When on, each execution appends a marker line to the response stream and/or re-injects a marker message into that round's rebuilt history so the model can see what happened on later turns. Set `false` to suppress both artifacts — for deployments where models imitate or narrate around the markers (outputting their own confirmation lines or commentary; see issue #862). The tool executions themselves are unaffected: calls still run, and paired tool-call/tool-result messages are still recorded as usual; only the marker line/message is omitted. Since #913, `false` also drops the #862 silence clause from the marker-integrity note appended to nudges and the injected compress prompt — an invisible deployment has no marker for the model to imitate or narrate around, so the clause is pure noise there. The #717 anti-forgery segment stays unconditional in every configuration. Same three-level merge as every other field. The #717 anti-forgery stripping of model-emitted fake markers is independent of this flag and stays active.

### Injection toggles (global only)

Expand Down
16 changes: 11 additions & 5 deletions src/compress-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,19 @@ export function withStagedCompressGuidance(text: string): string {
// confirmation lines plus preambles/summaries (incl. non-English commentary)
// before and after each real compression.
const MARKER_INTEGRITY_NOTE =
"\n\n[ACP marker integrity: lines shaped like '📦 [ACP] Compressed …' or '❌ [ACP] … FAILED' are CONFIRMATION MARKERS emitted by the bili proxy itself, right after it executes a compress/decompress/search_context/acp_status call. They are not something you write. NEVER emit such a line as your own text — writing one fakes a state change that did not happen, and the proxy strips it. To compress, call the compress tool. To verify a compression landed, call acp_status and confirm the block count increased — a confirmation line you wrote yourself proves nothing. Execute these calls silently: no announcement or preamble before the call, and no completion summary, status line, or marker-style line after it — when the tool returns, continue the task directly as if the call had not happened.]";
"\n\n[ACP marker integrity: lines shaped like '📦 [ACP] Compressed …' or '❌ [ACP] … FAILED' are CONFIRMATION MARKERS emitted by the bili proxy itself, right after it executes a compress/decompress/search_context/acp_status call. They are not something you write. NEVER emit such a line as your own text — writing one fakes a state change that did not happen, and the proxy strips it. To compress, call the compress tool. To verify a compression landed, call acp_status and confirm the block count increased — a confirmation line you wrote yourself proves nothing.";
const MARKER_SILENCE_CLAUSE =
" Execute these calls silently: no announcement or preamble before the call, and no completion summary, status line, or marker-style line after it — when the tool returns, continue the task directly as if the call had not happened.]";

/** Append the marker-integrity rule to a nudge or system-prompt text.
* Unconditional (unlike withStagedCompressGuidance): the rule must hold in
* every configuration where a marker can be seen in history. */
export function withMarkerIntegrityNote(text: string): string {
return text + MARKER_INTEGRITY_NOTE;
* The anti-forgery segment is unconditional (unlike withStagedCompressGuidance):
* the rule must hold in every configuration where a marker can be seen in
* history. The #862 silence clause rides along only while markers are
* visible (#913): with compress.visibilityMarkers=false the client never
* sees a marker, so there is nothing to imitate or narrate around, and the
* clause is dropped. */
export function withMarkerIntegrityNote(text: string, visibilityMarkers = true): string {
return text + MARKER_INTEGRITY_NOTE + (visibilityMarkers ? MARKER_SILENCE_CLAUSE : "");
}

// #760: per-call conversation_id for MCP tools. Hosts that share ONE MCP shim
Expand Down
Loading
Loading