feat(desktop): 会话已加载窗口显式建模,孤岛接回主段后零成本跳转 - #3693
Open
Michael-Yu2978 wants to merge 1 commit into
Open
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/lib/makerChatStore.ts | 用显式孤岛区间替代内部布尔状态,并在所有主要窗口形变和补齐路径中维护该模型;未发现可发布缺陷。 |
| apps/desktop/src/renderer/lib/searchJumpTargeting.ts | 新增主连续段计算与共享跳转判定,使 UI 和 store 对零成本跳转采用一致规则。 |
| apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 将 handoff 与容量环颜色迁移到语义主题 token,未改变交互逻辑。 |
| apps/desktop/src/renderer/features/maker-experimental/MakerExperimentalView.tsx | 将诊断视图的硬编码颜色系统性替换为已注册的双模式主题 token。 |
| apps/desktop/src/renderer/hooks/useCCAgentChat.ts | sessionless 轻量订阅改用形状匹配且稳定的 EMPTY_LIGHT_STATE。 |
| apps/desktop/src/renderer/tests/makerChatStoreJumpBackfill.test.ts | 增加多孤岛逐座收口、填洞后零网络跳转及裁剪语义回归覆盖。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[搜索或引用目标] --> B{目标位于主连续段?}
B -- 是 --> C[直接 focus]
B -- 否 --> D[around 与向上分页补齐]
D --> E[合并返回消息]
E --> F[收口被分页跨过的孤岛]
F --> B
Reviews (1): Last reviewed commit: "feat(desktop): 会话已加载窗口显式建模,孤岛接回主段后零成本跳转" | Re-trigger Greptile
Contributor
|
这个 PR 会改变会话跳转 / 已加载窗口的用户体验,已进入维护者确认,球不在作者手里。 请维护者直接在 PR 上 Approve;需要修改就 Request Changes。讨论 issue:#3716 |
Contributor
|
命中 UI 路径(会话跳转 / CCAgentSessionView)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面,便于确认界面符合 DESIGN.md 设计规范。 |
Signed-off-by: Michael-Yu2978 <ymt2978@163.com>
Michael-Yu2978
force-pushed
the
codex/featb
branch
from
September 1, 2026 14:53
3928920 to
a61307c
Compare
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.
这次改了什么
摘要
feat B「会话已加载窗口显式建模」:把
makerChatStore里「窗口是否掺过孤岛」的布尔(
historyWindowHasIsland)升级为显式孤岛区间模型historyWindowIslands: readonly LoadedWindowIsland[](每座孤岛{oldestClientId, newestClientId},按时间升序)。
背景(#676 review 之后与 MessageStream 锚定窗口双向有界 TODO 同一条后续改动):单个布尔
无法回答「目标落在窗口哪一段」,于是「孤岛 + 已翻到历史起点」的会话每次窗口内搜索都被迫
多发一轮 around + list 探测,窗口其实早已补成连续。显式模型下:孤岛被向上翻页真的跨过
(接回主段)时自动从模型消失;目标落在主连续段(最新尾段,最后一个孤岛最新边界行之后的
全部行)内时,搜索 / 跳转直接 focus、零网络。生产入口(
CCAgentSessionView的 searchJumpeffect)与 store 侧补齐快速通道共用同一把结构尺子
isInsideMainContiguousRun,不会再出现「生产判定与自愈判定漂移」的 #676 类问题。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
到历史起点」注释与 fix(desktop): 跳转历史消息不再留窗口空洞,工作组不跨空洞合并 #676 review(bce583965)
apps/desktop/src/renderer/lib/searchJumpTargeting.ts:新 API(LoadedWindowIsland、mainContiguousRunStartIndex、isInsideMainContiguousRun、canFocusWithoutJumpLoad)apps/desktop/src/renderer/lib/makerChatStore.ts:SessionChatState.historyWindowIslands(必填)替换旧布尔;
SessionChatLightState保留派生布尔historyWindowHasIsland;接入trim / demote / reload / clear / removeMessagesByClientIds / dropMessagesFromClientId
(edit-last)/ loadOlderMessages / 初始加载两次 setState / 权威重建(reconcile)/
around 提交(busy / covered / fallback);新增收口助手
(
absorbIslandsCrossedByPaging、updateIslandsAfterAroundMerge、pruneIslandsForTrimmedWindow、conservativeIslandsFor、conservativeIfIslandRowRemoved、pruneIslandsAfterNewestTruncation)apps/desktop/src/renderer/hooks/useCCAgentChat.ts:sessionless light 快照改用EMPTY_LIGHT_STATE新增 T2 / T3 / Y 语义更新)、makerChatStoreActiveView / makerQueueState /
reconcileRemoteMessages(断言迁移)
historyWindowIslands是 store 内部模型字段,未跨仓消费;对外 light 布尔保留)
UI 变化
与搜索跳转判定逻辑;UI 消费方(CCAgentSessionView / MessageStream)仍读派生布尔
historyWindowHasIsland,接口不变。怎么验证的
自动验证
相关单测覆盖(全部通过):
零分页请求;Y:整座被裁掉的孤岛随洞消失、保留尾段恢复主段
手工验证
未执行实机 GUI / device-link 验证:搜索跳转链路需真实双端联调,本机只覆盖到 store 与纯函数
单测;
canFocusWithoutJumpLoad的判定与 store 快速通道共用同一把尺子,单测已直接覆盖生产入口(CCAgentSessionView 的 searchJump effect 调用的就是该纯函数)。
未执行的验证
absorbIslandsCrossedByPaging的「row id 游标」分支:测试里id === clientId,未直接命中生产形态的分叉(代码为同一匹配函数,审查级确认)
风险
风险分类
影响与回滚
不涉及 SQLite / system prompt / 协议 / 原生层 / 存量插件 / 冷更。
行为变更与边界(如实记录)
真的跨过(行落进本批拉取范围)才从模型移除(T2 两孤岛序列守这条)。
起点塌缩吸收、孤岛永远记不上的 bug(T / Y3 回归);判据是「块里至少有一行本来就躺在
合并前主段里」。
slice(-TRIM_TARGET)后,整座被裁掉的孤岛随洞消失(Y 用例语义更新),仍夹在保留窗口里的孤岛保留(Y3 覆盖)——比旧 boolean「一律保留」更精确且不丢不变量。
跳过);一行都没加进来时不记(Z「零新增」语义不变)。
hasMore=false不再作为短路依据(fix(desktop): 跳转历史消息不再留窗口空洞,工作组不跨空洞合并 #676 codex P1 的「孤岛 + 已翻到历史起点」仍可被 around捞回缺的邻居)。
absorbIslandsCrossedByPaging的边界按clientId || id匹配——生产分页游标是 DB row id,只按 clientId 会让边界永远落空、孤岛不收口。
提交前检查
git commit -s,见 DCO)——重提后为 1 个 commit 并已签名(已重基到当前 main,剔除了误带入 fix(desktop): 诊断页与会话视图硬编码颜色改用语义 token #3686 的两个语义 token commit),pnpm check:dco对origin/main..HEAD全部通过