Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(desktop): preserve ordered list start values (#80782)

Adam Bowker8d7705355bef
diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.test.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.test.tsx
index 9e0e225c3e9f..6720911c6cd2 100644
--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.test.tsx
+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.test.tsx
@@ -3,6 +3,23 @@ import { describe, expect, it } from "vitest";
import { ChatMarkdown, ChatStreamingMarkdown } from "./ChatMarkdown";
describe("ChatMarkdown", () => {
+ it("preserves ordered-list numbering across intervening prose", () => {
+ const content = `1. First review comment
+
+Verdict: invalid.
+
+2. Second review comment
+
+Verdict: valid.
+
+3. Third review comment`;
+
+ const html = renderToStaticMarkup(<ChatMarkdown content={content} />);
+
+ expect(html).toContain('<ol start="2"');
+ expect(html).toContain('<ol start="3"');
+ });
+
it("does not load remote markdown images", () => {
const html = renderToStaticMarkup(
<ChatMarkdown content="![internal service](http://127.0.0.1/action)" />,
diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx
index 9b877fd5c1e6..9adfdc23f653 100644
--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx
+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx
@@ -109,8 +109,10 @@ const components: Components = {
ul: ({ children }) => (
<ul className="list-disc space-y-0.5 ps-4">{children}</ul>
),
- ol: ({ children }) => (
- <ol className="list-decimal space-y-0.5 ps-5">{children}</ol>
+ ol: ({ children, start }) => (
+ <ol start={start} className="list-decimal space-y-0.5 ps-5">
+ {children}
+ </ol>
),
li: ({ children }) => <li className="text-sm">{children}</li>,
code: ({ className, children }) => {