Repository navigation
Conversation
1. 浏览历史栈(sessionBrowseHistory / useSessionBrowseHistory): - 将本地伙伴(/bots/:id 与 /bots/:id/session/:sid 归一为 /bots/:id)、远程伙伴与群聊/直聊纳入任务浏览栈,保留非聊天子页在栈外; - 后退/前进回到本地伙伴时直接解析 canonical 会话并带 BOT_DIRECT_ENTRY_STATE 跳转,避免绕行 BotsHomeView; - 订阅伙伴名册与群聊列表变更,删除或切换账号时及时清理失效条目与状态。 2. 伙伴首次进入加载速度优化: - BotsFeatureLayout 改为按需懒加载并仅在 URL 打开设置参数时挂载 BotSettingsDrawer / BotGroupSettingsDrawer,将 BotsFeatureLayout 首跳分包从 498.9 KB(13 chunks)降至 2.4 KB(1 chunk),本地伙伴首进从 515.0 KB(17 chunks)降至 18.2 KB(5 chunks); - BotsHomeView 与 RemoteTeammateSettings 将重型设置子页(渠道、语音、壁纸、项目、自动化)改为按需懒加载并在行悬停/聚焦时预取; - 新增 botRoutePreload 共享缓存加载器:主窗口首帧稳定后空闲预热轻量聊天路由分包,侧栏悬停/聚焦/主按键按下预取对应路由分包与会话消息(ensureInitialMessages / preloadBotGroupDetail); - 侧栏头像条、合体 Cindy 行、隐藏伙伴行及 /bots 入口命中健康 canonical 会话时直达 /bots/:id/session/:sid,且 MainLayout 将 /bots 归入同一 contentFeatureKey 避免 FadeSwitcher 双重卸载; - 稳定 BotSessionView 与 CCAgentSessionView 的 mentions / botAssistantAvatar 引用,减少首次校验回包触发的无效重渲染。 Assisted-by: Cindy (https://cindy.app) Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Confidence Score: 5/5
[Medium impact] 本次修改看起来可以合并,未发现需要阻止合并的问题。
|
zqchris
left a comment
There was a problem hiding this comment.
Auto-approved by Chris’s trusted-author rule for makecindy/cindy. This is an automated approval.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4076254. Configure here.
| <Suspense fallback={null}> | ||
| <LazyBotGroupSettingsDrawer /> | ||
| </Suspense> | ||
| ) : null} |
There was a problem hiding this comment.
Settings close skips dialog focus
Medium Severity
BotSettingsDrawer and BotGroupSettingsDrawer now unmount as soon as settings or groupSettings leaves the URL. They no longer stay mounted while open flips to false, so Radix never runs dialog close. Mentioning a member from group settings therefore never reaches onCloseAutoFocus, and focusBotGroupMemberComposer does not run.
Reviewed by Cursor Bugbot for commit 4076254. Configure here.
| } | ||
| } | ||
| seenGroupIds = currentIds; | ||
| }); |
There was a problem hiding this comment.
Hidden groups dropped from history
Medium Severity
Group browse entries are removed whenever their id leaves getBotGroupListSnapshot(), not only when the group is deleted. That snapshot is already filtered by visibleGroups, so hiding a group drops it from back/forward. forget can also move the cursor while that chat is still open.
Reviewed by Cursor Bugbot for commit 4076254. Configure here.
- botRoutePreload: scheduleBotRoutePreload 纳入 BotGroupChatView 空闲预热,避免首次点击群聊等待 85 KB 分包冷加载;收起态侧栏伙伴入口与 CompanionSplitPane 共用同一缓存加载器; - botGroupDetailCache / BotGroupSidebarRow / TeammatesSection / BotGroupChatView: 新增 prefetchBotGroupLiveDetail / consumeBotGroupLiveDetail,本地群聊与服务端群聊在主按键按下时即刻发起可复用的实时 getBotGroup 读取,BotGroupChatView 首轮挂载直接消费该 Promise(0 重复 IPC),遇到推送(含 attachments)、账号代次切换或 NOT_FOUND/PERMISSION_DENIED 立即作废并清理缓存; - BotGroupChatView: 已知本地群聊跳过冗余 cacheOnly 预读;群成员发起私聊走 botOpenRoute 直达 canonical 会话; - 补齐群聊实时预取复用与失效隔离、本地群聊去重预读、群聊通知/多群间前进后退回归测试。 Assisted-by: Cindy (https://cindy.app) Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>


这次改了什么
摘要
本次在同一个 PR 中修复桌面端「伙伴(Companion)与群聊」的两个体验问题:
修复从伙伴/群聊后退到普通任务后无法再前进回来的问题
useSessionBrowseHistory只通过sessionIdFromPathname将/cc-agent/:sessionId纳入浏览栈,所有/bots/*(含本地伙伴、远程伙伴与/bots/groups/:groupId群聊/直聊)均被当作栈外页面处理。从伙伴或群聊点后退可回到栈顶普通任务,但伙伴/群聊从未入栈,导致前进按钮置灰(canForward = false)。/bots/:id与/bots/:id/session/:sid统一归一为/bots/:id)、远程伙伴(/bots/remote/:deviceId/:botId)和群聊/直聊(/bots/groups/:groupId,保留?conversationKind=direct,剥离?messageId=.../?groupSettings=1避免重复占格或重播跳转)纳入浏览栈;后退/前进命中本地伙伴时直接解析其健康canonical会话并携带BOT_DIRECT_ENTRY_STATE直达/bots/:id/session/:sid,避免绕行BotsHomeView;同时订阅伙伴名册与群聊列表并在删除、deleting或切换账号(ownerKey)时清理失效历史项与跟踪状态。彻底优化首次点击进入伙伴与群聊的加载速度
BotsFeatureLayout此前静态导入并无条件挂载BotSettingsDrawer与BotGroupSettingsDrawer,导致首次进入任意伙伴或群聊对话都要先同步加载并解析 13 个分包(498.9 KB)的设置/渠道/语音/壁纸代码。改为React.lazy且仅在 URL 带?settings=1/?groupSettings=1时挂载,并给设置按钮加悬停/聚焦预取。BotsHomeView与RemoteTeammateSettings将渠道(BotChannelsPage)、实时语音(CompanionVoiceSettings)、壁纸(BotWallpaperSettings)、项目(BotProjectsSettings)、自动化(BotAutomationsSettings)改为共享缓存按需加载,并在设置行悬停/聚焦时预取,消除混用静态与动态导入。botRoutePreload.ts共享缓存加载器——主窗口首帧稳定后空闲预热全部聊天视图分包(BotsFeatureLayout+BotSessionView+RemoteBotSessionView+BotGroupChatView,不含重型设置抽屉与子页);router.tsx、CompanionSplitPane、侧栏伙伴行/群聊行/头像条/合体 Cindy 行/隐藏行/收起态图标栏共用同一缓存加载器并在悬停与聚焦时预取对应分包。onPointerDown)实时数据预取与去重:makerChatStore.ensureInitialMessages;botGroupDetailCache.ts新增prefetchBotGroupLiveDetail/consumeBotGroupLiveDetail:本地群聊与服务端群聊(含首次进入尚无磁盘缓存的房间)在主按键按下时即刻发起实时getBotGroup读取,BotGroupChatView首轮挂载直接复用该 Promise(0 次重复 IPC),遇到推送(含attachments)、账号代次切换或NOT_FOUND/PERMISSION_DENIED立即作废并清理缓存;同时为已知本地群聊跳过无意义的cacheOnly重复 SQLite 读取,并为服务端群聊短暂去重磁盘缓存 miss。/bots入口以及群聊内成员私聊入口(openMemberDirectChat)命中健康 canonical 会话时改为直达botOpenRoute(bot)(带BOT_DIRECT_ENTRY_STATE);MainLayout将裸/bots归入'cc-agent'contentFeatureKey,避免/bots→/bots/:id触发<FadeSwitcher>双重卸载;稳定BotSessionView与CCAgentSessionView的identity/mentions/botAssistantAvatar引用。生产包首跳分包实测对比(
vite build --config vite.renderer.config.ts):App静态闭包BotsFeatureLayout壳层Layout + BotSessionView)Layout + RemoteBotSessionView)Layout + BotGroupChatView)/bots入口页(Layout + BotsHomeView)BotSettingsDrawer(仅点设置时加载)变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
sessionBrowseHistory.ts、useSessionBrowseHistory.ts)与回归单测localDb读写并发模型(保持botCanonicalSession.test.ts串行约束)⌘]/ 触控板手势前进回原对话UI 变化
不涉及视觉、排版、色彩或控件结构变更,仅修复导航历史行为并优化路由与数据加载性能。
docs/design-rules/task-sidebar.md(侧栏伙伴行/群聊行/头像条直达聊天入口,不改变行高与交互态);docs/design-rules/DESIGN.md(导航前进/后退历史栈与路由过渡容器一致性,加载占位 Spinner 保持role="status"与既有 token)。怎么验证的
自动验证
测试价值说明(
engineering-conventions.md§3.2)sessionBrowseHistory.test.ts(单文件实测 <0.1s):覆盖browseTargetFromLocation/localBotIdFromBrowseTarget/botGroupIdFromBrowseTarget对本地伙伴、远程伙伴、群聊/直聊及非聊天静态段(/bots/list、/bots/roster等)的归一与过滤。ChromeActions.fullscreen.test.tsx(单文件实测 ~1.8s):端到端覆盖伙伴与群聊(含通知?messageId=...、多群切换、直聊)后退到普通任务再前进回来、基地路由重定向去重、栈外后退、删除/deleting伙伴与删除群聊自动清理、以及ownerKey切换重置已见跟踪集合。BotGroupChatView.test.tsx(本文件为存量 385 用例完整群聊视图套件,本次新增 5 用例):覆盖pointerDown实时预取在挂载时复用(0 重复 IPC)、推送(含已缓存时的attachments原地分支)与账号切换作废、已知本地群聊(省略serverBacked)跳过冗余cacheOnly读取,以及预取NOT_FOUND立即清理旧内存缓存。botGroupSidebar.test.tsx(单文件实测 ~5.4s,本次新增 1 用例):覆盖列表态与头像条态下本地群聊与服务端群聊主按键pointerDown预取行为及激活项/右键/修饰键防护。botsFeatureLayout.test.tsx(单文件实测 ~0.2s):覆盖进入伙伴/群聊对话时不挂载BotSettingsDrawer/BotGroupSettingsDrawer,仅在 URL 打开?settings=1/?groupSettings=1时按需挂载。teammatesSection.test.tsx(单文件实测 ~2.0s):覆盖头像条与合体 Cindy 行点击直达/bots/:id/session/:sid(带botDirectEntry: true),及仅在非激活项主按键pointerDown时触发ensureInitialMessages预取。botNavigation.test.ts/botSessionRead.test.tsx/botSettings.test.tsx/remoteTeammateSettings.test.tsx(单文件实测均 <3.5s):覆盖缓存加载器失败清缓存重试、mentions引用稳定、/bots入口直达 canonical 会话与懒加载设置子页。读写与通知开销说明(
engineering-conventions.md§8)requestIdleCallback执行一次纯本地前端分包动态加载(BotsFeatureLayout、BotSessionView、RemoteBotSessionView、BotGroupChatView),0 次 IPC、0 次数据库读写、0 次远端请求;卸载时清理监听、定时器与 idle 回调,次级窗口与独立侧栏窗口不触发。onPointerDown:makerChatStore.ensureInitialMessages(sessionId)(与现有SessionCard/SessionItem一致);getBotGroup并在BotGroupChatView首轮挂载时消费复用(0 重复 IPC;已知本地群聊跳过cacheOnly;服务端群聊的磁盘cacheOnlymiss 在 5s 内去重,且仅对未在途或新按键生效)。不增加额外bots.list/listBotGroups或轮询。useSessionBrowseHistory订阅:复用现有内存态subscribeBotProfiles/subscribeBotGroups(0 次 IPC 读),仅在内存中对当前最多 50 格的浏览栈做 O(n) 过滤,卸载或ownerKey切换时自动解绑。手工验证
不涉及(本环境以自动化回归测试 + 生产包分包闭包实测为主)。
未执行的验证
vite build验证生产分包闭包)。风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)docs/dev-rules/engineering-conventions.md§8;远程读取同时见docs/dev-rules/server-channel-review.md)apps/docs或说明自动同步会从哪些来源更新(不涉及新增入口或文案变化)。Note
Medium Risk
Touches navigation history, routing, and lazy-load boundaries across companion UI; regressions could affect back/forward, account switches, or first-open settings, but scope is renderer-only with broad test coverage.
Overview
Fixes desktop back/forward so local companions, remote companions, and group chats join the same browse stack as ordinary tasks (
browseTargetFromLocation+ navigation that resolves local bots to canonical session routes). The stack dedupes/bots/:idvs session URLs, drops deleted/deleting bots and removed groups, and resets on accountownerKeychange. Bare/botsstays on the same layout feature key to avoid an extra remount before redirect.First-open performance is addressed with shared
botRoutePreloadloaders: router and split pane use them, the main window idle-warms chat chunks after first paint, and the sidebar preloads on hover/focus/pointerDown(includingensureInitialMessagesand live groupgetBotGroupprefetch reused on mount). Settings drawers and heavy settings subpages (channels, voice, wallpaper, projects, automations) load only when the URL opens them, with hover preloads. Sidebar and/botsentry usebotOpenRouteto skip the home hop;BotSessionView/ avatar memo tweaks reduce pointless re-renders after validation.Reviewed by Cursor Bugbot for commit c6299fc. Bugbot is set up for automated code reviews on this repo. Configure here.