fix(sessions): strip remote workspace prefix from file paths in chat#2205
Draft
timgl wants to merge 2 commits into
Draft
fix(sessions): strip remote workspace prefix from file paths in chat#2205timgl wants to merge 2 commits into
timgl wants to merge 2 commits into
Conversation
For cloud tasks the local workspace cwd is empty, so FileMentionChip fell back to rendering the full sandbox path (/tmp/workspace/repos/<owner>/<repo>/...). Derive the conventional remote root from `task.repository` when there is no local cwd, so the chip shows just the repo-relative directory. Generated-By: PostHog Code Task-Id: 1b29c9c1-769d-4c98-a3c1-04c703482115
timgl
commented
May 18, 2026
|
|
||
| const REMOTE_WORKSPACE_PREFIX = "/tmp/workspace/repos"; | ||
|
|
||
| export function useDisplayRepoPath( |
Author
There was a problem hiding this comment.
I think we could use a comment here to explain what/why (brief!)
Generated-By: PostHog Code Task-Id: 1b29c9c1-769d-4c98-a3c1-04c703482115
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.
Summary
When viewing a cloud task, file chips in the chat rendered the full sandbox path (e.g.
/tmp/workspace/repos/posthog/posthog.com/src/c). For cloud tasks the local workspace cwd is empty (folderPath: "",worktreePath: null), souseCwd()returnedundefinedandFileMentionChip'stoRelativePathhad nothing to strip.This adds a small
useDisplayRepoPath(taskId)hook that prefers the local cwd, and falls back to the conventional sandbox root/tmp/workspace/repos/<owner>/<repo>derived fromtask.repositorywhen there isn't one.FileMentionChipuses it instead ofuseCwdso the chip shows just the repo-relative directory on cloud tasks.Read/Editviews are unchanged structurally — they already useFileMentionChip; the chip just gets a correct prefix to strip now.ToolCallViewfallback (Glob/Grep/etc. viacompactHomePath(title)) is unchanged — out of scope for this fix.Test plan
pnpm vitest run src/renderer/features/sessions— 161 tests pass, including 7 new tests foruseDisplayRepoPathcovering local cwd, derived remote path, missing/malformed repository, and missing task.pnpm exec tsc -p tsconfig.web.json --noEmit— clean.biome check— clean (auto-formatted on commit via lint-staged).Read, verify the chip showssrc/...rather than/tmp/workspace/repos/<owner>/<repo>/src/....Created with PostHog Code