Skip to content

[business-logic] #1437-A's tail-anchor fallback checkpoint backfires on resume: the anchor is loaded as a summary REPLACEMENT (ContextMessages=[anchor], nothing after it), so a long session that never compacted crashes back with ~1 message instead of the pre-fix 200; undo_blind is dead for its charter scenario (undo_edit has no path arg and isn't in the wildcard trio, so the headline undo_edit->edit_file blind-edit case never warns); batch_replace's whitelist entry is dead (its files[] is a bare string array no extractor reads), and undo_blind's precision inversion (git_reset with explicit paths bypasses the wildcard) #1518

Description

@topcheer

文件行号

internal/agent/agent_compact.go L55-71(#1437-A fallback:fallbackID = msgs[n-1].ID; fn(fallbackID, "", tokenCount) 写 checkpoint {summary_msg_id=最后一消息, last_msg_id=""}——L61-63 注释称 "loadSession replays only what comes after the anchor, so anchoring at the tail is conservative and correct" 误述 load 语义)+ 消费端 internal/session/store.go L1195(ContextMessages = [summaryMsg]——anchor 被当作 summary 替身替换其前全部上下文)+ L1255-1262(last_msg_id=="" 走 migrated-checkpoint else 分支 load summary 之后全部——anchor 后为空)+ 对照无 checkpoint 路径 L1301-1310(恢复最近 MaxContextMessages=200 条,L215 确认)+ agent.go:1370(每轮 maybeFallbackCheckpoint 计数变化即重写——anchor 逐轮前移崩溃时 extras≈0);undo_blind.go L95-110(undoBlindExtractFilePath 对 undo_edit 恒返回 ""——其参数仅 action/checkpoint_id/description 无路径字段;verify_hint.go L474-512 只查 file_path/path/files[].path)+ L103(通配符三元组 git_reset/git_stash/git_checkout 不含 undo_edit → 不标记)+ 文件头 L25(自述头号案例 "undo_edit(file.go) -> edit_file(file.go) // BLIND")+ L70(git_revert 双路皆死:无参不在三元组/带 path 标仓库目录永不匹配文件级);agent_memory.go L114(whitelist 含 batch_replace——其 files[] 是裸字符串数组,projectMemoryPathKey("files")=false 全丢弃,L110-113 注释仅适用对象数组)

问题

案 A(High·#1437-A 修复引入回归):tail 锚点 fallback 使 resume 上下文≈1 条消息

  • 目标场景(长 session 从未 compaction 成功+崩溃):修复前 skip→无 checkpoint→恢复 200 条;修复后 anchor 当 summary 替身→其后为空→≈1 条(可能是一条 tool_result,其配对 tool_use 已被丢弃还可能触发 API 校验错误)——safety net 在其声称保护的精确场景造成更严重丢失
    :无真 summary 时写让 load 走 no-checkpoint 路径的标记(或 skip 不写 checkpoint)。

案 B(High·漏报):undo_blind 对头号场景 100% 死火

  • undo_edit 是最常用 undo 工具但参数无路径 → 提取恒空且不在通配符组 → 零标记零警告——charter 场景死火;agent.go:3746 recordToolCall 只传 name+args 未回填 checkpoint 实际触碰文件
    :executeTool 拦截处回填 checkpoint 涉及文件,或对 undo_edit 设通配符。

案 C(Med·漏报):batch_replace 白名单死条目 + undo_blind 精确参数失效族

  • batch_replace files[] 裸字符串数组取不到 path key → 白名单等效未加(该文件路径的 project memory 注入不触发——复核修正定性:影响注入触发而非 drift 计费);git_revert 双路皆死;git_reset 等显式带 files/path 时仅剩粗糙通配符(精确参数未获精确追踪)
    :files[] 裸字符串逐项入集;revert 入通配符组;extractFilePathFromArgs 支持 files 裸数组。

案 D(Low×2)

#1437 修复区验证(stale 重审)

  • counter race 已闭(锁在位);whitelist batch tools 中 multi_*/grep 生效(唯 batch_replace 死条目即案 C);fallback 锚点代码在位但语义有害即案 A;L344-347 陈旧注释(信息级)。

干净项

unicode_check:接线在位(write_integrity.go:465)/Langs 门 c74c17a 未回退/不可见字符恒 error tier/CJK 同形字 delta 多集(搬运不触发)全对——非 CJK 弯引号 warning 为既有设计。agent_compact 其余:summarization 主路径/边界无新案。agent_memory 其余:注入架构与记忆一致。

排除

#1437 三案本体(本案是新发现回归非重复);#1516 type_switch(不同文件);四记忆项不冲突。

严重程度

High×2 + Med + Low×2


独立复核确认:store.go new-format 不清 postCPEntries(L1026-1034)→anchor 可找到→替身语义链、200 vs 1 对照、每轮重写前移推演、tool_result 配对风险、undo_edit schema 实证+三元组原文+头注释、files[] 裸数组双重取不到、指纹碰撞与通配符清除原文。

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions