Skip to content

fix(ui): resolve repo root detection for tool call path shortening#426

Merged
matt2e merged 2 commits intomainfrom
read-tool-call-not-detecting-repo-root
Mar 20, 2026
Merged

fix(ui): resolve repo root detection for tool call path shortening#426
matt2e merged 2 commits intomainfrom
read-tool-call-not-detecting-repo-root

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Mar 20, 2026

Summary

  • Fix makePathsRelative to walk up ancestor directories (up to 3 levels) when the exact repoDir prefix 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 root
  • Explicitly pass repoDir to SessionModal from all call sites (ProjectSection, SessionLauncher) so the repo context is always available

Test plan

  • Open a session modal from a project with a worktree — verify file paths in tool calls are displayed as relative paths
  • Open a session modal from the session launcher (no repo context) — verify paths display without errors

🤖 Generated with Claude Code

matt2e and others added 2 commits March 20, 2026 15:56
…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>
@matt2e matt2e requested review from baxen and wesbillman as code owners March 20, 2026 05:15
@matt2e matt2e merged commit 5b6f516 into main Mar 20, 2026
4 checks passed
@matt2e matt2e deleted the read-tool-call-not-detecting-repo-root branch March 20, 2026 05:20
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant