Skip to content

feat(session-ui): show titles for referenced session links - #55648

Open
Brendonovich wants to merge 1 commit into
devfrom
session-link-titles
Open

Brendonovich wants to merge 1 commit into
devfrom
session-link-titles

Conversation

@Brendonovich

@Brendonovich Brendonovich commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Session IDs in markdown (ses_…) now show the referenced session's title instead of the raw ID.

  • MarkdownProvider accepts a reactive sessionTitle resolver. The app fills it from the session store first, then fetches unknown sessions once, without adding them to the shared session list. Archived sessions fall back to the ID.
  • Links with a title show it and keep the ID in the tooltip. Links without one still show the ID in monospace.
  • Each markdown block records the titles it rendered and re-renders when one resolves. Streaming blocks are rebuilt in that case, because their renderer cannot swap text in place.
  • Session links are restyled as a compact pill with a chat icon, in place of underlined link text.

Before / After

Desktop web, 1280×520. An assistant message references two sessions, as plain text and as inline code.

Before After
Message Session links shown as raw session IDs Session links shown as titled pills

Testing

  • packages/session-ui: bun typecheck
  • packages/session-ui: bun test src/components/markdown-session-links.test.ts
  • Added a component test covering title replacement, with and without streaming.

@Brendonovich
Brendonovich requested a review from Hona as a code owner October 15, 2026 07:50

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The approach looks sound. I couldn't run it in a browser: the sandbox's Chromium is missing a system library, so the new component tests couldn't start. markdown-session-links.test.ts passes, and typecheck is clean in packages/session-ui and packages/app. I read through the re-render path: a changed set of titles skips the hash shortcut, and streaming blocks are rebuilt and their old renderer cleaned up. It looks right.

Public API is unchanged: sessionTitle is a new optional prop on the internal MarkdownProvider.

This is a visible UI change. Could you add before/after screenshots or a short clip of a session link pill, both with and without a resolved title?

One minor inline note on which IDs get resolved. Nothing blocking.

export function sessionTitleSignature(html: string, title: MarkdownSessionTitle | undefined) {
if (!title || !html.includes("ses_")) return ""

return [...new Set(Array.from(html.matchAll(sessionID), (match) => match[0]))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This matches every ses_… in the block HTML, including IDs inside <pre> code blocks and inside <a> text or hrefs. markSessionLinks never turns those into links. Each of them still calls sessionTitle, which triggers a session.get in the app, and goes into the signature, so the block re-renders (or a streaming block is rebuilt) for a title that is never shown. Gathering IDs from the same nodes markSessionLinks actually links, for example by returning them from it, would keep the two in sync.

This branch has not been deployed

No deployments
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