Repository navigation
refactor(ui): simplify workspace discovery and preference restoration - #133705
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 10:01 PM ET / August 31, 2026, 02:01 UTC. ClawSweeper reviewWhat this changesThe branch makes Control UI worktree eligibility depend on Gateway repository inspection and restores saved placement preferences without blocking local drafts or overwriting checkout details edited during discovery. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open. Current main does not contain this branch’s repository-discovery and preference-restoration changes, and the member-authored, maintainer-labeled PR contains a coherent bounded fix with no concrete introduced correctness defect found. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI New Session flow combines agent workspace data, selected folders or projects, saved placement preferences, and a Gateway Git probe to choose direct, worktree, device, or cloud execution. The resulting placement state controls whether Start is enabled and which session parameters reach the Gateway. flowchart LR
A[Agent workspace and preferences] --> B[New Session draft]
C[Folder or project selection] --> B
B --> D[Gateway Git inspection]
D --> E[Placement eligibility]
E --> F[Start session]
E --> G[Visible recovery state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -56, Tests +88, Docs +2. Total +34 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Gateway repository inspection as the single eligibility authority, preserve saved cloud destinations for transient unavailable probes, and retain the explicit Local fallback for a conclusively non-Git workspace only if maintainers accept that preference migration. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible. The prior sidebar branch trusted the workspaceGit hint for an implicit workspace, while the added owner and mocked-Gateway browser scenarios exercise unavailable and direct Git results; this read-only review did not execute them. Is this the best way to solve the issue? Yes. The branch removes the non-authoritative workspace hint and routes eligibility through the existing Gateway inspection owner, rather than layering another client-side permission or repository-status cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 14f86793ecd6. 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
|
|
Maintainer review: the saved-preference choice is intentional for this repair. A conclusively non-Git source cannot support cloud worktree placement, so its restored default is repaired to Local and the operator can start the draft. This follows the existing repair of a saved worktree preference for a confirmed plain folder. It applies only to restored defaults: explicit cloud/worktree selections remain intact, and a transient This addresses the compatibility question and Rank-up move. The final code has no outstanding review findings. The previously failing test-type shard and the hosted real-Gateway smoke test are green on |
|
Merged via squash.
|
…openclaw#133705) * refactor(ui): simplify workspace discovery and preference restoration * fix(ui): preserve edited checkout details during preference adoption * test(ui): use shared deferred helper for workspace discovery
Related: #133664
What Problem This Solves
Fixes an issue where group defaults offered Worktree for an agent workspace whose
.gitmarker existed but whose checkout could not be verified. Reviewing the surrounding new-session flow also reproduced saved cloud preferences leaving plain folders stuck on “Restoring preferences,” and delayed identity preferences losing their base branch while repository discovery was pending or overwriting already-edited checkout details after discovery.Why This Change Was Made
Repository discovery now uses its existing state union directly, reuses the invalidation and worktree-selection owners, and reads the latest preferred base branch when a request completes while retaining the user-edit generation fence. Late identity preferences also preserve edited branch and checkout-name details when discovery is already cached. Group defaults inspect the agent workspace through the same Gateway operation as custom folders. Dead folder-permission bookkeeping and an impossible submission predicate are removed; the Gateway remains the folder authorization owner.
Production LOC: +53/-109, net -56. Tests: +148/-60, net +88. Documentation: +2. No new configuration, persistence schema, dependencies, or Gateway protocol changes.
User Impact
Plain workspaces remain usable, group defaults stop advertising unverified isolation, and saved cloud preferences finish restoring instead of indefinitely blocking Start. Transient Git failures clear only the current draft's cloud restoration and preserve the saved destination for a later visit. Explicit cloud/worktree choices retain their existing behavior.
Evidence
maininstead of the saved branch. All now pass.Promise.withResolvers). The test now uses the shared deferred helper; its focused suite passes. The final hosted run verifies the pinned dependencies; the local shared dependency tree is older than this checkout.9f6d8c5a60b4ce251157e354b459d29037179f57..gitshortcut was added by Show worktree option only for Git group folders #125280 (a928da457f82), verified against its raw parent41c081875133. Exact introduction of the other preference defects is not established.Before: group defaults incorrectly offer Worktree for an unverified workspace.
After: verification failure offers Retry and prevents saving invalid isolation.