Skip to content

feat(v2): 支持退出桌面后的常驻会话检索 - #634

Merged
Blue-Berrys merged 3 commits into
mainfrom
codex/on-demand-session-search
Oct 24, 2026
Merged

Blue-Berrys merged 3 commits into
mainfrom
codex/on-demand-session-search

Conversation

@Blue-Berrys

@Blue-Berrys Blue-Berrys commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

V2 桌面完全退出后,本机会话搜索和读取仍可由 CLI / MCP Gateway 使用。独立 Node 后台首次调用时启动,此后常驻,不因闲置、桌面退出或 MCP 断开而结束;无桌面连接时每十分钟增量扫描,搜索与读取前立即补齐索引。

CLI / Gateway / Desktop lease
  → one resident Node session backend
    → existing PostgreSQL + session index worker
    → scan every ten minutes when no desktop is attached
  → explicit stop / update / uninstall drains and shuts down

复用原有数据库、解析器和索引游标,无业务 schema 迁移或历史会话搬迁。桌面退出仅释放租约;周期任务不与活动请求或索引重叠,失败会记录并继续下次扫描。更新/卸载持有启动锁并等待后台关闭。保留来源、MCP 总开关及工具权限。

新增 V2 session search/get、backend start/status/stop;状态包含常驻模式与后台刷新周期。首版不注册开机或登录自启。规格与 ADR 同步更新。

Evidence

  • Before: V2 的 PostgreSQL 与本地索引线程由 Electron 持有,退出桌面后无法补齐新会话。
    After: 隔离 HOME 的真实 Node/PostgreSQL 验收通过:Codex/DSH、追加消息、并发 CLI/MCP、来源及工具权限、桌面断开后持续运行、显式停止/重启、崩溃恢复与维护锁。
  • 回归先观察到原实现在空闲六分钟后关闭,再验证常驻实现不再退出;覆盖无桌面定时扫描、桌面连接时跳过、错误后下次重试、活动请求与重复扫描避让、关闭前等待扫描结束。
  • 类型检查、构建及来源入口检查通过;相关 Vitest 54 项、客户端脚本 14 项通过。修复临时目录短暂锁定后的有限重试,故障注入与正常回归均通过。完整安装包与各平台结果见 CI。

Merge Danger

Door: two-way

不新增数据库格式。回退或切换版本前先退出桌面并停止后台,避免生命周期归属冲突。

Blast Radius: V2-lifecycle

后台常驻,Node 与内置 PostgreSQL 的资源占用会保留到显式停止、更新/卸载或系统结束。旧版桌面必须先退出;不同安装或版本拒绝混用。独立模式只覆盖本机会话搜索/读取,团队、资源和向量记忆仍需原服务。MCP 使用当前 Gateway;旧版手工直连数据库入口保持原行为,需重新配置 Gateway。

@Blue-Berrys Blue-Berrys changed the title feat(v2): 支持退出桌面后的按需会话检索 feat(v2): 支持退出桌面后的常驻会话检索 Oct 23, 2026
@Blue-Berrys
Blue-Berrys merged commit f2b797a into main Oct 24, 2026
11 checks passed
@Blue-Berrys
Blue-Berrys deleted the codex/on-demand-session-search branch October 24, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant