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(replay-vision): hover a scan result to read its reasoning (#89485)

coryslater7c6df4aa32ae
diff --git a/products/replay_vision/frontend/components/ObservationCard.tsx b/products/replay_vision/frontend/components/ObservationCard.tsx
index c72782431da3..431f0acfb20b 100644
--- a/products/replay_vision/frontend/components/ObservationCard.tsx
+++ b/products/replay_vision/frontend/components/ObservationCard.tsx
@@ -118,6 +118,7 @@ export function ObservationPrimaryOutput({
onSeek,
expandSummary = false,
copyable = false,
+ reasoningTooltip = false,
}: {
observation: ReplayObservationApi
compact?: boolean
@@ -128,6 +129,8 @@ export function ObservationPrimaryOutput({
expandSummary?: boolean
/** Shows a copy button on summarizer output: the clipboard gets the title plus the summary with citations as plain timestamps. */
copyable?: boolean
+ /** Hovering the result shows its reasoning. For list rows, which have nowhere else to print it. */
+ reasoningTooltip?: boolean
}): JSX.Element | null {
const snapshot = observation.scanner_snapshot
const result = readResult(observation)
@@ -136,10 +139,9 @@ export function ObservationPrimaryOutput({
}
const scannerType = snapshot.scanner_type
const config = configFromSnapshot(snapshot)
- const promptText = config?.prompt ?? null
- const prompt = showPrompt ? promptText : null
- // Tooltip carries the prompt only when it isn't printed inline.
- const promptTooltip = prompt ? null : promptText
+ const prompt = showPrompt ? (config?.prompt ?? null) : null
+ const reasoning = reasoningTooltip ? readReasoning(observation) : null
+ const resultTooltip = reasoning ? citedTextToPlainText(reasoning, result.reasoning_segments) : null
const textClass = 'text-sm'
const summaryClass = expandSummary
? `${textClass} whitespace-pre-wrap`
@@ -164,7 +166,7 @@ export function ObservationPrimaryOutput({
verdict === 'yes' ? 'Yes' : verdict === 'no' ? 'No' : verdict === 'inconclusive' ? 'Inconclusive' : '—'
return (
<div className="flex flex-col gap-1">
- <Tooltip title={promptTooltip}>
+ <Tooltip title={resultTooltip}>
<LemonTag size="medium" type={tagType} className="self-start">
{tagLabel}
</LemonTag>
@@ -288,7 +290,7 @@ export function ObservationPrimaryOutput({
const displayLabel = resultLabel ?? scaleLabel
return (
<div className="flex flex-col gap-1">
- <Tooltip title={promptTooltip}>
+ <Tooltip title={resultTooltip}>
<span className={`${textClass} self-start`}>
<span className="font-semibold text-base">{score ?? '—'}</span>
{scaleMax !== null && <span className="text-muted"> / {scaleMax}</span>}
@@ -359,7 +361,7 @@ export function ObservationResultSummary({ observation }: { observation: ReplayO
if (!snapshot || !result) {
return <span className="text-muted text-sm">—</span>
}
- return <ObservationPrimaryOutput observation={observation} compact showPrompt={false} />
+ return <ObservationPrimaryOutput observation={observation} compact showPrompt={false} reasoningTooltip />
}
export function FailureDetail({ errorReason }: { errorReason: string }): JSX.Element {