Skip to content

fix(omp): 兼容新版会话、忙态追加与状态显示 - #955

Merged
deepcoldy merged 4 commits into
deepcoldy:masterfrom
hu5h:codex/oh-my-pi-compatibility
Aug 21, 2026
Merged

deepcoldy merged 4 commits into
deepcoldy:masterfrom
hu5h:codex/oh-my-pi-compatibility

Conversation

@hu5h

@hu5h hu5h commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

改动概览

  • 移除 Oh My Pi 已废弃的硬编码工具名,使用 OMP 当前默认工具集。
  • 为每个 Botmux 会话使用独立的 OMP session 目录,并通过精确 JSONL 路径恢复,避免 --continue 串到同目录下的其它会话。
  • 在沙盒中仅开放当前会话 transcript 目录,同时保留 OMP 既有的宿主用户认证/配置访问模型。
  • 支持普通飞书消息在 OMP 忙态时通过原生 steer 立即追加,并通过结构化 transcript bridge 将合并后的最终回复归属到最新匹配消息。
  • 对 OMP JSONL 的暂定终态做 continuation 消歧,仅在完整行静默且权威终端画面已无 busy marker 时释放最终回复。
  • 收紧本地恢复命令,只允许绝对、完整引用且不可追加参数的 --resume 命令。
  • 在任何状态变更前处理 start|stop|restart|update|upgrade --help/-h,避免帮助命令产生副作用。
  • 修复冷恢复/冷 refork 后状态卡错误停留在“等待输入”:新轮先显示启动态,POST 期间到达的 working 状态会在同一张卡提交后补齐;恢复/relay 旧卡语义保持不变。

原因

  • OMP 17.3.5 已删除旧工具名,旧参数会在启动阶段直接报错退出。
  • OMP 的 --continue 受终端 breadcrumb 影响,不能提供会话级精确恢复与隔离。
  • 忙态普通 Enter 已具备 steer 语义,但 Botmux 原先既未即时提交,也没有可靠的结构化归属链路。
  • worker 冷恢复时会沿用上一轮的 idle 状态创建新卡;若 POST 期间收到 working 更新,该更新只写入内存且缺少提交后对账,卡片可能长期显示“等待输入”。

影响面

  • OMP 适配器、会话恢复、沙盒路径、结构化 transcript bridge 与普通消息 busy steer。
  • 根 CLI 的状态变更命令帮助守卫。
  • worker-ready 的新轮状态卡创建/对账共享路径;未改 restored-card reuse/PATCH、非 pending relay/recovery、durable/VC/raw/startup gate,也未增加 OMP 状态卡特判。
  • OMP transcript 按 Botmux session 隔离;认证与配置数据库仍按宿主用户共享,维持现有信任边界。

验证

  • pnpm build:通过(TypeScript、脚本类型检查、dashboard bundle、dist audit)。
  • pnpm test:1053 个测试文件通过,17623 条测试通过,17 条按平台条件跳过。
  • 状态卡/OMP/help/restart 聚焦回归:790 条通过。
  • 真实 bubblewrap、worker/OMP 集成回归:114 条通过。
  • 独立实现检查:无 P0/P1/P2 finding。
  • git diff --check:通过。
  • CodeGraph:已同步。
  • pnpm switch:here && pnpm daemon:restart:本机全局 wrapper 已指向该 checkout,8 个 PM2 进程全部 online,既有会话恢复成功。

安全边界

  • durable/dispatch-attempt、VC/meeting、raw、startup/reattach 与 stale-generation 输入仍保持串行,不进入 busy steer。
  • OMP 不声明 reliableTurnTerminal;本改动不扩张为 durable exactly-once 语义。
  • 状态卡对账使用发卡前 revision 与 captured turn target,superseded POST 不会覆盖更新轮次。

@hu5h
hu5h marked this pull request as ready for review August 20, 2026 06:44
@hu5h
hu5h requested a review from deepcoldy as a code owner August 20, 2026 06:44
@hu5h
hu5h marked this pull request as draft August 20, 2026 10:57
@hu5h hu5h changed the title fix(omp): support isolated resume on current Oh My Pi fix(omp): support current sessions and busy-turn steer Aug 20, 2026
@hu5h
hu5h marked this pull request as ready for review August 20, 2026 12:16
@hu5h
hu5h force-pushed the codex/oh-my-pi-compatibility branch from 7b486c7 to cd877cc Compare August 21, 2026 10:02
@hu5h hu5h changed the title fix(omp): support current sessions and busy-turn steer fix(omp): 兼容新版会话、忙态追加与状态显示 Aug 21, 2026
@deepcoldy
deepcoldy merged commit d9a438b into deepcoldy:master Aug 21, 2026
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.17.0

deepcoldy pushed a commit that referenced this pull request Aug 24, 2026
#955 起每个 OMP 会话钉独立 exact 目录并从中精确 resume,但 #955 之前
的老会话 transcript 落在旧的 cwd-derived 共享 bucket,升级后 resume 找
不到会退化成 fresh、丢失历史。

本改动在冷(非 adopt)resume OMP 会话时插入 fail-safe 迁移预检:扫描旧
bucket,靠 botmux 每条 prompt 注入的 <session_id> marker + header 校验 +
cwd realpath 匹配 + 文件名↔native-id 一致四重比对,找出唯一可归属本会话
的记录,恰好命中 1 个才原子拷进 exact 目录(O_EXCL 临时文件 + sha256 校验
+ linkSync 不覆盖发布 + fsync);任何不确定(0/多匹配、畸形、symlink、超
预算)一律 skip 落回既有 fresh 兜底,从不 throw 进 spawn 路径。

配套将 omp-transcript 的 visibleText 提升为导出的 ompMessageText 供迁移侧
复用(纯加法)。仅在 cliId==='oh-my-pi' 冷 resume 触发,对其余 CLI no-op。

这是为 #955 升级断层打的过渡兼容补丁,待存量老会话消解后移除(见 #993)。
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.

2 participants