Skip to content

Chat links to folders and extensionless files open the app's not-found page instead of the local file or folder #5625

Open

Description

@benwaffle

Summary

In an assistant message, a Markdown link to an absolute path opens a local preview only when the last path segment contains a dot. So [notes](/tmp/bb-link-repro/notes.md) and file:///tmp/bb-link-repro/notes.md open correctly. But links to folders, such as /tmp/bb-link-repro/folder or /tmp/bb-link-repro/folder/, and links to files with no extension, such as /tmp/bb-link-repro/Makefile, are not treated as local paths. They stay as raw same-origin hrefs, so a click sends bb's own server URL (http://<bb-origin>/tmp/bb-link-repro/folder) to the system browser, and the app shows its not-found page there. I expected a file link to open in the host-file preview and a folder link to open in something useful, such as the file manager open target or the thread-storage browser.

Versions and environment

  • bb 0.46.0 desktop app. The code path below is the same on main at 05771e3.
  • macOS 26.6, Apple Silicon
  • Claude Code 2.1.301 provider
  • Thread with a ready project-checkout environment on the local machine

Steps to reproduce

  1. In a terminal: mkdir -p /tmp/bb-link-repro/folder && echo hi > /tmp/bb-link-repro/notes.md && echo all: > /tmp/bb-link-repro/Makefile

  2. Start a thread in any project and send this prompt:

    Reply with exactly these lines and nothing else:
    - [file](/tmp/bb-link-repro/notes.md)
    - [file url](file:///tmp/bb-link-repro/notes.md)
    - [folder](/tmp/bb-link-repro/folder)
    - [folder slash](/tmp/bb-link-repro/folder/)
    - [folder url slash](file:///tmp/bb-link-repro/folder/)
    - [makefile](/tmp/bb-link-repro/Makefile)
    - [home](~/bb-link-repro-notes.md)
    
  3. Click each link.

The smallest form is any message link to an absolute path whose last segment has no ..

Does not reproduce: absolute paths whose last segment has a dot, with or without :12, :12:4 or #L3-L5. file:///… and file://localhost/… URLs, percent-encoded spaces, workspace-relative paths, and files in thread storage also route correctly.

Expected vs actual

Expected:

  • notes.md and Makefile open in a preview tab.
  • The folder links open in the file manager or the default folder open target. A folder in thread storage opens in the thread-storage browser.
  • ~/… links resolve to the home directory, or render as plain text.

Actual: I ran the upstream classifier against each href, using parseLocalFileHref, resolveRelativeLocalFileHref and resolveThreadLocalFileLink from 05771e3 under plain Node with stubs for imports. The workspace root was /tmp/bb-link-repro/ws and the thread-storage root was /Users/<user>/.bb/thread-storage/<thread>.

href Parsed as local file? Rendered href Result
/tmp/bb-link-repro/notes.md yes file:///tmp/bb-link-repro/notes.md open-host-path
/tmp/bb-link-repro/notes.md:12 yes, line 12 file:///…/notes.md#L12 open-host-path
file:///tmp/bb-link-repro/notes.md yes same open-host-path
file://localhost/tmp/bb-link-repro/notes.md yes file:///… open-host-path
/tmp/bb%20link%20repro/my%20notes.md yes, decoded file:///tmp/bb%20link… open-host-path
/Users/<user>/.bb/thread-storage/<thread>/report.md yes file:///… open-thread-storage-path
/tmp/bb-link-repro/folder no /tmp/bb-link-repro/folder same-origin href
/tmp/bb-link-repro/folder/ no /tmp/bb-link-repro/folder/ same-origin href
/tmp/bb-link-repro/ws/src (folder in workspace) no raw same-origin href
/Users/<user>/.bb/thread-storage/<thread>/subdir no raw same-origin href
/tmp/bb-link-repro/Makefile no raw same-origin href
~/bb-link-repro-notes.md no ~/bb-link-repro-notes.md relative href against the current page
file:///tmp/bb-link-repro/folder yes, as a file file:///tmp/bb-link-repro/folder open-host-path on a directory
file:///tmp/bb-link-repro/folder/ no "" rendered as plain text, not a link
file://otherhost/tmp/… no "" rendered as plain text

I did not reproduce the click results below in the live app. I worked them out from the code:

  • Same-origin href: the anchor has target="_blank". The message onOpenLink handler accepts only http(s) URLs, so it returns false for a bare path and the browser default runs. Electron's window-open handler resolves the href against the app origin. It denies the new window and opens http://<bb-origin>/tmp/bb-link-repro/folder in the system browser. The server's catch-all returns index.html for that path, so the browser shows the app's not-found route, not an HTTP 404.
  • file:///…/folder without a trailing slash: this opens a host-file preview tab for a directory. That tab is a file reader, so I expect it to show an error.

Evidence (code at 05771e3)

  1. Message links use trusted-host absolute routing: markdown-message-link-routing.ts#L48-L51
  2. For trusted-host hrefs that are not URLs, parseLocalFileHref sets requireLikelyFileBasename: markdown-local-file-link.ts#L406-L424
  3. That flag rejects any basename without a ., so folders and Makefile are rejected. A trailing / is rejected in every mode: markdown-local-file-link.ts#L226-L261
  4. file: URLs skip the basename check, so file:///…/folder is accepted as a file: markdown-local-file-link.ts#L373-L404
  5. ~/ is excluded from relative resolution (from Chat links starting with ~/ resolve against the project root #1182), and nothing else handles it: markdown-local-file-link.ts#L291-L313
  6. When the href does not parse, the URL transform falls back to react-markdown's defaultUrlTransform. That keeps bare paths and blanks non-http schemes such as file: with a host or a trailing slash: markdown-preview.tsx#L514-L549
  7. MarkdownAnchor then renders the raw href with target="_blank" and passes the click to onOpenLink: markdown-preview.tsx#L637-L712
  8. onOpenLink handles only http(s) URLs: in-app-browser-link-preference.ts#L27-L39
  9. The desktop window-open handler sends the resolved http://<origin>/… URL to the system browser: desktop-window-factory.ts#L283-L288. The server returns index.html for unknown paths: server.ts#L359-L388
  10. resolveThreadLocalFileLink has no directory outcome. Every parsed absolute path ends as a workspace, thread-storage or host file preview: thread-local-file-links.ts#L133-L216

Suggested fix

  • Accept trailing-slash paths as directory links.
  • Add a directory resolution to resolveThreadLocalFileLink: thread-storage folders open in the thread-storage browser, and other folders go to the default folder open target, such as Finder. Show a toast when no target is available.
  • Relax the dot-basename check for paths under common host roots (/Users, /home, /tmp, and similar), so Makefile and LICENSE also link.

My fork, benwaffle/bb, carries a patch that does this, in the commit "Open file-change titles outside the Changes panel as local files". I can open a PR with that part if it helps. With that patch, a folder link without a trailing slash under a host root still resolves as a file, except in thread storage, where it is checked against the storage file list. A full fix probably needs a stat on the host to tell files and folders apart.

What I ruled out

AGENT GENERATED

Activity

  1. added theissue type on Oct 16, 2026
  2. added theissue type on Oct 16, 2026
  3. added
    ui
    partial-repro
    on Oct 16, 2026
  4. bb-slop-cop commented on Oct 16, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority Medium · Effort Medium · area ui. Filled missing values; replaced none.
    • Report: Reproduction and root-cause report.
    • Verdict: PARTIALLY REPRODUCED · root-cause confidence high · reproduction label partial-repro.
    • Root cause: Bare absolute paths require a dotted basename; trailing separators are rejected; the thread resolver has no directory outcome.
    • Verification: The rendered-link click regression fails in two clean checkouts of 01affc197dc62; the explicit file-URL control works. All 88 relevant existing tests pass. The final macOS/Electron browser navigation remains unverified.
    • No PR: Correct directory handling requires path-type resolution and a routing-policy decision, outside the simple-fix gate.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reproui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions