Skip to content

Commit 6b7c497

Browse files
committed
docs(sleep): record the three boundaries of the conflict auto-resolve tier (#616)
The auto-resolve tier (#603 layer 4) is not safe to switch on yet, and none of the reasons were written down anywhere in the tree. This is a comment-only change: - config: the threshold argument quoted "345 rows carrying a similarity, 20 at or above 0.95 (5.8%)" is an earlier snapshot. Re-measured on the live store today: 748 rows total, only 11 with a non-NULL similarity, 0 at or above 0.95, the highest pair 0.914. Switching the tier on at the default threshold would adjudicate nothing tonight and read as a broken feature. - sleep: state that the whole tier lives inside the conflictFreezeEnabled branch. The two keys look independent in the panel but are parent and child - turning freeze off silently drops auto-resolve with it. - sleep: isCrossScopePair treats an unannotated scope as the same scope, because scopeKeyOf normalises NULL to null and null !== null is false. 2710 of 8259 active rows (32.8%) carry neither scope, so they slip past the ownership guard in v0.8.1 #170. - sleep: autoResolved and autoFailed have no consumer - dream.js forwards only frozen, conflict_reviewed has no API route and records no winner. No behaviour changes. Full suite: 3154 tests, 3153 pass, 1 skipped.
1 parent 9b16b97 commit 6b7c497

4 files changed

Lines changed: 90 additions & 16 deletions

File tree

‎dsh-mneme/lib/config.js‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,30 @@ export const Config = z.object({
546546
// Maximum number of frozen conflicts to keep pending for manual review.
547547
conflictFreezeMaxPending: z.natural().min(1).max(1000).default(100),
548548
// Issue #603 第 4 层(自动裁决档):freeze 模式里相似度极高的同 scope 对直接
549-
// 裁决(保留新条、归档旧条),不进人工队列——人只看模糊地带。默认关:这是
550-
// 会归档记忆的自动动作,必须显式打开。
551-
// 实测口径(live 库 345 条有相似度的历史行):>=0.95 只有 20 条(5.8%),
552-
// >=0.94 是 28 条(8.1%)。所以这一档减量约一半的峰值,减不到个位数;
553-
// 阈值留在配置里就是为了让人按自己队列的分布调,而不是信一个拍脑袋的数。
554-
// 跨 scope 对永不自动裁决:归属是用户的决定(v0.8.1 #170 的既有约束)。
549+
// 裁决(保留信息量更大的那条、归档另一条),不进人工队列——人只看模糊地带。
550+
// 默认关:这是会归档记忆的自动动作,必须显式打开。
551+
//
552+
// ⚠️ Issue #616:这一档有三个已知边界,打开前先读,别当成「开了就清净」。
553+
//
554+
// 1) 阈值论证用的是早期快照,当前库上 0.95 等于不生效。
555+
// 注释此前写「345 条有相似度、>=0.95 有 20 条(5.8%)」——2026-11-09 在
556+
// live 库重跑同口径:conflict_pending 全表 748 行,similarity 非 NULL 只有
557+
// 11 行,其中 >=0.95 是 0 行,最高一对 0.914。这不是说阈值错了,是说
558+
// 按 0.95 打开今晚一对都不会被判,用户会以为功能坏了。真要开,先按当前
559+
// 分布重定阈值(配置下限 0.85),别沿用这两个数。
560+
//
561+
// 2) 它不是独立开关,是 freeze 分支的子节点。整段自动裁决都在
562+
// sleep.js 的 `if (config.conflictFreezeEnabled === true)` 里;关掉 freeze
563+
// 会连它一起静默消失。面板上两个键看着平行,实际是父子。
564+
//
565+
// 3) 未标注 scope 会被判成同 scope。isCrossScopePair 走 scopeKeyOf,NULL 归一
566+
// 成 null,null !== null 为 false,于是「归属未知」被当成「归属相同」。
567+
// live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL,这批因此绕过了
568+
// 「归属是用户的决定、永不自动」(v0.8.1 #170)这条守卫。改判据前不要打开。
569+
//
570+
// 另外 autoResolved/autoFailed 目前没有任何消费者(dream.js 只取 frozen),
571+
// conflict_reviewed 台账也不记赢家、无 API 暴露——自动裁决了什么是看不见的。
572+
// 可见性补齐之前,这一档只适合在能盯日志的前提下短时打开。
555573
conflictAutoResolveEnabled: z.boolean().default(false),
556574
conflictAutoResolveMinSimilarity: z.number().min(0.85).max(1).default(0.95),
557575

‎dsh-mneme/lib/dream/sleep.js‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
356356
// · 只筛同 scope 对:跨 scope 对本来就要停车进人工队列,不能被台账吞掉;
357357
// · freeze 模式不筛:那一档只停车不送 LLM,台账与它无关(ledgerSkipped 记 0);
358358
// · ledgerSkipped 在这里一次数清,后面 candidates 直接取 samePairs,不再二次过滤。
359+
// ⚠️ Issue #616:这个判据把「未标注」当成「同 scope」。scopeKeyOf 把 NULL/空串
360+
// 归一成 null,于是两条都没标注时 null !== null 为 false,配对算同 scope、可以进
361+
// 自动池。但「归属未知」和「归属相同」不是一回事:按 v0.8.1 #170,前者本该是不可
362+
// 自动的范围。live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL,受影响的
363+
// 面不小。修法是把「任一未标注」显式判为不可自动,而不是继续让 null 自我相等。
359364
const isCrossScopePair = (p) =>
360365
scopeKeyOf(p.a.agent_scope) !== scopeKeyOf(p.b.agent_scope)
361366
|| scopeKeyOf(p.a.workspace_scope) !== scopeKeyOf(p.b.workspace_scope);
@@ -429,6 +434,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
429434
// · 接预算:conflictFreezeMaxPending 决定队列还能装多少,
430435
// sleepConflictMaxPairsPerRun 决定一轮最多处理多少,取两者较小值;
431436
// · 只把 fresh 计入 frozen,已入队的对不再虚报。
437+
//
438+
// ⚠️ Issue #616:下面这段 freeze 分支同时也是「自动裁决档」的唯一宿主——
439+
// conflictAutoResolveEnabled 的全部逻辑(autoEnabled / autoPool / autoResolved)
440+
// 都在这对花括号里面。两个配置键在面板上看是平行的,实际是父子:把 freeze
441+
// 关掉,自动档会跟着静默消失,没有任何提示。拆开之前别把它们当独立开关用。
432442
if (config.conflictFreezeEnabled === true) {
433443
const maxPending = Number.isInteger(config.conflictFreezeMaxPending) ? config.conflictFreezeMaxPending : 100;
434444
const pendingNow = typeof service.countConflictPending === "function" ? (service.countConflictPending() ?? 0) : 0;
@@ -445,13 +455,17 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
445455
// Issue #603 第 4 层(自动裁决档,默认关):相似度极高的**同 scope** 对不再
446456
// 进人工队列,直接保留信息量更大的那条、归档另一条。人只看模糊地带。
447457
//
448-
// 为什么阈值留在配置里而不是写死 0.95:live 库 345 条有相似度的历史行里,
449-
// >=0.95 只有 20 条(5.8%)、>=0.94 是 28 条(8.1%)。这一档减的是峰值,
458+
// 为什么阈值留在配置里而不是写死 0.95:这一档减的是峰值,
450459
// 不是把队列清零——把阈值当常量会让人以为「开了就没事了」。
451460
//
452461
// 为什么跨 scope 永不自动:归属是用户的决定(v0.8.1 #170),归档败者可能
453462
// 销毁某归属下的唯一副本。这条约束比减负重要。
454463
//
464+
// ⚠️ Issue #616:这条守卫有一个洞。isCrossScopePair 走 scopeKeyOf,NULL 归一
465+
// 成 null,null !== null 判为 false —— 「未标注」因此被当成「同 scope」混进
466+
// autoPool。live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL。改判据
467+
// 之前,别把这一档当成「归属安全」。
468+
//
455469
// 为什么用 supersede 而不是 conflict:conflict 会把「(已否决旧信息:…)」
456470
// 追加到**赢家**正文,而赢家正是留下来的那条;近重复对再叠一段互相引用的
457471
// 注记,等于用冗余污染幸存记忆。supersede 把可追溯性留在被归档的一侧,
@@ -552,6 +566,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
552566
frozen,
553567
// 自动裁决掉的不进队列,但确实是这一轮干的活——分开报,别混进 frozen
554568
// (frozen 的语义是「给人工队列新增了几行」,混进去面板就会虚高)。
569+
// Issue #616:这两个字段目前**没有消费者**。dream.js 的两处 return 只透出
570+
// frozen,面板也不读它们;conflict_reviewed 台账同样没有 API 暴露,且 schema
571+
// 不记赢家(memory_a/b 是排序过的)。也就是说自动裁决干了什么,事后只能翻
572+
// loser 正文的「(已被取代:…)」后缀反推。补可见性之前,别指望从报告里看出
573+
// 这一档跑了几对。
555574
autoResolved,
556575
autoFailed,
557576
// 写库抛错的对既没入队也不算落地:clean=false,别让调度器当「追完了」。

‎dsh-mneme/src/config.js‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,30 @@ export const Config = z.object({
546546
// Maximum number of frozen conflicts to keep pending for manual review.
547547
conflictFreezeMaxPending: z.natural().min(1).max(1000).default(100),
548548
// Issue #603 第 4 层(自动裁决档):freeze 模式里相似度极高的同 scope 对直接
549-
// 裁决(保留新条、归档旧条),不进人工队列——人只看模糊地带。默认关:这是
550-
// 会归档记忆的自动动作,必须显式打开。
551-
// 实测口径(live 库 345 条有相似度的历史行):>=0.95 只有 20 条(5.8%),
552-
// >=0.94 是 28 条(8.1%)。所以这一档减量约一半的峰值,减不到个位数;
553-
// 阈值留在配置里就是为了让人按自己队列的分布调,而不是信一个拍脑袋的数。
554-
// 跨 scope 对永不自动裁决:归属是用户的决定(v0.8.1 #170 的既有约束)。
549+
// 裁决(保留信息量更大的那条、归档另一条),不进人工队列——人只看模糊地带。
550+
// 默认关:这是会归档记忆的自动动作,必须显式打开。
551+
//
552+
// ⚠️ Issue #616:这一档有三个已知边界,打开前先读,别当成「开了就清净」。
553+
//
554+
// 1) 阈值论证用的是早期快照,当前库上 0.95 等于不生效。
555+
// 注释此前写「345 条有相似度、>=0.95 有 20 条(5.8%)」——2026-11-09 在
556+
// live 库重跑同口径:conflict_pending 全表 748 行,similarity 非 NULL 只有
557+
// 11 行,其中 >=0.95 是 0 行,最高一对 0.914。这不是说阈值错了,是说
558+
// 按 0.95 打开今晚一对都不会被判,用户会以为功能坏了。真要开,先按当前
559+
// 分布重定阈值(配置下限 0.85),别沿用这两个数。
560+
//
561+
// 2) 它不是独立开关,是 freeze 分支的子节点。整段自动裁决都在
562+
// sleep.js 的 `if (config.conflictFreezeEnabled === true)` 里;关掉 freeze
563+
// 会连它一起静默消失。面板上两个键看着平行,实际是父子。
564+
//
565+
// 3) 未标注 scope 会被判成同 scope。isCrossScopePair 走 scopeKeyOf,NULL 归一
566+
// 成 null,null !== null 为 false,于是「归属未知」被当成「归属相同」。
567+
// live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL,这批因此绕过了
568+
// 「归属是用户的决定、永不自动」(v0.8.1 #170)这条守卫。改判据前不要打开。
569+
//
570+
// 另外 autoResolved/autoFailed 目前没有任何消费者(dream.js 只取 frozen),
571+
// conflict_reviewed 台账也不记赢家、无 API 暴露——自动裁决了什么是看不见的。
572+
// 可见性补齐之前,这一档只适合在能盯日志的前提下短时打开。
555573
conflictAutoResolveEnabled: z.boolean().default(false),
556574
conflictAutoResolveMinSimilarity: z.number().min(0.85).max(1).default(0.95),
557575

‎dsh-mneme/src/dream/sleep.js‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
356356
// · 只筛同 scope 对:跨 scope 对本来就要停车进人工队列,不能被台账吞掉;
357357
// · freeze 模式不筛:那一档只停车不送 LLM,台账与它无关(ledgerSkipped 记 0);
358358
// · ledgerSkipped 在这里一次数清,后面 candidates 直接取 samePairs,不再二次过滤。
359+
// ⚠️ Issue #616:这个判据把「未标注」当成「同 scope」。scopeKeyOf 把 NULL/空串
360+
// 归一成 null,于是两条都没标注时 null !== null 为 false,配对算同 scope、可以进
361+
// 自动池。但「归属未知」和「归属相同」不是一回事:按 v0.8.1 #170,前者本该是不可
362+
// 自动的范围。live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL,受影响的
363+
// 面不小。修法是把「任一未标注」显式判为不可自动,而不是继续让 null 自我相等。
359364
const isCrossScopePair = (p) =>
360365
scopeKeyOf(p.a.agent_scope) !== scopeKeyOf(p.b.agent_scope)
361366
|| scopeKeyOf(p.a.workspace_scope) !== scopeKeyOf(p.b.workspace_scope);
@@ -429,6 +434,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
429434
// · 接预算:conflictFreezeMaxPending 决定队列还能装多少,
430435
// sleepConflictMaxPairsPerRun 决定一轮最多处理多少,取两者较小值;
431436
// · 只把 fresh 计入 frozen,已入队的对不再虚报。
437+
//
438+
// ⚠️ Issue #616:下面这段 freeze 分支同时也是「自动裁决档」的唯一宿主——
439+
// conflictAutoResolveEnabled 的全部逻辑(autoEnabled / autoPool / autoResolved)
440+
// 都在这对花括号里面。两个配置键在面板上看是平行的,实际是父子:把 freeze
441+
// 关掉,自动档会跟着静默消失,没有任何提示。拆开之前别把它们当独立开关用。
432442
if (config.conflictFreezeEnabled === true) {
433443
const maxPending = Number.isInteger(config.conflictFreezeMaxPending) ? config.conflictFreezeMaxPending : 100;
434444
const pendingNow = typeof service.countConflictPending === "function" ? (service.countConflictPending() ?? 0) : 0;
@@ -445,13 +455,17 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
445455
// Issue #603 第 4 层(自动裁决档,默认关):相似度极高的**同 scope** 对不再
446456
// 进人工队列,直接保留信息量更大的那条、归档另一条。人只看模糊地带。
447457
//
448-
// 为什么阈值留在配置里而不是写死 0.95:live 库 345 条有相似度的历史行里,
449-
// >=0.95 只有 20 条(5.8%)、>=0.94 是 28 条(8.1%)。这一档减的是峰值,
458+
// 为什么阈值留在配置里而不是写死 0.95:这一档减的是峰值,
450459
// 不是把队列清零——把阈值当常量会让人以为「开了就没事了」。
451460
//
452461
// 为什么跨 scope 永不自动:归属是用户的决定(v0.8.1 #170),归档败者可能
453462
// 销毁某归属下的唯一副本。这条约束比减负重要。
454463
//
464+
// ⚠️ Issue #616:这条守卫有一个洞。isCrossScopePair 走 scopeKeyOf,NULL 归一
465+
// 成 null,null !== null 判为 false —— 「未标注」因此被当成「同 scope」混进
466+
// autoPool。live 库活跃 8259 行里 2710 行(32.8%)两个 scope 全 NULL。改判据
467+
// 之前,别把这一档当成「归属安全」。
468+
//
455469
// 为什么用 supersede 而不是 conflict:conflict 会把「(已否决旧信息:…)」
456470
// 追加到**赢家**正文,而赢家正是留下来的那条;近重复对再叠一段互相引用的
457471
// 注记,等于用冗余污染幸存记忆。supersede 把可追溯性留在被归档的一侧,
@@ -552,6 +566,11 @@ async function phaseConflicts(ctx, service, config, logger, runId, semantic = nu
552566
frozen,
553567
// 自动裁决掉的不进队列,但确实是这一轮干的活——分开报,别混进 frozen
554568
// (frozen 的语义是「给人工队列新增了几行」,混进去面板就会虚高)。
569+
// Issue #616:这两个字段目前**没有消费者**。dream.js 的两处 return 只透出
570+
// frozen,面板也不读它们;conflict_reviewed 台账同样没有 API 暴露,且 schema
571+
// 不记赢家(memory_a/b 是排序过的)。也就是说自动裁决干了什么,事后只能翻
572+
// loser 正文的「(已被取代:…)」后缀反推。补可见性之前,别指望从报告里看出
573+
// 这一档跑了几对。
555574
autoResolved,
556575
autoFailed,
557576
// 写库抛错的对既没入队也不算落地:clean=false,别让调度器当「追完了」。

0 commit comments

Comments
 (0)