: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(canvas): open comment threads at the clicked highlight (#111064)
Shy Alterea4919186592
diff --git a/products/canvas/backend/tests/test_cloud_builder.py b/products/canvas/backend/tests/test_cloud_builder.pyindex 919509cd56c7..8d7a2ca5b677 100644--- a/products/canvas/backend/tests/test_cloud_builder.py+++ b/products/canvas/backend/tests/test_cloud_builder.py@@ -288,7 +288,10 @@ class TestCanvasCloudBuilder(SimpleTestCase):self.assertIn('event.data?.type==="set-comment-highlights"', runtime)self.assertIn('CSS.highlights.set("posthog-canvas-comment"', runtime)self.assertNotIn("ph-canvas-comment-outline", runtime)- self.assertIn('type:"comment-activate"', runtime)+ self.assertIn(+ 'type:"comment-activate",id:item.id,rect:{top:rect.top,right:rect.right,bottom:rect.bottom,left:rect.left}',+ runtime,+ )self.assertIn("event.preventDefault();event.stopPropagation()", runtime)self.assertIn("if(!items.length||timer)return", runtime)self.assertNotIn("clearTimeout(timer);timer=setTimeout(()=>render(items),100)", runtime)diff --git a/products/canvas/frontend/sidePanel/comments/CanvasCommentThreadCard.tsx b/products/canvas/frontend/sidePanel/comments/CanvasCommentThreadCard.tsxindex 86d0ac79f56d..4ba8d23bdd4a 100644--- a/products/canvas/frontend/sidePanel/comments/CanvasCommentThreadCard.tsx+++ b/products/canvas/frontend/sidePanel/comments/CanvasCommentThreadCard.tsx@@ -1,23 +1,18 @@import { useActions, useValues } from 'kea'-import { IconCheck, IconRefresh, IconX } from '@posthog/icons'-import { Badge, Button, Text, ThreadItemAction, ThreadItemGroup } from '@posthog/quill'+import { IconCheck, IconRefresh } from '@posthog/icons'+import { ThreadItemAction, ThreadItemGroup } from '@posthog/quill'-import { canvasHistoryLogic } from '../../history/canvasHistoryLogic'import { CanvasCommentEntry } from './CanvasCommentEntry'import { CanvasCommentReplyForm } from './CanvasCommentReplyForm'import { canvasCommentsLogic } from './canvasCommentsLogic'import { CanvasCommentThread, isThreadStateComment } from './canvasCommentThreads'-/** One comment thread over the canvas: the text it is about, its comments, and a reply box. */+/** One comment thread over the canvas: its comments and a reply box. */export function CanvasCommentThreadCard({ thread }: { thread: CanvasCommentThread }): JSX.Element {const { writing } = useValues(canvasCommentsLogic)- const { setActiveThread, setThreadResolved } = useActions(canvasCommentsLogic)- const { versionLabels, displayedVersionId } = useValues(canvasHistoryLogic)- const { setBrowseVersion } = useActions(canvasHistoryLogic)- const { anchor, canvasVersionId } = thread.context- const versionLabel = canvasVersionId ? versionLabels[canvasVersionId] : null- const onOtherVersion = !!canvasVersionId && canvasVersionId !== displayedVersionId+ const { setThreadResolved } = useActions(canvasCommentsLogic)+ const { anchor } = thread.contextconst replies = thread.replies.filter((reply) => !isThreadStateComment(reply))const resolveLabel = thread.resolved ? 'Reopen thread' : 'Resolve thread'@@ -40,48 +35,6 @@ export function CanvasCommentThreadCard({ thread }: { thread: CanvasCommentThreaclassName="flex min-h-0 flex-col"data-attr="canvas-comment-thread">- <div className="flex min-w-0 items-start gap-2 border-b border-border py-2 pr-1 pl-3">- <div className="flex min-w-0 flex-1 flex-col gap-1">- {anchor ? (- <Text size="xs" variant="muted" className="line-clamp-2 border-l-2 border-primary pl-2 italic">- {anchor.quote}- </Text>- ) : (- <Text size="xs" variant="muted">- Comment- </Text>- )}- {(versionLabel || thread.resolved) && (- <div className="flex min-w-0 flex-wrap items-center gap-1">- {thread.resolved && <Badge variant="completed">Resolved</Badge>}- {versionLabel && (- <Text size="xxs" variant="muted">- {onOtherVersion ? `Left on ${versionLabel}` : `On ${versionLabel}`}- </Text>- )}- {onOtherVersion && canvasVersionId && (- <Button- size="xs"- variant="link-muted"- onClick={() => setBrowseVersion(canvasVersionId)}- data-attr="canvas-comment-thread-show-version"- >- Show that version- </Button>- )}- </div>- )}- </div>- <Button- size="icon-sm"- variant="default"- aria-label="Close comment"- onClick={() => setActiveThread(null)}- data-attr="canvas-comment-thread-close"- >- <IconX />- </Button>- </div><div className="min-h-0 flex-1 overflow-y-auto py-2"><ThreadItemGroup><CanvasCommentEntry comment={thread.root} actions={resolveAction} />diff --git a/products/canvas/packages/canvas_builder/build.mjs b/products/canvas/packages/canvas_builder/build.mjsindex 7102ecdc19d6..6b055ae23148 100644--- a/products/canvas/packages/canvas_builder/build.mjs+++ b/products/canvas/packages/canvas_builder/build.mjs@@ -232,7 +232,7 @@ function installSelectionSettleGate(doc, callbacks) {}const selectionRuntime = `(()=>{const channel="posthog-canvas";let port,timer=0,published=false;const anchorRect=${commentActionAnchorRect.toString()};const settleGate=${installSelectionSettleGate.toString()};const post=message=>port?.postMessage({channel,...message}),clear=()=>{if(!published)return;published=false;post({type:"text-selection-cleared"})},clearNative=()=>{getSelection()?.removeAllRanges();clear()},report=()=>{clearTimeout(timer);timer=setTimeout(()=>{const selection=getSelection();if(!selection||selection.isCollapsed||selection.rangeCount===0){clear();return}const range=selection.getRangeAt(0);if(!document.body.contains(range.startContainer)||!document.body.contains(range.endContainer)){clear();return}const before=document.createRange();before.selectNodeContents(document.body);before.setEnd(range.startContainer,range.startOffset);const through=document.createRange();through.selectNodeContents(document.body);through.setEnd(range.endContainer,range.endOffset);const whole=document.createRange();whole.selectNodeContents(document.body);const text=whole.toString(),start=before.toString().length,end=through.toString().length,quote=text.slice(start,end);if(!quote.trim()||quote.length>10000){clear();return}const rect=anchorRect(range.getClientRects?range.getClientRects():[],range.getBoundingClientRect());published=true;post({type:"text-selection",selection:{quote,prefix:text.slice(Math.max(0,start-32),start),suffix:text.slice(end,end+32),start,end,rect:{top:rect.top,right:rect.right,bottom:rect.bottom,left:rect.left}}})},80)};addEventListener("message",event=>{if(port||event.source!==parent||event.data?.channel!==channel||event.data?.type!=="connect"||!event.ports[0])return;port=event.ports[0];port.addEventListener("message",event=>{if(event.data?.channel===channel&&event.data?.type==="clear-text-selection")clearNative()});port.start()});const abort=()=>{clearTimeout(timer);clear()};settleGate(document,{onGestureStart:abort,onSelectionSettled:report,onIdleSelectionChange:report,onGestureCancel:abort});document.addEventListener("scroll",abort,true)})();`-const highlightRuntime = `(()=>{const channel="posthog-canvas",style=document.createElement("style");style.textContent="::highlight(posthog-canvas-comment){background:rgba(250,204,21,.32);color:inherit}::highlight(posthog-canvas-comment-active){background:rgba(250,204,21,.48);color:inherit}";document.head.appendChild(style);let items=[],ranges=[],port,timer=0;const indexText=()=>{const walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT),entries=[];let text="";for(let node=walker.nextNode();node;node=walker.nextNode()){const start=text.length;text+=node.data;entries.push({node,start,end:text.length})}return{text,entries}},rangeAt=(index,start,end)=>{const find=offset=>{let low=0,high=index.entries.length-1,match=null;while(low<=high){const middle=low+high>>1,entry=index.entries[middle];if(offset<entry.start)high=middle-1;else if(offset>entry.end)low=middle+1;else{match=entry;high=middle-1}}return match},startEntry=find(start),endEntry=find(end);if(!startEntry||!endEntry)return null;const range=document.createRange();range.setStart(startEntry.node,start-startEntry.start);range.setEnd(endEntry.node,end-endEntry.start);return range},resolve=(text,anchor)=>{if(text.slice(anchor.start,anchor.end)===anchor.quote)return{start:anchor.start,end:anchor.end};const matches=[];for(let start=text.indexOf(anchor.quote);start>=0;start=text.indexOf(anchor.quote,start+Math.max(anchor.quote.length,1))){const end=start+anchor.quote.length,prefix=text.slice(Math.max(0,start-anchor.prefix.length),start),suffix=text.slice(end,end+anchor.suffix.length);matches.push({start,end,score:(anchor.prefix&&prefix===anchor.prefix?2:0)+(anchor.suffix&&suffix===anchor.suffix?2:0)})}if(matches.length===1)return matches[0];matches.sort((a,b)=>b.score-a.score);return matches[0]?.score&&matches[0].score!==matches[1]?.score?matches[0]:null},render=next=>{items=next||[];ranges=[];if(!window.Highlight||!window.CSS||!CSS.highlights)return;const normal=new Highlight,active=new Highlight,index=indexText();for(const item of items){const hit=resolve(index.text,item.anchor),range=hit&&rangeAt(index,hit.start,hit.end);if(range){ranges.push({id:item.id,range});(item.active?active:normal).add(range)}}CSS.highlights.set("posthog-canvas-comment",normal);CSS.highlights.set("posthog-canvas-comment-active",active)};addEventListener("message",event=>{if(port||event.source!==parent||event.data?.channel!==channel||event.data?.type!=="connect"||!event.ports[0])return;port=event.ports[0];port.addEventListener("message",event=>{if(event.data?.channel===channel&&event.data?.type==="set-comment-highlights")render(event.data.highlights)});port.start()});document.addEventListener("click",event=>{const selection=getSelection();if(selection&&!selection.isCollapsed)return;for(const item of ranges)for(const rect of item.range.getClientRects())if(event.clientX>=rect.left&&event.clientX<=rect.right&&event.clientY>=rect.top&&event.clientY<=rect.bottom){event.preventDefault();event.stopPropagation();port?.postMessage({channel,type:"comment-activate",id:item.id});return}},true);const observeBody=()=>new MutationObserver(()=>{if(!items.length||timer)return;timer=setTimeout(()=>{timer=0;render(items)},500)}).observe(document.body,{childList:true,characterData:true,subtree:true});document.body?observeBody():addEventListener("DOMContentLoaded",observeBody)})();`+const highlightRuntime = `(()=>{const channel="posthog-canvas",style=document.createElement("style");style.textContent="::highlight(posthog-canvas-comment){background:rgba(250,204,21,.32);color:inherit}::highlight(posthog-canvas-comment-active){background:rgba(250,204,21,.48);color:inherit}";document.head.appendChild(style);let items=[],ranges=[],port,timer=0;const indexText=()=>{const walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT),entries=[];let text="";for(let node=walker.nextNode();node;node=walker.nextNode()){const start=text.length;text+=node.data;entries.push({node,start,end:text.length})}return{text,entries}},rangeAt=(index,start,end)=>{const find=offset=>{let low=0,high=index.entries.length-1,match=null;while(low<=high){const middle=low+high>>1,entry=index.entries[middle];if(offset<entry.start)high=middle-1;else if(offset>entry.end)low=middle+1;else{match=entry;high=middle-1}}return match},startEntry=find(start),endEntry=find(end);if(!startEntry||!endEntry)return null;const range=document.createRange();range.setStart(startEntry.node,start-startEntry.start);range.setEnd(endEntry.node,end-endEntry.start);return range},resolve=(text,anchor)=>{if(text.slice(anchor.start,anchor.end)===anchor.quote)return{start:anchor.start,end:anchor.end};const matches=[];for(let start=text.indexOf(anchor.quote);start>=0;start=text.indexOf(anchor.quote,start+Math.max(anchor.quote.length,1))){const end=start+anchor.quote.length,prefix=text.slice(Math.max(0,start-anchor.prefix.length),start),suffix=text.slice(end,end+anchor.suffix.length);matches.push({start,end,score:(anchor.prefix&&prefix===anchor.prefix?2:0)+(anchor.suffix&&suffix===anchor.suffix?2:0)})}if(matches.length===1)return matches[0];matches.sort((a,b)=>b.score-a.score);return matches[0]?.score&&matches[0].score!==matches[1]?.score?matches[0]:null},render=next=>{items=next||[];ranges=[];if(!window.Highlight||!window.CSS||!CSS.highlights)return;const normal=new Highlight,active=new Highlight,index=indexText();for(const item of items){const hit=resolve(index.text,item.anchor),range=hit&&rangeAt(index,hit.start,hit.end);if(range){ranges.push({id:item.id,range});(item.active?active:normal).add(range)}}CSS.highlights.set("posthog-canvas-comment",normal);CSS.highlights.set("posthog-canvas-comment-active",active)};addEventListener("message",event=>{if(port||event.source!==parent||event.data?.channel!==channel||event.data?.type!=="connect"||!event.ports[0])return;port=event.ports[0];port.addEventListener("message",event=>{if(event.data?.channel===channel&&event.data?.type==="set-comment-highlights")render(event.data.highlights)});port.start()});document.addEventListener("click",event=>{const selection=getSelection();if(selection&&!selection.isCollapsed)return;for(const item of ranges)for(const rect of item.range.getClientRects())if(event.clientX>=rect.left&&event.clientX<=rect.right&&event.clientY>=rect.top&&event.clientY<=rect.bottom){event.preventDefault();event.stopPropagation();port?.postMessage({channel,type:"comment-activate",id:item.id,rect:{top:rect.top,right:rect.right,bottom:rect.bottom,left:rect.left}});return}},true);const observeBody=()=>new MutationObserver(()=>{if(!items.length||timer)return;timer=setTimeout(()=>{timer=0;render(items)},500)}).observe(document.body,{childList:true,characterData:true,subtree:true});document.body?observeBody():addEventListener("DOMContentLoaded",observeBody)})();`const keyboardRuntime = `(()=>{const channel="posthog-canvas";let port;addEventListener("message",event=>{if(port||event.source!==parent||event.data?.channel!==channel||event.data?.type!=="connect"||!event.ports[0])return;port=event.ports[0];port.start()});addEventListener("keydown",event=>{if(!port||!event.isTrusted||!event.metaKey&&!event.ctrlKey)return;port.postMessage({channel,type:"keydown",key:event.key,code:event.code,metaKey:event.metaKey,ctrlKey:event.ctrlKey,shiftKey:event.shiftKey,altKey:event.altKey})})})();`// Selection and highlight runtimes extend the shared canvas bridge.const platformStylesheet = `diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/artifactComments.ts b/products/posthog_ai/frontend/scenes/TaskTracker/artifactComments.tsindex e046d7b82b8e..816dfffa6105 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/artifactComments.ts+++ b/products/posthog_ai/frontend/scenes/TaskTracker/artifactComments.ts@@ -70,6 +70,14 @@ export function anchorKindLabel(anchor: ArtifactCommentAnchor | null): ArtifactCreturn anchor?.kind === 'region' ? 'image' : anchor?.kind === 'text' ? 'selection' : 'document'}+/** The accessible name of a thread: the text or the pin it is about. */+export function threadAnchorLabel(thread: ArtifactCommentThread): string {+ if (thread.anchor?.kind === 'text') {+ return `Comments on "${thread.anchor.quote}"`+ }+ return thread.pinNumber ? `Comments on pin ${thread.pinNumber}` : 'Comments on this file'+}+/** Comments need a stable artifact id the server can find on the task. Cited objects and living documents have none. */export function isCommentableArtifact(artifact: RunArtifact | null): artifact is RunArtifact & { id: string } {return !!artifact?.id && artifact.type !== 'reference' && !artifact.livingdiff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadCard.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadCard.tsxindex 83301b266850..5fb68a2531eb 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadCard.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadCard.tsx@@ -1,28 +1,24 @@import { useActions, useValues } from 'kea'import { useEffect, useRef } from 'react'-import { IconCheck, IconPin, IconRefresh, IconX } from '@posthog/icons'-import { Badge, Button, Text, ThreadItemAction, ThreadItemGroup, cn } from '@posthog/quill-primitives'+import { IconPin } from '@posthog/icons'+import { Badge, Button, Text, cn } from '@posthog/quill-primitives'-import { ArtifactCommentThread } from '../artifactComments'+import { ArtifactCommentThread, threadAnchorLabel } from '../artifactComments'import { TaskArtifactCommentsLogicProps, taskArtifactCommentsLogic } from '../taskArtifactCommentsLogic'import { ArtifactCommentComposer } from './ArtifactCommentComposer'-import { ArtifactCommentEntry } from './ArtifactCommentEntry'+import { ArtifactCommentThreadEntries } from './ArtifactCommentThreadEntries'-/** One comment thread: what it is about, its comments, and a reply box. */+/** One comment thread in the comments menu: what it is about, its comments, and a reply box. */export function ArtifactCommentThreadCard({logicProps,thread,- inline = false,}: {logicProps: TaskArtifactCommentsLogicPropsthread: ArtifactCommentThread- inline?: boolean}): JSX.Element {const { activeThreadId, writing, drafts } = useValues(taskArtifactCommentsLogic(logicProps))- const { activateThread, setThreadResolved, replyToThread, setDraft } = useActions(- taskArtifactCommentsLogic(logicProps)- )+ const { activateThread, replyToThread, setDraft } = useActions(taskArtifactCommentsLogic(logicProps))const ref = useRef<HTMLElement>(null)const rootId = thread.root.idconst active = activeThreadId === rootId@@ -30,98 +26,15 @@ export function ArtifactCommentThreadCard({// A click on a highlight or a pin in the preview brings its thread into view.useEffect(() => {- if (active && !inline) {+ if (active) {ref.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' })}- }, [active, inline])-- const resolveAction = (- <ThreadItemAction- label={thread.resolved ? 'Reopen thread' : 'Resolve thread'}- variant="default"- loading={writing === rootId}- disabled={!!writing && writing !== rootId}- onClick={() => setThreadResolved(rootId, !thread.resolved)}- data-attr={thread.resolved ? 'task-artifact-comment-reopen' : 'task-artifact-comment-resolve'}- >- {thread.resolved ? <IconRefresh /> : <IconCheck />}- </ThreadItemAction>- )- const anchorLabel =- anchor?.kind === 'text'- ? `Comments on "${anchor.quote}"`- : thread.pinNumber- ? `Comments on pin ${thread.pinNumber}`- : 'Comments on this file'-- if (inline) {- return (- <section- aria-label={anchorLabel}- className="flex min-h-0 flex-col"- data-attr="task-artifact-comment-thread"- >- <div className="flex min-w-0 items-start gap-2 border-b border-border py-2 pr-1 pl-3">- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-1">- {anchor?.kind === 'text' && (- <Text- size="xs"- variant="muted"- render={<span />}- className="line-clamp-2 w-full border-l-2 border-warning pl-2 italic"- >- {anchor.quote}- </Text>- )}- {thread.pinNumber && (- <Badge variant="info">- <IconPin />- {`Pin ${thread.pinNumber}`}- </Badge>- )}- {thread.resolved && <Badge variant="completed">Resolved</Badge>}- </div>- <Button- size="icon-sm"- aria-label="Close comment"- onClick={() => activateThread(null)}- data-attr="task-artifact-comment-thread-close"- >- <IconX />- </Button>- </div>- <div className="min-h-0 flex-1 overflow-y-auto py-2">- <ThreadItemGroup>- <ArtifactCommentEntry comment={thread.root} actions={resolveAction} />- {thread.replies.map((reply) => (- <ArtifactCommentEntry key={reply.id} comment={reply} />- ))}- </ThreadItemGroup>- </div>- {!thread.resolved && (- <div className="border-t border-border p-2">- <ArtifactCommentComposer- value={drafts[rootId] ?? ''}- onChange={(value) => setDraft(rootId, value)}- onSubmit={() => replyToThread(rootId)}- saving={writing === rootId}- busy={!!writing && writing !== rootId}- label="Reply"- placeholder="Reply"- submitLabel="Reply"- rows={2}- dataAttr="task-artifact-comment-reply"- />- </div>- )}- </section>- )- }+ }, [active])return (<sectionref={ref}- aria-label={anchorLabel}+ aria-label={threadAnchorLabel(thread)}data-selected={active || undefined}className={cn('flex flex-col gap-1 rounded-md py-2', active && 'bg-fill-selected')}data-attr="task-artifact-comment-thread"@@ -158,12 +71,7 @@ export function ArtifactCommentThreadCard({{thread.resolved && <Badge variant="completed">Resolved</Badge>}</div>)}- <ThreadItemGroup>- <ArtifactCommentEntry comment={thread.root} actions={resolveAction} />- {thread.replies.map((reply) => (- <ArtifactCommentEntry key={reply.id} comment={reply} />- ))}- </ThreadItemGroup>+ <ArtifactCommentThreadEntries logicProps={logicProps} thread={thread} />{/* Like Desktop, the reply box opens on the picked thread, so a long list stays short. */}{/* pl-9 lines the reply controls up with the comment text, past the avatar gutter. */}{!thread.resolved && !active && !drafts[rootId] && (diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadEntries.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadEntries.tsxnew file mode 100644index 000000000000..7b967a329320--- /dev/null+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactCommentThreadEntries.tsx@@ -0,0 +1,41 @@+import { useActions, useValues } from 'kea'++import { IconCheck, IconRefresh } from '@posthog/icons'+import { ThreadItemAction, ThreadItemGroup } from '@posthog/quill-primitives'++import { ArtifactCommentThread } from '../artifactComments'+import { TaskArtifactCommentsLogicProps, taskArtifactCommentsLogic } from '../taskArtifactCommentsLogic'+import { ArtifactCommentEntry } from './ArtifactCommentEntry'++/** The comments in one thread, with the resolve or reopen action on the first comment. */+export function ArtifactCommentThreadEntries({+ logicProps,+ thread,+}: {+ logicProps: TaskArtifactCommentsLogicProps+ thread: ArtifactCommentThread+}): JSX.Element {+ const { writing } = useValues(taskArtifactCommentsLogic(logicProps))+ const { setThreadResolved } = useActions(taskArtifactCommentsLogic(logicProps))+ const rootId = thread.root.id+ const resolveAction = (+ <ThreadItemAction+ label={thread.resolved ? 'Reopen thread' : 'Resolve thread'}+ variant="default"+ loading={writing === rootId}+ disabled={!!writing && writing !== rootId}+ onClick={() => setThreadResolved(rootId, !thread.resolved)}+ data-attr={thread.resolved ? 'task-artifact-comment-reopen' : 'task-artifact-comment-resolve'}+ >+ {thread.resolved ? <IconRefresh /> : <IconCheck />}+ </ThreadItemAction>+ )+ return (+ <ThreadItemGroup>+ <ArtifactCommentEntry comment={thread.root} actions={resolveAction} />+ {thread.replies.map((reply) => (+ <ArtifactCommentEntry key={reply.id} comment={reply} />+ ))}+ </ThreadItemGroup>+ )+}diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactInlineThread.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactInlineThread.tsxindex 27ef144174b2..cf20d7725d25 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactInlineThread.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/ArtifactInlineThread.tsx@@ -3,8 +3,10 @@ import { CSSProperties, useEffect, useRef } from 'react'import { cn } from '@posthog/quill-primitives'+import { threadAnchorLabel } from '../artifactComments'import { TaskArtifactCommentsLogicProps, taskArtifactCommentsLogic } from '../taskArtifactCommentsLogic'-import { ArtifactCommentThreadCard } from './ArtifactCommentThreadCard'+import { ArtifactCommentComposer } from './ArtifactCommentComposer'+import { ArtifactCommentThreadEntries } from './ArtifactCommentThreadEntries'export const INLINE_THREAD_WIDTH_PX = 320@@ -20,8 +22,8 @@ export function ArtifactInlineThread({style: CSSPropertiesclassName?: string}): JSX.Element | null {- const { activeThreadId, threads } = useValues(taskArtifactCommentsLogic(logicProps))- const { activateThread } = useActions(taskArtifactCommentsLogic(logicProps))+ const { activeThreadId, threads, drafts, writing } = useValues(taskArtifactCommentsLogic(logicProps))+ const { activateThread, replyToThread, setDraft } = useActions(taskArtifactCommentsLogic(logicProps))const ref = useRef<HTMLDivElement>(null)const thread = threads?.find((candidate) => candidate.root.id === activeThreadId) ?? nullconst open = !!thread@@ -53,12 +55,13 @@ export function ArtifactInlineThread({if (!thread) {return null}+ const rootId = thread.root.idreturn (<divref={ref}data-quillrole="dialog"- aria-label="Comment thread"+ aria-label={threadAnchorLabel(thread)}className={cn('absolute z-30 flex max-h-[480px] w-80 max-w-[calc(100%-16px)] flex-col overflow-hidden rounded-lg border border-border bg-background text-left shadow-lg',className@@ -68,7 +71,25 @@ export function ArtifactInlineThread({onClick={(event) => event.stopPropagation()}data-attr="task-artifact-comment-inline-thread">- <ArtifactCommentThreadCard logicProps={logicProps} thread={thread} inline />+ <div className="min-h-0 flex-1 overflow-y-auto py-2">+ <ArtifactCommentThreadEntries logicProps={logicProps} thread={thread} />+ </div>+ {!thread.resolved && (+ <div className="border-t border-border p-2">+ <ArtifactCommentComposer+ value={drafts[rootId] ?? ''}+ onChange={(value) => setDraft(rootId, value)}+ onSubmit={() => replyToThread(rootId)}+ saving={writing === rootId}+ busy={!!writing && writing !== rootId}+ label="Reply"+ placeholder="Reply"+ submitLabel="Reply"+ rows={2}+ dataAttr="task-artifact-comment-reply"+ />+ </div>+ )}</div>)}