Skip to content

[PR] fix: classify the dsh image-offload placeholder as a one-shot carrier (#6021) - #6024

Merged
ranxianglei merged 3 commits into
ranxianglei:masterfrom
sx4im:fix-6021-image-offload-anchor
Nov 9, 2026
Merged

ranxianglei merged 3 commits into
ranxianglei:masterfrom
sx4im:fix-6021-image-offload-anchor

Conversation

@sx4im

@sx4im sx4im commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #6021

What broke: after a compaction, DSH swaps the image in history for a placeholder line ("[image omitted to fit request image limits; ...]") plus the original user words. Nothing classified it, so lastUserAnchor() pinned the placeholder as the current question and the model answered a two-day-old screenshot.

What changed: new dshImageOffloadPlaceholderPath classifier returning oneshot/image-offload-placeholder, wired into both registries (slot exclusion and drift accounting), plus both markers in dshCarrierRawMarkers. The text-only-route sibling marker shares the same family. A placeholder still never classifies as a live handle.

How verified: the three suites covering this area pass 34/34 (anchor geometry keeps the live request pinned, classifier units, marker lockstep, role gate). Neighbor suites match pristine master exactly, and the touched files typecheck clean.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Dedupe: no duplicate. Searched open+closed issues/PRs for the same symptom/mechanism: #6024 is the only open fix targeting #6021. Related family items are all closed and orthogonal in mechanism: #5752 (request-image handle classifier — its note that the placeholder is "deliberately unclassified" is exactly what produced this residual), #5150 (expected-rebase drift accounting), #3644/#3588 (fold-anchoring doctrine / substrate-destroyed verdicts). Same lane (#5173 anchor family), different facet: this one classifies the placeholder side of the offload event.

Labels: mirror #6026 → bug + dsh + scope/kernel + p2 (defect fix on the dsh lane, context-management core; p2 = usable but visibly broken after compaction — the model answers a two-day-old screenshot until the user re-asks; not data-loss/cache-leak, so not p1). GitHub-side PR labels: I attempted them via the REST API (full set, then a single-label probe) — the endpoint answers 200 but the label write is silently dropped in this environment, and there is no gh CLI here. Reporting that instead of claiming success.

Review in progress: branch checked out at a45548f8; running the three touched suites plus neighbor suites and typecheck locally before the full verdict (八问 to follow).

@ranxianglei ranxianglei added bug Something isn't working dsh p2 scope/kernel labels Nov 9, 2026
…the offload placeholder

A [text, image] original keeps its prose before the '[' bracket, so the marker can sit mid-text; pin that the documented substring match classifies it (coverage folded in from the parallel analysis in ranxianglei#6027).
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Review complete — verdict: mergeable, subject to two owner-side items at the end. Evidence below; 八问 in Chinese at the bottom.

⚠️ Consolidation ruling: a parallel duplicate PR exists. While reviewing I found agent-owned PR #6027 (opened ~12:04 UTC, ≈40 min after #6024) fixing the same issue (#6021) with functionally identical src changes (same dshImageOffloadPlaceholderPath classifier, same both-registries wiring, same two raw markers). Its thread also received a full independent review and its head was synced to master (all ten workflows green there — verified live). Ruling: keep #6024 as the canonical vehicle — first-come-first-served, and repo §4 protects external contributions from being replaced by agent-owned PRs (#1765). Actions taken:

Independent audit of #6021 (verified at the PR head, not taken on trust from either description):

  • Anchor path: kernel/src/protected.ts:330-347 — lastUserAnchor() skips any user message whose virtualToolPathOf() !== undefined (Rule 3); the classifier reaches the kernel through Config.messagePathOf via withDurableProtection (wired at src/session.ts:841,853 and src/server/handle.ts:2680). So a classified placeholder loses anchor eligibility, and oneshot/* paths are never pinned by default policy.
  • Drift accounting: channel 1 (src/fold-reconcile.ts:1786-1799) marks every incoming one-shot carrier id into METADATA_EXPECTED_REBASE on first sight; expectedRetired returns the WHOLE ledger size (:2397,:2446) — so the T2c test change 1→2 is correct, not cosmetic. The channel-3 slot-pairing gates are unaffected by the classification.
  • The e2e (tests/issue5173-last-user-anchor.test.ts:97-185) has real teeth: a 13-message family scenario in which the pre-fix anchor would have been the placeholder and the LIVE request folded (lossy data loss); post-fix only pre-anchor content folds and the anchor receipt m00003 is emitted. It runs through the real classifier + kernel applyCompression.

Regression review (existing behaviors touched): three behavior changes, all intended and gated to pluginAgent==="dsh": (1) placeholder messages lose Rule-3 anchor eligibility — the fix itself; (2) placeholder ids enter the expected-rebase ledger on first sight (their later retirement is accounted, not alarmed); (3) the stored-row backfill pre-filter screens two new markers (lockstep test updated 12→14). No unintended regressions found: no other path reads the new path string or markers; benign-FP blast radius = a dsh user literally typing the marker text loses anchor eligibility for that one message (the module's documented benign-FP doctrine). Neighbor suites (durable-tool-identity, dsh skill/mcp/workspace/runtime catalogs, fold-drift, fold-reconcile): 106/106 green locally.

Code & test quality: meets the external bar — no refactor needed. The classifier follows every sibling convention (role gate first per #2766; includes-not-prefix documented with the splice rationale; appended LAST in both chains so order among one-shots is provably irrelevant). The role-gate table row (tests/issue2766-durable-role-gate.test.ts:34) keeps assistant-echo discipline in lockstep with every carrier family. Diff: 4 files, every line on-purpose.

Verification state (live as of writing):

Non-blocking: the 🔶 decision request already on #6021 (offloaded cells re-ingest with fresh ref/ts → ts/ref-based freshness sees stale-as-new; option A content-addressing vs B continuity) is a separate pending-owner item and does not affect this PR. Also flagging for your severity re-judgment when closing the duplicate: the #6027 thread's reviewer rated this p1; I kept p2 here because the trigger surface is narrow (dsh lane + image + compaction + the placeholder ending up as the last user message) and the harm is a lossy fold + a wrong-topic answer for one turn, immediately recoverable by restating the question — not permanent data loss. Your call either way.

八问(结构化审核结论)

  1. 是什么问题:DSH compaction 把历史里的图片换成一行占位文本(外加用户原话),没有任何机制识别它,于是 lastUserAnchor 把这行两天前的占位符当成「当前问题」钉住,模型对着旧截图回答。
  2. 什么原因导致的:根因是身份变化 + 分类缺失——offload 改写改变内容身份,占位符以未分类的 user 角色消息落在重发历史尾部;Rule-3 锚点规则只跳过被分类的虚拟工具消息,未分类的 user 消息天然具备锚点资格。不是渲染或提示词问题。
  3. 影响范围与严重程度:仅 dsh 插件车道、且发生过带图片 compaction 的长会话(bili 0.1.213 / DSH 0.2.2-rc.1 复现);触发后当轮回答整体跑偏到旧话题、当前请求被折进摘要(有损)。触发条件窄、用户重新提问即可恢复——p2(p1/p2 分歧说明见上文)。
  4. 怎么修复的:在决策点分类(疏不堵)——新增 dshImageOffloadPlaceholderPath 分类器(role gate + contentType + 两个 marker 子串匹配)返回 oneshot/image-offload-placeholder,按既有惯例追加进双注册表(槽位排除 + 漂移记账)末尾,两个 marker 加入存储行回填预筛列表。不做传输层 payload 过滤。
  5. 是否有回归问题:审过三处受影响的既有行为(锚点资格、expected-rebase 账本、回填预筛),均为有意变更且已披露旧值→新值并有测试钉住;无 fail-fast 变吞错、无阈值/时序/输出格式漂移;相邻套件本地 106/106 绿。
  6. 是否破坏缓存:不涉及——不改前缀字节、缓存键、去重键或增量游标。
  7. 是否改了设计方向:不涉及——沿用既有 oneshot 载体家族与双注册表模式;kernel 未动、配置面未动、线格式未动。
  8. 是否引入了新的配置:不涉及。

判定:可合并 —— 前提:① owner 将 #6027 以 duplicate of #6024 关闭;② c855d6f 上的新一轮 CI 全绿(静态守卫已绿,测试车道行进中)。合并操作留给你(agent 不合并 PR)。

…fload placeholder (folded in from parallel PR ranxianglei#6027)

The unit rows pin that the classifier resolves; this file pins the actual
failure mode of ranxianglei#6021 through applyCompression with the REAL dsh registry:
a fold covering the offloaded tail must keep the live request visible (the
stale placeholder loses Rule-3 last-user anchor eligibility), and a
placeholder ahead of the live request still folds normally (no bloat).
@ranxianglei
ranxianglei merged commit f3766fe into ranxianglei:master Nov 9, 2026
48 checks passed
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

2 participants