Repository navigation
fix(ui): preserve worktree base branch across reconnects - #133744
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 11:08 PM ET / August 31, 2026, 03:08 UTC. ClawSweeper reviewWhat this changesThe branch retains New Session worktree branch and checkout-name choices through Gateway reconnects or failed discovery, and clears those details only when the selected repository actually changes. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessNo introduced blocking defect was found. Keep this maintainer-authored, maintainer-labeled PR open for explicit maintainer handling because the reviewer could not load current-main source from the partial clone to complete the required exact-main comparison. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI combines the selected folder or project with Gateway repository discovery to decide whether a worktree can be used and which branch to check out. The resulting details are stored in New Session preferences and flow into session creation. flowchart LR
A[Folder or project selection] --> B[New Session draft]
B --> C[Gateway repository discovery]
C --> D[Worktree branch and name]
D --> E[Saved draft preference]
E --> F[Session creation]
Decision needed
Why: The PR is maintainer-authored and carries the protected maintainer label, while changing when saved worktree details are retained or cleared. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +76, Docs +2. Total +77 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single explicit branch-override owner and land only after a maintainer verifies the exact current-main merge and current-head checks preserve the documented clear-on-real-repository-change behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: the prior controller reset its base value during invalidation and each discovery load, and the new regression test follows that reconnect sequence. The read-only checkout has no dependencies, so this reviewer did not execute the test. Is this the best way to solve the issue? Yes: a single explicit override plus a discovery-derived fallback removes the duplicate restoration state and prevents asynchronous discovery from replacing an edited branch; catalog errors are correctly separated from authoritative absence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 346fae9a762d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Addressed the review finding and rank-up move: removed the release-owned CHANGELOG edit; release-note context remains in the PR body. The final runtime also fixes a connected project-catalog issue caught by the existing cloud-dispatch E2E: a disconnected/failed catalog lookup no longer masquerades as a confirmed missing project. The original assertion is retained and passes. Fresh Codex autoreview is clean at its configured blocking priority. Completed live proof now includes 360 repository probes, 120 direct creations, 12 managed worktree creations, 30 browser transitions, nine group-default checks, and ten real Gateway restart/recovery transitions with a registered project selected. The selected project, edited branch, and checkout name survive, and the final isolated session completes with the deterministic loopback provider. All browser runs recorded zero page errors. Before/after screenshots are in the PR body. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Completed the maintainer review and the remaining rank-up move in a complete checkout. Current main is The persisted-preference behavior is intentional: reconnects and failed catalog/Git lookups preserve the operator's existing repository and checkout choices; an explicit repository change or a confirmed missing project clears the old repository's branch/name. Preference shapes and storage schema are unchanged. The real registered-project restart test, folder-boundary regressions, and unchanged cloud-dispatch E2E cover this distinction. No remaining code finding or owner-boundary concern. Exact-head CI is finishing with no failures; the native prepare/merge gates will enforce completion before landing. |
|
Merged via squash.
|
…3744) * fix(ui): preserve worktree base branch across reconnects * fix(ui): retain project selection during catalog reconnects * docs: leave workspace release notes in the pull request
Related: #133664, #133705
What Problem This Solves
Fixes an issue where users editing the base branch on the New Session page lose that choice when the Gateway reconnects or Git discovery retries. Live stress testing reproduced
proof-basebecoming empty after restart; successful rediscovery could then replace it with the repository default.Why This Change Was Made
The repository controller now keeps an explicit or saved branch override and derives the fallback from current Git discovery. This removes the duplicate branch-restoration state and generation bookkeeping, so asynchronous repository results cannot overwrite operator input. Actual folder/project changes clear both current and saved checkout details. Project discovery now distinguishes a disconnect or failed refresh from a confirmed empty catalog, preserving the selected project and its checkout details until an authoritative result removes it.
Production delta: 35 additions / 36 deletions (net -1). Regression tests: 77 additions / 1 deletion (net +76). No protocol, configuration, or database changes.
User Impact
Worktree selection, edited base branch, and checkout name survive reconnects and temporary Git failures. Selecting a different repository clears stale repository-specific details.
Evidence
b4cf3ef9f4937826808f83c794aa708256407c51passed 360 repository probes (12 concurrent), 120 direct session creations (8 concurrent), 12 managed-worktree creations (4 concurrent), 30 browser navigation transitions, nine implicit-workspace group-default dialogs, and ten restart/recovery transitions followed by a completed worktree session. The ten restart/recovery transitions used a registered project, verified that its selection survived each reconnect, and ended in a completed isolated session. All browser runs recorded zero page errors. The final commit only removes a release-owned changelog edit; runtime code is unchanged.Before: the edited base branch disappears after reconnect.
After: the edited branch and name remain while Git is unavailable.