Repository navigation
fix(session-tabs): let a chat tab's name reach every paired client - #19859
brennanb2025 wants to merge 4 commits into
Conversation
A structured chat is the one tab kind with no host-owned name. A terminal's rename goes through terminal.rename on its pty handle; a chat has no pty, so the rename only ever reached this client's customLabel while the host kept publishing the placeholder it minted at create time and preserved verbatim on every renderer republish. The phone, the web client and a second desktop all read that placeholder. Name is now carried on session.tabs.setTabProps beside color, pin and view mode, so the tab's owner holds it, persists it, resolves the placeholder when it is cleared, and republishes to every subscriber. The attached-window gate in setMobileSessionTabProps stays for renderer-owned tabs and is lifted for chats, whose copy the renderer never republishes. Mobile gains the matching affordance: chat tabs get Rename, and a runtime that cannot name one says so instead of silently dropping it. Closes STA-6934, STA-6806
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds nullable title support to session-tab contracts and RPC handling. Renderer chat renames now mirror titles to local or environment runtimes. Runtime code persists custom titles, resolves display titles, restores titles, and publishes title state. Mobile session snapshots expose separate Merge Risk: ⚪ Minimal · up to Structured chat renames now persist and converge through the owning host while preserving legacy-host behavior. The covered tests address renaming, clearing, persistence, and paired-client convergence, with no current merge blocker identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
session.tabs.setTabPropsgainstitle— a new optionaltitle: string | nullonSetTabProps/RuntimeSessionTabProps, joined to the existing color/pin/viewMode channel so a chat tab's name has the same host-owned propagation path.- Host persistence + single precedence resolver —
persistHeadlessSessionTabPropswritescustomTitle/customLabel;resolveHeadlessSessionTabDisplayTitledecides named vs placeholder vs terminal projection, so clearing republishes the placeholder rather than an empty label. - Restore seeds the name —
publishStructuredAgentSessionTabreads the persistedcustomLabelviaresolveStructuredAgentSessionTabTitle, so a name survives the host forgetting the live tab. - Gate relaxed only for chats — the attached-window early return in
setMobileSessionTabPropsis lifted solely for anagent-sessiontab present in the host snapshot; terminal tabs keep the renderer-authoritative path. - Desktop + mobile wiring —
mirrorTabCustomTitleToHostroutes a chat rename to the runtime environment or the local host; mobile gains the Rename sheet, the allowlist entry, and an unsupported-host branch.
The host tests assert what a subscribed client receives through onMobileSessionTabsChanged, and the renderer tests drive the real setTabCustomTitle action. The terminal-rename no-op, clear→placeholder, restore-after-forget, and gate-holds-for-terminals arms all redden when their lever is severed, and I verified the id conventions (agent-session:<sessionId> on the wire, entityId === sessionId on unified rows, the hostSessionTabIdByLocalKey mapping for the web path) line up across host, renderer, and mobile.
ℹ️ Remote-runtime path is the one surface without end-to-end coverage
The desktop's runtime-hosted branch routes the rename through setWebRuntimeTabProps, whose host-tab-id resolution depends on the hostSessionTabIdByLocalKey mapping populated during web-session-tabs-sync (layout-groups.ts updateHostSessionTabIdMappings). The renderer test mocks setWebRuntimeTabProps entirely, so a real runtime-hosted pairing is the only path whose correctness is argued rather than exercised — consistent with the PR's own "no Electron or device run" note. Mergeable as-is; noting it only because this is exactly where a stale mapping would silently drop the rename.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e4173250-a85d-4234-946c-92c16083ecbb
📒 Files selected for processing (21)
mobile/src/session/MobileSessionSheets.tsxmobile/src/session/mobile-agent-session-tab-rename.test.tsmobile/src/session/mobile-agent-session-tab-rename.tsmobile/src/session/use-mobile-session-close-actions.tsmobile/src/session/use-mobile-session-tab-action-targets.tssrc/main/runtime/mobile-session-terminal-projection.tssrc/main/runtime/orca-runtime-close-headless-mobile-terminal-tab.tssrc/main/runtime/orca-runtime-persist-headless-session-tab-props.tssrc/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.tssrc/main/runtime/orca-runtime-tests/structured-chat-tab-name.spec.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/rpc/methods/session-tab-mutation-methods.tssrc/main/runtime/rpc/methods/session-tabs-schemas.tssrc/main/runtime/runtime-rpc/runtime-rpc-mobile-method-allowlist.tssrc/renderer/src/runtime/web-runtime-terminal-actions.tssrc/renderer/src/store/slices/tabs/tabs-host-mirroring.tssrc/renderer/src/store/terminals/structured-chat-tab-rename.test.tssrc/renderer/src/store/terminals/terminal-tab-attention.tssrc/shared/runtime-mobile-session-tab-contracts.tssrc/shared/runtime-session-contracts.tssrc/shared/runtime-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| )} | ||
| actions={[ | ||
| { | ||
| label: 'Rename', |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the new rename strings.
Replace the raw strings with intent-named localization IDs. Otherwise, localized clients show English for this new flow.
Based on learnings: new user-facing strings must use intent-named localization IDs with named interpolation placeholders.
Also applies to: 287-289
Source: Learnings
…ile entry point Review found two problems with the first pass. The client kept its own customLabel across every host frame, and resolveUnifiedTabLabel prefers customLabel over label unconditionally. So the first client to rename a chat pinned its own name forever: rename to Alpha here and Beta anywhere else, and this client renders Alpha across restarts. Multi-client convergence, which is the whole point, did not work between Orca clients. The host now publishes the raw name as `customTitle` beside the resolved `title`, and ingestion takes it for agent-session tabs only. The three states matter and absence is not "unnamed": a host that omits the key predates host-owned names and cannot be told apart from one reporting no name, so that case keeps the local name instead of stomping it. Terminals and editors keep owning customLabel locally and are untouched. Publishing the raw name beside the resolved one is what stops an unnamed chat persisting its own placeholder as a name. The mobile rename entry point is removed. It landed host-side but the renderer rewrites the whole persisted unifiedTabs array on any tab action (workspace-session-unified-tabs.ts), so a phone rename was clobbered back to null and the next restore republished the placeholder — a silent-loss path where main simply had no capability. Both tickets are desktop-to-everywhere; that direction was scope beyond either. Filed as a follow-up. Closes STA-6934, STA-6806
There was a problem hiding this comment.
Important
This delta deliberately dropped the mobile rename entry point, but the PR description still claims mobile rename and still closes STA-6806, which will falsely auto-close that ticket on merge.
Reviewed changes
- Added
customTitleto the agent-tab wire contract — a new optionalcustomTitle?: string | nullonRuntimeMobileSessionAgentTabwith three states (present string = named, presentnull= unnamed, absent = host predates host-owned names), so a client can finally tell "cleared back to the placeholder" apart from "named after the placeholder". This is an additive optional field, so it is safe under the wire-compatibility rules and needs no protocol bump. - Host now ships both the resolved and the raw name —
publishStructuredAgentSessionTabseedstitle(resolved) andcustomTitle(raw) from the renamedresolveStructuredAgentSessionTabName, andapplyHeadlessSessionTabPropsToSnapshotrepublishes both on a rename, trimmingprops.titlebefore persisting. - Desktop mirror converges on the host instead of pinning the local name —
buildMirroredAgentTabssetscustomLabelfromtab.customTitlewith the three-state fallback, so another client's rename wins and the host's name survives the next desktop session write. - Replacement conversations reset their name —
structured-conversation-tab-replacement.tsnow emitscustomTitle: null. - Dropped the mobile rename entry point — the Rename sheet,
mobile-agent-session-tab-rename.ts(+ test), and thesession.tabs.setTabPropsallowlist entry are gone; mobile can still see a chat's resolved name (it renderstitle), it just can no longer initiate a rename.
The convergence path is covered end-to-end at the unit level in both directions: the new renderer test drives applyWebSessionTabsSnapshot against a real host frame (asserting the local name is kept, replaced, and cleared across the three customTitle states, plus persistence), and the host spec asserts the exact title/customTitle a subscribed client receives through onMobileSessionTabsChanged. The three-state semantics are load-bearing here, and each arm reddens when the mirror's customTitle branch is severed.
⚠️ PR description still describes and closes the removed mobile rename path
The code no longer adds a mobile rename affordance — the Rename sheet, mobile-agent-session-tab-rename.ts, and the session.tabs.setTabProps allowlist entry are all removed — but the PR body still says "Mobile gets the matching affordance: chat tabs gain Rename", still closes STA-6806 ("try to rename one from the phone and there is no way to"), still carries the "From mobile the failure is louder…" mixed-version paragraph, and still lists mobile allowlist entry / mobile: unsupported-host branch / mobile: publish '' instead of clearing rows in the ablation table. As written, merging auto-closes STA-6806 without resolving it, and reviewers are told the PR ships a surface it no longer ships.
Technical details
# PR description out of sync with the dropped mobile entry point
## Affected sites
- PR body (not a code line) — claims mobile Rename, "Closes STA-6806", mobile mixed-version paragraph, and three now-deleted ablation rows.
## Required outcome
- Either remove "Closes STA-6806" and the mobile-rename prose/ablation rows (if mobile rename is now out of scope), or restore the mobile entry point (if STA-6806 is still intended to land here).
## Open questions for the human
- Is STA-6806 (rename from the phone) now deliberately out of scope for this PR, or planned as a follow-up?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
A chat the user deliberately names after its own placeholder publishes the same rendered title as one that was never named. Only customTitle separates them, and nothing asserted that: collapsing the two fields back into one -- by comparing the title against the placeholder to guess whether a chat is named -- passed every existing arm while silently discarding that user's name.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Re-synced the PR body with the code — the description no longer claims a mobile rename affordance, explicitly scopes the client→desktop direction to STA-7157 ("this PR changes no mobile file"), and re-frames STA-6806 as the receiving-end twin of STA-6934 rather than a phone-initiated rename, resolving the prior must-address finding.
- Pinned the "named after its own placeholder" case — a fifth convergence test asserts that a chat deliberately named
Codex ChatkeepscustomLabel: 'Codex Chat'(and that it survivesbuildPersistedUnifiedTabSessionData) while an unnamed chat staysnull, even though both frames render an identicaltitle; it reddens if the mirror ever collapses the two name fields back into one.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
The convergence arms ingested with the local options; a paired host arrives through the bare three-argument shape used by web-runtime-session-snapshot and global-session-events, which had no test on this branch. The two behave identically today, but that is a fact about today's code, not a pin: a regression on the paired path -- the path both tickets are about -- would have left every other arm green. Covers the three states at that entry point, including a released host that omits customTitle entirely, which must keep the local rename rather than read absence as "unnamed".
Status: readyAll three readiness gates cleared at Scope: 2 of 6STA-6934 and STA-6806 are one defect seen from both ends of the wire. The other four candidates were investigated and declined with named evidence, and spot-checked in review as genuinely different mechanisms rather than convenient deferrals: STA-6997 is settings write-scope, STA-6412 is a renderer-local view-mode early return, STA-3868 is host resolution from The "one channel" framing this started from was half right. The channel already exists and already carries colour, pin and view mode — it simply never carried the name, and only for one tab kind. Every other tab kind already has a host-owned name; a structured chat has no pty, so it fell through three composing gaps plus an RPC allowlist gap. Independent review — CLEAN WITH NITS, after one NOT CLEAN roundThe first round found two blockers:
The fix for the first blocker forced two things worth recording. It needs two fields, because the host must distinguish "unnamed" from "named exactly like the placeholder" — otherwise a client adopts the placeholder as a real name and persists it. And the gate had to become in-band three-state (present string / present Mixed-version — derived from the hosts actually runningThis is not a live wire capture, and should not be read as one. No CLI command calls What was measured instead, read-only against the real paired environments: Client behaviour was then exercised against a frame built from that released producer literal and JSON-round-tripped, with sensitivity arms proving the rig detects the opposite ( Collapse-hop audit: none found, checked in receive order across eight hops — Tests19 new tests; full production revert fails 16 of them. The three that pass at Validation found the paired-host entry point had no committed test — the convergence tests used the local options while a paired host uses the bare remote shape. Three arms were added there. Both collapses a future simplification might attempt are pinned: inferring "unnamed" by comparing Not validatedNo Electron or device run. No host running this branch — the fix working end to end against a paired host cannot be shown without deploying this build to one, which was deliberately not done. The two |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Pinned the paired-host call shape with three new convergence tests — a new
ingestRemotehelper drivesapplyWebSessionTabsSnapshotthrough its real three-argument form (the shapeweb-runtime-session-snapshot.tsandglobal-session-events.tsactually use), and three tests assert the keep / adopt / clearcustomLabeloutcomes at that entry point rather than only the local-options shape, so a regression on the paired path would redden independently of the local arm.
The new tests drive the real applyWebSessionTabsSnapshot against a real host frame and assert exact customLabel and renderedLabel outcomes, so they exercise the same buildMirroredAgentTabs ingestion the production path uses — not a mock. They pass (8/8 in the file).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Thanks for this. It covers what I asked for in #24512: an agent hook that sets a short topic title on its own chat tab via One thing I ran into while prototyping the same change locally, in case it helps: with a desktop window, the host calls a chat tab |

What breaks today
Rename a structured chat tab on the Mac and the phone keeps showing
Claude Chat. Rename it on a second desktop and nothing moves.Every other tab kind already has a host-owned name. A terminal's rename goes to the host over
terminal.renameon its pty handle (orca-runtime-resolve-worktree-removal-target.ts:118-143), which persistscustomTitleand pushes the change back through the renderer, so a paired client sees it.A structured chat has no pty, so it has no such channel. Three facts compose:
buildMobileSessionTabSnapshotswalksterminal | editor | browserand nothing else (sync-runtime-graph/mobile-session-snapshots.ts:114-146). The host mints the tab once, with a placeholder.shouldPreserveHeadlessMobileSessionTabreturnstrueunconditionally foragent-session(orca-runtime-stored-mobile-snapshot-has-stale-preserved-tab.ts:50-52).customLabelon the unified tab. The mirror side already said so out loud: "a manual rename lives only on the client" (web-session-tabs-sync/terminal-surfaces.ts:118-120).STA-6934 and STA-6806 are the same defect from the two ends of the wire.
The change
The tab's owner holds the name. It joins color, pin and view mode on
session.tabs.setTabProps— the channel that already exists for exactly this reason — so there is no parallel path.SetTabPropsgains optionaltitle: string | null;RuntimeSessionTabPropsis now the one shape both the RPC handler andsetMobileSessionTabPropstake.resolveHeadlessSessionTabDisplayTitleis the single place precedence is decided, so clearing a name republishes the agent placeholder rather than an empty label. The terminal half of that precedence is the existing projection expression, extracted asresolveHeadlessTerminalTabTitlerather than duplicated.publishStructuredAgentSessionTabseeds the name from the persistedcustomLabel, so it survives the host forgetting the live tab.setMobileSessionTabPropsstays for renderer-owned tabs: its stated premise is that the renderer republishes the tab, true for terminals and false for chats. It is lifted only for a chat that is actually in the host's snapshot.terminal.rename.Convergence between clients, and the three-state field
resolveUnifiedTabLabelpreferscustomLabeloverlabelunconditionally (src/shared/tab-title-resolution.ts:33-42), and ingestion used to carrycustomLabelforward fromexisting?.customLabel. Publishing the name alone would therefore not converge: client A renames to Alpha, B renames to Beta, the host publishes Beta, and A keeps rendering Alpha indefinitely, across restarts. The first client to rename a chat would pin its own name forever.So the host now publishes the raw name as
RuntimeMobileSessionAgentTab.customTitle, beside the resolvedtitle, and ingestion takes it — foragent-sessiontabs only. Terminals and editors legitimately owncustomLabellocally (tab-builders.ts:32mirrorscustomTitleinto it) and are deliberately untouched;resolveUnifiedTabLabelis not changed globally.The two fields are separate on purpose. The host must be able to say "this chat has no name" distinctly from "its name happens to equal the placeholder" — otherwise a client would adopt the placeholder as a real user-given name and persist it as one.
customTitleis gated by its own presence, the three-state shape this repo already documents foragentWait:null— the host owns chat names and this chat has none. The client clears its local name.titlestill publishes its placeholder, so an unconditional clear would stomp a legitimate local rename against an old host.That is the escape hatch Rule 1 requires, and it is why the earlier no-gate reasoning did not hold. It is carried in-band rather than as a capability-list lookup because the consumer is a per-frame reducer: the marker and the frame then come from the same publisher in the same message, and cannot be resolved against the wrong host — a real hazard here, since this ingestion serves both the local host and a runtime environment.
This also closes the durability loop. The renderer rewrites the whole persisted unified-tab array on any tab change (
workspace-session-unified-tabs.ts), and the host seeds a restored chat from that samecustomLabel. Ingestion writing the host's name intocustomLabelmeans the desktop persists the host's own value back, instead of erasing it.Mixed-version behaviour, both directions
titleand answers{updated:true}; the rename stays local, exactly as today. The old host also omitscustomTitle, so the client keeps its local name rather than having it cleared. Degrades to current behaviour in both halves.titlewas always a requiredstringmeaning "what to display", and now carries the user's name instead of the placeholder — a Rule 3 content change every shipped client interprets correctly (terminal-surfaces.ts:117; mobile renderstitledirectly).customTitleis a new optional field an old client ignores, so it keeps its existing local-override behaviour and is no worse off than before.RUNTIME_PROTOCOL_VERSIONbump. The cross-version harness does not cover the session-tab sync channel, so this reasoning is the record.Tests and ablations
orca-runtime-tests/structured-chat-tab-name.spec.ts(6+1),runtime/structured-chat-name-convergence.test.ts(8), additions tostore/terminals/structured-chat-tab-rename.test.ts(4 new, 8 total) — 19 new tests.The convergence file covers the three name states twice, at both entry points a frame can arrive through: the local-options shape and the bare three-argument shape a paired host takes (
web-runtime-session-snapshot.ts,web-session-tabs-sync/global-session-events.ts). They behave identically today, which is a fact about today's code rather than a guarantee — a regression on the paired path would otherwise have left every other arm green.The host tests assert what a subscribed client receives — frames delivered through
onMobileSessionTabsChanged, the real subscription path. The convergence tests assert what the tab bar paints, throughresolveUnifiedTabLabel, and whatbuildPersistedUnifiedTabSessionDatawrites. The renderer tests drive the real store action, so severing the wiring reddens them.Every production lever reverted individually, at this head:
main, tests keptnulltitleto the placeholdertitledirectlytitleapplicationcustomTitleapplicationagent-session:→ unified-tab id matchingmirrorTabCustomTitleToHostcall sitetitleon theSetTabPropsschemaThree of the 19 pass with all production code at
main, all by construction: the two "keeps a local rename when the host predates host-owned chat names" arms assert preserved behaviour, and "leaves a terminal rename on its own host channel" is a negative control asserting that no round trip happens. None is left unproven — collapsing absence intonullreddens both of the first, and the renderer call-site arm covers the path the third guards.Bad-case-worse arms: clearing a name must never publish an empty label; the gate relaxation must not widen to renderer-owned terminal tabs; an old host must not have a local rename stomped; and a chat the user deliberately names after its own placeholder must keep that name. That last one is why the two fields are separate rather than one — both frames carry the identical rendered
title, so a client with only that field has to guess by comparing against the placeholder, and throws the user's real name away. Both plausible one-field collapses are ablated above.Green:
tsc --noEmitseparately on the node, web and CLI projects and onmobile/;check:code-quality:changed0 findings across 18 files; 19958 passed acrosssrc/main/runtime,src/renderer/src/runtime,src/renderer/src/storeandsrc/shared. The native-plugins oxlint run reports twoimport(no-cycle)warnings inmobile/src/transport/, byte-identical tomainand in files this PR no longer touches at all.Mixed-version check against live released hosts
Two paired runtime environments on the development machine were read read-only —
openclaw 6768on 1.4.190 andM4Air macon 1.4.198, four read-only calls, nothing mutated.This is not a live wire capture. No
orcaCLI command callssession.tabs.*, and the transport is end-to-end encrypted with per-device credentials, so capturing the literal frame would have meant reconstructing the handshake or pairing a fresh instance — a mutation, declined. The contract below is derived from those released hosts' own source at their exact live versions:RuntimeMobileSessionAgentTabhas nocustomTitle, and its sole producer emits exactly six keys, soJSON.stringifyomits it — absent, not null;Client behaviour was then checked against a frame built from that released producer literal and JSON-round-tripped, with sensitivity arms confirming the rig detects the opposite outcomes.
A collapse-hop audit over the eight hops a frame crosses in receive order found none:
parseRemoteRuntimeJsonText(plainJSON.parse), the runtime-rpc envelope (result: z.unknown()returned by reference,.strip()on envelope keys only, no.default()/.nullable()), runtime-rpc-result pass-through, the IPC structured clone, the retirement-proof ledger, orphan recovery,apply-preparation-base(filters rows, never rebuilds one), andterminal-surfaces.tsas the sole consumer. Repo-wide, every?? nulloncustomTitlereads the localTerminalTab, where the field is non-optional, andstate-equality-tabs.ts:24compares with===, soundefinedstays distinct fromnull.Not validated: no Electron or device run, and no host running this branch. The desktop rename UI is asserted at unit level only, and the fix working end to end against a paired host cannot be shown without deploying this build to one.
What this does not close
The client→desktop direction is deliberately out of scope, filed as STA-7157. A rename from a phone lands host-side, but the desktop rewrites the whole persisted unified-tab array on its next tab action, so the host's value is clobbered and the following restore republishes the placeholder — the rename would work, propagate, then quietly revert. Both tickets here are desktop-to-everywhere, so that direction was scope beyond either, and it is the only part that carried a silent-loss path. The mobile Rename sheet and the
session.tabs.setTabPropsmobile-allowlist entry were removed along with it; this PR changes no mobile file.The other four tickets in the surveyed cluster are separate mechanisms:
settings.ts:208-241routes onlyworktreeVisibilityDefaultsandactiveRuntimeEnvironmentIdto the attached environment.applyBackendSpawnedDraftViewModereturns early onif (!backendSpawned || !request.launchDraftPrompt)(worktree-creation-agent-seeds.ts:57-58), soviewModeis never chosen.mobile-new-tab-agent-loader.ts:11-14,56-60resolves the detection host fromrepo.connectionIdalone, with no environment delegation inrpc/methods/.Also found and left alone: with a desktop window attached, a paired client's
color/isPinned/viewModechange is dropped by the same early return, because nothing forwardssession.tabs.setTabPropsto the renderer. This PR narrows the gate only for chat tabs, where the premise is provably false; widening it needs that forwarding path and belongs with STA-7157.Closes STA-6934
Closes STA-6806