Skip to content

feat(dsh): ship in-package bili preset as the roster default (#1772) [discussion draft] - #1827

Closed
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-01_dsh-bundle-preset
Closed

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-01_dsh-bundle-preset

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

Discussion draft — not for merge. Approach proven end-to-end on a live probe instance (dsh 0.2.0-rc.2): booted a web profile with this exact bundle-patch overlay, POST /api/agentPresets/list returns all four native presets plus standard-bili-auto-off (trust: system, isDefault: true).

Why not interception (investigated, all rejected)

  • dsh-compaction-basic exposes no service / veto API — it is pure event listeners (agent/pre-step pressure trigger, agent/request-error overflow recovery) and only registers them when its row config has auto truthy.
  • Vetoing the agent/pre-step event chain would starve 16 sibling listeners (dsh-agent, time-context, tool-cordis, plan-mode, …) — sledgehammer.
  • Wrapping ctx.llm to intercept the summarize call overrides a core service; monkey-patching loaded modules in-process is hostile and version-fragile.

The sanctioned lever

The web-app inserts the agent-presets row at boot-tree top level, and bili is the last bundle layer — so its bundle patch can replace that row's config wholesale:

  • Preset ships inside the npm package (dsh-presets/standard-bili-auto-off/): byte-copy of shipped standard, exactly one delta — compaction-basic gets config: { auto: false }. Manual /compact and the tool-result pruner stay. Every bili upgrade refreshes it → no snapshot drift, zero user files touched.
  • dsh.bundle.patch.yml: the old compaction-basic patch row (never applied — preset-internal rows are below the patch engine's reach; that was the dsh.bundle.patch.yml 禁用自动压缩在 web profile 下静默失效 #1772 dead end) is replaced by the agent-presets config override: extra roster root → package-relative dsh-presets/ (resolved from the loader ctx baseUrl, win32 leading-slash handled), trust: system, and default → bili preset.
  • Shipped + user roots stay enabled; all four native presets remain in the picker; an explicit settings/UI choice always wins over the row-config default; running sessions are untouched (new sessions only).

Open decisions (why this is a draft)

  1. Default override on/off? On = zero-action fix for every web-profile install (dsh.bundle.patch.yml 禁用自动压缩在 web profile 下静默失效 #1772 closes itself); off = preset appears in the picker only, warning points at it.
  2. Display name — currently 标准模式(bili 托管压缩); earlier …无自动压缩 was ambiguous.
  3. Preset content is a snapshot of shipped standard — release-managed per bili release; needs a note in CLIENTS.md once the approach is blessed.

Supersedes the manual-recipe automation sketched in #1786 (docs there stay valid as background).

Discussion draft — approach proven end-to-end against dsh 0.2.0-rc.2
on a live probe instance; NOT for merge until the open decisions
below are settled.

The #1786 recipe (copy standard into the user root by hand) works but
is three steps across two worlds, and user copies drift on preset
upgrades. Interception is worse: compaction-basic exposes no service
or veto API (pure event listeners), vetoing agent/pre-step starves
16 sibling listeners, wrapping ctx.llm fights the core. The remaining
sanctioned lever is the `agent-presets` row itself — a boot-tree row
the web-app inserts, so the LAST bundle layer (bili) can replace its
config wholesale:

- dsh-presets/standard-bili-auto-off/: byte-copy of the shipped
  `standard` preset with exactly one delta — compaction-basic
  `config: { auto: false }` (it only registers automatic compaction
  when this.config.auto). Manual /compact (command-compact) and the
  tool-result pruner stay. Ships in the npm package, so every bili
  upgrade refreshes it — no snapshot drift.
- dsh.bundle.patch.yml: replace the never-applied compaction-basic
  corpse row (preset-internal rows are below the patch engine's
  reach — that was the #1772 dead end) with an `agent-presets` config
  override: extra roster root pointing at the package's dsh-presets/
  (path resolved from the loader ctx baseUrl at activation, win32
  leading-slash handled), trust: system, default switched to the bili
  preset. Shipped + user roots stay enabled; every native preset
  remains selectable; an explicit settings/UI choice still wins over
  the row-config default.
- package.json: publish dsh-presets.
- tests/e2e/e2e-native-dsh.test.ts: wireProfile copies dsh-presets/
  like a registry install would.
- tests/dsh-bundle-preset.test.ts: guards — exactly one agent-presets
  patch row with default + package-relative root + win32 handling;
  preset keeps auto:false while command-compact and tool-result-pruner
  rows survive; package files and the e2e mirror stay in sync.

Open decisions: (a) default override on/off (on = zero-action fix for
existing installs; off = picker-only); (b) preset display name
(标准模式(bili 托管压缩)) — both flagged in the #1772 discussion
comment.
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-01_dsh-bundle-preset (548ff04)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1804-pr.1827.777d327

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

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

Install instructions are refreshed on each push.

antclt pushed a commit to antclt/billion-context that referenced this pull request Oct 1, 2026
…y gate

dsh-compaction-basic answers context pressure by replaying the whole
conversation prefix and appending its fixed COMPACTION_INSTRUCTION as
the final user message, under the SAME session id (KV prefix-cache
reuse). In the desktop lane those calls ride bili as a second producer
on the main conversation — the ranxianglei#1729 deadlock — and when one lands,
dsh durably shadows the replayed surface range: the original messages
never ride a future request again, destroying the proxy's compression
substrate. That loss is irreversible; every cost of refusing is
dsh-side, caught, and recoverable, so the guard is unconditional.

- src/server/dsh-compaction-guard.ts: two-signal AND identification
  (per the claudeSubagentSplit ranxianglei#970 discipline — both signals must
  agree, failure direction is "stop intercepting"):
  1. MARKER: final user message starts with the versioned instruction
     prefix (verbatim from @deepseek-ai/dsh-compaction-basic, tracked
     per dsh release like MAIN_SYSTEM_PREFIXES);
  2. SHAPE: whole request <= 4 messages (observed live: 2 msgs at
     ~152K tokens in the ranxianglei#1727 logs; a normal turn — even one quoting
     the template — carries its full history and cannot fit).
  openai + anthropic wire shapes; google/responses out of scope v1.
- src/server.ts: guard runs after identity resolution, BEFORE the ranxianglei#388
  side-request lane and any pipeline work — refused locally (403,
  non-retryable, protocol-shaped), kernel state untouched, WARN once
  per session. Not gated on the dsh plugin marker: a dsh host routed
  through a global bili without the plugin bundle is covered too.
  The refusal message rides into dsh's own warn line ("step
  compaction failed: <message>; continuing the turn").
- tests/dsh-compaction-guard.test.ts: 10 cases — observed production
  shapes, content-parts, anthropic shape, quoting/mid-history non-
  matches, count bar, protocol scope, refusal bodies, live-template
  prefix check.

Deliberate residual costs, on record: manual /compact is refused too
(same envelope — the traffic layer cannot tell the trigger), and
dsh's context-overflow recovery loses its compaction path (the
original 400 surfaces; bili's nudge/truncate is the defense). The
source-layer fix (preset auto:false, ranxianglei#1827) remains complementary:
it makes dsh not even try, so nothing reaches this gate.

Refs ranxianglei#1729 (deadlock producer), ranxianglei#1772/ranxianglei#1827 (source-layer preset),
ranxianglei#1206 ([conflict] name-scan), ranxianglei#394 (shared-session hazard class).
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

孤儿票清理:标题指向的 issue 已关闭,修复已由其他路径落地。关单;误判请 reopen。

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