Repository navigation
fix: worktree option missing when starting a session on a new GitHub repo - #131100
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Selecting a GitHub repo from the new-session project search (or pasting a clone URL) hid the branch/worktree chip entirely on Local placement and blocked cloud placement, even though the submit flow already materializes remote projects via projects.add before creating worktree sessions (#130192). The draft repository model classified a selected remote repo as unknown (kind idle) when it is git by construction. New pending-clone repository state makes remote selections worktree- capable everywhere availability is consulted: the detail chip renders, cloud profiles enable, and switching to a device placement no longer drops the selected repo. Repository discovery now runs through one planRepositoryDiscovery classifier plus a single adoptResolvedRepository reconciliation that owns preference restore and non-git rejection for both immediate and RPC results (previously duplicated across four branches). The submission-flow test no longer mocks worktreeAvailable.
00fe098 to
e660e96
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 2:12 PM ET / 18:12 UTC. ClawSweeper reviewWhat this changesThe PR represents a selected remote GitHub repository as awaiting cloning so the New Session UI offers worktree and remote-placement choices before the project exists locally. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: the fetched current main still omits this UI-state repair, while the submitted branch provides a focused fix with no blocking correctness finding. It is a protected maintainer PR and should proceed through normal exact-head CI and maintainer review. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Control UI’s New Session screen converts a selected folder or remote repository into Gateway session parameters. A remote repository is materialized into a registered project before the Gateway creates a managed worktree session. flowchart LR
A[New Session project picker] --> B[Selected remote repository]
B --> C[Repository discovery]
C --> D[Worktree and placement controls]
D --> E[Session submission]
E --> F[Gateway materializes project]
F --> G[Managed worktree session]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +218. Total +233 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the explicit pending-clone state once exact-head UI checks are green, retaining the existing Gateway materialization and session-creation flow as the single submission path. Do we have a high-confidence way to reproduce the issue? Yes, from source: selecting a remote project on current main leaves repository discovery idle, so the detail chip is omitted and placement gating treats it as unavailable. This review did not execute the test because the checkout is read-only. Is this the best way to solve the issue? Yes. The pending-clone state repairs the owner of the availability decision and reuses the established project-materialization path, rather than adding UI-only exceptions or a new Gateway API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5890806fbe56. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Pre-merge status on the ClawSweeper checklist:
Landing via the native flow now. |
|
Merged via squash.
|
…openclaw#131100) Selecting a GitHub repo from the new-session project search (or pasting a clone URL) hid the branch/worktree chip entirely on Local placement and blocked cloud placement, even though the submit flow already materializes remote projects via projects.add before creating worktree sessions (openclaw#130192). The draft repository model classified a selected remote repo as unknown (kind idle) when it is git by construction. New pending-clone repository state makes remote selections worktree- capable everywhere availability is consulted: the detail chip renders, cloud profiles enable, and switching to a device placement no longer drops the selected repo. Repository discovery now runs through one planRepositoryDiscovery classifier plus a single adoptResolvedRepository reconciliation that owns preference restore and non-git rejection for both immediate and RPC results (previously duplicated across four branches). The submission-flow test no longer mocks worktreeAvailable.
What Problem This Solves
Fixes an issue where users selecting a new GitHub repository in the new-session picker (from GitHub search results or a pasted clone URL) would lose the branch/worktree chip entirely on Local placement — there was no way to start that first session in a worktree, and cloud placement was blocked for the same selection. Switching to a device placement even silently dropped the selected repository.
The submit machinery has supported this since #130192: it materializes the remote project via
projects.addand then creates the session withprojectId+worktree: true. Only the UI availability gate never opened — the unit test for that path had to mockworktreeAvailabletotrueto be reachable.Why This Change Was Made
The draft repository model classified a selected remote GitHub repository as unknown (
kind: "idle") when it is git by construction. This adds apending-clonerepository state so every consumer of worktree availability (detail chip, cloud-profile gating, device-placement retention) sees the selection as worktree-capable. Repository discovery is restructured into a pureplanRepositoryDiscoveryclassifier plus oneadoptResolvedRepositoryreconciliation that owns preference restore and non-git rejection for both immediate and RPC results — previously duplicated with drift across four branches. No server or protocol changes.User Impact
Picking a not-yet-cloned GitHub repository now offers the same Runs directly / Worktree choice as a registered project: the repo is cloned first, then the session runs in a managed worktree of that clone. Cloud placement works with such a selection, and switching to a device placement keeps it. Stored worktree preferences now also apply to these selections.
Evidence
Unit + e2e lanes green (
pnpm test ui/src/pages/new-session,ui/src/e2e/new-session-page.github-projects.e2e.test.ts),pnpm check:changedgreen, fresh autoreview clean. The new e2e fails on pre-fix code at the chip-visibility assertion (#new-session-detail-triggerabsent). Production LOC +103/−88 (net +15), tests +233/−15.Before — GitHub repo selected, branches chip missing:
After — chip present with "Runs directly", and Worktree selectable with base branch + name:
Live proof (isolated dev gateway, built dist, real clone of
octocat/Hello-World): pasted the clone URL, toggled Worktree, started the session. The gateway cloned the project and provisioned a managed worktree; the agent answered from inside it ("Just one file at the root: README", claude-sonnet-4-6, 12s):Video of the full live flow is attached below.
live-github-worktree.mp4