fix(cli): include working tree in WorktreeFamily.list for submodules#9499
Open
truffle-dev wants to merge 1 commit intoKilo-Org:mainfrom
Open
fix(cli): include working tree in WorktreeFamily.list for submodules#9499truffle-dev wants to merge 1 commit intoKilo-Org:mainfrom
truffle-dev wants to merge 1 commit intoKilo-Org:mainfrom
Conversation
Inside a git submodule `git worktree list --porcelain` reports the gitdir (`<repo>/.git/modules/<sub>`) rather than the actual working tree, so the worktree-family filter for the experimental session listing endpoint dropped every session whose directory was the real submodule path. The CLI `kilo session list` was unaffected because it filters on `project_id` only. Append `Instance.worktree` to the parsed dirs so the working tree is always in scope. Normal repos and linked worktrees already include it, so the [...new Set(...)] dedup keeps those cases unchanged. Closes Kilo-Org#9267
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by gpt-5.4-20260305 · 188,020 tokens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9267.
What
Inside a git submodule,
git worktree list --porcelainreports thesubmodule's gitdir (
<repo>/.git/modules/<sub>) instead of the workingtree, so
WorktreeFamily.list()returns a path that no session'sdirectoryever falls under. The experimental/sessionendpoint thenfilters every session out, leaving the in-TUI session list (
/sessions,ctrl-x l) empty. The
kilo session listCLI is unaffectedbecause it filters by
project_idonly and never consults the family.Fix
Append
Instance.worktreeto the parsed dirs inpackages/opencode/src/kilocode/worktree-family.ts. Normal repos andlinked worktrees already include it (the
git worktree listoutputcontains the current worktree), so the trailing
[...new Set(...)]dedups them away. The fallback path that runs when
git worktree listfails was already prefixing
Instance.worktree, so this just extendsthe same guarantee to the success path.
What
git worktree listdoes inside a submoduleThe reported worktree is the gitdir, not
core.worktree(
../../../sub). Sessions storedirectoryasInstance.directorywhich is the actual submodule path, so the family filter rejects them.
Regression test
packages/opencode/test/kilocode/worktree-family-submodule.test.tssets up a real parent repo with a file-protocol submodule and asserts
that
WorktreeFamily.list()from inside the submodule contains theworking tree. Stash-bisected to confirm the test fails on
main:bun test test/kilocode/session-list.test.tsandbun test test/kilocode/worktree-family-submodule.test.tsboth pass.Scope
Only the worktree-family success path is touched. The fallback path
already includes
Instance.worktree. Project-identity discovery inProject.fromDirectory(which currently setsproject.worktreeto<repo>/.git/modulesfor submodules) is left alone — it doesn'taffect the symptoms reported here.