Skip to content

Show worktree option only for Git group folders - #125280

Merged
clawsweeper merged 5 commits into
mainfrom
jesse/group-defaults-git-worktree
Aug 18, 2026
Merged

clawsweeper merged 5 commits into
mainfrom
jesse/group-defaults-git-worktree

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

New behavior

Session-group defaults now offer a worktree only when the selected working directory is a Git repository.

  • Non-Git folders show Local as the resolved environment, without a dropdown that cannot change anything.
  • Saving a confirmed non-Git folder intentionally persists Local, replacing any stale Worktree default for that folder.
  • Git folders reveal a rich Local/Worktree dropdown with icons and a short explanation for each option.
  • The open dropdown matches the working-directory field width.
  • Both environment states stay 56 px tall, so the modal does not jump while repository detection resolves.
  • An unrelated session refresh no longer discards a valid repository check and incorrectly hides the worktree option.
  • A real Gateway reconnect rejects folder and repository results from the previous connection generation, even when the browser client is reused.
  • If repository inspection is unavailable, Save stays disabled and Retry preserves the existing default until the check succeeds.

Visual proof

Before — direct base

pr125280-before-direct-base.webm

What this shows: The direct-base modal always exposes Local/Worktree, including for the initial non-Git folder, and uses the older working-directory layout.

State: Direct main base; synthetic Client work group; /home/peter non-Git folder followed by /home/peter/client-work Git folder; 1280×900 Chromium recording.

After — this PR

pr125280-after-rich-full-width-dropdown.webm

What this shows: The initial non-Git folder resolves to static Local. Choosing the synthetic Git folder reveals the full-width rich Environment dropdown, including the Local and Worktree descriptions, and Worktree can be selected without shifting the modal.

State: PR branch; same synthetic group, folders, mock Gateway, viewport, and interaction as the direct-base recording.

Unavailable inspection safeguard

The modal disables Save and offers Retry when Git inspection is unavailable

What this shows: A temporary repository-inspection failure cannot overwrite a saved Worktree default: Save is disabled and Retry is available.

How to verify

  1. Open New session defaults… for a session group whose saved folder is not a Git repository.
  2. Confirm Environment shows static Local with no dropdown.
  3. Choose a Git working directory through the folder picker.
  4. Confirm Environment becomes a Local / Worktree dropdown at the same height.
  5. Open it and confirm the menu matches the field width, then select Worktree.
  6. If repository inspection fails, confirm Save is disabled and Retry restores the saved selection once inspection succeeds.

Implementation note

Folder and repository requests use the session capability's Gateway connection generation. Real reconnects invalidate stale results, while unrelated session refreshes do not make the worktree option disappear.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 17, 2026
@jesse-merhi
jesse-merhi marked this pull request as ready for review August 17, 2026 13:06
Copilot AI lite review requested due to automatic review settings August 17, 2026 13:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 7:02 PM ET / 23:02 UTC.

ClawSweeper review

What this changes

This PR shows the Worktree choice in session-group defaults only when the selected folder is confirmed as a Git repository, with stale-request and unavailable-inspection handling.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Current main still always exposes Local and Worktree, so this member-authored, maintainer-labeled PR remains necessary. The implementation and supplied UI proof support the behavior; a maintainer should accept the intentional persisted-default change before merge.

Priority: P2
Reviewed head: c2fc5aaa6f52be68a93083598e2709fd409e7f80
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch and real UI proof are strong; explicit acceptance of the persisted-default migration remains before merge.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (recording): The PR body provides directly relevant before/after browser recordings and unavailable-inspection proof for the changed dialog flow.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The PR body provides directly relevant before/after browser recordings and unavailable-inspection proof for the changed dialog flow.
Evidence reviewed 6 items Current-main behavior: Current main renders Local and Worktree unconditionally; it has no repository inspection option in the dialog.
Existing protocol contract: The PR consumes the established git/not_git/unavailable repository-status response rather than altering the Gateway protocol.
Persistence path: The dialog submits Worktree only for a confirmed Git result; the organizer passes that resolved value to the existing group-default update operation.
Findings None None.
Security None None.

How this fits together

The Control UI sidebar saves a working directory and environment default for future sessions in a group. It asks the Gateway whether the directory is a Git repository, then presents either Local alone or a Local/Worktree selector.

flowchart LR
A[Session group defaults] --> B[Control UI sidebar]
B --> C[Gateway folder and repository check]
C --> D{Repository status}
D -->|Git| E[Local or Worktree selector]
D -->|Not Git| F[Local environment]
D -->|Unavailable or stale| G[Retry and disabled save]
E --> H[Saved defaults for future sessions]
F --> H
Loading

Decision needed

Question Recommendation
Should saving a confirmed non-Git group folder intentionally replace an existing persisted Worktree default with Local? Accept the Local migration: Approve clearing Worktree on save for confirmed non-Git folders so future sessions do not request an impossible worktree.

Why: Source and proof establish the behavior, but accepting this persisted-default migration is a maintainer product and compatibility choice.

Before merge

  • Resolve merge risk (P1) - Saving a confirmed non-Git folder intentionally replaces an existing persisted Worktree default with Local, affecting how later sessions start.
Agent review details

Security

None.

PR surface

Source +442, Tests +138. Total +580 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 10 532 90 +442
Tests 1 147 9 +138
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 679 99 +580

Review metrics

Metric Value Why it matters
Production vs test LOC production +495/-90, tests +184/-9 The dialog, styling, and connection-aware request path grow substantially, with focused browser and sidebar regression coverage.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-group-defaults-dialog.ts, serialized state: ui/src/components/session-organizer-controller-types.ts, serialized state: ui/src/e2e/session-management.group-defaults.e2e.test.ts, serialized state: ui/src/lib/sessions/session-capability.ts, unknown-data-model-change: ui/src/components/session-group-defaults-dialog.ts, unknown-data-model-change: ui/src/e2e/session-management.group-defaults.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the persisted-default migration (recommended)
    Approve clearing Worktree after a confirmed non-Git result and retain the focused E2E coverage.
  2. Preserve existing Worktree defaults
    Revise the dialog so a non-Git result hides the picker without rewriting an existing value unless the operator selects Local.

Technical review

Best possible solution:

Keep repository classification at the existing Gateway/UI boundary and merge only after accepting that confirmed non-Git folders clear a saved Worktree preference.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a defect report; the supplied recordings and E2E directly demonstrate the proposed Git, non-Git, unavailable, and retry behaviors.

Is this the best way to solve the issue?

Yes for the implementation boundary: it reuses the existing repository-status protocol and shared connection lifecycle. The remaining decision is whether the persisted-default migration is desired.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against daafb2bf5c0e.

Labels

Label justifications:

  • P2: This is a bounded session-defaults workflow change without evidence of an urgent outage.
  • merge-risk: 🚨 compatibility: Saving a confirmed non-Git folder changes an existing persisted Worktree setting to Local.
  • merge-risk: 🚨 session-state: The changed group default determines the environment used by future sessions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body provides directly relevant before/after browser recordings and unavailable-inspection proof for the changed dialog flow.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides directly relevant before/after browser recordings and unavailable-inspection proof for the changed dialog flow.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides directly relevant before/after browser recordings and unavailable-inspection proof for the changed dialog flow.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame assigns the dialog, sidebar boundary, and organizer path to this recent feature commit; shallow history prevents stronger attribution. (role: current feature owner; confidence: medium; commits: bc277fa09554; files: ui/src/components/session-group-defaults-dialog.ts, ui/src/components/app-sidebar.ts, ui/src/components/session-organizer-controller.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain maintainer confirmation of the non-Git-to-Local persisted-default behavior.

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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-17T14:51:36.524Z sha 9b7dd04 :: found issues before merge. :: [P1] Preserve saved Worktree defaults when inspection is unavailable
  • reviewed 2026-08-17T17:30:01.179Z sha e60eb58 :: needs changes before merge. :: [P1] Preserve the reconnect generation in stale-result checks
  • reviewed 2026-08-17T17:52:04.519Z sha 80260ab :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T20:50:00.053Z sha 80260ab :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T21:06:30.830Z sha c2fc5aa :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T21:17:26.645Z sha c2fc5aa :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T21:26:51.023Z sha c2fc5aa :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T21:33:07.754Z sha c2fc5aa :: needs maintainer review before merge. :: none

@jesse-merhi
jesse-merhi force-pushed the jesse/group-defaults-git-worktree branch from 53ff45b to 9b7dd04 Compare August 17, 2026 14:43
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 17, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Aug 17, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Aug 17, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Aug 17, 2026
@clawsweeper
clawsweeper merged commit a928da4 into main Aug 18, 2026
182 checks passed
@clawsweeper

Copy link
Copy Markdown
Contributor

Merged via squash.

@clawsweeper
clawsweeper deleted the jesse/group-defaults-git-worktree branch August 18, 2026 02:50
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
* feat(ui): show worktrees only for Git group folders

* feat(ui): enrich group environment picker

* fix(ui): preserve worktree defaults on probe errors

* fix(ui): reject stale group repository probes

* test(ui): type repository inspection helper
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

3 participants