Skip to content

Move worktrees to ~/.Conclave to avoid Windows MAX_PATH issues#50

Merged
Cellcote merged 2 commits into
mainfrom
fix/path_length_windows
May 1, 2026
Merged

Move worktrees to ~/.Conclave to avoid Windows MAX_PATH issues#50
Cellcote merged 2 commits into
mainfrom
fix/path_length_windows

Conversation

@Cellcote
Copy link
Copy Markdown
Owner

@Cellcote Cellcote commented May 1, 2026

Summary

  • Worktrees previously lived next to the SQLite DB — on Windows that's %AppData%\Roaming\Conclave\worktrees\…, which burns ~50 chars of the 260-char MAX_PATH budget before any repo content is appended. Deep file paths inside a worktree (e.g. nested Views/Shell/... files plus git's own .git/worktrees/<name>/index.lock) push some users past the limit.
  • Adds Database.DefaultWorktreeRoot() returning ~/.Conclave on every platform, and points SessionManager.Open() at it.
  • Existing sessions keep working: each session row stores its absolute worktree_path, so only newly-created sessions land under the new root. No migration needed.

Fixes #49.

Cellcote added 2 commits May 1, 2026 16:35
Worktrees previously lived next to the SQLite db (e.g.
%AppData%\Roaming\Conclave\worktrees), which on Windows ate ~50
characters of the 260-char path budget before any repo content. Move
them to ~/.Conclave on all platforms so deep file paths inside a
worktree stay clear of MAX_PATH.

Existing sessions keep working because each session row stores its
absolute worktree_path; only newly created sessions land under the new
root.

Fixes #49.
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR moves the git worktree root from <app-data-dir>/worktrees/ to ~/.Conclave on all platforms, reducing the path prefix on Windows from ~50 chars (%AppData%\\Roaming\\Conclave\\worktrees\\) to ~15 chars (C:\\Users\\<name>\\.Conclave\\). The change is minimal and correct: DefaultWorktreeRoot() uses Environment.SpecialFolder.UserProfile cross-platform, the directory is created in the SessionManager constructor just as before, and existing sessions are unaffected because each row already stores its absolute worktree_path.

Confidence Score: 5/5

Safe to merge — minimal, focused change with no logic alterations and no data migration risk.

Both changed files have only targeted, correct modifications. The new DefaultWorktreeRoot() is implemented correctly using Environment.SpecialFolder.UserProfile (cross-platform), the worktree directory is still created at startup, and the DB-stored absolute paths mean existing sessions are unaffected. No P0 or P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
src/Conclave.App/Sessions/Database.cs Adds DefaultWorktreeRoot() returning ~/.Conclave via Environment.SpecialFolder.UserProfile on all platforms — correct and intentionally platform-uniform to save Windows MAX_PATH budget.
src/Conclave.App/Sessions/SessionManager.cs Wires SessionManager.Open() to the new Database.DefaultWorktreeRoot() instead of deriving the root from the DB file's directory — straightforward call-site change, no logic altered.

Sequence Diagram

sequenceDiagram
    participant App
    participant SessionManager
    participant Database
    participant FileSystem

    App->>SessionManager: Open(tokens)
    SessionManager->>Database: DefaultPath()
    Database-->>SessionManager: ~/Library/.../conclave.db (platform-specific)
    SessionManager->>Database: Open(dbPath)
    Database->>FileSystem: CreateDirectory(db parent dir)
    Database-->>SessionManager: db instance

    SessionManager->>Database: DefaultWorktreeRoot()
    Note over Database: Always returns ~/.Conclave<br/>(platform-uniform)
    Database-->>SessionManager: ~/.Conclave

    SessionManager->>SessionManager: new SessionManager(db, "~/.Conclave", tokens)
    SessionManager->>FileSystem: CreateDirectory("~/.Conclave")

    Note over SessionManager,FileSystem: New sessions use ~/.Conclave/<projectId>/<slug><br/>Old sessions unchanged (absolute path in DB)
Loading

Reviews (1): Last reviewed commit: "Update new-session modal preview to show..." | Re-trigger Greptile

@Cellcote Cellcote merged commit e4fa57c into main May 1, 2026
3 checks passed
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.

fatal: Could not reset index file to revision 'HEAD'.'

1 participant