You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chat links starting with ~/ resolve against the project root #1182
A chat message that contains a path like ~/.config/example.md renders as a clickable link. The click opens a file tab in the secondary panel. From that tab, Open in editor fails, because the path bb resolved is <project root>/~/.config/example.md.
Steps to reproduce
Open a thread whose environment has a workspace, for example /Users/me/bb.
Post a message that contains ~/.config/example.md.
Click the link. A file tab opens.
Click Open in editor.
Expected: the link resolves to the home directory, or bb leaves it as plain text.
Actual: bb joins the literal ~ segment to the workspace root. The editor reports that it cannot open /Users/me/bb/~/.config/example.md.
Cause
resolveRelativeLocalFileHref in apps/app/src/components/ui/markdown-local-file-link.ts treats every non-absolute href as workspace-relative. It rejects absolute paths, fragments, queries, and URI schemes, but it does not handle a leading ~/.
The join at line 320 produces the literal path above. That path passes isAbsoluteFilePathWithinRoot, so resolveThreadLocalFileLink classifies the link as a workspace file and opens a workspace tab.
No code expands ~ in this path. Tilde expansion exists in apps/cli, apps/desktop/src/main.ts, apps/host-daemon, and packages/config, but not in the renderer link code. The renderer has no home directory value at all.
Possible fixes
Reject a leading ~/ in resolveRelativeLocalFileHref. The link stays plain text. Small and safe.
Expand ~/ to the host home path. This needs the home path in the renderer, and it routes the result as a host file link. Larger, and it needs a host-daemon field.
I plan to send a pull request for option 1, unless you prefer option 2.
Apologies for the overlap, @arunsathiya — an overnight issue sweep opened #1504 for this without checking that you were already assigned. I have closed it. This is yours.
One note from that work, in case it saves you time: rejecting a decoded leading ~/ in resolveRelativeLocalFileHref also needs to reject the percent-encoded forms, otherwise %7E/ still reaches the join.
Root cause (short): resolveRelativeLocalFileHref (apps/app/src/components/ui/markdown-local-file-link.ts L294-L323) rejects absolute/fragment/query/scheme hrefs but has no case for shell home paths, so ~/x is string-joined onto the workspace root, yielding <root>/~/x, which passes every containment check and opens as a workspace file tab whose Open-in-editor fails with path_not_found.
Proposed fix: Add isHomeRelativePath(path) with the corrected regex /^(?:/|[^/]*/|$)/ — i.e. /^(?:[^/]*/|$)/u — and include it in the early-return guard of resolveRelativeLocalFileHref next to the startsWith("/") check, on the decoded href (so %7E/ is covered). Matches bare ~, ~/…, ~user/…; keeps ~notes.md, ~$report.docx, docs/~draft.md as relative files (now guarded by four positive test cases). Verified at 16ceb3a: repro test 7 fail/4 pass on base, 11/11 with fix; 37 pass together with markdown-local-file-link.test.ts and markdown-preview.test.tsx; turbo typecheck @bb/app clean; dif…
Caveats: Revision: the original regex /^[^/]*(?:/|$)/ was equivalent to /^/ and the report's claim that it kept ~notes.md linkified was false; corrected regex, diff, test file (11 cases), vitest output, and report text were regenerated and a Verification section added. Live-app screenshots were not re-taken because both regexes behave identically for every ~/… case exercised in the browser (unit tes…
The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).
Activity
ymichael commentedon Aug 10, 2026
@arunsathiya option 1 sounds good - feel free to open a PR for it!
SawyerHood commentedon Aug 13, 2026
Apologies for the overlap, @arunsathiya — an overnight issue sweep opened #1504 for this without checking that you were already assigned. I have closed it. This is yours.
One note from that work, in case it saves you time: rejecting a decoded leading
~/inresolveRelativeLocalFileHrefalso needs to reject the percent-encoded forms, otherwise%7E/still reaches the join.SawyerHood commentedon Aug 18, 2026
Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1182.html
~/xis string-joined onto the workspace root, yielding<root>/~/x, which passes every containment check and opens as a workspace file tab whose Open-in-editor fails with path_not_found.isHomeRelativePath(path)with the corrected regex /^(?:/|[^/]*/|$)/ — i.e. /^(?:[^/]*/|$)/u — and include it in the early-return guard of resolveRelativeLocalFileHref next to the startsWith("/") check, on the decoded href (so%7E/is covered). Matches bare~,~/…,~user/…; keeps~notes.md,~$report.docx,docs/~draft.mdas relative files (now guarded by four positive test cases). Verified at 16ceb3a: repro test 7 fail/4 pass on base, 11/11 with fix; 37 pass together with markdown-local-file-link.test.ts and markdown-preview.test.tsx; turbo typecheck @bb/app clean; dif…[^/]*(?:/|$)/ was equivalent to /^/ and the report's claim that it kept~notes.mdlinkified was false; corrected regex, diff, test file (11 cases), vitest output, and report text were regenerated and a Verification section added. Live-app screenshots were not re-taken because both regexes behave identically for every~/…case exercised in the browser (unit tes…The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at
16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).Do not resolve home-relative chat links against the project root (#1796)