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.

feat(autoresearch): link the report notebook from the training run row (#110423)

posthog[bot]45542e4461a8
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 68987484f18a..837f191c73e4 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -269,6 +269,7 @@ export const FEATURE_FLAGS = {
ANOMALY_ALERT_GUIDANCE_EXPERIMENT: 'anomaly-alert-guidance',
APPROVALS: 'approvals', // owner: @yasen-posthog #team-platform-features
AUTORESEARCH: 'autoresearch', // owner: @andrewm4894 #team-platform-features
+ AUTORESEARCH_REPORT_NOTEBOOK: 'autoresearch-report-notebook', // owner: @andrewm4894 #team-platform-features, gates the training run report notebook
AVERAGE_PAGE_VIEW_COLUMN: 'average-page-view-column', // owner: @jordanm-posthog #team-web-analytics
BACKFILL_WORKFLOWS_DESTINATION: 'backfill-workflows-destination', // owner: #team-batch-exports
BILLING_ALERTS: 'billing-alerts', // owner: #team-billing, gates the Billing > Alerts tab
diff --git a/products/autoresearch/frontend/autoresearchPipelineLogic.ts b/products/autoresearch/frontend/autoresearchPipelineLogic.ts
index 307c768e2a69..1e2c5fa11069 100644
--- a/products/autoresearch/frontend/autoresearchPipelineLogic.ts
+++ b/products/autoresearch/frontend/autoresearchPipelineLogic.ts
@@ -458,6 +458,9 @@ export interface autoresearchPipelineLogicActions {
pollScoreRun: () => {
value: true
}
+ reportNotebookOpened: (runId: string) => {
+ runId: string
+ }
resumePipeline: () => any
resumePipelineFailure: (
error: string,
@@ -605,6 +608,7 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([
setActiveTab: (tab: AutoresearchPipelineTab) => ({ tab }),
loadDetail: true,
toggleRunArtifacts: (runId: string) => ({ runId }),
+ reportNotebookOpened: (runId: string) => ({ runId }),
setSuggestionDraft: (draft: string) => ({ draft }),
setSuggestionPriority: (priority: CreateSuggestionPriorityEnumApi) => ({ priority }),
setActiveScoreRun: (run: AutoresearchRunApi | null) => ({ run }),
@@ -1164,6 +1168,9 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([
}
}
},
+ reportNotebookOpened: ({ runId }) => {
+ posthog.capture('autoresearch model report notebook opened', { pipeline_id: props.id, run_id: runId })
+ },
})),
actionToUrl(({ values }) => ({
// Reflect the active tab in the URL (?tab=…) so each tab is deep-linkable.
diff --git a/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx b/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx
index cbab732635c3..ea909392bfbc 100644
--- a/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx
+++ b/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx
@@ -1,10 +1,12 @@
import { useActions, useValues } from 'kea'
-import { IconChevronRight, IconExternal } from '@posthog/icons'
+import { IconChevronRight, IconExternal, IconNotebook } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonCollapse, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { LemonMarkdownWithMermaid } from 'lib/lemon-ui/LemonMarkdown/LemonMarkdownWithMermaid'
+import { urls } from 'scenes/urls'
import { autoresearchPipelineLogic, trainingRunProgress } from '../autoresearchPipelineLogic'
import { type AutoresearchRunApi, AutoresearchTrainingRunApi } from '../generated/api.schemas'
@@ -50,8 +52,11 @@ function RunReport({ runId }: { runId: string }): JSX.Element | null {
}
export function TrainingRunRow({ run }: { run: AutoresearchTrainingRunApi }): JSX.Element {
- const { expandedRunId, artifactsByRun, artifactsByRunLoading } = useValues(autoresearchPipelineLogic)
- const { toggleRunArtifacts, viewArtifact } = useActions(autoresearchPipelineLogic)
+ const { expandedRunId, artifactsByRun, artifactsByRunLoading, featureFlags } = useValues(autoresearchPipelineLogic)
+ const { toggleRunArtifacts, viewArtifact, reportNotebookOpened } = useActions(autoresearchPipelineLogic)
+ const reportNotebookShortId = featureFlags[FEATURE_FLAGS.AUTORESEARCH_REPORT_NOTEBOOK]
+ ? run.summary?.report_notebook_short_id
+ : undefined
const isExpanded = expandedRunId === run.id
const paths = artifactsByRun[run.id]
const progress = trainingRunProgress(run)
@@ -108,7 +113,19 @@ export function TrainingRunRow({ run }: { run: AutoresearchTrainingRunApi }): JS
{isExpanded && (
<div className="border-t p-3 space-y-3">
{run.status === 'failed' && run.error && <LemonBanner type="error">{run.error}</LemonBanner>}
- <RunReport runId={run.id} />
+ {reportNotebookShortId ? (
+ <Link
+ to={urls.notebook(reportNotebookShortId)}
+ onClick={() => reportNotebookOpened(run.id)}
+ data-attr="autoresearch-report-notebook-link"
+ className="inline-flex items-center gap-1 text-sm"
+ >
+ <IconNotebook />
+ Open report notebook
+ </Link>
+ ) : (
+ <RunReport runId={run.id} />
+ )}
<div className="space-y-2">
<div className="text-xs font-semibold text-muted uppercase tracking-wide">Iterations</div>
<IterationTrail iterations={run.iterations} />