Skip to content

[PR] fix: recognize dsh 0.2.2-rc.3 reworded runtime-context snapshot (#7085) - #7087

Merged
ranxianglei merged 2 commits into
masterfrom
2026-11-18_fix-dsh-runtime-context-classifier
Nov 18, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-11-18_fix-dsh-runtime-context-classifier

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

dsh 0.2.2-rc.3 reworded the runtime-context snapshot: it no longer contains "Current runtime context" but opens with "The following information describes your current session:" wrapped in a <system-reminder> envelope. The dshRuntimeContextPath classifier only matched the old literal, so the snapshot silently lost its durable protection (31/31 new-form snapshots unclassified on the reporter's machine; old form 18/18).

Fix

All three consumer sites of the shared literal "Current runtime context":

  1. dshRuntimeContextPath (src/durable-message-guards.ts): also match the new lead-in. Old literal kept for cross-form transition sessions and the cleared form.
  2. dshCarrierRawMarkers (src/durable-message-guards.ts): add the new lead-in (14 to 15 markers).
  3. AUTO_INJECTED_NOTIFICATION_PREFIXES (src/server.ts): add the <system-reminder> envelope prefix so deriveTitle skips the reworded snapshot.

Behavior change

AUTO_INJECTED_NOTIFICATION_PREFIXES gains a 4th prefix: <system-reminder>. Any message starting with <system-reminder> (after trim) is now skipped in deriveTitle. Previously only 3 specific prefixes were skipped. This is intentional: the <system-reminder> envelope wraps dsh host-injected messages (runtime-context, skill-catalog, workspace-instructions), all of which are correctly skipped in title derivation.

Tests

  • tests/issue2481-dsh-runtime-context.test.ts: classifier unit (new form projects to durable/runtime-context), e2e fold (new form survives a positional fold), lane entry assertion.
  • tests/issue5142-expected-rebase.test.ts: lockstep test (15 markers).
  • tests/title-derive.test.ts: isAutoInjectedNotification (new form recognized), deriveTitle (new form does not become the title).

All 40 targeted tests pass.

Closes #7085

dsh 0.2.2-rc.3 reworded the runtime-context snapshot: it no longer
contains 'Current runtime context' but opens with 'The following
information describes your current session:' wrapped in a
<system-reminder> envelope. The dshRuntimeContextPath classifier only
matched the old literal, so the snapshot silently lost its durable
protection (31/31 new-form snapshots unclassified on the reporter's
machine; old form 18/18).

Fix all three consumer sites of the shared literal:
- dshRuntimeContextPath: also match the new lead-in (old literal kept
  for cross-form transition sessions and the cleared form).
- dshCarrierRawMarkers: add the new lead-in (14 -> 15 markers).
- AUTO_INJECTED_NOTIFICATION_PREFIXES: add the <system-reminder>
  envelope prefix so deriveTitle skips the reworded snapshot.

Regression tests: classifier unit (new form projects), e2e fold (new
form survives a positional fold), lockstep (15 markers), title-derive
(new form is an auto-injected notification and does not become the
title).

Closes #7085
@ranxianglei ranxianglei added bug Something isn't working dsh p1 scope/kernel labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-18_fix-dsh-runtime-context-classifier (29f4061)

Latest build — install this exact version

npm install -g billion-context@0.0.10689-pr.7087.ae1522a

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

Recent builds (commit → version)

commit version build
29f4061 billion-context@0.0.10689-pr.7087.ae1522a build
419f83b billion-context@0.0.10673-pr.7087.4c322cd build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: recognize dsh 0.2.2-rc.3 reworded runtime-context snapshot (#7085) [PR] fix: recognize dsh 0.2.2-rc.3 reworded runtime-context snapshot (#7085) Nov 17, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #7087 审核结论

已拉取分支 2026-11-18_fix-dsh-runtime-context-classifier(commit 419f83b525),逐行核对代码,本地跑通全部 40 条定向测试(tests/issue2481-dsh-runtime-context.test.ts、tests/issue5142-expected-rebase.test.ts、tests/title-derive.test.ts),40 pass / 0 fail。

代码核对:三处消费点全部覆盖,无遗漏——

  1. dshRuntimeContextPath(src/durable-message-guards.ts:155):新 lead-in The following information describes your current session: 已加入匹配,旧字面量保留(跨形态过渡会话两种形态并存,清空态仍用旧字面量)。
  2. dshCarrierRawMarkers(src/durable-message-guards.ts:447):14→15 个 marker,新 lead-in 已加入。
  3. AUTO_INJECTED_NOTIFICATION_PREFIXES(src/server.ts:4754):<system-reminder> 前缀已加入,deriveTitle 会跳过新形态快照。

master 侧尚未包含新 lead-in(git grep "describes your current session" origin/master 零命中),fix 对当前 master 仍然有效,无冲突。

CI 状态:进行中(27 success / 11 in_progress / 43 cancelled / 19 skipped)。cancelled 是先前 run 被新 run 取代,正常。

⚠️ 注意:PR 落后 master 87 个 commit(mergeable_state: behind)。虽无冲突(mergeable: true),但按仓库 §7.2 纪律,合并前应 rebase 到当前 master 再跑 CI。建议 owner 在合并前 rebase。


八问

  1. 是什么问题:dsh 0.2.2-rc.3 改写了 runtime-context 快照文案(从 Current runtime context 变为 <system-reminder> 包裹的 The following information describes your current session:),bili 的分类器只认旧字面量,新形态快照静默失去 durable 保护。
  2. 什么原因导致的:dshRuntimeContextPath 只按 msg.text.includes("Current runtime context") 判定,新形态里这句不再出现。同一字面量还有两个消费点(dshCarrierRawMarkers、AUTO_INJECTED_NOTIFICATION_PREFIXES)跟着一起失效。
  3. 影响范围与严重程度:所有使用 dsh 0.2.2-rc.3 的会话,新形态 runtime-context 快照不再被归类为 durable/runtime-context,只剩 preserveRecentMessages=3 / preserveRecentTokens=5000 软保护,长会话里必然掉出保护区。后果:模型按过期权限前提干活(不敢调 write、反复请求沙箱升级)。p1——保护机制已失效,虽尚未观察到实际折叠损失(12 条在块范围内的快照都还在 directMessageIds 里),但踩到只是时间问题。
  4. 怎么修复的:三处消费点全部加入新 lead-in 匹配,旧字面量保留(跨形态过渡会话两种形态并存)。<system-reminder> 信封前缀加入 AUTO_INJECTED_NOTIFICATION_PREFIXES,deriveTitle 跳过新形态快照。
  5. 是否有回归问题:无。旧字面量保留,跨形态过渡会话和清空态不受影响。dshCarrierRawMarkers 从 14→15,lockstep 测试已同步更新。AUTO_INJECTED_NOTIFICATION_PREFIXES 从 3→4 个前缀,<system-reminder> 信封只包裹 dsh 宿主注入消息(runtime-context、skill-catalog、workspace-instructions),真实用户提问不会以它开头——无误伤。
  6. 是否破坏缓存:否。fix 只影响分类判定,不涉及缓存、重试、增量游标、去重键。
  7. 是否改了设计方向:否。fix 遵循既有 evidence-permitlist 纪律(KDD release v0.1.2 #9),在既有分类器内扩展匹配,不引入新机制。
  8. 是否引入了新的配置:否。

判定:代码正确,定向测试全过,fix 对当前 master 有效。建议 rebase 到当前 master 后合并。

… colon (#7085)

The reworded snapshot's lead-in has two continuations in the dsh emitter
(packages/core/agent-loop/src/runtime-context.ts): the FIRST snapshot ends
"The following information describes your current session:" while every
re-send after a context change continues it with ". It replaces earlier
versions of this context, including any retained in conversation
summaries." The colon-terminated marker from the previous commit only
matches the first-snapshot form, so all state-change re-sends (approval
policy flips, cwd changes — exactly the snapshots whose loss makes the
model act on stale permission premises) would stay unclassified.

The marker is now the shared prefix WITHOUT the trailing colon, in both
consumers (dshRuntimeContextPath + dshCarrierRawMarkers). Regression:
classifier + lane-entry + positional-fold e2e cases for the re-send form.
@ranxianglei
ranxianglei merged commit 10b0c2b into master Nov 18, 2026
56 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1228-master.10b0c2b (rolling master tag).

npm install -g billion-context@0.0.1228-master.10b0c2b  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Nov 18, 2026
…lict at 0.0.200

Master advanced past the PR base again (batch11 wave11 #6827, lean-compress
receipt #7105, wire-client-sidecars #7083, p1 batch b2/b3, #7087, #7101 ->
kernel 0.0.199, storage-render goldens regenerated for #6775 persisted
fields, 400 files). Content hunks auto-merged (kernel/src/compress.ts,
kernel/src/types.ts, all four storage-render goldens); the only conflicts
were the three kernel version lines, resolved at 0.0.200 = master's 0.0.199
+ this PR's kernel/src change, per the CI-enforced kernel version discipline.

Targeted local verification: tests/golden-storage-render.test.ts 5/5,
tests/storage-state-fields.test.ts 2/2, kernel issue6116/issue3769/
hide-consumed suites 27/27.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][dsh] 0.2.2-rc.3 changes the runtime-context snapshot copy, dshRuntimeContextPath silently stops classifying

1 participant