Repository navigation
fix(bots): make bot group room and thread tabs renamable - #50436
Conversation
Committing a rename on a bot group's room or thread tab was dropped, because the tab store only renames terminal and agent-session tabs. The room tab now forwards the new name to the group's host: the original room renames the group (bots.groups.update), and a thread gets its own title through a new bots.groups.renameThread RPC. The title is collapsed to one line and capped like a first post's name, and does not bump the group revision, so posts composed before the rename still send. The room tab then shows the host's name for both rooms. A host too old to rename threads gets an "update Orca" toast. Fixes #50312
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
ELI5
You could double-click a bot group thread tab (or the group's room tab) to rename it, but pressing Enter threw the new name away. Now the new name sticks.
What Changed
orca bot chats) follow the new name.TabBarItemRowpasses anonSetCustomTitlefor room tabs. It callsrenameBotGroupRoom, which sends the rename to the group's host:bots.groups.update(name) for the original room, and a newbots.groups.renameThreadRPC for a thread. An empty name, or one equal to the name already shown, sends nothing, so blurring an untitled thread doesn't name it "New thread".bots.groups.renameThread(owner-only, workspace permission, mobile allowlisted) runs on the group's serialized queue. It writes the title and leaves the group revision alone, because a title is no roster change and a post composed before the rename should still send. The first-post auto-title already skips threads that have a title, so the hand-given name wins.BotGroupThreadNamecollapses whitespace to one line, trims it, and caps it at the same 80 characters as a first post's name (BOT_GROUP_THREAD_TITLE_MAX_LENGTH). It bounds the input before collapsing it and refuses an empty result.BotGroupChatnow sets the tab label frombotGroupRoomLabelfor both rooms, so a group rename also shows up on the original room tab.bots.groups.renameThread(method_not_found) shows a toast asking you to update Orca on that host.Why
A room tab's name belongs to the group or thread on the group's host. It is not a per-tab custom label, so other windows, the mobile app and the members' chat names all need to see the same rename. The tab store's
findRenamableUnifiedTabonly renames terminal and agent-session tabs. Giving room tabs a local custom label would have kept the name only on this tab, and it would have drifted from what the host and mobile show.Linked Issue
Fixes #50312
Visual Proof
N/A. No before/after capture was taken for this run, and GUI runs aren't allowed on the machine that landed it. The behavior is covered by the unit tests below and is simple to check by hand with the repro steps.
Testing
Repro (from the issue): create a bot group, start a thread from the room tab's + menu, post "Draft the release notes for the next version", double-click the thread tab, type "Release notes", and press Enter. Before this change the tab went back to the post text. With it, the tab and
orca bot chatsshow "Release notes".src/main/bots/bot-group-member-chat-names.test.ts: a renamed thread is collapsed to one line and capped at 80 characters, a blank name is refused, the revision doesn't change, and the members' chat names follow the rename.src/renderer/src/lib/bot-group-room-rename.test.ts: a thread rename goes tobots.groups.renameThreadand an original-room rename goes tobots.groups.update(capped at the bot name limit). An empty or unchanged name sends no RPC.Targeted vitest passes (2 files, 6 tests). oxlint, oxfmt, anti-slop, the native code-quality plugins, ast-grep and the changed-code quality gate all report 0 findings. Only the unit tests were run, on macOS.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None. The rename only runs when the user commits a tab rename: one RPC and one store write on the group's existing serialized queue. There is no polling, no new sync I/O and no subprocess. The other changes were measured:
BotGroupChatlabel lookup is the same singlethreads.findas before: 1.3 us with 500 threads.setTabLabeldoes nothing when the value is the same.onSetCustomTitleclosure works like the existing inline props on that row.Risk
Level: Low
bots.groups.renameThread. Renaming a thread on one shows an "Update Orca on " toast instead of failing silently. Renaming the original room uses the existingbots.groups.update, so it works on older hosts.threads[].titlewas already optional with a max length of 80.Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Reported by @zengwenliang416