Skip to content

fix: worktree option missing when starting a session on a new GitHub repo - #131100

Merged
steipete merged 1 commit into
mainfrom
claude/github-repo-worktree-selection-c7c338
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/github-repo-worktree-selection-c7c338

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.add and then creates the session with projectId + worktree: true. Only the UI availability gate never opened — the unit test for that path had to mock worktreeAvailable to true to 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 a pending-clone repository 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 pure planRepositoryDiscovery classifier plus one adoptResolvedRepository reconciliation 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:changed green, fresh autoreview clean. The new e2e fails on pre-fix code at the chip-visibility assertion (#new-session-detail-trigger absent). Production LOC +103/−88 (net +15), tests +233/−15.

Before — GitHub repo selected, branches chip missing:

before: no worktree chip

After — chip present with "Runs directly", and Worktree selectable with base branch + name:

after: runs directly chip

after: worktree selected

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):

live: worktree toggled on pasted URL

live: session ran in the worktree

$ git -C <state>/projects/1d7ed7bd7bc9f544/hello-world worktree list
.../projects/1d7ed7bd7bc9f544/hello-world            7fd1a60 [master]
.../worktrees/d3f16419821e02fd/repository-root-files 7fd1a60 [openclaw/repository-root-files]

Video of the full live flow is attached below.

live-github-worktree.mp4

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 27, 2026 18:03
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 27, 2026
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.
@steipete
steipete force-pushed the claude/github-repo-worktree-selection-c7c338 branch from 00fe098 to e660e96 Compare August 27, 2026 18:04
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 2:12 PM ET / 18:12 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: e660e96d1978d185b5e7d794f9e8ea0e9fa400e4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with browser and state coverage, pending normal exact-head CI completion.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored PR; the contributor proof gate does not apply, and the body additionally records live-flow and browser evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored PR; the contributor proof gate does not apply, and the body additionally records live-flow and browser evidence.
Evidence reviewed 7 items Current defect and repair boundary: On fetched main, remote selection returns from discovery with idle state and availability only accepts a local Git root; the PR instead classifies the selected remote repository as pending clone and makes that state worktree-capable.
UI caller: The New Session page passes repository availability to the detail chip, whose existing contract hides the chip only when worktrees are unavailable and not selected.
Submission callee remains canonical: The existing submission path materializes a remote project with projects.add, records its project ID, and then builds sessions.create parameters; the PR does not add a competing protocol path.
Findings None None.
Security None None.

Live Verification

Command: pnpm test ui/src/e2e/new-session-page.github-projects.e2e.test.ts

Result: FAIL (failed) — step 1 expect_output offers a worktree for a GitHub result and materializes its project before session creation: expected terminal output was not visible within 30 seconds: "offers a worktree for a GitHub result and materializes its project before session creation"

$ node --import ./scripts/tsx.mjs scripts/test-projects.mts ui/src/e2e/new-session-page.github-projects.e2e.test.ts
[test] starting test/vitest/vitest.ui-e2e.config.ts
[test] preflight test/vitest/vitest.ui-e2e.config.ts
[ui-e2e] Using system Chromium at /usr/bin/chromium-browser.
Downloading FFmpeg (playwright ffmpeg v1011) from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1011/ffmpeg-linux.zip
|                                                                                |   0% of 2.3 MiB
|■■■■■■■■                                                                        |  10% of 2.3 MiB
|■■■■■■■■■■■■■■■■                                                                |  20% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■                                                        |  30% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                                |  40% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                        |  50% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                |  60% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                        |  70% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                |  80% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■        |  90% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 2.3 MiB
FFmpeg (playwright ffmpeg v1011) downloaded to /tmp/clawsweeper-live-proof-131100-EOy0GT/profile/cache/ms-playwright/ffmpeg-1011

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-131100-EOy0GT/target

Assertions:

  • FAIL expect_output: offers a worktree for a GitHub result and materializes its project before session creation

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +15 lines in a bug-fix PR; the additional explicit pending-clone state and shared reconciliation are justified by modeling a remote selection without inventing a local repository root, but exact-head CI should still complete before merge.
  • Complete next step (P2) - No repair lane is needed: this protected maintainer PR has no mechanical review finding; await exact-head CI and normal merge review.
Agent review details

Security

None.

PR surface

Source +15, Tests +218. Total +233 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 103 88 +15
Tests 3 233 15 +218
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 336 103 +233

Review metrics

Metric Value Why it matters
Production versus test delta production +103/-88 (net +15); tests +233/-15 (net +218) The production growth is limited to modeling the previously unrepresented remote-before-clone state and consolidating repository reconciliation; the added tests cover the UI and placement boundaries.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P1: The current UI prevents real users from choosing a managed worktree or cloud placement for a newly selected remote repository.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR; the contributor proof gate does not apply, and the body additionally records live-flow and browser evidence.

Label justifications:

  • P1: The current UI prevents real users from choosing a managed worktree or cloud placement for a newly selected remote repository.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR; the contributor proof gate does not apply, and the body additionally records live-flow and browser evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger owns the prior remote-project materialization work and the baseline state-controller history, then authored the focused repair. (role: recent feature owner; confidence: high; commits: b6662bf157e5, b5ed58c2bc67, e660e96d1978; files: ui/src/pages/new-session/draft-repository-state.ts, ui/src/pages/new-session/draft-submission-flow.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Pre-merge status on the ClawSweeper checklist:

  • P1 (exact-head CI): complete and green at e660e96d1978d185b5e7d794f9e8ea0e9fa400e4 — 70 check-runs success, 30 skipped, none failing. Attempt 1 had a single unrelated build-artifacts failure: the plugins list --json startup-memory ceiling on a Blacksmith host measured a 401.0 MB median against the 400 MB budget with an 85 MB sample spread (318.4/403.3/401.0); the rerun passed. This is main-side drift at the budget edge on self-hosted runners (github-hosted already uses 425 MB), unrelated to this UI-only diff.
  • P2 (merge review): native review artifacts are validated (READY FOR /prepare-pr), fresh autoreview is clean, and the net +15 production LOC is the accepted pending-clone state model.
  • ClawSweeper's sandboxed live-verification re-run of the new e2e timed out at 30s while its harness was still provisioning (ffmpeg download, system Chromium); the same file passes in this run's ui-e2e lane on the exact head and 3× locally, and fails on pre-fix code at the chip-visibility assertion as designed.

Landing via the native flow now.

@steipete
steipete merged commit 2f13a37 into main Aug 27, 2026
200 of 202 checks passed
@steipete
steipete deleted the claude/github-repo-worktree-selection-c7c338 branch August 27, 2026 18:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant