Repository navigation
fix(desktop): 既有会话发送不再报告已解析会话 (onSessionResolved 契约) #4630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0354a10
fix(desktop): 既有会话发送不再报告已解析会话
somewan820 50cbf27
chore(desktop): 同步 renderer architecture ledger
somewan820 47c2dbd
ci: 重触发检查(transcript-scroll e2e 疑似 flaky,与本次改动无交集)
somewan820 efcfea0
ci: 再触发检查(重试 e2e)
somewan820 c7f8fae
fix(desktop): 仅在首条消息投射时报告已解析会话
somewan820 bc3c38a
chore(desktop): 同步 renderer architecture ledger
somewan820 325aacd
fix(desktop): 仅在首条消息投射时报告已解析会话
somewan820 d1cfe83
refactor(desktop): 收敛 send() 重复并移除死分支
somewan820 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English
Could we also gate this callback in the new-session branch on
submitted.kind === 'projected'?outcome_unknownis mapped tounreconciled, but this branch only returns early forrefused, so it still callsonSessionResolved. That contradicts the contract documented here and could link a Work Board item to a Session whose first message was never confirmed as projected. Sincesend()intentionally returnstrueforunreconciled, the caller cannot correct this afterward.Please also cover
new Session + outcome_unknownwith a regression test asserting thatsend()returnstruewhile the callback is not invoked.中文
这里是否也应该把新会话分支的回调限制为仅在
submitted.kind === 'projected'时触发?outcome_unknown会被映射为unreconciled,但当前分支只对refused提前返回,因此仍会调用onSessionResolved。这与此处声明的契约不一致,并可能把 Work Board 条目链接到首条消息尚未确认成功投射的 Session。由于send()对unreconciled会有意返回true,调用方之后也无法补救。建议同时补充
新 Session + outcome_unknown的回归测试,断言send()返回true,但回调不触发。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English
Good catch — done.
onSessionResolvedin the new-session branch now fires only whensubmitted.kind === 'projected'(headd1cfe8349).Follow-ups since the first fix (
c7f8fae78):ifso the file stays at or below the base token count (the renderer architecture debt ratchet only allows legacy AppShell files to shrink); the contract comments were re-added once the follow-up refactor freed budget.sendCommand/submitAndProjectblock shared by the new-session and existing-session branches into asubmitIntoSessionhelper, and removed the now-deadif (submitted.kind === 'unreconciled') return true;branch in the existing-session path (it existed to skip the deleted callback call).nonTriviaTokenswent 4278 → 4089.Verification: renderer architecture check passes against the CI base
726fb809· desktop main 2005/2005 · CItestgreen.This comment and the code changes were AI-assisted (pi); per CONTRIBUTING the affected commits carry a
Generated-by: pitrailer.中文
好建议,已完成。新会话分支的
onSessionResolved现在只在submitted.kind === 'projected'时触发(headd1cfe8349)。初版修复(
c7f8fae78)之后的后续调整:if,使文件 token 保持不高于 base(renderer architecture 单调 debt ratchet 只允许 legacy AppShell 文件缩减);后续重构释放预算后,契约注释已补回。sendCommand/submitAndProject块提取为submitIntoSessionhelper,并删除了既有会话路径中已失效的if (submitted.kind === 'unreconciled') return true;死分支(该行原本用于跳过已删除的回调调用)。nonTriviaTokens从 4278 降至 4089。验证:renderer architecture 检查以 CI 同款 base
726fb809通过 · desktop main 全量 2005/2005 · CItest绿。本评论与代码修改由 AI(pi)辅助生成,已按 CONTRIBUTING 在受影响 commit 附加
Generated-by: pitrailer。