Skip to content

Relative markdown links in plugin-embedded ThreadChat open as broken URLs against the app origin #4438

Closed

Description

@cristoslc

Summary

When a plugin renders a thread with the SDK's ThreadChat component, relative markdown links in message bodies open in the browser as broken URLs against the bb app origin. The main thread view handles the same links correctly; only plugin-embedded chats are affected.

Versions and environment

Steps to reproduce

  1. Install a plugin that renders ThreadChat in its own panel (focus-board's thread pane, for example).
  2. Have an agent post a message containing a repo-relative link, like [ERD](docs/erd.mmd).
  3. Click the link in the plugin's embedded chat.

The browser navigates to something like https://<app-origin>/docs/erd.mmd and shows an error page. Nothing opens the actual file. The same link in the same thread's main view opens the file preview correctly.

Expected vs actual

Expected: the link opens as a live workspace file in the preview panel, the way it does from the main thread view.

Actual: the anchor keeps its raw relative href, the browser resolves docs/erd.mmd against the app origin, and the user gets an error page.

Evidence

PluginThreadChat takes its link handling from useThreadTimelineNavigation() (

const timelineNavigation = useThreadTimelineNavigation();
const canUseHostFileNavigation =
thread !== undefined &&
thread.environmentId === timelineNavigation?.environmentId;
const onOpenLink = timelineNavigation?.onOpenLink;
const onOpenLocalFileLink = canUseHostFileNavigation
? timelineNavigation.onOpenLocalFileLink
: undefined;
const resolveHostMentionLink = canUseHostFileNavigation
? timelineNavigation.resolveMentionLink
: undefined;
const workspaceRootPath =
environment?.path ??
(canUseHostFileNavigation
? timelineNavigation.workspaceRootPath
: undefined);
const pluginId = useContext(PluginContext);
const consumerMessageActions = useMemo<
readonly ThreadTimelineConsumerMessageAction[] | undefined
). That context comes from ThreadTimelineNavigationProvider, which is only mounted in ThreadDetailView (
<ThreadTimelineNavigationProvider
environmentId={thread.environmentId}
onOpenLink={handleOpenTimelineLink}
onOpenLocalFileLink={handleOpenTimelineLocalFileLink}
resolveMentionLink={resolveMentionLink}
threadId={thread.id}
workspaceRootPath={environment?.path ?? undefined}
>
<PluginPanelTabContent
tab={tab}
context={{ kind: "thread", threadId: thread.id }}
fileOpenerOriginal={fileOpenerOriginal}
/>
</ThreadTimelineNavigationProvider>
). In a plugin surface the context is null, so onOpenLink, onOpenLocalFileLink, and workspaceRootPath all stay undefined and buildMarkdownMessageLinkRouting (components/ui/markdown-message-link-routing.ts) returns undefined. With no routing, the anchor renders with its raw href and the browser resolves it against the app origin.

The data needed for a fallback is already fetched there: a few lines above the navigation lookup, PluginThreadChat reads thread.environmentId and runs useEnvironment(thread?.environmentId), which carries the workspace path. It just never uses those values to synthesize routing when the context is missing.

What you ruled out

Suggested priority and effort

Low priority, low effort. Hits any plugin embedding ThreadChat outside a thread-detail panel. A workaround exists (plugin-side click interception). No data loss. PluginThreadChat could build the same routing from the thread's own environmentId and environment.path when the context is missing, routing local files through experimental_openFilePreview; I have a working version of that in focus-board 0.4.3 (https://github.com/cristoslc/bb-plugin-focus-board/blob/main/components/thread-pane.tsx) but it duplicates logic the host already owns and I would rather it lived in the host. Happy to attempt a PR after contributor approval.

AGENT GENERATED

Activity

  1. added theissue type on Sep 30, 2026
  2. added
    ui
    plugins
    partial-repro
    on Sep 30, 2026
  3. SawyerHood commented on Sep 30, 2026

    @SawyerHood
    Collaborator

    Verified report: https://get-bb.github.io/reports/issues/4438.html

    PARTIALLY REPRODUCED in two clean checkouts at the same main SHA by the same agent. PluginThreadChat lacks a local-file callback outside navigation context; a separate real Markdown-renderer browser fixture then opens the relative link at the local web origin and receives 404. Routed controls invoke the workspace callback. Current main already supplies workspaceRootPath and image routing. Full plugin-page/live preview behavior and broader #4466 remain untested. Four genuine screenshots and complete repeatable evidence are included.

  4. SawyerHood commented on Oct 19, 2026

    @SawyerHood
    Collaborator

    Consolidated full-page ThreadChat routing evidence

    Consolidating #4466 into this canonical tracker at the maintainer's request following the open-issue duplicate sweep.

    #4466 adds a full-page plugin-route example (focus-board 0.5.3, bb 0.44.0 on macOS, SDK 0.5.29): inline workspace-relative .md paths render as inert code, whereas relative Markdown anchors in this issue navigate to broken app-origin URLs. Both local-file symptoms are consistent with missing routing context/callbacks outside the normal thread surface.

    • Cover both Markdown anchors and inline .md file paths on a full-page plugin route, including environment/context matching.
    • Compare the same message in the normal thread pane and SDK ThreadChat/Markdown surfaces.
    • Independently verify the reported @thread mention and workspace-relative image failures in the full plugin page. Scoped reproduction showed working thread resolver navigation and synthetic images, so these additional claims are not confirmed and must not be silently dropped or described as fixed by a local-file-only patch.

    Evidence: https://get-bb.github.io/reports/issues/4466.html. Full reproduction, consumer link and plugin-side workaround are preserved in #4466. Its closure is consolidation, not confirmation that all symptoms have one cause.

    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-repropluginsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions