Skip to content

feat: compress.visibilityMarkers toggle to suppress ACP visibility markers - #893

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-17_visibility-markers-config
Sep 18, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-17_visibility-markers-config

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Follow-up to #862 (marker-suppression item 1 of 2 confirmed by the reporter).

Problem

In the #862 deployment (ZCode/ACP → openai-wire relay), the model repeatedly imitated and narrated around the 📦/❌ ACP visibility markers — emitting its own confirmation marker lines and Chinese commentary before/after proxy compression. The reporter's deployment-side workaround was stubbing buildVisibilityMarker to return "" plus empty-marker guards in three adapters; this lands that as a proper config option.

Change

New compress.visibilityMarkers boolean (three-level global/provider/model merge like every other compress field), default true = current behavior, zero change for existing users:

  • false suppresses all four marker artifacts:
    1. the live marker line streamed to the client (LoopCtx guard at the emitMarker yield),
    2. the orphan marker message re-injected into rebuilt history (core.ts orphan path),
    3. the responses JSON read-only marker item (surfaceReadonlyJson),
    4. the mutating re-request developer marker message (compressLoopResponsesJson).
  • Tool executions are unaffected: proxy tools still run, paired tool-call/tool-result messages are still recorded as usual; only the marker line/message is omitted.
  • The 模型把 "📦 [ACP] Compressed" 确认标记伪造为普通 assistant 文本——17 次假压缩、0 次真实执行(自我回执幻觉) #717 anti-forgery stripping of model-emitted fake markers is independent of this flag and stays active in both modes.

Server resolution follows the existing per-request pattern: resolveCompress(opts.routes, route?.rewrittenUrl, model, opts.compress).visibilityMarkers ?? true at both loop call sites in forward() (same shape as the existing resolutions for strip-images / reasoning-guard). No changes to the Prepared type, prepare* signatures, or kernel Config.

Docs: CONFIGURATION.md + CONFIGURATION.zh-CN.md new field section; web UI compress field list updated.

Tests: new tests/visibility-markers.test.ts (7 tests) — parse valid/invalid, merge cascade, streaming loop default-parity vs suppressed (tool still executes + re-request still fires), JSON read-only path, JSON mutating re-request body.

Pre-flight on master @ 55da3f0 (v0.1.117): typecheck clean · npm test 1675 pass / 0 fail / 2 skipped · tsup build ok.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-17_visibility-markers-config (923fb46)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-893

Each push to this PR publishes a new version under the pr-893 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr893.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Reviewing now — pulling branch 2026-09-17_visibility-markers-config, verifying diff cleanliness vs master @ 55da3f0, re-running typecheck + full test suite + build, and checking CI. Full verdict to follow in this thread.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — verified, ready to merge (merge stays with you, human-only).

Diff cleanliness (first gate)

Single linear commit 942eb87 on current master @ 55da3f0 (v0.1.117) — no stale base, no merge commits. 9 files, +200/−7, every line on-purpose: no whitespace churn, no lockfile/generated-file drift, no off-topic files.

Code review — all four artifacts covered, default = zero change

Guarded sites (all use !== false so undefined/true = today's behavior):

  1. Live stream line — src/loop/core.ts:483 (if (ctx.visibilityMarkers !== false) yield adapter.emitMarker(...))
  2. Orphan marker message in rebuilt history — src/loop/core.ts:557 (else if (ctx.visibilityMarkers !== false))
  3. Responses JSON read-only marker item — src/compress-loop-responses.ts:166
  4. Mutating re-request developer marker — src/compress-loop-responses.ts:218

I grepped every buildVisibilityMarker/emitMarker call site in src/ — these four are exhaustive (the three adapters' emitMarker impls are only reachable via core.ts:483). Nothing unguarded remains.

Config plumbing is correct and consistent with the codebase's strictness rules:

  • parseCompressSettings rejects non-boolean values by poisoning the whole block (same contract as stripImages) — a typo'd "false" string fails loudly instead of silently defaulting.
  • Three-level merge via pick("visibilityMarkers") in mergeCompress.
  • Server resolution at both forward() loop call sites (src/server.ts:3755, :3811) uses the exact existing resolveCompress(routes, url, model, opts.compress) shape with ?? true fallback — same pattern as strip-images/reasoning-guard. No Prepared type or kernel Config changes, as claimed.

Both compression modes reasoned through: the flag only gates text artifacts, never executeProxyTool or the continuation fetch — tool executions, paired tool-call/tool-result recording (non-text-protocol path), and session-state folding are untouched in either mode. In text-protocol relays (the #862 ZCode case), extracted text-calls historically got their result back only via the orphan marker message; with the flag off that feedback channel closes entirely — which is exactly the intended "nothing left to imitate" outcome, and compression still lands in rebuilt history. Confirmed intentional, not a regression.

#717 anti-forgery stripping (src/loop/tag-echo-filter.ts + adapters + plugin.ts) is untouched by this diff → stays active in both modes, independent of the flag, as claimed.

Docs: CONFIGURATION.md + CONFIGURATION.zh-CN.md sections are content-synced (not just translated titles), web UI compress field list updated. Tests: 7 new, all deterministic (mocked fetch, no port binds) — parse valid/invalid, merge cascade, streaming default-parity vs suppressed (asserts tool still executes AND re-request still fires), JSON read-only, JSON mutating re-request body.

Evidence

  • Local pre-flight, re-run by me on branch head: typecheck clean · npm test 1675 pass / 0 fail / 2 skipped · tsup build ok
  • GitHub CI on 942eb87: 8/8 success — test matrix (ubuntu/windows × node 22/24), version-guard, build-artifact, both codex e2e probes
  • Mergeability: mergeable: true, mergeable_state: clean vs master

中文摘要:新增 compress.visibilityMarkers 开关(默认 true,现有部署零变化),把 #862 里"模型模仿/旁白 📦❌ 标记"的部署侧 workaround 收敛为正式配置项——四处标记产物全部按开关抑制、工具执行与 #717 防伪造剥离不受影响;diff 干净、本地三项检查与 CI 全绿、可合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

解决冲突

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,正在处理。master 已前进到 a8676a5(#891 truncation-continuation、#804 cache-ledger、#923 opencode-acp bridge 等,共 70 个文件变更),本分支 base 停在 55da3f0——冲突集中在双方都动过的 src/loop/core.ts、src/server.ts、src/config.ts 等文件。正在把分支 rebase 到最新 master 并逐处按"两边意图取并集"解决,完成后跑 typecheck/test/build 全绿再 force-push 回分支。稍后回报结果。

…rkers (#862)

- CompressSettings.visibilityMarkers: three-level merge, default true (zero behavior change)
- parseCompressSettings: strict boolean validation like tiers/stripImages
- LoopCtx + CompressLoopResponsesCtx guards cover all four emission sites: live emitMarker stream line, orphan marker message in rebuilt history, responses JSON read-only marker item, mutating re-request developer marker
- server.ts resolves per request via resolveCompress at both loop call sites (same pattern as existing per-request resolutions)
- tool executions themselves unaffected: calls still run, paired tool-call/tool-result messages untouched; #717 anti-forgery stripping independent of this flag
- docs: CONFIGURATION.md + CONFIGURATION.zh-CN.md + web UI field list
- tests/visibility-markers.test.ts: parse/merge cascade + streaming + JSON read-only/mutating paths
@ranxianglei
ranxianglei force-pushed the 2026-09-17_visibility-markers-config branch from 942eb87 to 923fb46 Compare September 18, 2026 07:45
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

冲突已解决并推送完成。

Rebase: 942eb87 → 923fb46, now a single commit directly on current master a8676a5 (master had moved on: #891 truncation-continuation in core.ts, #804 cache-ledger, #923 opencode-acp bridge, etc.).

Conflict — exactly one file, adjacent lines:

  • src/web/page.ts: master added a window-column <th> to the page-sessions table header; this PR inserted visibilityMarkers into the page-settings field list. Resolved as the union of both intents (both lines kept), and verified the resolved file differs from master only by the visibilityMarkers text.

Semantic check after rebase: all nine change sites re-verified intact (src/loop/core.ts live-marker yield + orphan-marker guard, src/compress-loop-responses.ts read-only JSON item + mutating developer message, src/config.ts parse, src/compress-settings.ts merge pick, src/server.ts both per-request resolutions, web UI, both doc files, new test file). Master's core.ts marker sites were structurally untouched by #891, so no behavior interaction.

Pre-flight on rebased head 923fb46: typecheck clean · npm test 1773 pass / 0 fail / 2 skipped · tsup build ok.

Pushed & CI: branch force-pushed to 923fb46 (parent = master, so the PR diff is unchanged: 9 files, +200/−7). Full CI on the new head: 8/8 success, including both codex e2e probes and version-guard/build-artifact.

一句话总结:PR 已 rebase 到最新 master(仅 src/web/page.ts 一处相邻行冲突,按两边意图取并集解决),rebase 后 typecheck/测试/构建全绿、diff 足迹不变(9 文件 +200/−7),CI 8/8 全绿,可以合并(合并操作留给人工)。

@ranxianglei
ranxianglei merged commit 19cfe03 into master Sep 18, 2026
8 checks passed
This was referenced Sep 18, 2026
@ranxianglei
ranxianglei deleted the 2026-09-17_visibility-markers-config branch October 15, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant