Conversation
wh-1
force-pushed
the
pr/session-cleanup
branch
from
September 19, 2026 10:06
8e4e2b7 to
a2914fc
Compare
This was referenced Sep 19, 2026
Open
Closed
wh-1
force-pushed
the
pr/session-cleanup
branch
from
September 19, 2026 12:44
a2914fc to
48b0606
Compare
新增「清理旧会话」:每账号每项目保留 updated_at 最新 keep 条,其余软删;
已上云的会话用该账号 token 同步删除云端,并追加对账与云端全貌两阶段。
- core 新增三个模块:session_slim(清理主流程)/ cloud_conv(云端删除,
含映射库代次探测与全账枚举)/ cloud_reconcile(残留清理 + 清单)
- 归属判据 = edge-sync-mapping 库的 msg_channel,只删目标账号自己的云端会话,
删不掉(403/404/网络)如实记进报告,绝不静默吞错
- 真跑前自动备份 workbuddy.db(含 -wal/-shm),拷不动就不给回滚点并如实上报
- 桌面端:账号卡片菜单新增「清理旧会话」,预览(dry_run)确认后再执行
- 顺带修掉 9 个 Windows 上必然失败的用例(上游 main 同样失败):
· 路径断言按 `/` 归一化后再比较(variant / session)
· token_stats 三处 fixture 改用 write(true) 句柄 pin mtime
(Windows 的 SetFileTime 需要 FILE_WRITE_ATTRIBUTES,只读句柄 Access Denied)
· codebuddy_cli::node_path_from_shell_output 接受 Unix 风格根路径、
export_import 的路径校验同口径 —— 修产品代码,不用 cfg 屏蔽绕开
· rate_limit_hook 的断言改用 script_name(),不再写死 hook.sh
wh-1
force-pushed
the
pr/session-cleanup
branch
from
September 19, 2026 12:48
48b0606 to
e0b74fe
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能
长期用下来云端和本地的旧会话只增不减,官方没有批量清理入口。账号卡片菜单新增「清理旧会话」:每个项目按
updated_at保留最新 N 条(N 可配),其余软删;已上云的会话用该账号的 token 同步删云端,最后跑一次对账。设计要点
msg_channel = convmsg:<uid>;归属别的账号、或没有映射行的一律只做本地软删(拿错 token 会 403)。对账阶段清「本机已软删、云端还在」的残留,其他设备上的活会话(Unknown)只计数workbuddy.db(含-wal/-shm),拷不动就不给回滚点并如实报告;前端先dry_run报「本地清 N 条 / 云端删 N 条」,确认才执行与 #43「历史重复清理」的区别
看到你在 #43 的回复(重复清理先放一放,怕误删同名不同内容)。这条判据不一样:
deleted_at,数据库行和 jsonl 正文都不动改动
session_slim/cloud_conv/cloud_reconcile(含单测);reqwest补blockingfeature;backup_workbuddy_db改pub(crate)顺带修 9 个 Windows 上必然失败的用例
上游 main 在 Windows 11 实机跑 core 测试是 334 passed / 9 failed,都是平台差异(路径归一化、
is_absolute()不认 Unix 风格根路径、SetFileTime权限、脚本名断言写死)。修的是产品代码而不是屏蔽测试,逐条见 commit。验证
cargo check -p wb-switch-rust -p wb-switch-server与tsc --noEmit均通过