fix: use-active-conversation updates when agent checks out new branch#1324
fix: use-active-conversation updates when agent checks out new branch#1324HeyItsChloe wants to merge 2 commits into
Conversation
This fix addresses issues #1193 and #1182 where the Changes/Diffs tab was not displaying the correct workspace directory when switching repos. Root cause: getGitPath() prioritized workingDir over selectedRepository, but workingDir is updated asynchronously by the agent after cloning. During repo switches, workingDir would be stale while selectedRepository was immediately updated. Changes: - get-git-path.ts: Prioritize selectedRepository over workingDir when a repo is selected. This ensures the Changes tab uses the correct workspace immediately when a user selects a repository. - git-control-bar.tsx: Show repo button when localGitInfo detects a repository (even if selected_repository wasn't set via UI). This handles the case where the agent autonomously clones a repo. - Updated tests to reflect new priority behavior and added tests for localGitDetectedRepo functionality. Fixes #1193 Fixes #1182
…mid-conversation - useLocalGitInfo: invalidate conversation query when live branch diverges from recorded selected_branch (immediate refetch instead of 30s poll) - useActiveConversation: add selected_branch to useEffect deps so ConversationService.setCurrentConversation fires on branch change - getGitPath: add localGitDetectedRepo fallback param for agent-autonomous clones where git info is detected before selected_repository is set - useUnifiedGitDiff / useUnifiedGetGitChanges: pass localGitInfo.repository to getGitPath so Changes tab uses correct workspace after repo switch - add tests for localGitDetectedRepo fallback behavior
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Mock-LLM E2E Tests53/53 passed Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
📸 Snapshot Test ReportWarning Snapshot comparison step crashed (timeout, OOM, or runner error) — diff results below may be incomplete or absent. ❌ 8 snapshots differ from the main branch baselines. Add the
🔴 Changed snapshots (8)
|
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
automations
automations-no-automations
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
changes-tab
changes-empty
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
collapsible-thinking
think-action-collapsed
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
onboarding
onboarding-step-3-say-hello
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
settings-page — 2 snapshots
analytics-consent-modal
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
settings-app-page
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
skills-page
skills-no-match
| Expected (main) | Actual (PR) | Diff |
|---|---|---|
![]() |
![]() |
![]() |
✅ Unchanged snapshots (66)
archived-conversation
- conversation-panel-with-archived-badges
- conversation-view-sandbox-error
automations
- automations-delete-modal
- automations-list-active-inactive
- automations-search-no-results
backends-extended
- backend-add-blank-disabled
- backend-add-cloud-advanced-open
- backend-add-cloud-no-key-disabled
- backend-add-cloud-with-key-enabled
- backend-add-form-partially-filled
- backend-add-invalid-url-disabled
- backend-add-local-ready
- backend-add-name-only-disabled
- backend-add-two-column-layout
- backend-add-whitespace-host-disabled
- backend-after-switch
- backend-cancel-nothing-saved
- backend-dropdown-two-backends
- backend-edit-prefilled
- backend-manage-after-removal
- backend-manage-two-listed
- backend-remove-cancelled
- backend-remove-confirmation
- backend-switch-overlay
backends
- backend-add-modal
- backend-manage-modal
- backend-selector-open
changes-tab
- changes-deleted-file
- changes-diff-viewer
collapsible-thinking
- reasoning-content-collapsed
- reasoning-content-expanded
- think-action-expanded
mcp-page
- mcp-custom-server-1-editor-open
- mcp-custom-server-2-url-filled
- mcp-custom-server-3-all-filled
- mcp-custom-server-4-installed
- mcp-custom-server-editor
- mcp-empty-installed
- mcp-search-filtered
- mcp-slack-install-1-marketplace
- mcp-slack-install-2-modal
- mcp-slack-install-3-filled
- mcp-slack-install-4-installed
onboarding
- onboarding-step-0-check-backend
- onboarding-step-1-choose-agent
- onboarding-step-2-setup-llm
projects-workspace-browser
- projects-workspace-browser
settings-page
- add-backend-modal
- home-screen
- settings-page
settings-secrets
- secrets-add-form-filled
- secrets-add-form
- secrets-after-save
- secrets-delete-confirm
- secrets-list
settings-verification
- condenser-settings
- verification-settings-critic-enabled
- verification-settings-off
- verification-settings-on
sidebar
- sidebar-collapsed
- sidebar-conversation-panel
- sidebar-filter-menu
skills-page
- skills-empty
- skills-loaded
- skills-search-filtered
- skills-type-filter
Generated by the Snapshot Tests workflow. This comment was created by an AI agent (OpenHands) on behalf of the repo maintainers.
🛑 Mock-LLM Docker E2E Test Results30/35 passed · 5 skipped · Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
























Why
The Changes tab and git control bar were not updating when the agent checked out to a new branch mid-conversation. Several layers were not reacting to branch changes:
git rev-parse --abbrev-ref HEADevery 10s but never invalidated the conversation query when it diverged fromconversation.selected_branchselected_branchsoConversationService.setCurrentConversationnever fired on branch switchlocalGitInfo.repositoryfor agent-autonomous clones whereselected_repositoryisn't set yetgetGitPath, so the Changes tab used stale pathsChanges
useQueryClient.invalidateQuerieswhen live branch diverges from recorded branch — forces immediate conversation refetch instead of waiting up to 30s for the next poll cycleuserConversation?.data?.selected_branchtouseEffectdeps soConversationService.setCurrentConversationfires on branch changelocalGitDetectedRepo3rd parameter as fallback for agent-autonomous cloneslocalGitInfo?.repositorytogetGitPathso Changes tab uses correct workspacelocalGitDetectedRepofallback behaviorTest Results
get-git-path.test.ts: 14 tests passeduse-active-conversation.test.ts: 5 tests passedgit-control-bar.test.tsx: 11 tests passed🐳 Docker images for this PR
• GHCR package: https://github.com/OpenHands/agent-canvas/pkgs/container/agent-canvas
ghcr.io/openhands/agent-canvasghcr.io/openhands/agent-server:1.26.0-pythonopenhands-automation==1.0.0a69216274c1f8a84665bcb5e534e6c21ef9a379933Pull (multi-arch manifest)
# Multi-arch manifest — Docker automatically pulls the correct architecture docker pull ghcr.io/openhands/agent-canvas:sha-9216274Run
All tags pushed for this build
About Multi-Architecture Support
sha-9216274) is a multi-arch manifest supporting both amd64 and arm64sha-9216274-amd64) are also available if needed