Repository navigation
fix(sidebar): identify remote server workspaces - #10061
Conversation
📝 WalkthroughWalkthroughWorktree cards now resolve runtime ownership from worktree and repository data, use environment status to determine disconnection, and display named runtime host messages. Localization files add host-specific variants across supported languages. Sidebar row construction now supports per-worktree host labels for mixed runtime hosts while retaining repo-based labels for repo grouping. Tests cover disconnected runtime cards, multiple runtime environments, and grouped sidebar rows. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)src/renderer/src/i18n/locales/en.jsonTraceback (most recent call last): src/renderer/src/i18n/locales/ja.jsonTraceback (most recent call last): src/renderer/src/i18n/locales/es.jsonTraceback (most recent call last):
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.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3c0dd0ce-1af5-4a23-a614-d6adbe5d8575
📒 Files selected for processing (9)
src/renderer/src/components/sidebar/WorktreeCard.ssh-reconnect-prompt.test.tsxsrc/renderer/src/components/sidebar/WorktreeCard.tsxsrc/renderer/src/components/sidebar/worktree-list-groups.test.tssrc/renderer/src/components/sidebar/worktree-list-groups.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.json
| let sshConnectionStates = new Map<string, { status: string }>() | ||
| let sshTargetLabels = new Map<string, string>() | ||
| let runtimeStatusByEnvironmentId = new Map<string, { status?: unknown }>() | ||
| let runtimeEnvironments: { id: string; name: string }[] = [] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Remove the duplicate runtimeEnvironments declaration.
The provided file declares the same let runtimeEnvironments variable twice at Line 17, which causes a TypeScript duplicate block-scoped variable error. Keep only one declaration.
| {!repo?.connectionId && parsedRepoHost?.kind === 'runtime' && ( | ||
| <Tooltip> | ||
| <TooltipTrigger asChild> | ||
| <span className="shrink-0 inline-flex items-center"> | ||
| {isRuntimeDisconnected ? ( | ||
| <ServerOff className="size-3 text-red-400" /> | ||
| ) : ( | ||
| <Server className="size-3 text-muted-foreground" /> | ||
| )} | ||
| </span> | ||
| </TooltipTrigger> | ||
| <TooltipContent side="right" sideOffset={8}> | ||
| {isRuntimeDisconnected | ||
| ? runtimeHostLabel | ||
| ? translate( | ||
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnectedNamed', | ||
| '{{hostName}} disconnected', | ||
| { hostName: runtimeHostLabel } | ||
| ) | ||
| : translate( | ||
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnected', | ||
| 'Server disconnected' | ||
| ) | ||
| : runtimeHostLabel | ||
| ? translate( | ||
| 'auto.components.sidebar.WorktreeCard.runtimeHostProjectNamed', | ||
| 'Project on {{hostName}}', | ||
| { hostName: runtimeHostLabel } | ||
| ) | ||
| : translate( | ||
| 'auto.components.sidebar.WorktreeCard.runtimeHostProject', | ||
| 'Project on Orca server' | ||
| )} | ||
| </TooltipContent> | ||
| </Tooltip> | ||
| )} | ||
| </TooltipContent> | ||
| </Tooltip> | ||
| )} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check whether existing tests cover worktree-level runtimeOwnerEnvironmentId
# differing from the repo's parsed execution host kind.
fd 'WorktreeCard.ssh-reconnect-prompt.test.tsx' --exec rg -n -A5 -B5 'runtimeOwnerEnvironmentId' {}Repository: stablyai/orca
Length of output: 1071
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the relevant WorktreeCard implementation and tests without running repo code.
file="$(fd 'WorktreeCard\.tsx$' src/renderer/src/components/sidebar | head -n1)"
test_file="$(fd 'WorktreeCard\.ssh-reconnect-prompt\.test\.tsx$' src/renderer/src/components/sidebar | head -n1)"
echo "FILE=$file"
echo "TEST=$test_file"
wc -l "$file" "$test_file"
printf '\n--- outline ---\n'
ast-grep outline "$file" --match 'runtimeOwnerEnvironmentId' --view expanded || true
printf '\n--- relevant implementation lines 340-390 ---\n'
sed -n '340,390p' "$file" | nl -ba -v340
printf '\n--- relevant implementation lines 1400-1470 ---\n'
sed -n '1400,1470p' "$file" | nl -ba -v1400
echo
echo "--- relevant tests around runtime mismatch ---"
sed -n '160,235p' "$test_file" | nl -ba -v160Repository: stablyai/orca
Length of output: 621
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="src/renderer/src/components/sidebar/WorktreeCard.tsx"
test_file="src/renderer/src/components/sidebar/WorktreeCard.ssh-reconnect-prompt.test.tsx"
printf '%s\n' '--- relevant implementation lines 330-385 ---'
awk 'NR>=330 && NR<=385 { printf "%d\t%s\n", NR, $0 }' "$file"
printf '\n%s\n' '--- relevant implementation lines 1395-1475 ---'
awk 'NR>=1395 && NR<=1475 { printf "%d\t%s\n", NR, $0 }' "$file"
printf '\n%s\n' '--- relevant test lines 155-230 ---'
awk 'NR>=155 && NR<=230 { printf "%d\t%s\n", NR, $0 }' "$test_file"
printf '\n%s\n' '--- usages of parsedRepoHost, runtimeOwnerEnvironmentId, runtimeHost ---'
rg -n -C3 'parsedRepoHost|runtimeOwnerEnvironmentId|runtimeHostId|runtim.*Disconnected|runtimeHostLabel' "$file" "$test_file"Repository: stablyai/orca
Length of output: 17678
Gate runtime host rendering on the resolved runtime id.
The runtime status and label are derived from runtimeOwnerEnvironmentId, but the badge is still gated on the repo-level parsedRepoHost?.kind === 'runtime'. That excludes worktree-level runtime hosts when the repo default is local/undefined, so the mixed-host case doesn’t show the badge/tooltip. Gate on runtimeHostId instead.
🐛 Proposed fix
- {!repo?.connectionId && parsedRepoHost?.kind === 'runtime' && (
+ {!repo?.connectionId && runtimeHostId && (📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {!repo?.connectionId && parsedRepoHost?.kind === 'runtime' && ( | |
| <Tooltip> | |
| <TooltipTrigger asChild> | |
| <span className="shrink-0 inline-flex items-center"> | |
| {isRuntimeDisconnected ? ( | |
| <ServerOff className="size-3 text-red-400" /> | |
| ) : ( | |
| <Server className="size-3 text-muted-foreground" /> | |
| )} | |
| </span> | |
| </TooltipTrigger> | |
| <TooltipContent side="right" sideOffset={8}> | |
| {isRuntimeDisconnected | |
| ? runtimeHostLabel | |
| ? translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnectedNamed', | |
| '{{hostName}} disconnected', | |
| { hostName: runtimeHostLabel } | |
| ) | |
| : translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnected', | |
| 'Server disconnected' | |
| ) | |
| : runtimeHostLabel | |
| ? translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostProjectNamed', | |
| 'Project on {{hostName}}', | |
| { hostName: runtimeHostLabel } | |
| ) | |
| : translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostProject', | |
| 'Project on Orca server' | |
| )} | |
| </TooltipContent> | |
| </Tooltip> | |
| )} | |
| </TooltipContent> | |
| </Tooltip> | |
| )} | |
| {!repo?.connectionId && runtimeHostId && ( | |
| <Tooltip> | |
| <TooltipTrigger asChild> | |
| <span className="shrink-0 inline-flex items-center"> | |
| {isRuntimeDisconnected ? ( | |
| <ServerOff className="size-3 text-red-400" /> | |
| ) : ( | |
| <Server className="size-3 text-muted-foreground" /> | |
| )} | |
| </span> | |
| </TooltipTrigger> | |
| <TooltipContent side="right" sideOffset={8}> | |
| {isRuntimeDisconnected | |
| ? runtimeHostLabel | |
| ? translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnectedNamed', | |
| '{{hostName}} disconnected', | |
| { hostName: runtimeHostLabel } | |
| ) | |
| : translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostDisconnected', | |
| 'Server disconnected' | |
| ) | |
| : runtimeHostLabel | |
| ? translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostProjectNamed', | |
| 'Project on {{hostName}}', | |
| { hostName: runtimeHostLabel } | |
| ) | |
| : translate( | |
| 'auto.components.sidebar.WorktreeCard.runtimeHostProject', | |
| 'Project on Orca server' | |
| )} | |
| </TooltipContent> | |
| </Tooltip> | |
| )} |
Co-authored-by: OrcaWin <[email protected]>
Summary
Validation
Evidence