Skip to content

feat(settings): support worktree layout mappings (#582) - #993

Merged
wesm merged 2 commits into
kenn-io:mainfrom
rodboev:pr/worktree-layout-resolver
Jul 7, 2026
Merged

feat(settings): support worktree layout mappings (#582)#993
wesm merged 2 commits into
kenn-io:mainfrom
rodboev:pr/worktree-layout-resolver

Conversation

@rodboev

@rodboev rodboev commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Worktree mappings currently preserve project names only when each repository has its own explicit path-prefix row. That works for a few deleted worktrees, but it does not scale for layouts such as {repo}.worktrees/{branch} where the canonical project is already present in the path segment.

This adds a layout mode to the existing worktree mapping row instead of creating a separate template system. Existing rows stay explicit and keep their current behavior. A new {repo}.worktrees/{branch} layout lets one parent-directory mapping derive the project from service.worktrees style directories, while the existing longest-prefix precedence still lets a more specific explicit mapping override the generic layout.

The resolver stays in the worktree mapping layer, and the settings API and UI only adapt that row shape. Scope is limited to the local worktree mapping path; parser behavior, backend sync semantics, and unrelated project inference remain unchanged.

Fixes #582

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (54f232e)

No Medium, High, or Critical findings were reported.

Review 1 reported only a Low-severity resolver fallback issue, which is omitted per instructions. Review 2 found no issues.


Reviewers: 2 done | Synthesis: codex, 6s | Total: 7m36s

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (989c1f0)

Medium findings need attention before merge.

Medium

  • internal/db/worktree_mappings.go:417 - A repo_dot_worktrees mapping can shadow broader valid mappings even when the cwd is not inside a {repo}.worktrees/{branch} directory. bestWorktreeProjectMapping stops on the first path-prefix match, then resolveRepoDotWorktreesProject returns false, so resolution never falls through to a less-specific explicit mapping such as the supported root-prefix mapping.

    Fix: Resolve mappings in order and continue to the next mapping when the selected layout cannot resolve for that cwd, or make the “best mapping” predicate layout-aware.


Reviewers: 2 done | Synthesis: codex, 6s | Total: 6m7s

@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (6d8026f)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 6m3s

Squashed branch changes:

- fix(frontend): restore Korean localization
- fix(settings): satisfy worktree layout gates (kenn-io#582)
- feat(settings): support worktree layout mappings (kenn-io#582)
@wesm
wesm force-pushed the pr/worktree-layout-resolver branch from 6d8026f to 646770c Compare July 7, 2026 17:02
@roborev-ci

roborev-ci Bot commented Jul 7, 2026

Copy link
Copy Markdown

roborev: Combined Review (646770c)

Medium issue found; no High or Critical findings.

Medium

  • internal/db/project_identity.go:567
    Repo-dot-worktrees mappings are ignored by the legacy project identity fallback because layout rows persist Project as empty, but this code only accepts mappings where mapping.Project == project. Sessions whose project was derived from /parent/repo.worktrees/branch can fall back to per-branch cwd identities, making the same repo ambiguous across branches.

    Fix: Use the layout-aware resolver here and, for repo_dot_worktrees, derive the identity root from the matched repo.worktrees directory rather than mapping.Project.


Reviewers: 2 done | Synthesis: codex, 7s | Total: 6m41s

Layout rows persist an empty project, so the legacy project identity
fallback's mapping.Project == project guard never matched
repo_dot_worktrees mappings and sessions fell back to per-branch cwd
identities, making the repo ambiguous. Match mappings layout-aware and
anchor repo_dot_worktrees identities at the shared repo.worktrees
directory.
@roborev-ci

roborev-ci Bot commented Jul 7, 2026

Copy link
Copy Markdown

roborev: Combined Review (a984bfe)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 12m25s

@wesm
wesm merged commit c46dc02 into kenn-io:main Jul 7, 2026
18 checks passed
wesm added a commit to RobSchilderr/agentsview that referenced this pull request Jul 7, 2026
…c-include-cwd-prefixes

* origin/main:
  feat(usage): show session context and token breakdown (kenn-io#982) (kenn-io#989)
  perf(push): ignore volatile stat fields for session candidacy (kenn-io#1014)
  feat(settings): support worktree layout mappings (kenn-io#582) (kenn-io#993)
  fix(config): apply port from config.toml to Config struct (kenn-io#1005)
  feat(parser): add Qoder session support (kenn-io#1013)
  fix(usage): wire agent exclusions through usage filters (kenn-io#972)
  fix(frontend): preserve calendar range picker selections (kenn-io#1016)
  feat: semantic search with run-grouped embeddings and conversation-unit citations (kenn-io#999)
  feat(parser): add ZCode SQLite sync support (kenn-io#1003) (kenn-io#1012)
  fix(sync): drop unchanged opencode-family container sessions (kenn-io#1015)
  fix(sync): skip local git discovery for foreign-machine sessions (kenn-io#1008)
  fix(activity): count subagent sessions in activity report cost (kenn-io#1006)
  feat(i18n): add Korean (ko) locale support (kenn-io#1002)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: support for user-configurable worktree layouts

2 participants