Skip to content

fix new session first message race - #52

Merged
LetItBe12345 merged 1 commit into
mainfrom
agent/fix-new-session-first-message-race
Jul 30, 2026
Merged

fix new session first message race#52
LetItBe12345 merged 1 commit into
mainfrom
agent/fix-new-session-first-message-race

Conversation

@LetItBe12345

Copy link
Copy Markdown
Owner

修改内容

  • 以 Runtime 接受首条 Prompt 作为新 Session 创建的提交点
  • Session JSONL 尚未出现时仍返回创建成功,并异步刷新 Session 列表
  • 保留新会话中的乐观 Prompt,接收创建 IPC 返回前到达的实时事件
  • 启动恢复失效 Session 时不再持久化空 Session 的临时 ID
  • 补充 Main 和 Renderer 的竞态回归测试,并记录 MVP-39

根因

OMP 接受 Prompt 后已经进入 streaming,但 Desktop 随即扫描 Session JSONL。文件尚未写入时,Main 返回 SESSION_NOT_FOUND,Renderer 因此撤销乐观 Prompt并继续停留在临时会话,同时忽略已经开始运行的新 Session 事件。这造成界面显示失败、Stop 可用、无法切换 Session,但消息实际上已经发出的部分成功状态。

用户影响

新建对话发送首条消息时,不再出现“Session 不存在”。首条 Prompt 和后续 Assistant、Thinking、工具事件会持续显示;Session 列表允许稍后刷新。

验证

  • pnpm test:workspace-session:3 个测试文件、39 项测试通过
  • pnpm check:25 个测试文件、169 项测试通过
  • OMP_RPC_FAKE=1 node scripts/rpc-smoke.mjs:通过
  • pnpm build:通过

@LetItBe12345
LetItBe12345 marked this pull request as ready for review July 30, 2026 08:36
@LetItBe12345
LetItBe12345 merged commit 795bfd2 into main Jul 30, 2026
1 check passed
@LetItBe12345
LetItBe12345 deleted the agent/fix-new-session-first-message-race branch August 5, 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