fix new session first message race - #52
Merged
Merged
Conversation
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.
修改内容
根因
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:通过