fix(git): show branch name for SSH/container agents in header#1125
fix(git): show branch name for SSH/container agents in header#1125pedramamini wants to merge 1 commit into
Conversation
The main panel header rendered an SSH host pill (the remote name) that fully replaced the GIT/branch badge whenever a session ran on an SSH remote. For agents running inside a container over SSH this meant the branch name disappeared - only the remote/sandbox name was shown - even though the branch is fetched fine over SSH and was already available in the pill's hover tooltip. Render a dedicated branch badge next to the SSH host pill for SSH-backed git repos, styled like the local git badge and reusing the same click-to-open-git-log behavior, so remote/container agents surface the branch the same way local agents do. closes #1124
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesSSH Git Branch Badge in MainPanelHeader
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. 🔧 ESLint
ESLint install failed due to a network error. 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 |
Greptile SummaryThis PR fixes a regression where agents running inside SSH/container environments lost the branch name display in the header — only the SSH remote pill was shown, while local agents display an orange branch badge. The fix adds a dedicated branch badge rendered alongside the SSH host pill for git-backed SSH sessions, reusing existing styling and click behavior.
Confidence Score: 5/5Safe to merge — the change is purely additive, limited to one conditional block in the header component, and leaves all existing rendering paths untouched. The fix is small and well-contained: it adds one new branch badge element behind the same condition used by the SSH host pill, reuses existing styles and click handlers, and has no effect on local-agent or non-git paths. Two targeted regression tests cover both the git and non-git SSH cases. The only observation is a now-redundant branch name in the SSH pill's native tooltip title, which is cosmetic and harmless. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Render header pill area] --> B{SSH enabled AND sshRemoteName set?}
B -- Yes --> C[Render SSH host pill 🖧 REMOTE-NAME]
B -- No --> D[Render local badge]
D --> E{isGitRepo?}
E -- Yes --> F[🌿 branch or GIT]
E -- No --> G[LOCAL]
C --> H{isGitRepo?}
H -- Yes --> I[Render branch badge 🌿 branch or GIT]
H -- No --> J[No branch badge]
I --> K[Hover outer div → git tooltip / Click either pill → git log]
F --> K
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Render header pill area] --> B{SSH enabled AND sshRemoteName set?}
B -- Yes --> C[Render SSH host pill 🖧 REMOTE-NAME]
B -- No --> D[Render local badge]
D --> E{isGitRepo?}
E -- Yes --> F[🌿 branch or GIT]
E -- No --> G[LOCAL]
C --> H{isGitRepo?}
H -- Yes --> I[Render branch badge 🌿 branch or GIT]
H -- No --> J[No branch badge]
I --> K[Hover outer div → git tooltip / Click either pill → git log]
F --> K
|
closes #1124
Problem
When an agent runs inside a container over SSH (the reporter's "vssh" setup), the branch name was missing next to the agent name in the main panel header. Only the SSH remote / sandbox name (e.g.
HARNESS-SANDBOX) was shown. For local agents the branch name appears as expected.Root cause
In
MainPanelHeader.tsx, the header pill is an either/or:sessionSshRemoteConfig.enabled && sshRemoteNameis set, it renders an SSH host pill (Servericon + uppercase remote name) that replaces the GIT/branch badge entirely.GitBranchicon +gitInfo.branch).So any SSH-backed git repo lost the inline branch name. The branch was only available in the host pill's hover tooltip (
SSH Remote: <name> (<branch>)), confirming the data is fetched fine over SSH - it just wasn't rendered.Fix
Render a dedicated branch badge next to the SSH host pill for SSH-backed git repos. It's styled like the existing local git badge (orange
GitBranch+ branch name,header-git-branch-textso it still collapses at narrow widths) and reuses the same click-to-open-git-log behavior. Non-git SSH agents are unaffected (no badge). Local agents are unchanged.Result for a container/SSH git agent:
[🖧 HARNESS-SANDBOX] [⎇ main]instead of just[🖧 HARNESS-SANDBOX].Tests
Added two cases to
MainPanelHeader.test.tsx:All 21 header tests pass. Type-check is clean for the changed files (only the repo's pre-existing
@codemirror/*module-resolution errors remain, unrelated to this change).Summary by CodeRabbit
New Features
Bug Fixes