Skip to content

fix(bots): label an item's old Home Chat by its own title - #51881

Merged
nwparker merged 1 commit into
stablyai:mainfrom
2SinceJuly:fix/51868-home-chat-item-label
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
2SinceJuly:fix/51868-home-chat-item-label

Conversation

@2SinceJuly

@2SinceJuly 2SinceJuly commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Each bot has a "Home Chat" where it normally talks. When you start a fresh chat with the bot (orca bot new-chat), the old chat stops being home, but items made there still said "Home Chat" with the house icon. Now those items show the old chat's real name (or just "Chat" if it has none), so the label matches the chat you actually open.

What Changed

Before: an item made in a chat that was the bot's Home Chat at the time kept kind: 'home' and the "Home Chat" label forever, on desktop, mobile, the CLI and the look-around prompt. On mobile, kind === 'home' also sent the click to the bot's current Home Chat instead of the chat the item was made in.

After: the same item reads as a plain chat with its own title. An item made in the bot's current Home Chat still says "Home Chat" with the house icon.

Mechanism: BotItemsHost.chatSource() records { kind: 'home' } when the item is created and never revisits it. owningChat() (src/main/bots/bot-items-runtime.ts) now resolves that recorded source at read time: a home source stays home only while the owning bot's chatRoot(chatSessionId) === item.chatId. Otherwise it becomes { kind: 'chat', title: null }, and the chat's own title wins as before; with no title the UI shows the generic "Chat" label and the CLI prints chat:<id>. chatSource and the read-time check share one isHomeChat helper so the two cannot drift. owningChat now takes ownerBotId; item views pass the full record and noteBy in bots-items-mail.ts passes the bot id. Other source kinds (chat, thread, automation) pass through unchanged.

Why

The stored source is an honest snapshot of where the item came from, and the issue confirms the link target is right and only the label is wrong. Resolving at read time avoids a migration or a write on bot new-chat, and it also fixes items created before this change without a backfill. An untitled replaced Home falls back to title: null rather than the recorded "Home Chat", so it never reads "Home Chat" next to a plain chat icon.

Linked Issue

Fixes #51868

Visual Proof

Same item row, rendered through BotItemView's label rule (botItemChatName) with the chat source the item had before this change (recorded kind: 'home') and after (owningChat returns kind: 'chat' with the chat's title). The images come from @2SinceJuly's component-fixture capture in the original PR. The fixture was screenshot-only, so it is not part of this change. It shows the label rule; the owningChat resolution is covered by the unit test below.

Before
before: the item still reads Home Chat

After
after: the item reads its own chat title

Testing

  • 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

  • Reproduced with a unit test in src/main/bots/bot-items-runtime.test.ts: bot chatSessionId is home-2, and the item has chatId: 'home-1' with a recorded home source. With bot-items-runtime.ts from main it fails (kind stays 'home'). On this branch it passes for a titled old home, an untitled old home (title: null) and the current home (still home).

  • Extra probes (deleted owning bot, old home that is gone, another bot's home with the same id) fail on main and pass here.

  • vitest: bot-items-runtime, every src/main/bots/bot-item* and src/main/runtime/rpc/methods/bots-items* suite (18 files, 71 tests), plus the bot-chat-address, look-around, home and chat suites. All pass.

  • oxlint, oxfmt --check, anti-slop oxlint, native and type-aware code-quality oxlint, ast-grep, and the changed-code quality gate are clean on the 4 touched files.

  • Platform: macOS (main-process logic only, no platform-specific code).

Performance

None that matters. owningChat runs once per item when an item list is read, in the main process. It is not a renderer, store or selector path, so nothing fans out per tab. Non-home items return early. A home item adds one bots() lookup (already cached) and one chatRoot call. Benchmark with 200 items, 50 bots and 5000 session records, using the real cached session resolver:

  • non-home items: 11.0 µs on main, 8.8 µs here per 200-item view
  • home items: 8.7 µs on main, 47.6 µs here per 200-item view, about +200 ns per item
  • worst adversarial view: about 3 ms, well under 16 ms

No new I/O, subprocesses or polling.

Risk

Level: Low

  • Behavior: items made in a Home Chat that has since been replaced change label and icon. If the owning bot is deleted or the bot store hasn't loaded yet, the item falls back to a plain chat label rather than throwing.
  • Callers: the worker-origin linked-item chatTitle now gets null for an untitled replaced Home, which the type already allows. bot-chat-address --item uses only id/gone, so it is unaffected.
  • Live refresh: an open items list shows the new label the next time it reads. bot new-chat sends only a 'bot' change notice, so an open list does not re-read straight away. This matches main and is not a regression.
  • Data/remote: nothing is written and BotItemRecord.source keeps its recorded value. The server resolves the kind before sending, so paired phones and older clients need no wire change.
  • Rollback: a plain revert.

Review

Reviewed for correctness, breakage across every owningChat caller, and perf. No blocking findings.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Original fix by @2SinceJuly in #51881. Issue reported by @tenko-labs in #51868.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The owning chat resolver now receives the owner bot ID and uses the bot’s current Home Chat root to classify items recorded as home. Items from a replaced Home Chat are represented as regular chats with their own title, or no source title when untitled. The mail method passes the bot ID, and tests cover the current and replaced Home Chat cases.

Severity of issue fixed: Low

Merge Risk: Low · up to 1d794

The change makes items from a replaced Home Chat show their own chat title instead of "Home Chat". A narrow edge case may remain for untitled former Home Chats. The change only affects display, writes no data, and is easy to revert, so merge risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an item made in a replaced Home Chat is now labelled with its own chat's title. It is specific, concise, and matches the linked issue and the changed code path (owning…
Description check Passed The description follows the template closely. It covers ELI5, What Changed (before/after and mechanism), Why, a linked issue (Fixes #51868), Visual Proof with before/after images, Testing with the new…
Linked Issues check Passed Issue #51868 requires that items recorded as made in a replaced Home Chat stop showing "Home Chat" with the house icon, and show that chat's own title. The link target stays unchanged. At head, `BotIt…
Out of Scope Changes check Passed All changed code connects to the #51868 label fix. owningChat gains ownerBotId in src/main/bots/bot-items-runtime.ts, and the BotItemViewDeps.owningChat type in src/main/bots/bot-item-views.ts p…
Full details: Title check

Explanation

The title names the main change: an item made in a replaced Home Chat is now labelled with its own chat's title. It is specific, concise, and matches the linked issue and the changed code path (owningChat resolves the recorded home source at read time).

Full details: Description check

Explanation

The description follows the template closely. It covers ELI5, What Changed (before/after and mechanism), Why, a linked issue (Fixes #51868), Visual Proof with before/after images, Testing with the new test cases and results, Performance, Risk with level and rollback, AI Disclosure, and the upstream boundary checkbox. The Visual Proof images are from a fixture harness rather than the running app, which the author states, and the template asks for a real BEFORE/AFTER. Some template items such as the Notes and Checklist sections are not ticked, but the content is substantially complete.

Full details: Linked Issues check

Explanation

Issue #51868 requires that items recorded as made in a replaced Home Chat stop showing "Home Chat" with the house icon, and show that chat's own title. The link target stays unchanged. At head, BotItemsHost.currentSource (src/main/bots/bot-items-runtime.ts) returns the recorded source unless its kind is home. For a home source, it keeps home only when isHomeChat(owner, chatId, chatRoot) is true for the item's ownerBotId. Otherwise it returns { kind: 'chat', title: null }. owningChat then uses chatTitle(id) ?? title, so the chat's own title is shown. The stored source is not written, and owningChat still returns the same id, so the link is unchanged. The new unit test in src/main/bots/bot-items-runtime.test.ts covers the replaced chat (kind chat, its own title), an untitled replaced chat (title null, not the recorded 'Home Chat'), and the current Home Chat (kind home). Remaining uncertainty: the renderer label rule botItemChatName was not inspected, so the displayed fallback for a null title is not verified. The PR description also states a second test for chat, thread, and automation pass-through. The test diff at head contains only one new it block, so that claimed test is not present in this diff. The implementation for the linked objective is present regardless.

Full details: Out of Scope Changes check

Explanation

All changed code connects to the #51868 label fix. owningChat gains ownerBotId in src/main/bots/bot-items-runtime.ts, and the BotItemViewDeps.owningChat type in src/main/bots/bot-item-views.ts passes it through. src/main/runtime/rpc/methods/bots-items-mail.ts passes the bot id at the owningChat call, so the same resolution applies to bot-note attribution. The test file changes generalize the existing retention test helper into hostWith(deps) to support the new Home Chat test. This is supporting test refactoring for the same change. No unrelated change was identified. The chat, thread, and automation pass-through behavior is unchanged in code because currentSource returns any non-home source as is. The PR description's claimed fixture and image assets were not inspected, so no conclusion is drawn about them.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b83ec69-5de0-417d-85ac-ea3e8f3a50e5
Commits

Reviewing files that changed from the base of the PR and between b2f550f and 1d79479.

Files selected for processing: 2

  • src/main/bots/bot-items-runtime.test.ts
  • src/main/bots/bot-items-runtime.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

2SinceJuly added a commit to 2SinceJuly/orca that referenced this pull request Nov 28, 2026
Served from this branch for the PR body; removed before merge.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 11765161-8ea6-43ee-b77d-dbbd5d5c4e10
Commits

Reviewing files that changed from the base of the PR and between aa7691f and 3d57d0e.

Files selected for processing: 5

  • src/main/bots/bot-item-views.ts
  • src/main/bots/bot-items-runtime.test.ts
  • src/main/bots/bot-items-runtime.ts
  • src/main/runtime/rpc/methods/bots-items-mail.ts
  • src/renderer/src/components/bots/items/BotItemChatLabelProof.fixture.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/main/bots/bot-items-runtime.ts Outdated
return {
id,
...this.settledSource(ownerBotId, id, source),
title: this.deps.chatTitle(id) ?? source.title,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Do not fall back to the stored Home Chat title for a demoted Home Chat.

When settledSource demotes a home source to chat, owningChat still falls back to source.title when chatTitle(id) returns null. A stored 'Home Chat' title then remains on that item. This can happen when the chat has no conversationName, when its record is missing (including a deleted chat), or when no record store is available. The label then says Home Chat for a chat that is no longer the bot's Home Chat, which is the defect this change targets.

The fallback for a demoted item must not show Home Chat. The choice of replacement text is open. Options include a generic plain-chat label or the chat id. Keep the fallback for all other sources.

@2SinceJuly
2SinceJuly force-pushed the fix/51868-home-chat-item-label branch from c170a16 to 9a94810 Compare November 28, 2026 16:44
2SinceJuly added a commit to 2SinceJuly/orca that referenced this pull request Nov 28, 2026
Two variants of the item label rule, used for PR stablyai#51881's visual proof.
After `orca bot new-chat`, items made in the previous Home Chat kept the
recorded `home` source, so they still showed the house icon and the
"Home Chat" label even though that chat is now a plain chat.

owningChat now resolves a recorded `home` source at read time: it stays
`home` only while the owning bot's current chatSessionId roots to the
item's chat. Otherwise it presents as a plain chat labelled by its own
title (or no title, so the UI falls back to "Chat"). chatSource and the
read-time check share one isHomeChat helper. Nothing stored changes.

Fixes stablyai#51868

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/51868-home-chat-item-label branch from b2f550f to 1d79479 Compare November 28, 2026 17:56
@nwparker
nwparker merged commit 5fff9a9 into stablyai:main Nov 28, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: After bot new-chat, older items still say "Home Chat" but open the replaced chat

2 participants