Skip to content

Choose the worktree location; solenta.json onSettle (#1531) - #1544

Merged
currentbits merged 3 commits into
mainfrom
coder/1531-worktree-location-onsettle-dafc23
Oct 9, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/1531-worktree-location-onsettle-dafc23

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part of #1531 (and #1401 for the WSL roots).

Worktree location (Settings → Threads, worktreeRoot)

  • An empty value keeps the default userData/worktrees. Otherwise the value must be an absolute, writable directory, which is checked when you save.
  • New worktrees and PR checkouts go to the new root. Existing threads keep the worktreePath they were created with.
  • If the folder later goes missing (an unmounted volume, say), new worktrees fall back to the default with a warning.

GC now covers every root: the default root, the configured root, the WSL roots from resolveWorktreeDir, and the parent folder of every stored worktreePath.

  • Only userData/worktrees is treated as app-owned, so cleanup works there exactly as before.
  • In any other root, a folder is only a candidate when its name is a thread id and git worktree list registers it as a worktree of a known project. Project main checkouts are never candidates.
  • Folders git can't read are never force-deleted outside the app-owned root.
  • A test shows that a non-worktree folder in a custom root is left untouched.

onSettle in solenta.json: either a command string or the name of one of the file's quickActions.

  • It runs once in the worktree when a worktree thread settles, whether manually, through thread_settle or by auto-settle. It has a 2 min timeout, and the settle never waits on it or fails because of it.
  • New activity on the thread re-arms it, so the next settle runs it again.
  • It goes through the existing repo-command trust gate: an unapproved file adds a "skipped" event instead of running. Adding onSettle changes the config hash, so the file needs approval again.

Verification (my runs on this branch, not the worker's):

  • Electron suite run alone: 4364 pass, 0 fail.
  • Renderer suite: 2884 pass, 0 fail.
  • Typecheck: only the mermaidEngine.ts error that is already on main.

Note: like #1537 and #1538, this PR adds a setting to electron/test/budget-spend.test.js, so it needs a small rebase after those land.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T12:22:53.908629Z 9c79814 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c79814d86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/worktrees-gc.js
Comment on lines +259 to +262
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const dir = path.join(root.dir, entry.name);
if (!root.owned) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent GC from deleting a nested custom root

When worktreeRoot is a child of the default worktreeBase (for example, <userData>/worktrees/custom), this loop first encounters custom through the app-owned root and adds the directory itself without applying the external-root filters. sweepOrphanWorktrees then sees that container as an unreferenced, non-Git directory and recursively force-removes it, deleting every active worktree stored beneath it, including uncommitted files. Reject nested custom roots or skip configured root directories while enumerating the owned base.

Useful? React with 👍 / 👎.

Willem and others added 3 commits October 9, 2026 14:41
Adds settings.worktreeRoot (Threads pane, "Worktree location"): an
absolute, writable folder for new local worktrees; empty keeps the
default userData/worktrees. Existing threads keep their stored
worktreePath. An unavailable root falls back to the default.

GC (orphan sweep, gcScan, retention) now enumerates the default root,
the chosen root, the WSL roots resolveWorktreeDir uses (#1401) and the
parent of every stored worktreePath. Only the default root is
app-owned. In the others GC only considers dirs named like a thread id
that are registered linked worktrees of a known project (main checkouts
excluded), and never force-removes a dir git cannot read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tles (#1531)

`onSettle` in solenta.json is a command string or the name of one of
the files
@currentbits
currentbits force-pushed the coder/1531-worktree-location-onsettle-dafc23 branch from 9c79814 to 844b78b Compare October 9, 2026 12:44
@currentbits
currentbits merged commit 70b5595 into main Oct 9, 2026
6 checks passed
currentbits added a commit that referenced this pull request Oct 13, 2026
…L) roots (#1401) (#1623)

The WSL root enumeration landed with #1544. Pin the issue's check on the
non-owned root path WSL roots share: clean past keep-N is reclaimed,
dirty and working are kept.

Co-authored-by: Willem <willem@willems-mbp.home>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
currentbits pushed a commit that referenced this pull request Oct 19, 2026
…L) roots (#1401)

The WSL root enumeration landed with #1544. Pin the issue's check on the
non-owned root path WSL roots share: clean past keep-N is reclaimed,
dirty and working are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant