fix(tabs): a Claude worktree session gets its case's default group too

Merge-time fix for #676 (review finding 1 and nit 7). The Git worktrees modal
launches Claude through POST /api/sessions with workingDir
<case>/.claude/worktrees/<name>, which inferLocalCaseName did not recognise,
so the session landed in Ungrouped while the same gesture for any other CLI
(quick-start with the case name) landed in the group. The inference now
strips a trailing .claude/worktrees/<name> lexically before its two checks,
reusing CLAUDE_WORKTREE_PATH (hoisted to module scope). It also runs only for
a named workingDir, never on the server's own cwd, as the hook and skill
injection above already do. Route tests for both, failing without the fix;
api-reference and architecture-invariants say so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-22 19:29:25 +02:00
1 parent 74c980413a
commit 5a677bf03c
4 files changed
+49 -10

No files matched your search

+2 -1
View File
@@ -794,7 +794,8 @@ its creating write when nothing stronger applies; the order is: an explicit `tab
then the session it was spawned from (`parentSessionId`), then the case default, else
Ungrouped. `POST /api/v1/quick-start` uses its `caseName` (local, linked, remote and Docker
cases); `POST /api/v1/sessions` uses the case whose folder `workingDir` is (a direct child of
the caller's case space, or a linked case's exact path). When a case default places the
the caller's case space, a linked case's exact path, or a Claude worktree of either,
`<case>/.claude/worktrees/<name>`); without a `workingDir` there is no case. When a case default places the
session, the create response carries `tabLayout` as it does for `tabGroupId`. Deleting the
case forgets the value; existing sessions never move.