fix(ui): resolve repo root detection for tool call path shortening#426
fix(ui): resolve repo root detection for tool call path shortening#426
Conversation
…icitly provided SessionModal now falls back to session.workingDir when the repoDir prop isn't passed (e.g. when opened from ProjectSection or NoteModal). makePathsRelative also tries ancestor directories of the given base path, so repos with a subpath (worktree_root/apps/staged) correctly shorten file paths that reference the worktree root. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ProjectSection now derives repoDir from the first branch with a worktree path. SessionLauncher explicitly passes null (standalone sessions have no repo). Removes the implicit session.workingDir fallback in SessionModal so the prop is always provided by the caller. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cbebae776
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| )} | ||
| <SessionModal | ||
| sessionId={openSessionId} | ||
| repoDir={branches.find((b) => b.worktreePath)?.worktreePath ?? null} |
There was a problem hiding this comment.
Shorten project-session paths from the project root
For project notes opened from ProjectSection, the backend creates the session with working_dir = project_worktree_root_for(project.id) (apps/staged/src-tauri/src/session_commands.rs:457-479), so tool-call paths should be made relative to that project root. Passing the first branch's worktreePath here makes one arbitrary repo look like the root: paths in that repo collapse to src/..., while paths in sibling repos still render as other-repo--branch/.... In multi-repo projects this produces a misleading transcript, because reviewers can no longer tell which repo the coordinator session actually accessed.
Useful? React with 👍 / 👎.
Summary
makePathsRelativeto walk up ancestor directories (up to 3 levels) when the exactrepoDirprefix isn't found in tool call text, handling cases where the session's working directory is a repo subpath (e.g.worktree_root/apps/staged) but tool calls reference the worktree rootrepoDirtoSessionModalfrom all call sites (ProjectSection,SessionLauncher) so the repo context is always availableTest plan
🤖 Generated with Claude Code