Repository navigation
Conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
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:
08738354-f402-4364-a6e7-3dca7cdda77a
📒 Files selected for processing: 22
src/main/runtime/orca-runtime-tests/mobile-session-tab-appearance-window.spec.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/runtime-notifier-contract.tssrc/main/runtime/session-tabs/headless-terminal-tab-close.tssrc/main/window/runtime-window-lifecycle.tssrc/preload/api/ui-bridge-terminal-and-session-tabs.tssrc/preload/api/ui-command-event-api.tssrc/renderer/src/hooks/ipc-events-agent-status-window-test-fixtures.tssrc/renderer/src/hooks/ipc-events-close-routing-test-harness.tssrc/renderer/src/hooks/ipc-events-terminal-create-window-test-fixtures.tssrc/renderer/src/hooks/ipc-events/session-tab-appearance-ipc-bridge.test.tssrc/renderer/src/hooks/ipc-events/session-tab-ipc-bridge.tssrc/renderer/src/hooks/useIpcEvents-browser-tab-create.test.tssrc/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.tssrc/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.tssrc/renderer/src/hooks/useIpcEvents-lifecycle.test.tssrc/renderer/src/hooks/useIpcEvents-ssh-disconnect-cleanup.test.tssrc/renderer/src/hooks/useIpcEvents-updater-status.test.tssrc/renderer/src/runtime/sync-runtime-graph/mobile-session-terminal-tabs.tssrc/renderer/src/web/preload-api/web-ui-api.tssrc/shared/runtime-session-contracts.tssrc/shared/runtime-types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
|
||
| unsubs.push( | ||
| window.api.ui.onSetSessionTabAppearance(({ worktreeId, tabId, color, isPinned }) => { | ||
| const localTabId = resolveWindowTabIdForHostTab(worktreeId, tabId) | ||
| const store = useAppStore.getState() | ||
| const tabs = store.unifiedTabsByWorktree[worktreeId] ?? [] | ||
| // Browser and editor rows may be keyed by their entity (workspace or file) id. | ||
| const tab = | ||
| tabs.find((candidate) => candidate.id === localTabId) ?? | ||
| tabs.find((candidate) => candidate.entityId === localTabId) | ||
| if (!tab) { | ||
| return | ||
| } | ||
| if (color !== undefined && color !== tab.color) { | ||
| if (tab.contentType === 'terminal') { | ||
| store.setTabColor(tab.entityId, color) | ||
| } else { | ||
| store.setUnifiedTabColor(tab.id, color) | ||
| } | ||
| } | ||
| if (isPinned !== undefined && isPinned !== Boolean(tab.isPinned)) { | ||
| if (isPinned) { | ||
| store.pinTab(tab.id) | ||
| } else { | ||
| store.unpinTab(tab.id) | ||
| } | ||
| } | ||
| }) | ||
| ) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '110,165p' src/renderer/src/hooks/ipc-events/session-tab-ipc-bridge.ts
sed -n '105,140p' src/renderer/src/runtime/sync-runtime-graph/mobile-session-terminal-tabs.ts
rg -n 'setTabColor:|setUnifiedTabColor:|pinTab:|unpinTab:' src/renderer/srcRepository: stablyai/orca
Length of output: 7038
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- resolver and handler references ---'
rg -n -F -- 'resolveWindowTabIdForHostTab' src/renderer/src
rg -n -F -- 'onSetSessionTabAppearance' src/renderer/src
printf '%s\n' '--- action implementations ---'
sed -n '1,230p' src/renderer/src/store/terminals/terminal-tab-appearance.ts
sed -n '100,210p' src/renderer/src/store/slices/tabs/tabs-label-actions.ts
printf '%s\n' '--- terminal tab construction and types ---'
rg -n -F -- 'entityId:' src/renderer/src/store src/renderer/src/runtime/sync-runtime-graph src/renderer/src/hooks/ipc-events | head -80
rg -n -F -- 'contentType: ' src/renderer/src/store src/renderer/src/runtime/sync-runtime-graph | head -80
printf '%s\n' '--- appearance fixtures and assertions ---'
rg -n -F -- 'mobile-session-tab-appearance-window' .
rg -n -F -- 'setTabColor' src/renderer/src/hooks src/renderer/src/runtime src/renderer/src -g '*session*appearance*' -g '*.test.ts' -g '*.spec.ts' -g '*.tsx'
rg -n -F -- 'isPinned' src/renderer/src/hooks src/renderer/src/runtime/sync-runtime-graph -g '*session*appearance*' -g '*.test.ts' -g '*.spec.ts'Repository: stablyai/orca
Length of output: 36417
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- host-session-tab-target.ts ---'
nl -ba src/renderer/src/hooks/ipc-events/host-session-tab-target.ts
printf '%s\n' '--- session appearance test ---'
nl -ba src/renderer/src/hooks/ipc-events/session-tab-appearance-ipc-bridge.test.ts
printf '%s\n' '--- terminal creation ---'
nl -ba src/renderer/src/store/terminals/terminal-tab-creation.ts | sed -n '165,215p'
printf '%s\n' '--- tab patch helpers ---'
rg -n -F -- 'function patchTerminalTabRow' src/renderer/src
rg -n -F -- 'function findRenamableUnifiedTab' src/renderer/src
rg -n -F -- 'function patchTab' src/renderer/src/store
printf '%s\n' '--- runtime event registration and relevant caller ---'
nl -ba src/renderer/src/hooks/ipc-events/session-tab-ipc-bridge.ts | sed -n '1,175p'
rg -n -F -- 'emitSetSessionTabAppearance' src || test "$?" -eq 1
rg -n -F -- 'setSessionTabAppearance' src/main src/renderer/src | head -100Repository: stablyai/orca
Length of output: 16886
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- terminal row patch and unified lookup helpers ---'
nl -ba src/renderer/src/store/slices/tabs/tabs-host-mirroring.ts
nl -ba src/renderer/src/store/terminals/renamable-unified-tab.ts
nl -ba src/renderer/src/store/slices/tab-group-state.ts | sed -n '220,260p'
printf '%s\n' '--- host/local mapping implementation ---'
nl -ba src/renderer/src/runtime/web-session-tabs-sync/tracking-mappings.ts
rg -n -F -- 'resolveLocalTabIdForHostSessionTab' src/renderer/src
printf '%s\n' '--- terminal creation callers and IDs ---'
rg -n -F -- 'createTab(' src/renderer/src/store/terminals src/renderer/src/store/slices | head -100
rg -n -F -- 'createTerminalTab' src/renderer/src/store src/renderer/src/hooks src/renderer/src/runtime
printf '%s\n' '--- terminal/unified reconciliation ---'
rg -n -F -- 'tabsByWorktree' src/renderer/src/store/slices/tabs-model-reconciliation.ts src/renderer/src/store/slices -g 'tabs-model-reconciliation.ts' -g '*reconcil*.ts'
rg -n -F -- 'entityId === terminal.id' src/renderer/src
rg -n -F -- 'contentType: '\''terminal'\''' src/renderer/src/store -g '*.ts' | head -100Repository: stablyai/orca
Length of output: 41810
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- terminal location ---'
nl -ba src/renderer/src/store/terminals/terminal-tab-location.ts
printf '%s\n' '--- tabs reconciliation ---'
nl -ba src/renderer/src/store/slices/tabs/tabs-reconciliation.ts
printf '%s\n' '--- explicit terminal id/entityId pairs ---'
python3 - <<'PY'
from pathlib import Path
import re
for p in Path('src/renderer/src').rglob('*.ts'):
text = p.read_text(errors='replace')
if "contentType: 'terminal'" not in text:
continue
lines = text.splitlines()
for i, line in enumerate(lines):
if "contentType: 'terminal'" in line:
block = '\n'.join(lines[max(0,i-8):min(len(lines),i+8)])
if re.search(r'\bid:\s*[^\n,}]+', block) and re.search(r'\bentityId:\s*[^\n,}]+', block):
print(f'--- {p}:{i+1} ---')
print(block)
PY
printf '%s\n' '--- reconciliation tests around terminal identity ---'
rg -n -F -- 'entityId:' src/renderer/src/store/slices/tabs-model-reconciliation.test.ts
rg -n -F -- 'id:' src/renderer/src/store/slices/tabs-model-reconciliation.test.ts | head -80Repository: stablyai/orca
Length of output: 41606
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- pin actions exact block ---'
nl -ba src/renderer/src/store/slices/tabs/tabs-label-actions.ts | sed -n '125,212p'
printf '%s\n' '--- canonical runtime/unified fixture ---'
nl -ba src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts | sed -n '1,215p'
printf '%s\n' '--- mobile terminal snapshot fields ---'
nl -ba src/renderer/src/runtime/sync-runtime-graph/mobile-session-terminal-tabs.ts | sed -n '100,132p'
printf '%s\n' '--- reachable appearance producer ---'
nl -ba src/main/window/runtime-window-lifecycle.ts | sed -n '168,190p'
nl -ba src/main/runtime/session-tabs/headless-terminal-tab-close.ts | sed -n '245,280p'
printf '%s\n' '--- changed diff context ---'
git diff 01800a092a94da1ed309a0590004b1350bf12cc4 b2a83d23ec75ee5dfd7db88d426e9ef1f2572b3f -- src/renderer/src/hooks/ipc-events/session-tab-ipc-bridge.ts src/renderer/src/store/slices/tabs/tabs-label-actions.tsRepository: stablyai/orca
Length of output: 19877
Use the terminal entity ID when mirroring pin state.
pinTab and unpinTab receive the unified tab ID, but patchTerminalTabRow looks up tabsByWorktree by the terminal row ID. Canonical terminal tabs can have different IDs. The unified tab becomes pinned, but the terminal parent remains unpinned, so the mobile snapshot can publish a stale isPinned value.
Suggested fix
- ...patchTerminalTabRow(state.tabsByWorktree, tabId, { isPinned: true }),
+ ...patchTerminalTabRow(
+ state.tabsByWorktree,
+ tab.contentType === 'terminal' ? tab.entityId : tabId,
+ { isPinned: true }
+ ),- ...patchTerminalTabRow(state.tabsByWorktree, tabId, { isPinned: false }),
+ ...patchTerminalTabRow(
+ state.tabsByWorktree,
+ tab.contentType === 'terminal' ? tab.entityId : tabId,
+ { isPinned: false }
+ ),|
Closing per owner decision. This bug is minor (tab pin and colour from the web client or a paired desktop), and the single-copy layout refactor fixes it by design: with C6, main owns tab properties. We are not taking a one-off fix in the old window-forwarding path. The finding is logged for the refactor's verification. |
ELI5
When you pin or recolor a tab from a paired client (the web client on your phone, or another computer paired to this one), the change now shows up on the desktop and comes back to the client. Before, nothing happened whenever the Orca window was open.
What Changed
Before: with the desktop window open, a paired client's pin or color request returned success, but the desktop tab did not change and the client's tab list never showed it. With no window open (a headless server), it already worked.
After: the desktop tab gets the pin and color immediately, and the tab list sent back to paired clients carries them, so the client shows them too.
Mechanism:
moveSessionTab). The window applies it with the same store actions as the desktop's own pin and color controls.Why
The window is the source of truth for tab state while it is open, so the change has to go through it. Writing to the saved session in the host process would be overwritten on the window's next publish. The alternative of letting the host process own pin and color while a window is open would create two owners for the same state. Handing the change to the window reuses the existing path for moving tabs and needs no protocol change. The RPC is unchanged, and older clients and hosts behave as before.
Linked Issue
Fixes #
Visual Proof
Hidden dev app (
ORCA_BACKGROUND_LAUNCH=1) with a window open, plus a runtime-paired client callingsession.tabs.setTabPropswith an orange color and pin on the same terminal tab.Before: the call returns

{updated: true}, but the tab is unchanged on the desktop and the client sees no color or pin.After: the desktop tab shows the pin icon and the orange dot, and the client's next

session.tabs.listreturnscolor: "#ff8800", isPinned: true.Testing
I manually tested these changes locally (macOS, hidden window, paired client; before and after on the same profile)
Automated tests added/updated, or explained why not below
New:
mobile-session-tab-appearance-window.spec.ts. It fails before the fix (the window is never told) and passes after. It also checks that a view-mode-only change is not forwarded.New:
session-tab-appearance-ipc-bridge.test.ts. The window applies pin and color, and the published client tab list carries them. It fails without the projection change.The existing headless (no window) tests are unchanged and pass.
src/main/runtime,src/main/window,src/renderer/src/hooks,src/renderer/src/runtime, and the tabs and terminal store tests all pass (16.8k tests).pnpm tcandcheck:code-quality:changedare clean.SSH workspaces on a host with a window take the same window path. Their tabs are local to the host window, so no extra request is sent.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The native phone app cannot call this RPC (it is not on the phone allowlist). The callers are the web client and paired desktops. A paired desktop that already has the tab keeps its own color and pin until it reloads. That limit predates this change.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)