Skip to content

[PR] fix: dsh lane — protect instruction-file revision notices from folds (#4921) - #4927

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-27_dsh-instructions-revision-guard
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-27_dsh-instructions-revision-guard

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4921

What & why

The dsh-lane durable guard (src/durable-message-guards.ts) matched ONLY the uppercase baseline label Instructions from:. @deepseek-ai/dsh-agent-instructions re-emits that baseline only when baselineIdentity (projectRoot + discovery/budget config, NOT file contents) changes — content edits arrive instead as separate per-file notices: Updated instructions from: <path> (file edited), Additional instructions from: <path> (file discovered after the baseline), Instructions removed: <path> (file deleted/disabled). All three were ordinary foldable history while the STALE baseline stayed BLOCKED, so after one fold the model kept executing changed/removed rules and the correction died with the block (field evidence in the issue: 11 real update carriers, 9 folded).

Fix: a dedicated classifier dshWorkspaceInstructionsRevisionPath projects each notice to its own per-path identity durable/agents-md-update/<path>, ordered BEFORE the shared baseline in the lane chain (an update body can quote the literal Instructions from: label — real traffic seq=2346 in the report — and must land in its per-path group). Markers are matched at line start on their exact evidenced shapes (wrapper-independent per the #2419 marker-over-wrapper discipline; no case folding — the three shapes are distinct DSH strings and widening only grows false-positive surface). #2766 role gate applies (assistant echoes never project).

Why per-path identities, not one shared revision identity

The default policy is latest-per-PATH (protectedLatestTools: ["durable/*"], kernel collectLatestProtected keeps the last instance per exact virtual path). Sharing one identity for all revisions would demote the OLDER instance to foldable — i.e. the baseline itself in multi-file sessions — a net loss. Per-path grouping keeps the baseline plus the newest notice of every changed file live, bounded by the number of distinct files revised; the removed notice rides the same group so the newest event per file wins (add → remove leaves the invalidation visible).

Behavior change (disclosed)

  • OLD: on the dsh lane, only messages containing the exact uppercase Instructions from: label projected (to durable/agents-md); Updated/Additional instructions from: and Instructions removed: messages were foldable and died with their block.
  • NEW: those three shapes additionally project to durable/agents-md-update/<path> and are protected latest-per-path under the default policy — the newest notice per file stays visible across folds (bounded footprint = number of distinct files revised).
  • UNCHANGED: baseline classification (byte-identical, still case-sensitive), the kernel (host-side fix only — no kernel/ change), user durable-policy takeover configs (any user-configured durable* pattern decides, as before), unregistered lanes (still fold everything — allowlist discipline KDD release v0.1.2 #9), other lanes/classifiers.

Config surface

No change. No new env var / config key / CLI flag; the existing protectedTools/protectedLatestTools machinery and the default durable/* policy cover the new identities without any schema addition.

Tests

  • NEW tests/issue4921-dsh-instructions-revision.test.ts: unit (three evidenced shapes → per-path ids; distinct paths → distinct ids; mid-line/case/role/content-type negatives; lane-chain precedence over the quoted-baseline case; baseline classifier pinned byte-identical) + real folds through /__bili/plugin/tool (baseline AND revision survive a positionally-covering fold; per-path latest — superseded older notice folds while newest stays pinned; unregistered-lane negative).
  • tests/issue2447-dsh-workspace-instructions.test.ts: its CHANGE_MSG fixture assertion now pins the new lane-chain projection (durable/agents-md-update/AGENTS.md) instead of "stays consumable history".
  • Local: typecheck clean; targeted suites green (issue4921 + issue2447 + durable-tool-identity + issue2419/2446/2481/2766 = 41/41); NEGATIVE CONTROL: with the revision classifier removed from the lane chain both e2e pins fail (RULE_V2 folded away) — the tests reproduce the original bug. Full-suite verdict = CI on this head.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-27_dsh-instructions-revision-guard (4aec140)

Latest build — install this exact version

npm install -g billion-context@0.0.9259-pr.4927.f4d4923

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
4aec140 billion-context@0.0.9259-pr.4927.f4d4923 build
50f6c94 billion-context@0.0.7729-pr.4927.97a1714 build
e90d50b billion-context@0.0.7396-pr.4927.109f98d build
930300f billion-context@0.0.7045-pr.4927.625a1d2 build
20da083 billion-context@0.0.6860-pr.4927.a8a30c9 build
305f61b billion-context@0.0.6408-pr.4927.7dc91ae build
5c40756 billion-context@0.0.6405-pr.4927.d2e4f90 build

Download artifact

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

Install instructions are refreshed on each push.

ranxianglei pushed a commit that referenced this pull request Oct 27, 2026
…ts (#4921)

Review pass-by fix for PR #4927: the new durable/agents-md-update/<path>
identities were missing from the config-surface field docs. Without them a
user who takes over the durable policy with exactly "durable/agents-md"
silently leaves every revision notice foldable — the same failure mode
#4921 fixes. Doc-only, zero behavior change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI 状态补报(限流窗口已过):新 head 305f61b27 的 run 已正常触发——48 项检查中快门禁 24/24 全绿(typecheck/build/各 guard,含我补的 docs commit)、12 个 test 分片在跑、12 skipped、目前零红。全量判定等分片跑完;若出现 registry-unsupported-proxy.test.ts 签名属 master 继承红(#4599 floor 333 已登记),按政策不追。其余收工判定不变:代码审核通过,可合(待 CI 绿 + owner 对 #4922/#4927 去留拍板)。

@ranxianglei ranxianglei added bug Something isn't working dsh p2 scope/kernel labels Oct 27, 2026
@ranxianglei
ranxianglei force-pushed the 2026-10-27_dsh-instructions-revision-guard branch from 305f61b to 20da083 Compare October 29, 2026 17:16
ranxianglei pushed a commit that referenced this pull request Oct 29, 2026
…ts (#4921)

Review pass-by fix for PR #4927: the new durable/agents-md-update/<path>
identities were missing from the config-surface field docs. Without them a
user who takes over the durable policy with exactly "durable/agents-md"
silently leaves every revision notice foldable — the same failure mode
#4921 fixes. Doc-only, zero behavior change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)

Merge-guard sync: rebased this branch onto current master 09a5b5b (was 229 commits behind at base e4cc685) — clean rebase, no conflicts (only shared file src/config.ts carried a comment-only change, applied byte-identical); local typecheck green + dsh-instructions tests 9/9 green; pushed head is now 20da083d6, base = master tip, mergeable=true, all 22 checks queued/in flight with no failures.

ranxianglei pushed a commit that referenced this pull request Oct 30, 2026
…ce, v9 migration stamp) onto PR #4927

Inherited-failure stopgap per CI coordination policy (owner 2026-10-24): the three red test
shards (win22/4, ubu22/3, ubu24/3) are the pre-existing #5140 cold-tail fork family
(tests/plugin-fork.test.ts:1473, 409 SNAPSHOT_UNAVAILABLE) which fails on pristine master and
has zero intersection with this PR's diff (src/durable-message-guards.ts + dsh-instruction
tests). #5140 is escalated to owner in #4599 (floor 535) and is NOT yet converged into
ci-fixes, so this merge converges the 5 guard-lane docs/config reds + the #4666 v9 stamp and
advances the base; it does not self-fix the master-level #5140 fork defect.
ranxianglei pushed a commit that referenced this pull request Oct 31, 2026
Resolve additive conflict in src/durable-message-guards.ts: union of #4921
workspace-instructions revision-notices classifier and #5109 dsh time-context
injection. Disjoint message families; dshDurableToolPath chain keeps both
(revision-notices checked before the shared baseline, time-context last).
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)
Synced origin/master into this branch (merge-guard). The only conflict was in src/durable-message-guards.ts, resolved as the additive union of #4921 (workspace-instructions revision-notices classifier) and #5109 (dsh time-context injection) — disjoint message families, both kept in dshDurableToolPath with correct precedence. Typecheck green; 44 targeted durable/dsh tests pass. Pushed fast-forward to 463cb85. Post-push state: mergeable, 0 commits behind master (e5e2108), status checks running (mergeable_state=behind). Note: master is advancing rapidly during active release work — if it reads behind again, the next guard pass will close it.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Superseding my sync note above (that was my own merge-guard report): I've since merged further master advances — this branch is now at e90d50b, synced to the master tip (e1938618), 0 commits behind, mergeable (status checks still running → blocked). The sole src/durable-message-guards.ts conflict stays resolved as the additive #4921 ∪ #5109 union (disjoint carriers, both kept in dshDurableToolPath); typecheck green + 44 targeted durable/dsh tests pass. Master is moving fast during active release work, so it may briefly read "behind" between guard passes — each pass re-syncs cleanly with no conflicts.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ai: vllm-qwen/qwen3.8-27b)

Verdict: APPROVE / 可合. (Posted as a comment-review: GitHub forbids the author identity from issuing a formal Approve on its own PR, so this carries the full review + verdict here.) Reviewed end-to-end independently (PR body, linked issue #4921, full diff, full src/durable-message-guards.ts at head) and re-ran the targeted suites plus a negative control locally. Structured conclusion:

  1. What problem: On the dsh lane bili protected only the uppercase workspace-instructions baseline (Instructions from:) from compression folds. DSH delivers later rule edits as separate per-file notices (Updated/Additional instructions from: <path>, Instructions removed: <path>) that were ordinary foldable history — so after one fold the model kept executing changed/removed rules while the stale baseline stayed pinned. Field evidence in #4921: 11 real update carriers, 9 folded.

  2. Root cause: src/durable-message-guards.ts matched only the exact uppercase baseline label; the three lowercase revision shapes had no classifier, so they projected to no durable identity and were foldable. A missing classifier for the revision carrier family — not a threshold/policy bug.

  3. Blast radius / severity: dsh-lane plugin-native users who edit instruction files mid-session AND hit a compression covering the notice. Silent behavior corruption — the model executes stale/removed rules against a confident-looking pinned baseline (worse than losing both). p2 functional defect with a real user-visible failure mode (matches issue triage).

  4. How fixed: New classifier dshWorkspaceInstructionsRevisionPath projects each revision to its OWN per-path identity durable/agents-md-update/<path>, ordered BEFORE the shared baseline in the lane chain — an update body can quote the literal Instructions from: label (real traffic seq=2346) and must land in its per-path group, not the shared baseline. Per-path (not shared) identity is load-bearing: under default latest-per-path (durable/*) one shared identity would demote the OLDER instance (the multi-file baseline) to foldable — a net loss. Removed notices ride the same group so newest-event-per-file wins.

  5. Regressions audited: Baseline classifier byte-identical (still case-sensitive durable/agents-md) — unit + e2e pinned. Role gate (#2766 assistant echoes never project), content-type guard, and KDD#9 allowlist discipline (Object.keys(durableMessageToolPaths) === ["dsh"]) preserved and pinned. src/config.ts diff is comments-only (zero behavior change). No high-risk pattern hit: no fail-fast→swallow, no threshold/timing/output-format drift. One intentional, DISCLOSED behavior change: the three revision shapes now project + are protected latest-per-path under the default durable/* policy (old: foldable → new: newest-per-file pinned); footprint bounded by distinct files revised.

  6. Cache impact: None. Protection only affects which refs render BLOCKED-vs-foldable; it does not alter prefix-cache keys, retry, incremental cursors, or dedup. Pinned notices are turn-stable (same path+content), so they help prefix stability rather than hurt it.

  7. Design direction: No shift. Extends the existing #1947 "project client dialects to canonical virtual paths, govern by pattern" principle to one more evidence-backed dsh carrier family — same translation-layer / policy-split design, host-side only. No kernel/ change, no kernel-change declaration.

  8. New config: None. Reuses existing protectedTools/protectedLatestTools machinery + default durable/*; no new env var / config key / CLI flag. User durable-policy takeover configs keep working verbatim.

Tests: real, not tautological. Local run: new file 5/5; modified issue2447 + durable-tool-identity + issue2766 role-gate + issue5142 lockstep = 36/36. Negative control proven: removing the classifier from the lane chain makes both e2e pins fail with THE BUG: … RULE_V2 … must survive the fold — the test reproduces the original defect. Full-suite verdict = CI on this head (green).

Non-blocking note (left untouched, no issue filed): the new classifier is intentionally absent from the oneShotCarrierPaths / dshCarrierRawMarkers drift-accounting surface (#5142); a superseded older revision that folds would count as drift rather than expected-rebase. This is pre-existing (revisions were unclassified before → strictly more folded then) and this PR improves, not regresses, that surface; it is a different failure domain than #4921's protection concern, so out of scope here. Flagged for awareness only.

可合 / merge-ready: host-side-only fix, correct mechanism, real regression test with verified negative control, behavior change disclosed, clean on-topic diff, up-to-date with master.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #4927 (dsh lane: protect instruction-file revision notices from folds) — review complete, verdict: APPROVE / 可合 (merge-ready).

What I did:

  • Read PR body, linked issue [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath only recognizes uppercase "Instructions from:", leaving rule update/ad | [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath 只认大写 "Instructions from:",规则更新/新增/删除消息因此不设防——折掉后模型留着过期基线,更正消失 #4921, full diff, and the whole src/durable-message-guards.ts at head independently; re-ran the affected test suites locally plus a negative control.
  • Confirmed correctness: the new dshWorkspaceInstructionsRevisionPath classifier projects DSH's three per-file revision markers (Updated instructions from: / Additional instructions from: / Instructions removed:) to per-path identities durable/agents-md-update/<path>, ordered BEFORE the shared baseline so a notice quoting the literal baseline label lands in its own group; per-path (not shared) identity is what keeps the older multi-file baseline from being demoted under default latest-per-path. Baseline classifier byte-identical.
  • Verified tests have teeth: new file 5/5 + 36/36 across the four affected suites locally; negative control proven — deleting the classifier makes both e2e pins fail with "THE BUG … must survive the fold". Full-suite green = CI on this head.
  • Risk/drift check: one intentional, disclosed behavior change (the three revision shapes now protected latest-per-file vs previously foldable); no cache/retry/cursor impact; no config surface added; no kernel/ change → no authorization gate, so approval stands.
  • No small mechanical findings left unfixed; nothing filed (one out-of-scope observation flagged in the review for awareness only).

GitHub review posted (as a comment-review — a formal Approve is blocked because the token identity is the PR author): #4927 (review)

…4921)

Rebuild on current master to resolve the merge conflict: the PR branch had
drifted onto an old master line, so a plain merge produced 99 file conflicts.
The net #4921 contribution is exactly 4 files, re-applied as pure additions
on top of current master (which already carries the #5109/#4313/#5173/#5142/
#6021 classifiers the PR head lacked).

Re-applies the original fix commits 95a6062 (guard classifier + tests) and
20da083 (config.ts docs) verbatim:
- src/durable-message-guards.ts: new dshWorkspaceInstructionsRevisionPath
  classifier (per-path durable/agents-md-update/<path> identity) inserted
  before the baseline classifier in the dsh lane chain.
- tests/issue4921-dsh-instructions-revision.test.ts: new unit + real-fold e2e.
- tests/issue2447-dsh-workspace-instructions.test.ts: lane-chain assertion.
- src/config.ts: doc-only notes on the revision identities.

Closes #4921
@ranxianglei
ranxianglei force-pushed the 2026-10-27_dsh-instructions-revision-guard branch from 50f6c94 to 4aec140 Compare November 12, 2026 05:14
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Merge conflict resolved — PR branch rebuilt on current master and force-pushed (new head 4aec140503).

七问 summary (this run):

  1. What was the blocker? The PR was "dirty": its head branch (2026-10-27_dsh-instructions-revision-guard @ 50f6c94) had drifted onto an OLD diverged master line, so a plain merge against current master produced 99 file conflicts (including files that should auto-resolve).

  2. What did I do? Rebuilt the branch as a clean descendant of current master + re-applied ONLY the [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath only recognizes uppercase "Instructions from:", leaving rule update/ad | [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath 只认大写 "Instructions from:",规则更新/新增/删除消息因此不设防——折掉后模型留着过期基线,更正消失 #4921 deltas, then force-pushed (the conflict-rebase this task authorized). New head: 4aec140503.

  3. Why rebuild instead of merge? The PR head's net contribution vs its merge-base is exactly 4 files; everything else was byte-identical to the old master line. Taking the PR head's file versions verbatim would have deleted master's newer work (The "most recent user message" slot in the protected zone was preempted by a system-injected prompt, causing the just-is | 保护区「最近一条 user 消息」被系统注入提示抢占,导致刚下达的用户指令被压缩 #5173/[Performance][dsh] Mega-sessions pay an ever-growing O(full-history) fold-reconcile tax every turn: expected host churn (one-shot carrier retirement, image/offload retroactive rewrites) misclassified as drift | 大会话每轮付不断增长的 O(全史) fold-reconcile 税:合法宿主变更(o… #5142/[Bug][dsh] image-offload placeholder text hijacks the last-user anchor: model treats a two-day-old screenshot as the cur | [Bug][dsh] image-offload 占位文本抢走 last-user 锚点:模型把两天前的旧截屏当成当前提问(bili 0.1.213 / DSH 0.2.2-rc.1) #6021 classifiers: dshMnemonPath, dshSubagentSettledPath, dshAgentRelayPath, dshImageHandlePath, dshImageOffloadPlaceholderPath). A clean rebuild on master + pure [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath only recognizes uppercase "Instructions from:", leaving rule update/ad | [Bug][dsh] 0.1.208 · dshWorkspaceInstructionsPath 只认大写 "Instructions from:",规则更新/新增/删除消息因此不设防——折掉后模型留着过期基线,更正消失 #4921 additions avoids that regression.

  4. What did I verify?

    • 46 targeted tests pass (issue4921 e2e, issue2447, durable-tool-identity, issue2419/2446/2481/2766) — 0 fail.
    • npm run typecheck clean (kernel + pi-subagents build + tsc --noEmit).
    • git merge-tree against current master (259cd87674) → no conflicts.
  5. What's the diff? 4 files, pure additions (332+/8−): src/durable-message-guards.ts (new dshWorkspaceInstructionsRevisionPath classifier → per-path durable/agents-md-update/<path> identity, inserted before the baseline classifier in the dsh lane chain), tests/issue4921-dsh-instructions-revision.test.ts (new), tests/issue2447-dsh-workspace-instructions.test.ts (lane-chain assertion), src/config.ts (doc-only notes).

  6. Current state / what I could NOT verify live? The push landed (remote head confirmed 4aec140503). Master has since advanced to 259cd87674 but did not touch any of the 4 files, so no new conflict. The mirror check cache is stale (last fetched 2026-11-01, still showing the old head 50f6c94 + "blocked") — I could NOT verify the fresh CI/merge state from it; the poller has not refreshed this PR. Stating that rather than asserting green.

  7. Decisions needed? No. Mechanical conflict resolution only (rebuild = rebase-equivalent); no design decision, no authorization gate, no red-CI fix required.

End state: PR branch is a clean rebuild on current master, merges cleanly with 259cd87674, targeted tests + typecheck green. Awaiting the mirror/CI to refresh on the new head.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

No new action needed — the conflict resolution from my previous comment is already complete and verified live just now: remote head 4aec140503, git merge-tree vs current master → CLEAN (no conflicts). The full 七问 summary is in my prior comment above; not repeating it here.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

1 similar comment
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p2 scope/kernel

Projects

None yet

1 participant