Repository navigation
Conversation
d6ea911 to
0d6578a
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 open+closed 全量检索(按 标签:bug + dsh + scope/kernel + p2(缺陷类;dsh 车道;src 侧折叠保护判定属压缩决策面;条件触发、有绕行,p2)。 本条为外部贡献 PR(无 agent 标记),正在做完整审核:拉分支读 diff、核 CI、定向跑相关测试。结论稍后按八问体例补在这条线程。 |
(ai: vllm-qwen/qwen3.8-27b) 审核完成(外部贡献 PR,独立审过 diff、机制与 CI)。结论:可合。 ① 方向关:修对了层。缺陷的产地是分类器—— ② 回归审查(逐项过既有行为):
③ 代码审查(主关):关键机制我独立核过源码而非只信 PR 描述—— ④ 测试有效性:新增 e2e 折叠场景走完整管道( ⑤/⑤b diff 整洁度与代码质量(外部提交从严):3 个文件全部与目的相关,无空行/生成物/锁文件噪音,无 version 触碰;命名达意( 八问:
收工判定:代码与行为均可合入。本 PR 改变默认保护行为面(§7.4「fallback/default 变化属产品决策」),不进 auto-merge,请人工合并:#4922 。合并后 #4921 由 PR 的 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) |
dsh's workspace-instructions carrier has a second shape that the ranxianglei#2447 guard never covered. @deepseek-ai/dsh-agent-instructions emits the baseline once and then, per changed file, a reconciliation message — `Updated instructions from: <path>`, `Additional instructions from: <path>` or `Instructions removed: <path>` — all lowercase (or a different verb), so the case-sensitive `Instructions from:` match left every one of them foldable. They are not ordinary consumable history. baselineIdentity (lib/index.js:39) is projectRoot + discovery/budget config and excludes file CONTENT, so a mid-session edit never re-emits a baseline: the revision is the only carrier of the change. Folding it left the pinned, superseded baseline in context and dropped the correction — the model kept obeying rules the user had already rewritten, with no signal that it lost the update. Field measurement on a live session: 11 revision carriers, 9 folded. Revisions now project to their own identity, `durable/agents-md-update/ <path>`, while the baseline keeps `durable/agents-md`. Per-path is deliberate: the default policy is latest-per-identity, so sharing one bucket would let the newest revision DEMOTE the baseline — and a baseline merges every discovered file into one message while a revision carries only its own file, so a multi-file session would have gone from "keep 2, lose 1" to "keep 1, lose 2" (measured: baseline 2 files, 5311 chars; Additional 1 file, 6710 chars). `durable/*` still matches the suffixed path (matchToolPath compares only the first segment). Also reorders the classifier so the revision shapes win over the baseline marker: a revision body can itself contain the uppercase label (a user documenting the matcher inside their own AGENTS.md), which used to be misread as a baseline. Tests: the classifier now pins all three revision shapes, the multi-file baseline, and the body-quotes-the-label case; a new fold scenario proves a revision survives a compress range that covers it (the negative control fails without the fix).
2abb52e to
2a67299
Compare
|
已重基到当前 master( 本地另外跑过: 这条与 #4927 是同一处缺陷(#4921)的两种实现,identity 都落在
缺陷本身仍在线:v0.1.213 里还是只认大写 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
结论:APPROVE —— 修复方向正确、实现干净、测试真实有牙;审核中发现的两个小问题已在 PR 分支顺手修掉(见下),无阻塞项。
方向审核(原 issue):#4921 的诊断成立——dsh 在 AGENTS.md 变更后不会重发 baseline(baselineIdentity 只含 projectRoot+发现配置,不含文件内容),三种会话中期的对账形态(Updated instructions from: / Additional instructions from: / Instructions removed:)是规则变更的唯一载体;分类器此前只认 baseline 的大写 Instructions from:,修订全部被折叠吃掉,留下仍被钉住的过期 baseline + 不含规则文本的摘要 → 模型静默遵守已被改写的规则。本 PR 给每种修订独立的 per-path identity durable/agents-md-update/<path>,默认策略 durable/* 的 latest-per-path 天然覆盖,不动 kernel。「per-path 而非共享桶」的论证成立(真实流量实测:共享桶会把 keep-2-lose-1 变成 keep-1-lose-2)。
回归审核(既有行为逐项):
- baseline 分类:不变(仍大小写敏感
Instructions from:,identity 仍durable/agents-md)✅ 保持 - 其余 10 个 dsh 分类器:diff 未触碰 ✅ 不变
- oneShot 载体链(#5142 漂移记账):被取代的修订现在也被分类 → 折叠后消失记为 expected host behavior(该机制的设计目的)✅ 有意
- Rule-3 last-user anchor:修订消息分类后失去锚点资格(宿主注入不得顶掉人类请求),与 baseline 本 PR 之前的待遇一致 ✅ 有意
- takeover-config 用户(
protectedTools: ["durable/agents-md"]精确):修订被分类但仍不匹配该精确 pattern → 保护净效果不变;config.ts 新注释引导加durable/agents-md-update/*或durable/*✅ 已披露 - raw markers 消费方(fold-reconcile channel-2 预筛):多 3 个子串,命中只是触发 JSON.parse + 严格分类,良性,≤256 行/pass ✅ 无害
kernel/:未触碰,无需版本 bump ✅
行为变更(旧值→新值披露):
- 三种修订形态:可折叠历史 → 受保护(latest-per-path,默认
durable/*)——即本修复本身。 - 修订消息失去 Rule-3 last-user-anchor 资格——有意(与 baseline 同待遇)。
- 我的修复提交:
/i移除(修订匹配由大小写不敏感改为敏感;DSH 发固定模板字面量,零召回损失、缩小误报面);raw markers 12→15(升级残留的修订行可被 channel-2 回填记账,不再持续漂成 drift-warn 噪音)。
已顺手修(同一 commit 0411a37e):
- 已顺手修:
dshCarrierRawMarkers(src/durable-message-guards.ts:463)补上三种修订形态的 marker——否则升级前已折叠的修订 id(issue 的现场人群:11 条 Updated 里 9 条被折)永远拿不到 channel-2 回填的 expected-rebase 记录,会持续每 pass 漂 warning 直到 backbone 滚过;lockstep 测试同步扩展(锚定 marker 需 wrapper 前缀 + 样例路径后缀,tests/issue5142-expected-rebase.test.ts:441)+ commit 0411a37 - 已顺手修:
agentsMdRevisionPath去掉/i——owner 的 #4927 明说「no case folding」,模块对固定模板的先例(baseline 的 includes、dshAgentRelayPath)也是大小写敏感,DSH 发固定 casing,/i 零召回收益只有误报面扩大 + commit 0411a37
修复提交的本地验证:durable 家族 7 个测试文件 52/52(含 issue2447 全部 e2e 场景与扩展后的 lockstep)、typecheck 绿;全量裁决以 head 0411a37e 的 CI 为准(写作时在跑,0 红)。原 head 2a672997 的 CI 全绿已核对(镜像缓存:failed 0)。
测试质量:真服务 rig(startServer + listen(0) 动态端口)、经 /__bili/plugin/tool 走真实 compress、断言看下一轮上游 body;双向有牙(存活 + filler 被消费证明折叠真的发生)、防 vacuous 注入 guard、KDD #9 未注册车道负例齐全。
与 #4927 的关系(提请 owner 注意,我不代决):两 PR 是同一缺陷(#4921)的两种实现。本 PR = 内联私有分类器、rebased 单提交、CI 绿;#4927 = 单独导出函数、大小写敏感、当前与 master 冲突(dirty)。合任一个都能关 #4921;两个都合会在 dshWorkspaceInstructionsPath 与同一测试文件上语义冲突——留哪个由 owner 定。若先合本 PR,#4927 需要重做或关闭。
八问:
- 是什么问题:dsh 会话中期改 AGENTS.md 的对账通知(Updated/Additional/removed)没被认成持久载体,被压缩吃掉,留下过期 baseline 继续钉住 → 模型静默遵守已被改写的规则。
- 什么原因导致的:分类器只匹配 baseline 的大写标签;宿主在文件变更后不会重发 baseline(其 identity 不含内容),修订是唯一载体,折叠它 = 规则变更本身丢失。
- 影响范围与严重程度:任何「会话中编辑/新发现/删除 AGENTS.md 且发生压缩」的 dsh 插件会话(现场证据:单会话 11 条 Updated 载体折掉 9 条);后果是静默语义漂移——模型按旧规则行事且无从察觉,核心保护承诺失灵,用户难以自查。
- 怎么修复的:每种修订形态独立 per-path identity,修订先于 baseline 分类(修订正文可能引用大写标签);默认 latest-per-path 策略天然覆盖,kernel 零改动。
- 是否有回归问题:未发现无意回归——回归审核七项逐一给出结论(见上)。
- 是否破坏缓存:不涉及——纯分类/策略层,不碰缓存键、重试、增量游标、去重键;钉住的消息集合小幅增长(每触及路径一条修订),有界。
- 是否改了设计方向:没有——沿用既有 durable-carrier 框架(KDD #9 证据许可清单、per-path identity、latest-per-path 策略),未引入新机制。
- 是否引入新配置:没有——无新 env/config/默认值;仅 config.ts 加引导注释,schema 不变。
可合并:是(APPROVE)。待办:owner 在本 PR 与 #4927 之间择一落地。
…able-message-guards.ts and issue5142-expected-rebase.test.ts) The two conflicts were in doc comments and a test assertion that both sides had updated independently: - master added image-handle/image-offload classifiers (12 total, 14 markers) - PR added workspace-instructions revision markers (4 total for that family) - merged: 12 classifiers, 17 markers Closes none — this is a CI sync commit for PR ranxianglei#4922.
[bot] (ai: vllm-qwen/qwen3.8-27b) 冲突已解决,PR 恢复可合并状态。 做了什么:把 master 最新 tip(
验证:typecheck 干净; 当前状态:head |
…able-message-guards.ts and issue5142-expected-rebase.test.ts) Master added a second runtime-context marker (ranxianglei#7085, 0.2.2-rc.3 lead-in without trailing colon) on top of the PR's three workspace-instructions revision markers. Merged count: 12 classifiers, 18 markers. Doc comment and lockstep assertion updated to match.
[bot] (ai: vllm-qwen/qwen3.8-27b) 第二次冲突同步完成。master 在上次同步后又前进了( 冲突内容:
验证:typecheck 干净; 当前状态:head |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
结论:APPROVE(sync 后复审) —— 上轮审查(head 0411a37e)之后新增的两个 master-sync 合并提交(1911566bce、c9767d0adf)我独立核过:冲突解决是正确的并集,PR 内容与我上轮批准的一字不差,无新增逻辑改动、无阻塞项。
本轮变更审计(sync 合并):
- 对当前 master(
a446a3c1c8)的净 diff 仍恰好是 4 个文件(src/durable-message-guards.ts、src/config.ts、tests/issue2447-…、tests/issue5142-…),没有任何其他文件被 merge 带入 → 合并未夹带内容。 - 我上轮顺手修的两处全部保留:三种修订形态的 raw markers(现 18 条中的 3 条)、修订正则无
/i、lockstep 测试的MARKER_CONTEXT+MARKER_SUFFIX扩展。 - master 侧增量完整带入:#7085 runtime-context 第二 marker(0.2.2-rc.3 lead-in 无尾冒号)+
dshRuntimeContextPath双字面量分类器、agent-relay/image-offload 家族 markers。 - doc comment 计数同步更新正确(fifteen→seventeen→eighteen),家族分解与数组逐条对得上(workspace-instructions 4 + runtime-context 2 + mnemon 2 + agent-relay 2 + image-offload 2 + 6 个单条 = 18);lockstep 断言
>=17→>=18更新正确。 - 无 evil merge:相对 master 侧 = 恰好 PR 贡献;相对 PR 侧 = 恰好 master 增量。
本地验证(新 head c9767d0ad):durable 家族 7 个测试文件 57/57 绿(含扩展 lockstep + issue2447 的 e2e 修订折叠场景),npm run typecheck 干净。CI 镜像 0 红(写作时 12 项仍在跑)。
八问(本轮 = sync 复审,与原审查一致处从简):
- 是什么问题:dsh 会话中途改 AGENTS.md 的修订消息(唯一携带新规则的载体)不被折叠保护——同前,本轮无新问题。
- 什么原因导致的:分类器只认大写基线标记——同前。
- 影响范围与严重程度:仅 dsh 车道,条件触发(改文件 + 折叠盖住修订),静默过期规则执行——同前。
- 怎么修复的:修订投射 per-path identity
durable/agents-md-update/<path>——同前;sync 合并为纯并集,未改任何语义。 - 是否有回归问题:无。合并未改变任何行为;对 master 的净 diff 与上轮批准的内容一致;上轮逐项审过的既有行为(基线判定、exact-takeover 配置、同族载体、fail-fast/阈值/输出格式)逐项保持。
- 是否破坏缓存:不涉及。
- 是否改了设计方向:不涉及。
- 是否引入新配置:无。
收工判定:可合并(APPROVE)。本 PR 与 #4927 是同一缺陷(#4921)的两种实现,合哪条仍请 owner 拍板;合入后 #4921 由 Closes 自动关闭。
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
这是啥问题
dsh 的 workspace instructions 是 durable 载体(#2447),而它有两种形态;守卫只覆盖了第一种。
基线是
Instructions from: <path>(大写 I),已被durable/agents-md保护住。但会话中途改了文件之后,@deepseek-ai/dsh-agent-instructions发的是核对消息:Updated instructions from: <path>Additional instructions from: <path>Instructions removed: <path>三者全是小写
instructions(或干脆换了动词),而dshWorkspaceInstructionsPath用的是msg.text.includes("Instructions from:")——大小写敏感精确匹配,一条都没被保护。后果不是"少了一条历史"。
baselineIdentity(dsh-agent-instructions/lib/index.js:39)只含projectRoot/projectRootMarkers/maxBytes/maxSourceBytes/instructionFileCandidates/localInstructionFileCandidates,不含文件内容——内容改了 identity 不变,宿主不重发基线。所以那条修订是本次变更唯一的载体。折掉它之后,上下文里留下的是「一条被钉死的旧基线 + 一个不含新规则正文的摘要」:模型继续按用户已经改掉的规则干活,并且无从察觉自己丢了更新。这比两条都折更糟——两条都折,模型至少知道自己手上没有规则。实测(一个 2907 条消息 / 23 个 block 的真实会话):11 条
Updated instructions from:载体,9 条被折,其中一次compress一口气吞掉 4 条。另一会话里Additional instructions from: neighbor-help-frontend/AGENTS.md(6710 字符)被折进b1,此后整个会话再无项目指令。根因(代码坐标)
src/durable-message-guards.tsdshWorkspaceInstructionsPath:只匹配大写Instructions from:。原注释写着"大小写敏感是故意的——核对消息属于普通可消费历史",本仓tests/issue2447-dsh-workspace-instructions.test.ts:138也把这一点钉成了预期。dsh-agent-instructions/lib/index.js:39的baselineIdentity不含文件内容,而:262/:283/:285三种修订文案全是小写(或换动词)——于是"可消费"的那条恰好是唯一带新内容的那条。toLowerCase():默认策略是protectedLatestTools: ["durable/*"]的 latest-per-identity(collectLatestProtected按 virtualPath 分组、每组只留最新一条)。基线与修订共用durable/agents-md时,最新修订会把多文件基线挤成可折。实测那对 base + revision:基线带 2 个文件(全局 + 项目根,5311 字符)、Additional只带 1 个(6710 字符),共用 identity 就是从"保 2 丢 1"变成"保 1 丢 2",净亏。改动
src/durable-message-guards.ts:新增agentsMdRevisionPath(),把三种修订投射到独立 identitydurable/agents-md-update/<path>;基线保留durable/agents-md。durable/*仍匹配带后缀的路径(matchToolPath对<prefix>/*只看第一段)。dshWorkspaceInstructionsPath改为先认修订、再认基线。这不是形式上的整齐:修订正文完全可能引用大写Instructions from:字面量(用户在自己 AGENTS.md 里说明这个匹配串),按旧顺序会被误判成基线、拿到和真基线相同的 identity,再被 latest-per-identity 挤掉。回放真实会话日志时,就有一条Updated instructions from: ~/.dsh/AGENTS.md,其正文同时含大写Instructions from:。src/config.ts:补文档——修订有独立 identity,所以"durable/agents-md"这个精确 takeover 不再覆盖修订;要收全家桶写"durable/*",或再加上"durable/agents-md-update/*"。tests/issue2447-dsh-workspace-instructions.test.ts:翻转原第 138 行断言(原值undefined,旁边注明 "lowercase reconciliation variants stay consumable history"),并在旁边写清为什么翻转;补三种修订形态、多文件基线、正文引用大写标记的用例;新增端到端折叠场景。验证
session-b5ad5365-…6879 条事件、session-d979d0c3-…3277 条),把新正则直接跑在真实注入消息上:Additional instructions from: neighbor-help-frontend/AGENTS.md→durable/agents-md-update/neighbor-help-frontend/AGENTS.md;同时确认所有真实基线消息都不被修订正则误命中。上面那条"正文引用大写标记"的用例就是从这里来的,不是编的。正文引用大写标记那条用例靠INSTR_MSG.replace(...)注入,一旦 fixture 变动会静默不生效、断言照样通过。已加assert.notEqual(注入后, INSTR_MSG, "fixture injection must actually land"),注入没落地直接红。durable/agents-md;基线正文引用Instructions from:仍认作基线;修订正文引用它仍认作修订(顺序正确性)。compress让区间同时盖住两者 → 修订正文always run lint AND typecheck存活(它别处没有);基线同时存活(独立 identity,没被修订挤下去);区间里的填充消息确实被吃掉(证明折叠真发生了,不是保护把整个范围否决了)。src/durable-message-guards.ts重跑,issue2447的 5 个用例红 2 个(单测 + 新折叠场景);恢复后 5/5 绿。确认这两个测试真钉住了行为,不是无论怎么实现都会通过的摆设。issue24475/5;issue2446/issue2481/issue276619/19;durable-tool-identity9/9;issue2419+protected-*系列 17/17(2 个 verif 用例无求解器环境自动 skip);wire-contract-golden/config-surface-guard/marker-lane-coverage/golden-kernel-dist-guard全绿;npm run typecheck干净;unused-export / test-import-graph 两个 gate 干净。关联
Closes #4921
#2447(本条 durable 车道)· #2428(message-level 保护钩子)· #2419 / #2446 / #2481(同族 carrier)