Commit 63826e6
feat: support multiple branches per repo and display actual checked-out branch
Implements the remaining functionality from the git repo context feature:
1. **Fix 2nd branch checkout issue (Runner)**:
- Modified `clone_repo_at_runtime()` in main.py to handle branch switching
- When repo already exists, now fetches and checks out the requested branch
- Previously skipped clone entirely if repo directory existed
2. **Add /repos/status endpoint (Runner)**:
- New GET endpoint to query actual checked-out branches
- Returns list of repos with current branch info from git
- Used by operator to sync actual state to status
3. **Fetch and store current branch (Operator)**:
- Added `fetchActualBranchesFromRunner()` helper function
- Calls runner's /repos/status endpoint during reconciliation
- Updates status.reconciledRepos with both intended and actual branch
- New field: `currentBranch` alongside existing `branch` field
4. **Display actual branch (Frontend)**:
- Updated RepositoriesAccordion to support `currentBranch` field
- Changed data source from spec.repos to status.reconciledRepos
- Badge now shows actual checked-out branch from runner
**User Impact**:
- Can now add same repo with different branches as context
- Context Modal displays the actual checked-out branch
- Runner properly switches branches when user adds 2nd branch
- System maintains both intended (spec) and actual (status) branch info
Fixes the issue described in PR ambient-code#498 where adding a 2nd branch for the
same repo would show in UI but not actually checkout in the runner pod.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 8cb14fb commit 63826e6
File tree
4 files changed
+192
-21
lines changed- components
- frontend/src/app/projects/[name]/sessions/[sessionName]
- components/accordions
- operator/internal/handlers
- runners/claude-code-runner
4 files changed
+192
-21
lines changedLines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1552 | 1552 | | |
1553 | 1553 | | |
1554 | 1554 | | |
1555 | | - | |
| 1555 | + | |
1556 | 1556 | | |
1557 | 1557 | | |
1558 | 1558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1552 | 1552 | | |
1553 | 1553 | | |
1554 | 1554 | | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1555 | 1558 | | |
1556 | 1559 | | |
1557 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
1558 | 1569 | | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
1563 | 1575 | | |
1564 | 1576 | | |
1565 | 1577 | | |
| |||
2230 | 2242 | | |
2231 | 2243 | | |
2232 | 2244 | | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2233 | 2305 | | |
2234 | 2306 | | |
2235 | 2307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
| 578 | + | |
| 579 | + | |
580 | 580 | | |
581 | | - | |
582 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
583 | 613 | | |
584 | 614 | | |
585 | 615 | | |
| |||
819 | 849 | | |
820 | 850 | | |
821 | 851 | | |
822 | | - | |
| 852 | + | |
823 | 853 | | |
824 | 854 | | |
825 | 855 | | |
826 | | - | |
| 856 | + | |
827 | 857 | | |
828 | 858 | | |
829 | | - | |
| 859 | + | |
830 | 860 | | |
831 | 861 | | |
832 | 862 | | |
833 | | - | |
| 863 | + | |
834 | 864 | | |
835 | 865 | | |
836 | 866 | | |
837 | 867 | | |
838 | 868 | | |
839 | 869 | | |
840 | | - | |
| 870 | + | |
841 | 871 | | |
842 | 872 | | |
843 | | - | |
| 873 | + | |
844 | 874 | | |
845 | | - | |
| 875 | + | |
846 | 876 | | |
847 | 877 | | |
848 | 878 | | |
849 | | - | |
| 879 | + | |
850 | 880 | | |
851 | | - | |
| 881 | + | |
852 | 882 | | |
853 | 883 | | |
854 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
855 | 949 | | |
856 | 950 | | |
857 | 951 | | |
| |||
0 commit comments