Repository navigation
fix(ui): keep non-Git agent workspaces usable for new sessions - #133664
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 9:01 PM ET / August 31, 2026, 01:01 UTC. ClawSweeper reviewWhat this changesThe PR makes New Session offer worktree isolation only after repository discovery confirms a usable Git checkout or a remote repository awaiting cloning. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessThe PR addresses a real current-main mismatch and no introduced correctness defect was found. Its targeted reset of a persisted worktree preference is compatibility-sensitive, so the protected maintainer review should remain open for explicit acceptance. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI turns saved, group, and user-selected destinations into a New Session request. It queries the Gateway for repository status, then either permits Git worktree isolation or allows a direct session. flowchart LR
A[New Session defaults] --> B[Selected workspace]
B --> C[Gateway repository discovery]
C --> D{Usable Git checkout?}
D -->|Yes| E[Worktree isolation]
D -->|No| F[Direct session]
E --> G[Create session]
F --> G
Decision needed
Why: The behavior fixes an invalid session-start state but intentionally changes retained user preference during upgrade; source evidence cannot decide the desired persistence policy. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +71, Docs +2. Total +72 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt repository discovery as the sole worktree-availability authority and explicitly accept the narrow preference reset for confirmed non-Git folders. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main exposes worktree availability from a saved project root or workspace marker despite an unavailable repository result, while the Gateway contract distinguishes usable Git from unavailable state. Is this the best way to solve the issue? Yes: placing the decision in the repository controller uses the Gateway result that already verifies Git and HEAD availability, rather than duplicating weaker path or marker heuristics in callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 252e80d1cc4f. LabelsLabel 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
History |
|
CI caught a group-default ordering regression on the first head. I reproduced it locally: an old workspace-discovery reply arrived while the saved group folder was being validated, consumed the new folder's worktree preference, and left the group in direct mode. The controller now retires the old request immediately when the target changes and consumes the current preference when matching discovery resolves. On The review's positive-production-LOC concern is resolved. The persisted-preference distinction remains intentional: inferred/saved isolation is adopted only for a usable checkout, while an explicit selection is retained and submission blocked after a failed recheck. I am checking the optional isolated real-Gateway proof while exact-head CI runs. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Review follow-up: persisting The latest push only corrects device-dispatch fixtures to provide the Git discovery response their scenarios require. The four failures reproduced locally and all 13 device cases now pass, with their dispatch-order and capacity assertions unchanged. Together with the other suites, focused browser coverage is 38 passing scenarios; focused units remain 52 passing. The real-Gateway Rank-up move was attempted and remains incomplete: production UI build, isolated unborn workspace, Gateway startup, and browser handshake passed; synchronous source-module loading blocked the shared event loop for about 221 seconds, then navigation timed out before the target assertions. The PR body records this concrete proof limitation. All owned processes, ports, and temporary state were cleaned, and no provider turn was requested. I am retaining the completed mocked-Gateway browser and owner-boundary evidence and waiting for the final exact-head checks before native landing. |
|
Land-ready on The repair keeps repository discovery as the capability/restoration owner, removes metadata-based eligibility and the group bypass, and retires obsolete-folder requests. Production is net -1 line. Verification includes 52 focused unit tests, 38 browser scenarios, pre-fix failures, manual synthetic before/after browser proof, remote changed checks, and clean Codex autoreview. The PR records the incomplete isolated real-Gateway attempt and its source-loading blocker; no provider turn or deployment is claimed. Latest exact-head ClawSweeper review and Rank-up move are addressed. This fix intentionally retains the existing direct-mode reset after confirmed non-Git discovery; confirmed-non-Git preference clearing already existed in base (source linked above), the extra real-Gateway attempt and limit are documented, and exact-head CI is now green. Proceeding through the native landing workflow. |
|
Merged via squash.
|
…law#133664) * fix(ui): keep non-Git agent workspaces usable for new sessions * fix(ui): retire stale repository discovery on preference changes * test(ui): verify Git in device dispatch fixtures
What Problem This Solves
Fixes an issue where starting a Control UI session in an ordinary agent workspace could offer Worktree, then fail with
agent workspace is not a git checkout. A.gitmarker or a saved project path does not prove that the folder has a usable checkout; newly initialized workspaces can have Git metadata without any commits.Why This Change Was Made
The New Session repository controller now uses the Gateway's repository discovery result as the authority for worktree availability. Confirmed Git checkouts and selected remote repositories awaiting cloning support isolation. Saved workspace and group defaults go through that same decision, including when discovery is already cached. Switching placement after discovery reuses the resolved repository so a remembered base branch is preserved. Changing folders retires the previous discovery request before its reply can consume the new folder's preference.
An explicitly selected worktree remains selected when a later Git check fails, with Start blocked until the user clears isolation or reselects the folder. Ordinary sessions continue to run directly. Gateway worktree validation and remote-placement isolation requirements are unchanged.
User Impact
Plain folders and fresh repositories without commits work for ordinary local sessions without requiring users to initialize or commit a repository. Worktree controls are offered only when usable, and valid GitHub, project, cloud, and reconnect flows retain their intended selections.
Evidence
unavailablewhile the Worktree option remained enabled.9ea3b23853bde7accd79fdd8394c161c45ca6991: CI run 33345931670.Before: the unavailable checkout still offers a selected Worktree and an enabled Start button.
After: the same folder starts directly without a Worktree control.
Real-Gateway Proof Limit
The suggested isolated real-Gateway check was attempted: a fresh production UI build, an isolated Gateway, an unborn Git workspace, and the real browser handshake all succeeded. Source-module loading then blocked the shared runner event loop for about 221 seconds; navigation timed out before the Worktree-control and direct-creation assertions. The attempt is incomplete and is not counted as successful behavior proof. No provider turn was requested. All task-owned processes, listener ports, and temporary state were cleaned up.
The remaining gap is the optional real-Gateway UI proof for the persisted-preference transition. The completed proof is the mocked-Gateway browser flow plus the owner regressions; exact-head hosted CI also passed before landing. The startup-loading observation is recorded here for follow-up; no unrelated startup change is included.