Hosted file history: retention and recovery follow-ups / Hosted 文件历史:保留与恢复后续
Context / 背景
Follow-up to #13105 and #13110, including the real-environment review. PR #13110 is past five review rounds; this issue records non-blocking design and coverage work so the correctness fixes remain bounded.
承接 #13105 与 #13110,包括真实环境评审。PR 已超过五轮评审,本 issue 记录非阻塞的设计和覆盖工作,避免扩大当前正确性修复范围。
Work to evaluate / 待评估事项
Retention and capacity: history currently keeps two snapshot representations and all completed undo receipts within a 64 KiB record. Evaluate deduplication, delta records, bounded pruning or external resources without deleting referenced backups or breaking older request replay. The current preflight refusal is an explicit finite bound, not a long-session retention solution.
Unknown/partial undo recovery: define operator recovery and lease lifecycle using proof of stopped writers and durable outcomes. A timer alone must not authorize overlapping effects.
Shell/external mutation contract: tracked Write/Edit history treats later Shell content/mode changes as conflicts. Evaluate how to make that contract clearer to models/users, and whether any explicit reconciliation belongs in a separate design; do not silently absorb untracked writes or claim Shell backups.
Stored receipt validation: consider strict validation of persisted undo receipts and document cumulative replay invariants.
Remaining regression assertions: review mutation-surviving assertions for pending-before-undo, partial restore, pending-history acquisition, denied-call backup preparation, the 100-snapshot limit, changes after preparation, and active/blocked/pending undo gates. Account for new assertions added in the comment repair before adding duplicates.
Measured I/O cost: evaluate optimizing exact-byte backup comparison while retaining correctness for non-UTF8 data and older mtimes. Review evidence measured full reads; do not replace them with unsafe timestamp equality.
Local simplifications: evaluate explicit path invariants inside the history adapter and whether the general Broker history overload remains useful. These are suggestions, not merge blockers.
保留与容量: 当前历史将两份快照表示及全部已完成撤销回执保存在 64 KiB 记录内。评估去重、增量记录、有界裁剪或外部资源;不得删除仍被引用的备份或破坏旧请求回放。当前容量预检拒绝是明确的有限边界,不是长会话保留方案。
未知/部分撤销恢复: 根据写入者已停止的证据与持久化结果,定义运维恢复及租约生命周期。不能仅因计时器到期就允许重叠副作用。
Shell/外部修改约定: 已跟踪 Write/Edit 的内容或权限被 Shell 后续改变时视为冲突。评估如何向模型/用户说明,以及是否需要独立设计显式协调机制;不得静默接纳未跟踪修改或宣称已备份 Shell。
已存回执校验: 评估严格校验持久化撤销回执,并明确累计回放约束。
剩余回归断言: 核对变异测试存活的断言,包括撤销前 pending、部分恢复、带 pending 历史的获取、拒绝调用的备份准备、100 快照上限、准备后文件变化,以及活动/阻塞/pending 撤销门禁。先考虑评论修复新增的断言,避免重复添加。
实测 I/O 成本: 评估优化精确字节备份比较,同时保留非 UTF-8 数据及较旧 mtime 的正确性。评审已测得完整读取成本,不得退回不安全的时间戳相等假设。
局部简化: 评估在历史适配器内显式维护路径约束,以及 Broker 通用历史重载是否仍有必要。这些是建议,不是合并阻塞项。
Acceptance / 验收
Each adopted behavior/design change should have synchronized English and Chinese design documentation and focused evidence. Preserve Session/Workspace ownership, pre-effect refusal, conservative unknown-outcome handling and idempotent receipt replay. This issue does not require all items to be implemented together.
采纳行为或设计变更时,提供同步中英文设计文档和针对性证据。保留 Session/Workspace 所有权、副作用前拒绝、未知结果的保守处理,以及回执幂等重放。各项无需捆绑实现。
Source: QwenLM/qwen-code