: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
feat(autoresearch): redesign the agent research tab around a status brief (#116622)
posthog[bot]0c549217612b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 42a00b0d3822..c0040a4c3677 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6623,25 +6623,29 @@ snapshots:products-autoresearch-model-card--training--light:hash: v1.k794b7964.b358f33a0d879e85f4c8bdb4ae65330f392cdaa8a869e8bce7e07cdcb22d13a9.EAfBa_-86ylT0UXKPW7EAqtGV9zNLRT4VdSYkWFWj_Mproducts-autoresearch-model-detail-scene--accuracy--narrow--dark:- hash: v1.k794b7964.ab6cd49b1bd74e55cdfc33e06cbfaea05af40f5423c9a354f2f0206f0b757755.GrpIVBW2vJXjMK0cAm_bPc0wDJN0yjE_PZ5Sqemb9F8+ hash: v1.k794b7964.cc5c80f54b366af72ee206c132ff16855a53d9f0152b5fcd665badc347dfe76a.VrTGlwRaHpwfI1QBWePyr2ARuWCj1HoG2ztzwfXESAEproducts-autoresearch-model-detail-scene--accuracy--narrow--light:- hash: v1.k794b7964.0d14631f0afdcd7aa5601ee60740636b06f5b8701b3b84659016f55dd50c5e36.Rff5tsMEhih7Q6jnXaojrhaq_dq8ShBZoW_sx4mJWe8+ hash: v1.k794b7964.fd34150ddd7a416e7fe6d25aad92f32348db555b75b8b9074eb984313d326ae5.regqIjpzTv7BhVk_HRbkv2QTV49o_yP7SXcVGHbuOgMproducts-autoresearch-model-detail-scene--accuracy--wide--dark:- hash: v1.k794b7964.be30fc55698840326ecb7ad998616a24eadcd9b1ff10413cc14b7894c9930f8a.Ir0oYLj5Vk8seoGSVk4o-_jWDmevr-Nth5G082R7SzU+ hash: v1.k794b7964.8079c8a10c44ea9de9d26d8ce7c73c380b7523fecb0bc6c5217fcbe757d48ddc.s4wWq4ykRqBZKIokdQ7VJwm6NlFNienMd_5OeTxFEGEproducts-autoresearch-model-detail-scene--accuracy--wide--light:- hash: v1.k794b7964.0cf1ce7f42431db447f057023346cd63cc8cddb5e45e6f41a5c1fc9b40ea717e.6X-N8RqCuyLJCXCvQUeiBKvbcDFuUbkfYUd_ngR_O6M+ hash: v1.k794b7964.93b1cbc7ef465154449463c0410d44fa6b468c1272015c66aeda987b45e55c82.3KzsV_fKafMRSkfLwl5Tmb0lJ0BtsaXYCePf36mOhDAproducts-autoresearch-model-detail-scene--accuracy-before-precision-recall--wide--dark:- hash: v1.k794b7964.2200b8e78bd0b6233eb155370f90b744fdd4bbf8765144a4801f9e9d72f2bbd3.dNmkJFFXuPHe_L4ocSeLTIACMvFmnvxIZpdhv4UwVNw+ hash: v1.k794b7964.392e2f039d6619c9344d299e9bdde59ba18e44f3c6a52f9485d16b1d12f71143.iws2WKI1cVn8mtF7gQ7yXjLl6Zer9ClpXnKDt4saXMwproducts-autoresearch-model-detail-scene--accuracy-before-precision-recall--wide--light:- hash: v1.k794b7964.b9002eda53b32c688750ed9a09909356359135c1d697cbe011d1f3af170e61e0.ZW7Kz4xxkZU06OMpIB8KsDIxouakUNKAbgWYoCvApwk+ hash: v1.k794b7964.f9e9a4a3106781c287215c4814de98cfcd66afa6c3bba6f3a9b5e028943a035d.GFjkvK159EBC_ohj72MNqX56nSfXlla66-89avAQ16Iproducts-autoresearch-model-detail-scene--agent-research-narrow--narrow--dark:- hash: v1.k794b7964.30d2a61a4d85714b8aa85d7a3551956a34d963b3c08fdf8543bac8ff298e393d.JWWJ93sVqwsvhTlOfR5BbtFkHXWx_0vKG74yU5gFln0+ hash: v1.k794b7964.0889baa7d2b6bca50dfd14487b80f287e8bd27a098a0e3482cb9da086c840e3e.5vUCdyEAF1AXUusb51kIrj4Jbpwm8BYmrR6O3ATOz34products-autoresearch-model-detail-scene--agent-research-narrow--narrow--light:- hash: v1.k794b7964.5e6ac0591a15b387087c35a38c222364782bc217a38492f36ade0bd177319b71.Rf99y4ns4bgamhRDXrjUtWkUphR-21ps5-z2zKrui6s+ hash: v1.k794b7964.c886c90f5857ec3832569882f07dd6d977bbb853acfd91a22c7ce115c07244af.VI_y6lzckFWdnDBbwApi8V4A5qqDqFp5F8lVoJRivhgproducts-autoresearch-model-detail-scene--agent-research-wide--wide--dark:- hash: v1.k794b7964.b74d014f7df17eae944c2d1617c9c5f7f5dca7e0fd47118ee1c79586722fae82.LMBrryOp9NjhaqHO9d7I9QkJmAQ5Vyy3sFfUvkGWdxQ+ hash: v1.k794b7964.d0ca993aa9965e415a9ceab3a9627ab8e17c2cea945674f2eb918bec777bb8d5.4YLF7WUT-SVytW6rcFDb1zd2Ws8Q1W-AYt1gzvxk5_0products-autoresearch-model-detail-scene--agent-research-wide--wide--light:- hash: v1.k794b7964.a8249c53caa4af1687731fd2fd05785c8edf78cdb4e9c8c1250bb064585249ca.G_lrb4ODihzN6JFOpzGe1T2zGGhL_54bVGOc2XE7BQk+ hash: v1.k794b7964.be3defac5ebb74bede73fd4fa23dd635d7f9d9c47b89435e231a1ce9881253bc.-hZXA2bEZO_6Ixc9VCUu6zKHn-y1X3I53UQx1C0Lxto+ products-autoresearch-model-detail-scene--agent-research-without-reader-notes--wide--dark:+ hash: v1.k794b7964.8b6e01d7ceb84bec06771244a5bfbe9b59067a66994310f5733afbb61c46a442.KJvApW0Ve1NkXTOjjFz-srlFt6h3ZHriKDrgtXHcZbs+ products-autoresearch-model-detail-scene--agent-research-without-reader-notes--wide--light:+ hash: v1.k794b7964.9fb91b480e5de8c67dabb79c3df5fec3c35816c2e3d7c155b12f211c4ebc3e61.62mzQ0K7BFpXn69hUmZ2IPzqq86diDtDIzLWRldwRsgproducts-autoresearch-model-detail-scene--coverage-below-cap--narrow--dark:hash: v1.k794b7964.e0ad2e627d68765547c107f5f8d1f2ad214de6b3c7fddcaf973c8d0c47abd3e8.iRRLGCI7qO0vmHNg6YvjDatNxsPN2em2kVattLKAiGsproducts-autoresearch-model-detail-scene--coverage-below-cap--narrow--light:@@ -6687,21 +6691,21 @@ snapshots:products-autoresearch-probability-histogram--single-bucket--light:hash: v1.k794b7964.7087a0c145f21f4ad346356f61768cfe3c158fcaf680e2bfd46135bcb39985a5.DRfvEC1xadIFDKaZCGZtNj1jj7vYSW_jF1U97K7QrBIproducts-autoresearch-training-run-row--compared-with-champion-narrow--dark:- hash: v1.k794b7964.289abee50375ba479d8caea199304a7632057234c526376407dbba834a319e7c.ITTtiPxedZ8qNA-_vP6kANJZWCp5iJZIcAUD2bnIuaM+ hash: v1.k794b7964.f8c626effff05ff3dbd59b72fca04393081415ddf2a648d5ec0eb3fa6c1ca940.dP2aSX8tvT6bxmAprrGnHP9MV9m0LptmZ2qfp19AAOoproducts-autoresearch-training-run-row--compared-with-champion-narrow--light:- hash: v1.k794b7964.62f9be4c63ec3c06d6c20fdcea81fa888d91fa912903645d1897c428cfbd0446.Ed8UEyOJowfkfvqFb7f6WUp0tAi9uh93hBI_15IzyFo+ hash: v1.k794b7964.493f978c8552cced05ae3d2b8816ded348b32a676dd9b97ac7dcb8ae936434e0.cizo_osqaPiEDdAxdbeusaSFxn246Yex7CBBv_XF_Dwproducts-autoresearch-training-run-row--compared-with-champion-wide--dark:- hash: v1.k794b7964.25ad73b9ceb9da71ab8027fd583528c55c1ec12078b39d44ce4308dbfb4681f1.rvBV45eYb2m-T1O9z4LZc3r9g7MEBo5p6Yw6xlk-ijc+ hash: v1.k794b7964.fafe7cde482a2fc322ad9b5052a9e91664c57a78a128a3b55fab3ec5a6ad5374.u_NC6rnxxTGMvt3dzGtjHuYSGzmBC0JuxABvTST3qacproducts-autoresearch-training-run-row--compared-with-champion-wide--light:- hash: v1.k794b7964.5fa4295b13654c206e7d74cef1388d96a8d2d32da3ca16f1abc1e1a9c14f0ac9.4pTHsaqL6pk0tX1sGCVnQ-Yfnwz0GOB8kGbhXn1ufEc+ hash: v1.k794b7964.e9b983562be4b2c35a4a9c18f4c79a055f767237d9827d14f8444f42ed8f7d28.NXkWg_yv4dQouSDR0OFFzAlS37lKgmnhtlqQU1n2ByAproducts-autoresearch-training-run-row--run-model-without-importances--dark:- hash: v1.k794b7964.daffaac0f784c23fcc5ceb185c819575045b715e95dac2f86e60e867edabeddb.dJzY4_jYvtPCGVo_jqCzVZa97mIecM7lamJExFeQWFE+ hash: v1.k794b7964.852eed57630bbf84606f9db00c1d0a3ce39f3fadbd1ebca4f9e59185f14bbd51.rD7gYIjqtbQlUDytndqJhvSyDxVsnbrAiU2w_YQtFmcproducts-autoresearch-training-run-row--run-model-without-importances--light:- hash: v1.k794b7964.2464b7f50c35540a5a09124569e870d987d9da18850531e16ba4d7661d30a014.cJFO6YIMxD8nsrZqF6ZBiaCaHwuS9akXKa9w0NnuP0E+ hash: v1.k794b7964.abfa6ec429217086813c8236b4ae934c28b19928d7bb8acb463312bded4c6824.DPhfkJCL1e09xRk315_crbGH1ZBXuBUJJDGQuqs7Pesproducts-autoresearch-training-run-row--run-produced-the-champion--dark:- hash: v1.k794b7964.217c79a0f1d109409c6d6395574ad5a5847ff6cd7fd8347382d4b7c1906fd8df.t_NlghuFmtknzsDJnKEOFwoTSOXtgLoCSV6f6DZnXXo+ hash: v1.k794b7964.31703656b8a306a7d49b09cc8f656c7c42736668885c84bc98bb313bf1ebf501.mQsSNC-D51SFFN3Ck7nPjwPYTva-iHTshY5Nn4Nprqgproducts-autoresearch-training-run-row--run-produced-the-champion--light:- hash: v1.k794b7964.f32c7fc6333c5aa557c0923a802dfd936f3a1d4fa6d086645449ce32bc3fe1fd.0dcjrO_Ave0qQ94o7Fq5Ayvr5ZTq1G99ViPrL16PvPQ+ hash: v1.k794b7964.0ca7c29c5445ee44d47a1cef4c7c8f6d331310b0176e173f43530b99079e4e86.tjZPXyNflXDsKIgM8KBKf31qxG5l2W-_GViGBr51tn0products-business-intelligence-chart-years--partial-years--dark:hash: v1.k794b7964.2a6374590be64f7a06a222b2c702f194a05289115c618d7ec8864a6b62f85631.wJMlvq8tZxD3TVKI8Lt9pHxK7YwHkdHS2QDRpZaqRJoproducts-business-intelligence-chart-years--partial-years--light:diff --git a/products/autoresearch/frontend/AGENTS.md b/products/autoresearch/frontend/AGENTS.mdindex eb48f477d074..683fc904f5eb 100644--- a/products/autoresearch/frontend/AGENTS.md+++ b/products/autoresearch/frontend/AGENTS.md@@ -18,14 +18,14 @@ The product is mostly a backend, and the UI is deliberately thin — it reads st| `newModel/` | Create-form parts: template chips, definition sentence, Advanced section, readiness checklist, "What happens next". || `autoresearchPipelineLogic.ts` | Detail logic. Also maps the old `?tab=` keys to the four tabs, so saved links still open. || `pipelineLifecycle.ts` | The five lifecycle steps (question set to checked against reality) and which one is current. |-| `agentSearch.ts` | The agent's search across training runs: chart points, best score so far, AUC change per experiment, log groups and the latest agent notes. |+| `agentSearch.ts` | The agent's search across training runs: chart points, best score so far, change per experiment within a run, log groups and status brief. || `onlinePerformance.ts` | Accuracy tab helpers over the `online_performance` endpoint: the stat tiles, the realized AUC series, predicted against actual by segment. || `predictionCoverage.ts` | Predictions tab coverage from the runs list: the measured summary and the coverage and score age per day. || `predictionSegments.ts` | The likelihood segments from the cut points the `online_performance` endpoint returns: lift over the base rate, or a fixed pair until then. || `PipelineStatusTag.tsx` | Status tag + tooltip shared by the list and detail scenes. || `ProbabilityHistogram.tsx` | Decile histogram of the latest scoring run's probabilities. || `DailyVolumeChart.tsx` | Bar-per-day chart of scoring volume. |-| `pipeline/` | The detail-scene tabs (Predictions, Accuracy, Agent research, Setup) and their components. Agent research combines Training and Suggestions. |+| `pipeline/` | The detail-scene tabs and their components. Agent research stacks a status brief, a steer bar, the search chart and the run log. || `emptyState/` | `ProductEmptyState` config + example-data preview for the first-run gate. || `generated/` | **Generated. Never hand-edit.** Change the serializer in `../backend/presentation/views/serializers.py` and run `hogli build:openapi`. |@@ -52,7 +52,7 @@ Follow `frontend/src/AGENTS.md` — it applies to product frontends too.- TypeScript with explicit return types; Tailwind utilities rather than inline styles.- Reuse Lemon / quill components instead of hand-rolling tables, badges, or tags.- Any button that fires a request must guard against double-submission — `loading` / `disabledReason` on `LemonButton`, reset on both success and error paths. The lifecycle actions here (train, score, archive, pause, resume) are all network calls, and several are expensive: firing `train` twice starts two sandbox agent runs and spends the budget twice.-- Usage events are part of the API: renaming one breaks every insight built on it. The list logic captures `autoresearch model list viewed`, `autoresearch model list load failed`, `autoresearch model deleted` / `paused` / `resumed`, `autoresearch model training started` (with `source: 'list'` from a card), `autoresearch model card clicked`, and `autoresearch model action failed` (with `action`). The create logic captures `autoresearch model template selected` (with `template_key`), `autoresearch model custom chosen`, `autoresearch model advanced opened`, `autoresearch model created` (with `action`: `start_training` or `save_draft`), and `autoresearch model training started` / `training start failed`. The detail logic captures `autoresearch model tab changed` (with `tab`) when a person picks a tab, `autoresearch model experiment log filter changed` (with `filter`), `autoresearch model accuracy cutoff changed` (with `cutoff`), `autoresearch model search point clicked` (with `run_id`, `iteration_number`, `status`), `autoresearch model experiment details opened` (with `run_id`, `iteration_number`) when a person opens an experiment's working notes and `autoresearch model suggestion sent` (with `priority`); buttons carry a `data-attr` for autocapture. Extend the same names when you add a scene.+- Usage events are part of the API: renaming one breaks every insight built on it. The list logic captures `autoresearch model list viewed`, `autoresearch model list load failed`, `autoresearch model deleted` / `paused` / `resumed`, `autoresearch model training started` (with `source: 'list'` from a card), `autoresearch model card clicked`, and `autoresearch model action failed` (with `action`). The create logic captures `autoresearch model template selected` (with `template_key`), `autoresearch model custom chosen`, `autoresearch model advanced opened`, `autoresearch model created` (with `action`: `start_training` or `save_draft`), and `autoresearch model training started` / `training start failed`. The detail logic captures `autoresearch model tab changed` (with `tab`) when a person picks a tab, `autoresearch model experiment log filter changed` (with `filter`), `autoresearch model accuracy cutoff changed` (with `cutoff`), `autoresearch model search point clicked` (with `run_id`, `iteration_number`, `status`), `autoresearch model experiment details opened` (with `run_id`, `iteration_number`) when a person opens an experiment's working notes, `autoresearch model suggestion sent` (with `priority`), `autoresearch agent research experiment opened` (with `run_id`, `iteration_number`, `status`, `source`: `chart` or `log`) when a person opens the experiment drawer, `autoresearch agent research steer opened` (with `queued_count`) and `autoresearch agent research full notes opened` (with `run_number`); buttons carry a `data-attr` for autocapture. Extend the same names when you add a scene.## Copydiff --git a/products/autoresearch/frontend/AutoresearchPipelineScene.stories.tsx b/products/autoresearch/frontend/AutoresearchPipelineScene.stories.tsxindex 6e3698dfe7e2..cf3e942b07dc 100644--- a/products/autoresearch/frontend/AutoresearchPipelineScene.stories.tsx+++ b/products/autoresearch/frontend/AutoresearchPipelineScene.stories.tsx@@ -11,6 +11,7 @@ import type {AutoresearchModelApi,AutoresearchPipelineApi,AutoresearchRunApi,+ AutoresearchSuggestionApi,AutoresearchTrainingRunApi,} from './generated/api.schemas'@@ -104,11 +105,24 @@ const runs = [},] as unknown as AutoresearchRunApi[]+const challenger = {+ ...champion,+ id: '0190c3f2-0000-7000-8000-0000000000c2',+ role: 'challenger',+ holdout_score: 0.84,+ realized_score: 0.83,+ source_training_run: 'training-4',+ agent_description: 'Gradient boosting with share counts measured up to midnight.',+ promoted_at: null,+ created_at: '2026-02-25T11:00:00Z',+} as unknown as AutoresearchModelApi+function iteration(iteration_number: number,status: 'kept' | 'discarded' | 'crashed',holdout_score: number | null,- agent_description: string+ agent_description: string,+ summary: string | null = null): Record<string, unknown> {return {iteration_number,@@ -116,7 +130,11 @@ function iteration(holdout_score,train_score: null,agent_description,- model_spec: { model_class: 'sklearn.ensemble.HistGradientBoostingClassifier', model_params: { max_depth: 4 } },+ summary,+ model_spec: {+ model_class: 'sklearn.ensemble.HistGradientBoostingClassifier',+ model_params: { max_depth: 4, learning_rate: 0.05, random_state: 7 },+ },}}@@ -171,6 +189,63 @@ const onlinePerformance = {},}+const newestRun = {+ id: 'training-4',+ pipeline: PIPELINE_ID,+ task_url: null,+ status: 'completed',+ iteration_count: 3,+ best_holdout_score: 0.84,+ reader_summary:+ 'Found why scores on real outcomes lagged. Training counted shares up to a random time of day, but scoring counts them up to midnight. Its model is now scored next to the live one.',+ next_steps: [+ 'Check the midnight cutoff on two more weeks of outcomes.',+ 'Try shares per active day.',+ 'Drop features that never rank in the top ten.',+ ],+ summary: {+ distillation: 'MATCHED CUTOFFS. Midnight cutoffs close most of the gap between holdout and realized AUC.',+ recommended_next: 'Validate on more matured dates before any new features.',+ kept_ladder: [],+ dead_ends: [+ { iteration_number: 1, holdout_score: 0.82, model_class: 'x', agent_description: 'Hour of day weights.' },+ ],+ },+ iterations: [+ iteration(+ 0,+ 'kept',+ 0.82,+ 'SHIPPED BUNDLE. Re-scored the live recipe the way the scoring job runs it, to get a fair baseline.',+ 'Re-scored the live recipe the way scoring runs it'+ ),+ iteration(1, 'discarded', 0.82, 'Weight training rows by hour of day. No gain over the baseline.'),+ iteration(+ 2,+ 'kept',+ 0.84,+ 'Moved every training cutoff to midnight to match how scoring counts shares. This closes part of the gap.',+ 'Moved training cutoffs to midnight'+ ),+ ],+ error: '',+ started_at: '2026-02-25T09:00:00Z',+ completed_at: '2026-02-25T09:39:00Z',+ created_at: '2026-02-25T09:00:00Z',+}++const suggestions = [+ {+ id: 'suggestion-1',+ pipeline: PIPELINE_ID,+ prompt: 'Try the number of people each file was shared with.',+ priority: 'consider',+ status: 'queued',+ agent_response: '',+ created_at: '2026-02-28T09:00:00Z',+ },+] as unknown as AutoresearchSuggestionApi[]+const trainingRuns = [{id: 'training-3',@@ -247,11 +322,16 @@ const meta: Meta = {mswDecorator({get: {[`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/`]: pipeline,- [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/models/`]: toPaginatedResponse([champion]),+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/models/`]: toPaginatedResponse([+ champion,+ challenger,+ ]),[`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/runs/`]: toPaginatedResponse(runs),- [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/training_runs/`]:- toPaginatedResponse(trainingRuns),- [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/suggestions/`]: toPaginatedResponse([]),+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/training_runs/`]: toPaginatedResponse([+ newestRun,+ ...trainingRuns,+ ]),+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/suggestions/`]: toPaginatedResponse(suggestions),[`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/online_performance/`]: onlinePerformance,},}),@@ -282,6 +362,24 @@ export const AgentResearchNarrow: Story = {},}+// Runs from before the plain-language notes existed: the brief falls back to a line built from the scores.+export const AgentResearchWithoutReaderNotes: Story = {+ decorators: [+ mswDecorator({+ get: {+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/models/`]: toPaginatedResponse([champion]),+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/training_runs/`]:+ toPaginatedResponse(trainingRuns),+ [`/api/projects/:team_id/autoresearch/${PIPELINE_ID}/suggestions/`]: toPaginatedResponse([]),+ },+ }),+ ],+ parameters: {+ pageUrl: `${urls.autoresearchPipeline(PIPELINE_ID)}?tab=agent_research`,+ testOptions: { viewportWidths: ['wide'] },+ },+}+export const Accuracy: Story = {parameters: {pageUrl: `${urls.autoresearchPipeline(PIPELINE_ID)}?tab=accuracy`,diff --git a/products/autoresearch/frontend/agentSearch.test.ts b/products/autoresearch/frontend/agentSearch.test.tsindex 2dae4471ed05..27fd565eab57 100644--- a/products/autoresearch/frontend/agentSearch.test.ts+++ b/products/autoresearch/frontend/agentSearch.test.ts@@ -1,4 +1,4 @@-import { buildAgentSearch, experimentLogGroups, latestAgentNotes } from './agentSearch'+import { buildAgentSearch, experimentLogGroups, experimentTitle, runHeadline, statusBrief } from './agentSearch'import { AutoresearchModelApi, AutoresearchTrainingRunApi, IterationTrailApi } from './generated/api.schemas'function iteration(@@ -37,19 +37,19 @@ const RUNS = []describe('buildAgentSearch', () => {- it('measures each experiment against the best kept score before it, across runs', () => {+ it('measures each experiment against the previous kept experiment in its own run', () => {const { points } = buildAgentSearch(RUNS, null)expect(points.map((p) => [p.runNumber, p.iterationNumber, p.status, p.delta?.toFixed(2) ?? null, p.bestSoFar])).toEqual([[1, 0, 'kept', null, 0.7],[1, 1, 'kept', '0.10', 0.8],- // The first experiment of a later run compares against the best of the runs before it.- [2, 0, 'kept', '-0.05', 0.8],+ // The first experiment of a later run has no delta, even below an earlier run's best.+ [2, 0, 'kept', null, 0.8],// A discarded experiment with a higher score than a kept one does not raise the best.- [2, 1, 'discarded', '-0.02', 0.8],+ [2, 1, 'discarded', '0.03', 0.8],[2, 2, 'crashed', null, 0.8],- [2, 3, 'kept', '0.02', 0.82],+ [2, 3, 'kept', '0.07', 0.82],])})@@ -79,18 +79,11 @@ describe('buildAgentSearch', () => {'Tried fewer features.',],[- 'the first sentence of the description otherwise',+ 'the first clause of the description otherwise',undefined,null,'Dropped 12 features (v1.2). AUC fell.',- 'Dropped 12 features (v1.2).',- ],- [- 'the first clause of the description, cut to length',- null,- null,- `Dropped ${'very '.repeat(12)}weak features, AUC fell.`,- `Dropped ${'very '.repeat(10).trim()}…`,+ 'Dropped 12 features (v1.2)',],['the whole description when it has no sentence end',@@ -116,55 +109,97 @@ describe('experimentLogGroups', () => {[1, [1, 0]],])})+})++describe('experimentTitle', () => {+ it.each([+ ['a label in capitals', 'SHIPPED BUNDLE. Re-ran the final package end to end.', 'SHIPPED BUNDLE'],+ [+ 'a clause before a semicolon',+ 'Moved cutoffs to midnight; scoring runs then too.',+ 'Moved cutoffs to midnight',+ ],+ [+ 'a long clause, cut to one line',+ 'Retrained the live recipe with every hourly weight and both views of the population before pruning anything',+ 'Retrained the live recipe with every hourly weight and both views of…',+ ],+ ])('keeps %s short', (_, description, expected) => {+ expect(experimentTitle(description)).toEqual(expected)+ })+})+describe('runHeadline', () => {it.each([[- 'the run headline',+ 'the agent headline, with the plain summary as detail',{ headline: 'Recency won', reader_summary: 'Recent visits mattered. More later.' },- 'Recency won',+ { headline: 'Recency won', detail: 'Recent visits mattered. More later.' },+ ],+ [+ 'the first sentence of the plain summary, with the rest as detail',+ { reader_summary: 'Found why real outcomes lagged. Training used a random time of day.' },+ { headline: 'Found why real outcomes lagged.', detail: 'Training used a random time of day.' },],[- 'the first sentence of the reader summary',- { headline: null, reader_summary: 'Recent visits mattered. More later.' },- 'Recent visits mattered.',+ 'the run number and best score without one',+ { best_holdout_score: 0.9431 },+ { headline: 'Run 3 · best 0.943', detail: '' },],- ['the run number', {}, 'Run 1'],- ])('falls back to %s', (_, overrides, expected) => {- const runs = [run('run-1', '2026-01-01T00:00:00Z', [], overrides as Partial<AutoresearchTrainingRunApi>)]- expect(experimentLogGroups(runs, buildAgentSearch(runs, null), 'all')[0].headline).toEqual(expected)+ ])('uses %s', (_, overrides, expected) => {+ const r = run('run-1', '2026-01-01T00:00:00Z', [], overrides as Partial<AutoresearchTrainingRunApi>)+ expect(runHeadline(r, 3)).toEqual(expected)})})-describe('latestAgentNotes', () => {- it('reads the newest completed run that left notes', () => {- const notes = { distillation: 'Recency wins', recommended_next: 'Try sessions' }+describe('statusBrief', () => {+ const champion = {+ role: 'champion',+ source_training_run: 'run-1',+ holdout_score: 0.948,+ realized_score: 0.874,+ } as AutoresearchModelApi++ it('builds a factual line and keeps the agent notes apart when a run has no plain summary', () => {const runs = [run('run-3', '2026-01-03T00:00:00Z', [], { status: 'running' }),- run('run-2', '2026-01-02T00:00:00Z', [], { summary: { distillation: '', recommended_next: '' } as any }),- run('run-1', '2026-01-01T00:00:00Z', [], { summary: notes as any }),+ run('run-2', '2026-01-02T00:00:00Z', [], {+ best_holdout_score: 0.94,+ summary: { distillation: 'Recency wins', recommended_next: 'Try sessions' } as any,+ }),+ run('run-1', '2026-01-01T00:00:00Z', []),]- expect(latestAgentNotes(runs)).toEqual({- runNumber: 1,+ const brief = statusBrief(runs, champion, null)+ expect(brief).toMatchObject({+ runNumber: 2,readerSummary: '',- nextSteps: [],+ factualLine:+ 'The live model scores 0.948 in training and 0.874 on real outcomes. Run 2 got a best score of 0.940 in training.',distillation: 'Recency wins',recommendedNext: 'Try sessions',+ live: { runNumber: 1, holdoutScore: 0.948, realizedScore: 0.874 },+ scoredAlongside: null,})})- it('reads the plain notes for people when a run left only those', () => {+ it('reads the plain summary, at most three next steps, and the scored-alongside model', () => {const runs = [- run('run-1', '2026-01-01T00:00:00Z', [], {- reader_summary: 'Recent visits predict a purchase best.',- next_steps: ['Add session length', ' '],+ run('run-2', '2026-01-02T00:00:00Z', [], {+ reader_summary: 'Run 2 found part of the reason.',+ next_steps: ['One', ' ', 'Two', 'Three', 'Four'],} as Partial<AutoresearchTrainingRunApi>),+ run('run-1', '2026-01-01T00:00:00Z', []),]- expect(latestAgentNotes(runs)).toEqual({- runNumber: 1,- readerSummary: 'Recent visits predict a purchase best.',- nextSteps: ['Add session length'],- distillation: '',- recommendedNext: '',+ const challenger = {+ role: 'challenger',+ source_training_run: 'run-2',+ holdout_score: 0.94,+ realized_score: 0.893,+ } as AutoresearchModelApi+ expect(statusBrief(runs, champion, challenger)).toMatchObject({+ readerSummary: 'Run 2 found part of the reason.',+ nextSteps: ['One', 'Two', 'Three'],+ scoredAlongside: { runNumber: 2, holdoutScore: 0.94, realizedScore: 0.893 },})})})diff --git a/products/autoresearch/frontend/agentSearch.ts b/products/autoresearch/frontend/agentSearch.tsindex 0125661b11aa..615371c7df53 100644--- a/products/autoresearch/frontend/agentSearch.ts+++ b/products/autoresearch/frontend/agentSearch.ts@@ -15,17 +15,19 @@ export interface SearchPoint {iterationNumber: numberstatus: AutoresearchIterationStatusEnumApiholdoutScore: number | null- /** One plain line for people: the agent's `headline`, else its `summary`, else the first clause of its description. */+ /** One plain line for people: the agent's `headline`, else its `summary`, else a short first clause of its description. */summary: stringagentDescription: stringmodelSpec: IterationTrailApiModelSpec- /** Best kept holdout AUC before this experiment, across all earlier runs too. */- bestBefore: number | null- /** Holdout AUC minus `bestBefore`. Null for a crashed or unscored experiment, or when nothing came before. */+ /** Holdout AUC of the last kept experiment before this one in the same run. Null for the first experiment. */+ previousKept: number | null+ /** Holdout AUC minus `previousKept`. Null for a crashed or unscored experiment, or when nothing came before. */delta: number | null- /** Best kept holdout AUC after this experiment. Never goes down. */+ /** Best kept holdout AUC after this experiment, across all runs. Never goes down. */bestSoFar: number | nullisLiveModel: boolean+ /** The experiment that produced the newest challenger with a realized score. */+ isScoredAlongside: boolean}/** The span of one training run on the chart's x axis. */@@ -47,28 +49,39 @@ export type ExperimentLogFilter = 'all' | 'kept' | 'discarded' | 'crashed'export interface ExperimentLogGroup {run: AutoresearchTrainingRunApirunNumber: number- /** The run's `headline`, else the first sentence of its `reader_summary`, else "Run N". */- headline: string/** Newest first, after the filter. */entries: SearchPoint[]}-export interface AgentNotes {- runNumber: number- /** Plain sentences for people. Empty when the agent wrote none. */+/** Holdout and realized AUC of one model, and the run that produced it. */+export interface BriefModel {+ runNumber: number | null+ holdoutScore: number | null+ realizedScore: number | null+}++/** What the top of the Agent research tab says: where the live model stands and what comes next. */+export interface StatusBrief {+ /** The newest completed run. Null before any run completes. */+ runNumber: number | null+ /** The newest completed run's plain sentences for people. Empty when the agent wrote none. */readerSummary: string+ /** A short line built from data, for when there is no `readerSummary`. */+ factualLine: stringnextSteps: string[]+ /** The agent's own notes for its next run. They stay behind a click. */distillation: stringrecommendedNext: string+ live: BriefModel | null+ /** The newest challenger with a realized score. Null when no challenger has one. */+ scoredAlongside: BriefModel | null}-/** Fields for people that older runs and iterations do not have. */-interface ReaderFields {- headline?: string | null- summary?: string | null- reader_summary?: string | null- next_steps?: string[] | null-}+export type RunRole = 'live' | 'scored_alongside'++/** The longest experiment title, so that it fits one line at a narrow scene width. */+const TITLE_MAX_LENGTH = 72+const BRIEF_NEXT_STEPS = 3function firstSentence(text: string): string {const trimmed = text.trim()@@ -76,31 +89,69 @@ function firstSentence(text: string): string {return match ? match[0] : trimmed}-const HEADLINE_MAX_LENGTH = 60+function truncate(text: string, maxLength: number): string {+ if (text.length <= maxLength) {+ return text+ }+ const cut = text.slice(0, maxLength - 1)+ const lastSpace = cut.lastIndexOf(' ')+ return `${(lastSpace > maxLength / 2 ? cut.slice(0, lastSpace) : cut).trimEnd()}…`+}-function firstClause(text: string): string {- const clause = firstSentence(text).split(/[,;:]\s/)[0]- if (clause.length <= HEADLINE_MAX_LENGTH) {- return clause+/** A short title from the agent's description: its first clause, never a full paragraph. */+export function experimentTitle(description: string): string {+ const trimmed = description.trim()+ const match = trimmed.match(/^.*?(?:[.!?;:](?=\s|$)|\s[-–—]\s)/s)+ const clause = (match ? match[0] : trimmed).replace(/\s[-–—]\s$|[.;:]$/, '').trim()+ return truncate(clause, TITLE_MAX_LENGTH)+}++/** A run's one-line headline and the rest of its plain summary. */+export function runHeadline(run: AutoresearchTrainingRunApi, runNumber: number): { headline: string; detail: string } {+ const readerSummary = run.reader_summary?.trim() ?? ''+ const headline = run.headline?.trim()+ if (headline) {+ return { headline, detail: readerSummary }+ }+ if (readerSummary) {+ const first = firstSentence(readerSummary)+ return { headline: first, detail: readerSummary.slice(first.length).trim() }}- return `${clause.slice(0, HEADLINE_MAX_LENGTH).replace(/\s+\S*$/, '')}…`+ const best = run.best_holdout_score ?? bestKeptScore(run)+ return { headline: best != null ? `Run ${runNumber} · best ${best.toFixed(3)}` : `Run ${runNumber}`, detail: '' }+}++/** Short labels for the approaches a run ruled out. */+export function ruledOut(run: AutoresearchTrainingRunApi): string[] {+ return (run.summary?.dead_ends ?? [])+ .map((item) => truncate(experimentTitle(item.agent_description ?? ''), 40))+ .filter((label) => label)}-function runHeadline(run: AutoresearchTrainingRunApi, runNumber: number): string {- const { headline, reader_summary } = run as ReaderFields- return headline?.trim() || firstSentence(reader_summary ?? '') || `Run ${runNumber}`+function bestKeptScore(run: AutoresearchTrainingRunApi): number | null {+ const scores = run.iterations+ .filter((it) => it.status === 'kept' && it.holdout_score != null)+ .map((it) => it.holdout_score as number)+ return scores.length > 0 ? Math.max(...scores) : null}function oldestFirst(runs: AutoresearchTrainingRunApi[]): AutoresearchTrainingRunApi[] {return [...runs].sort((a, b) => a.created_at.localeCompare(b.created_at))}-/** The kept experiment that produced the champion: in its source run, the kept score nearest the champion's holdout AUC. */-function liveModelIteration(run: AutoresearchTrainingRunApi, champion: AutoresearchModelApi | null): number | null {- if (!champion || champion.source_training_run !== run.id) {+/** The newest challenger with a realized score: the model scored next to the live one. */+export function scoredChallenger(models: AutoresearchModelApi[]): AutoresearchModelApi | null {+ const scored = models.filter((m) => m.role === 'challenger' && m.realized_score != null)+ scored.sort((a, b) => b.created_at.localeCompare(a.created_at))+ return scored[0] ?? null+}++/** The kept experiment that produced a model: in its source run, the kept score nearest the model's holdout AUC. */+function modelIteration(run: AutoresearchTrainingRunApi, model: AutoresearchModelApi | null): number | null {+ if (!model || model.source_training_run !== run.id) {return null}- const target = champion.holdout_score ?? Infinity+ const target = model.holdout_score ?? Infinitylet best: { iterationNumber: number; distance: number; score: number } | null = nullfor (const it of run.iterations) {if (it.status !== 'kept' || it.holdout_score == null) {@@ -116,21 +167,27 @@ function liveModelIteration(run: AutoresearchTrainingRunApi, champion: Autoreseaexport function buildAgentSearch(trainingRuns: AutoresearchTrainingRunApi[],- champion: AutoresearchModelApi | null+ champion: AutoresearchModelApi | null,+ challenger: AutoresearchModelApi | null = null): AgentSearch {const points: SearchPoint[] = []const runs: SearchRunBand[] = []let best: number | null = nulloldestFirst(trainingRuns).forEach((run, runIndex) => {const runNumber = runIndex + 1- const liveIteration = liveModelIteration(run, champion)+ const liveIteration = modelIteration(run, champion)+ const challengerIteration = modelIteration(run, challenger)const iterations = [...run.iterations].sort((a, b) => a.iteration_number - b.iteration_number)const firstSeq = points.length + 1+ let previousKept: number | null = nullfor (const it of iterations) {const score = it.status === 'crashed' ? null : (it.holdout_score ?? null)- const bestBefore = best- if (it.status === 'kept' && score != null && (best == null || score > best)) {- best = score+ const keptBefore = previousKept+ if (it.status === 'kept' && score != null) {+ previousKept = score+ if (best == null || score > best) {+ best = score+ }}points.push({seq: points.length + 1,@@ -139,16 +196,14 @@ export function buildAgentSearch(iterationNumber: it.iteration_number,status: it.status,holdoutScore: score,- summary:- (it as ReaderFields).headline?.trim() ||- (it as ReaderFields).summary?.trim() ||- firstClause(it.agent_description ?? ''),+ summary: it.headline?.trim() || it.summary?.trim() || experimentTitle(it.agent_description ?? ''),agentDescription: it.agent_description ?? '',modelSpec: it.model_spec,- bestBefore,- delta: score != null && bestBefore != null ? score - bestBefore : null,+ previousKept: keptBefore,+ delta: score != null && keptBefore != null ? score - keptBefore : null,bestSoFar: best,isLiveModel: it.iteration_number === liveIteration,+ isScoredAlongside: it.iteration_number === challengerIteration,})}if (points.length >= firstSeq) {@@ -164,9 +219,9 @@ export function buildAgentSearch(return { points, runs }}-/** The y range of the chart: the scored points with some room, inside [0, 1]. Crashed points sit on its floor. */-export function searchYDomain(points: SearchPoint[]): [number, number] {- const scores = points.map((p) => p.holdoutScore).filter((s): s is number => s != null)+/** The y range of the chart: the scored points and any reference score with some room, inside [0, 1]. Crashed points sit on its floor. */+export function searchYDomain(points: SearchPoint[], reference: number | null = null): [number, number] {+ const scores = [...points.map((p) => p.holdoutScore), reference].filter((s): s is number => s != null)if (scores.length === 0) {return [0, 1]}@@ -191,60 +246,104 @@ export function experimentLogGroups(.map((run, index) => ({run,runNumber: index + 1,- headline: runHeadline(run, index + 1),entries: [...(pointsByRun.get(run.id) ?? [])].reverse(),})).reverse()}-/** The newest completed run's notes. Null when no completed run left any. */-export function latestAgentNotes(trainingRuns: AutoresearchTrainingRunApi[]): AgentNotes | null {+function briefModel(model: AutoresearchModelApi, runNumbers: Map<string, number>): BriefModel {+ return {+ runNumber: model.source_training_run ? (runNumbers.get(model.source_training_run) ?? null) : null,+ holdoutScore: model.holdout_score ?? null,+ realizedScore: model.realized_score ?? null,+ }+}++function factualLine(live: BriefModel | null, newestRunNumber: number | null, newestBest: number | null): string {+ const parts: string[] = []+ if (!live) {+ parts.push('There is no live model yet.')+ } else if (live.realizedScore != null && live.holdoutScore != null) {+ parts.push(+ `The live model scores ${live.holdoutScore.toFixed(3)} in training and ${live.realizedScore.toFixed(3)} on real outcomes.`+ )+ } else if (live.holdoutScore != null) {+ parts.push(+ `The live model scores ${live.holdoutScore.toFixed(3)} in training. It is not checked on real outcomes yet.`+ )+ }+ if (newestRunNumber != null && newestBest != null) {+ parts.push(`Run ${newestRunNumber} got a best score of ${newestBest.toFixed(3)} in training.`)+ }+ return parts.join(' ')+}++/** The status brief: the newest completed run's plain notes, or a factual line, and the live and scored-alongside models. */+export function statusBrief(+ trainingRuns: AutoresearchTrainingRunApi[],+ champion: AutoresearchModelApi | null,+ challenger: AutoresearchModelApi | null+): StatusBrief | null {const ordered = oldestFirst(trainingRuns)- for (let i = ordered.length - 1; i >= 0; i--) {- const run = ordered[i]- const { summary } = run- const readerSummary = (run as ReaderFields).reader_summary?.trim() ?? ''- const nextSteps = ((run as ReaderFields).next_steps ?? []).filter((step) => step.trim())- if (- run.status === 'completed' &&- (readerSummary || nextSteps.length || summary?.distillation || summary?.recommended_next)- ) {- return {- runNumber: i + 1,- readerSummary,- nextSteps,- distillation: summary?.distillation ?? '',- recommendedNext: summary?.recommended_next ?? '',- }- }+ const runNumbers = new Map(ordered.map((run, index) => [run.id, index + 1]))+ const newestIndex = ordered.map((run) => run.status).lastIndexOf('completed')+ const newest = newestIndex >= 0 ? ordered[newestIndex] : null+ if (!newest && !champion) {+ return null}- return null+ const live = champion ? briefModel(champion, runNumbers) : null+ const runNumber = newest ? newestIndex + 1 : null+ return {+ runNumber,+ readerSummary: newest?.reader_summary?.trim() ?? '',+ factualLine: factualLine(live, runNumber, newest ? (newest.best_holdout_score ?? bestKeptScore(newest)) : null),+ nextSteps: (newest?.next_steps ?? []).filter((step) => step.trim()).slice(0, BRIEF_NEXT_STEPS),+ distillation: newest?.summary?.distillation ?? '',+ recommendedNext: newest?.summary?.recommended_next ?? '',+ live,+ scoredAlongside: challenger ? briefModel(challenger, runNumbers) : null,+ }+}++/** Which runs produced the live model and the model scored alongside it. */+export function runRoles(+ champion: AutoresearchModelApi | null,+ challenger: AutoresearchModelApi | null+): Record<string, RunRole> {+ const roles: Record<string, RunRole> = {}+ if (challenger?.source_training_run) {+ roles[challenger.source_training_run] = 'scored_alongside'+ }+ if (champion?.source_training_run) {+ roles[champion.source_training_run] = 'live'+ }+ return roles}-/** The agent's model spec (class and hyperparameters), compact. random_state is noise, so it is dropped. */-export function formatModelSpec(spec: unknown): { className: string; params: string } | null {+/** The agent's model spec as key-value rows: the model class first, then its settings. random_state is noise, so it is dropped. */+export function modelSpecRows(spec: unknown): { key: string; value: string }[] {if (!spec || typeof spec !== 'object') {- return null+ return []}const { model_class, model_params } = spec as { model_class?: string; model_params?: Record<string, unknown> }const className = (model_class ?? '').split('.').pop() ?? ''- const params = model_params- ? Object.entries(model_params)- .filter(([key]) => key !== 'random_state')- .map(([key, value]) => `${key}=${value}`)- .join(', ')- : ''- return className || params ? { className, params } : null+ const rows = className ? [{ key: 'Model', value: className }] : []+ for (const [key, value] of Object.entries(model_params ?? {})) {+ if (key !== 'random_state') {+ rows.push({ key, value: typeof value === 'object' ? JSON.stringify(value) : String(value) })+ }+ }+ return rows}-/** "+0.021 vs best" style label for an experiment's change against the best score before it. */+/** "+0.021" style label for an experiment's change against the previous kept experiment in its run. */export function formatDelta(delta: number | null): string | null {if (delta == null) {return null}const rounded = Math.round(delta * 1000) / 1000if (rounded === 0) {- return 'Same as best'+ return 'No change'}- return `${rounded > 0 ? '+' : '−'}${Math.abs(rounded).toFixed(3)} vs best`+ return `${rounded > 0 ? '+' : '−'}${Math.abs(rounded).toFixed(3)}`}diff --git a/products/autoresearch/frontend/autoresearchPipelineLogic.ts b/products/autoresearch/frontend/autoresearchPipelineLogic.tsindex 8a85d8b26fcf..242c3cc9d409 100644--- a/products/autoresearch/frontend/autoresearchPipelineLogic.ts+++ b/products/autoresearch/frontend/autoresearchPipelineLogic.ts@@ -20,14 +20,17 @@ import { cohortsCreate } from 'products/cohorts/frontend/generated/api'import type { FeatureFlagsSet } from '../../../frontend/src/lib/logic/featureFlagLogic'import {- AgentNotes,AgentSearch,ExperimentLogFilter,ExperimentLogGroup,+ type RunRole,SearchPoint,+ type StatusBrief,buildAgentSearch,experimentLogGroups,- latestAgentNotes,+ runRoles,+ scoredChallenger,+ statusBrief,} from './agentSearch'import {autoresearchModelsList,@@ -84,6 +87,9 @@ import {} from './predictionSegments'import type { PredictionsPeopleView } from './predictionsPeopleQuery'+/** Where a person opened an experiment from. */+export type ExperimentOpenSource = 'chart' | 'log'+export interface AutoresearchPipelineLogicProps {id: string}@@ -284,7 +290,6 @@ export interface autoresearchPipelineLogicValues {accuracyCutoff: AccuracyCutoffactiveScoreRun: AutoresearchRunApi | nullactiveTab: AutoresearchPipelineTab- agentNotes: AgentNotes | nullagentSearch: AgentSearchartifactsByRun: Record<string, string[]>artifactsByRunLoading: boolean@@ -304,6 +309,7 @@ export interface autoresearchPipelineLogicValues {experimentLogGroups: ExperimentLogGroup[]firstCheck: dayjs.Dayjs | nullhasLiveTrainingRun: boolean+ hoveredSearchPoint: SearchPoint | nulllatestChampionPerformance: OnlinePerformanceRowApi | nulllatestPropertyCleanupRun: AutoresearchRunApi | nulllifecycleSteps: LifecycleStep[] | null@@ -315,6 +321,7 @@ export interface autoresearchPipelineLogicValues {onlinePerformance: OnlinePerformanceRowApi[]onlinePerformanceError: booleanonlinePerformanceLoading: boolean+ openedExperiment: SearchPoint | nullpersonPropertyDisabledReason: string | undefinedpipeline: AutoresearchPipelineApi | nullpipelineError: boolean@@ -327,9 +334,11 @@ export interface autoresearchPipelineLogicValues {probabilityDistributionError: booleanprobabilityDistributionLoading: booleanprobabilityHistogram: ProbabilityBucket[] | null+ queuedSuggestionCount: numberrealizedAucPoints: RealizedAucPoint[]reportByRun: Record<string, string | null>reportByRunLoading: boolean+ runRoles: Record<string, RunRole>runs: AutoresearchRunApi[]runsError: booleanrunsLoaded: boolean@@ -338,6 +347,7 @@ export interface autoresearchPipelineLogicValues {savingWritePersonProperty: booleanscoreResult: AutoresearchRunApi | nullscoreResultLoading: boolean+ scoredChallenger: AutoresearchModelApi | nullscoringCoverage: ScoringCoverage | nullsegmentCalibration: SegmentCalibration[]segmentDefinitions: PredictionSegmentDefinition[] | null@@ -345,6 +355,7 @@ export interface autoresearchPipelineLogicValues {selectedTab: AutoresearchPipelineTab | nullstartTrainingResult: AutoresearchTrainingRunApi | nullstartTrainingResultLoading: boolean+ statusBrief: StatusBrief | nullsuggestionDraft: stringsuggestionPriority: CreateSuggestionPriorityEnumApisuggestionSubmitResult: AutoresearchSuggestionApi | null@@ -390,9 +401,15 @@ export interface autoresearchPipelineLogicActions {viewedArtifact: nullpayload?: any}+ closeExperiment: () => {+ value: true+ }experimentDetailsOpened: (point: SearchPoint) => {point: SearchPoint}+ fullNotesOpened: () => {+ value: true+ }loadDailyVolume: () => anyloadDailyVolumeFailure: (error: string,@@ -587,6 +604,13 @@ export interface autoresearchPipelineLogicActions {trainingRuns: AutoresearchTrainingRunApi[]payload?: any}+ openExperiment: (+ point: SearchPoint,+ source: ExperimentOpenSource+ ) => {+ point: SearchPoint+ source: ExperimentOpenSource+ }pausePipeline: () => anypausePipelineFailure: (error: string,@@ -668,6 +692,9 @@ export interface autoresearchPipelineLogicActions {setExperimentLogFilter: (filter: ExperimentLogFilter) => {filter: ExperimentLogFilter}+ setHoveredSearchPoint: (point: SearchPoint | null) => {+ point: SearchPoint | null+ }setPredictionsPeopleView: (view: PredictionsPeopleView) => {view: PredictionsPeopleView}@@ -714,6 +741,9 @@ export interface autoresearchPipelineLogicActions {startTrainingResult: AutoresearchTrainingRunApi | nullpayload?: any}+ steerOpened: () => {+ value: true+ }submitSuggestion: () => anysubmitSuggestionFailure: (error: string,@@ -804,13 +834,27 @@ export interface autoresearchPipelineLogicMeta {firstCheck: (runs: AutoresearchRunApi[], pipeline: AutoresearchPipelineApi | null) => dayjs.Dayjs | nullprobabilityHistogram: (probabilityDistribution: ProbabilityBucket[] | null) => ProbabilityBucket[] | nullhasLiveTrainingRun: (trainingRuns: AutoresearchTrainingRunApi[]) => boolean- agentSearch: (trainingRuns: AutoresearchTrainingRunApi[], champion: AutoresearchModelApi | null) => AgentSearch+ scoredChallenger: (models: AutoresearchModelApi[]) => AutoresearchModelApi | null+ runRoles: (+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ) => Record<string, RunRole>+ queuedSuggestionCount: (suggestions: AutoresearchSuggestionApi[]) => number+ agentSearch: (+ trainingRuns: AutoresearchTrainingRunApi[],+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ) => AgentSearchexperimentLogGroups: (trainingRuns: AutoresearchTrainingRunApi[],agentSearch: AgentSearch,experimentLogFilter: ExperimentLogFilter) => ExperimentLogGroup[]- agentNotes: (trainingRuns: AutoresearchTrainingRunApi[]) => AgentNotes | null+ statusBrief: (+ trainingRuns: AutoresearchTrainingRunApi[],+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ) => StatusBrief | nulldefaultTab: (pipeline: AutoresearchPipelineApi | null) => AutoresearchPipelineTablatestPropertyCleanupRun: (runs: AutoresearchRunApi[]) => AutoresearchRunApi | nullpersonPropertyDisabledReason: (@@ -867,6 +911,11 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([toggleLogRun: (runId: string) => ({ runId }),searchPointClicked: (point: SearchPoint) => ({ point }),experimentDetailsOpened: (point: SearchPoint) => ({ point }),+ openExperiment: (point: SearchPoint, source: ExperimentOpenSource) => ({ point, source }),+ closeExperiment: true,+ setHoveredSearchPoint: (point: SearchPoint | null) => ({ point }),+ steerOpened: true,+ fullNotesOpened: true,saveSegmentCohort: (segment: PredictionSegmentKey) => ({ segment }),saveSegmentCohortFinished: true,setWritePersonProperty: (enabled: boolean, source: PersonPropertyToggleSource) => ({ enabled, source }),@@ -929,6 +978,19 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([current.includes(point.runId) ? current : [...current, point.runId],},],+ openedExperiment: [+ null as SearchPoint | null,+ {+ openExperiment: (_, { point }) => point,+ closeExperiment: () => null,+ },+ ],+ hoveredSearchPoint: [+ null as SearchPoint | null,+ {+ setHoveredSearchPoint: (_, { point }) => point,+ },+ ],suggestionDraft: ['',{@@ -1440,10 +1502,29 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([(s) => [s.trainingRuns],(trainingRuns: AutoresearchTrainingRunApi[]): boolean => trainingRuns.some(isTrainingRunLive),],+ scoredChallenger: [+ (s) => [s.models],+ (models: AutoresearchModelApi[]): AutoresearchModelApi | null => scoredChallenger(models),+ ],+ runRoles: [+ (s) => [s.champion, s.scoredChallenger],+ (+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ): Record<string, RunRole> => runRoles(champion, scoredChallenger),+ ],+ queuedSuggestionCount: [+ (s) => [s.suggestions],+ (suggestions: AutoresearchSuggestionApi[]): number =>+ suggestions.filter((suggestion) => suggestion.status === 'queued').length,+ ],agentSearch: [- (s) => [s.trainingRuns, s.champion],- (trainingRuns: AutoresearchTrainingRunApi[], champion: AutoresearchModelApi | null): AgentSearch =>- buildAgentSearch(trainingRuns, champion),+ (s) => [s.trainingRuns, s.champion, s.scoredChallenger],+ (+ trainingRuns: AutoresearchTrainingRunApi[],+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ): AgentSearch => buildAgentSearch(trainingRuns, champion, scoredChallenger),],experimentLogGroups: [(s) => [s.trainingRuns, s.agentSearch, s.experimentLogFilter],@@ -1453,9 +1534,13 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([experimentLogFilter: ExperimentLogFilter): ExperimentLogGroup[] => experimentLogGroups(trainingRuns, agentSearch, experimentLogFilter),],- agentNotes: [- (s) => [s.trainingRuns],- (trainingRuns: AutoresearchTrainingRunApi[]): AgentNotes | null => latestAgentNotes(trainingRuns),+ statusBrief: [+ (s) => [s.trainingRuns, s.champion, s.scoredChallenger],+ (+ trainingRuns: AutoresearchTrainingRunApi[],+ champion: AutoresearchModelApi | null,+ scoredChallenger: AutoresearchModelApi | null+ ): StatusBrief | null => statusBrief(trainingRuns, champion, scoredChallenger),],defaultTab: [(s) => [s.pipeline],@@ -1695,6 +1780,35 @@ export const autoresearchPipelineLogic = kea<autoresearchPipelineLogicType>([iteration_number: point.iterationNumber,status: point.status,})+ actions.openExperiment(point, 'chart')+ },+ openExperiment: ({ point, source }) => {+ // pinned: analytics event name and properties. Renaming breaks insights built on them.+ posthog.capture('autoresearch agent research experiment opened', {+ pipeline_id: props.id,+ run_id: point.runId,+ iteration_number: point.iterationNumber,+ status: point.status,+ source,+ })+ actions.experimentDetailsOpened(point)+ if (!values.artifactsByRun[point.runId]) {+ actions.loadRunArtifacts({ runId: point.runId })+ }+ },+ steerOpened: () => {+ // pinned: analytics event name and properties. Renaming breaks insights built on them.+ posthog.capture('autoresearch agent research steer opened', {+ pipeline_id: props.id,+ queued_count: values.queuedSuggestionCount,+ })+ },+ fullNotesOpened: () => {+ // pinned: analytics event name and properties. Renaming breaks insights built on them.+ posthog.capture('autoresearch agent research full notes opened', {+ pipeline_id: props.id,+ run_number: values.statusBrief?.runNumber ?? null,+ })},experimentDetailsOpened: ({ point }) => {// pinned: analytics event name and properties. Renaming breaks insights built on them.diff --git a/products/autoresearch/frontend/pipeline/AgentNotes.tsx b/products/autoresearch/frontend/pipeline/AgentNotes.tsxdeleted file mode 100644index ca21eba8884e..000000000000--- a/products/autoresearch/frontend/pipeline/AgentNotes.tsx+++ /dev/null@@ -1,62 +0,0 @@-import { useValues } from 'kea'--import { LemonCollapse } from '@posthog/lemon-ui'--import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'-import { SectionCard } from './SectionCard'--/** What the newest completed run learned, and what comes next. Renders nothing before any notes exist. */-export function AgentNotes(): JSX.Element | null {- const { agentNotes } = useValues(autoresearchPipelineLogic)- if (!agentNotes) {- return null- }- const { readerSummary, nextSteps, distillation, recommendedNext, runNumber } = agentNotes- // The agent writes its own notes for its next run, so they go behind a toggle when plainer notes exist.- const hasReaderNotes = !!readerSummary || nextSteps.length > 0- const hasWorkingNotes = !!distillation || !!recommendedNext- return (- <SectionCard title="What the agent learned">- {hasReaderNotes ? (- <>- {readerSummary && <div className="text-sm">{readerSummary}</div>}- {nextSteps.length > 0 && (- <div className="text-sm">- <div className="text-muted">Next steps</div>- <ul className="list-disc pl-5">- {nextSteps.map((step) => (- <li key={step}>{step}</li>- ))}- </ul>- </div>- )}- {hasWorkingNotes && (- <LemonCollapse- embedded- size="xsmall"- panels={[- {- key: 'notes',- header: "Agent's working notes",- dataAttr: 'autoresearch-agent-working-notes',- content: (- <div className="space-y-1 text-xs text-muted">- {distillation && <div>{distillation}</div>}- {recommendedNext && <div>Next it plans to: {recommendedNext}</div>}- </div>- ),- },- ]}- />- )}- </>- ) : (- <>- {distillation && <div className="text-sm">{distillation}</div>}- {recommendedNext && <div className="text-sm text-muted">Next it plans to: {recommendedNext}</div>}- </>- )}- <div className="text-xs text-muted">From run {runNumber}</div>- </SectionCard>- )-}diff --git a/products/autoresearch/frontend/pipeline/AgentResearchTab.tsx b/products/autoresearch/frontend/pipeline/AgentResearchTab.tsxindex a0639cb43391..94347a3cacab 100644--- a/products/autoresearch/frontend/pipeline/AgentResearchTab.tsx+++ b/products/autoresearch/frontend/pipeline/AgentResearchTab.tsx@@ -1,20 +1,16 @@-import { AgentNotes } from './AgentNotes'-import { LiveModelCard } from './LiveModelCard'-import { SuggestionsTab } from './SuggestionsTab'+import { ExperimentDrawer } from './ExperimentDrawer'+import { StatusBrief } from './StatusBrief'+import { SteerAgentBar } from './SteerAgentBar'import { TrainingTab } from './TrainingTab'-/** What the agent did (search chart, experiment log) next to the live model, its notes, and how to steer it. */+/** Where the live model stands, how to steer the next run, then what the agent did (search chart, run log). */export function AgentResearchTab(): JSX.Element {return (- <div className="@container">- <div className="grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)] gap-4 items-start">- <TrainingTab />- <div className="space-y-4 min-w-0">- <LiveModelCard />- <AgentNotes />- <SuggestionsTab />- </div>- </div>+ <div className="@container space-y-4 min-w-0">+ <StatusBrief />+ <SteerAgentBar />+ <TrainingTab />+ <ExperimentDrawer /></div>)}diff --git a/products/autoresearch/frontend/pipeline/AgentSearchChart.tsx b/products/autoresearch/frontend/pipeline/AgentSearchChart.tsxindex 3c7cae9068cb..f96310a22315 100644--- a/products/autoresearch/frontend/pipeline/AgentSearchChart.tsx+++ b/products/autoresearch/frontend/pipeline/AgentSearchChart.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import { useMemo } from 'react'+import { useEffect, useMemo } from 'react'import { ScatterChart, TooltipFooter, TooltipSurface, TooltipSwatch } from '@posthog/quill-charts'import type { ScatterChartConfig, ScatterPoint, ScatterSeries } from '@posthog/quill-charts'@@ -9,26 +9,32 @@ import { useChartTheme } from 'lib/charts/hooks'import { type SearchPoint, formatDelta, searchYDomain } from '../agentSearch'import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'import { AgentSearchOverlay } from './AgentSearchOverlay'+import { EXPERIMENT_STATUS } from './experimentStatus'import { SectionCard } from './SectionCard'-const STATUS_LABEL: Record<SearchPoint['status'], string> = {- kept: 'Kept',- discarded: 'Discarded',- crashed: 'Crashed',-}-// Room above the plot for the run band labels.const CHART_MARGINS = { top: 24 }-/** Every experiment across runs: holdout AUC by status, the best score so far, run bands and the live model. */+/** Tells the logic which point the tooltip shows, so the plain line can render under the chart. */+function HoveredPoint({ point }: { point: SearchPoint }): null {+ const { setHoveredSearchPoint } = useActions(autoresearchPipelineLogic)+ useEffect(() => {+ setHoveredSearchPoint(point)+ return () => setHoveredSearchPoint(null)+ }, [point, setHoveredSearchPoint])+ return null+}++/** Every experiment across runs: holdout AUC by status, the best score so far, run bands, the live model and its realized AUC. */export function AgentSearchChart(): JSX.Element | null {- const { agentSearch } = useValues(autoresearchPipelineLogic)+ const { agentSearch, champion, hoveredSearchPoint } = useValues(autoresearchPipelineLogic)const { searchPointClicked } = useActions(autoresearchPipelineLogic)const theme = useChartTheme()+ const liveRealized = champion?.realized_score ?? nullconst { series, config } = useMemo(() => {const points = agentSearch.points- const yDomain = searchYDomain(points)+ const yDomain = searchYDomain(points, liveRealized)const toPoint = (p: SearchPoint): ScatterPoint<SearchPoint> => ({x: p.seq,y: p.holdoutScore ?? yDomain[0],@@ -38,21 +44,21 @@ export function AgentSearchChart(): JSX.Element | null {const series: ScatterSeries<SearchPoint>[] = [{key: 'kept',- label: 'Kept',- color: 'var(--success)',+ label: EXPERIMENT_STATUS.kept.label,+ color: EXPERIMENT_STATUS.kept.color,points: points.filter((p) => p.status === 'kept' && p.holdoutScore != null).map(toPoint),},{key: 'discarded',- label: 'Discarded',- color: 'var(--color-text-secondary)',+ label: EXPERIMENT_STATUS.discarded.label,+ color: EXPERIMENT_STATUS.discarded.color,pointRadius: 3,points: points.filter((p) => p.status === 'discarded' && p.holdoutScore != null).map(toPoint),},{key: 'crashed',- label: 'Crashed',- color: 'var(--danger)',+ label: EXPERIMENT_STATUS.crashed.label,+ color: EXPERIMENT_STATUS.crashed.color,shape: 'cross',points: points.filter((p) => p.status === 'crashed' || p.holdoutScore == null).map(toPoint),},@@ -63,12 +69,12 @@ export function AgentSearchChart(): JSX.Element | null {label: 'Experiment',tickFormatter: (value) => (Number.isInteger(value) ? String(value) : ''),},- yAxis: { domain: yDomain, label: 'Holdout AUC', tickFormatter: (value) => value.toFixed(2) },+ yAxis: { domain: yDomain, label: 'AUC in training', tickFormatter: (value) => value.toFixed(2) },legend: { show: true },margins: CHART_MARGINS,}return { series, config }- }, [agentSearch])+ }, [agentSearch, liveRealized])if (agentSearch.points.length === 0) {return null@@ -76,8 +82,12 @@ export function AgentSearchChart(): JSX.Element | null {return (<SectionCard- title="How the agent found it"- description="Each dot is one experiment. The agent keeps a change only when it beats the best score so far."+ title="How the agent got here"+ description={+ liveRealized != null+ ? 'Each dot is one experiment, scored in training. The agent keeps a change only when it improves the score. The dashed line is the live model on real outcomes.'+ : 'Each dot is one experiment, scored in training. The agent keeps a change only when it improves the score.'+ }><div className="h-64 min-w-0 flex flex-col"><ScatterChart@@ -94,26 +104,36 @@ export function AgentSearchChart(): JSX.Element | null {const delta = formatDelta(p.delta)return (<TooltipSurface data-attr="autoresearch-search-chart-tooltip">+ <HoveredPoint point={p} /><div className="font-semibold text-sm">{`Run ${p.runNumber} · experiment ${p.iterationNumber}`}</div><div className="flex items-center gap-2 mt-1"><TooltipSwatch color={point.color} />- <span>{STATUS_LABEL[p.status]}</span>+ <span>{EXPERIMENT_STATUS[p.status].label}</span>{p.holdoutScore != null && (- <strong className="tabular-nums">{`AUC ${p.holdoutScore.toFixed(3)}`}</strong>+ <strong className="tabular-nums">{p.holdoutScore.toFixed(3)}</strong>)}{delta && <span className="opacity-70">{delta}</span>}</div>- {p.agentDescription && (- <div className="mt-1 max-w-80 break-words opacity-80">{p.agentDescription}</div>- )}- <TooltipFooter>Click to open this run in the log</TooltipFooter>+ <TooltipFooter>Click to open the experiment</TooltipFooter></TooltipSurface>)}}>- <AgentSearchOverlay search={agentSearch} />+ <AgentSearchOverlay search={agentSearch} liveRealized={liveRealized} /></ScatterChart></div>+ <div className="text-sm min-h-5 truncate" data-attr="autoresearch-search-chart-hovered">+ {hoveredSearchPoint ? (+ <>+ <span className="text-muted">{`Run ${hoveredSearchPoint.runNumber} · #${hoveredSearchPoint.iterationNumber}: `}</span>+ {hoveredSearchPoint.summary || 'No description'}+ </>+ ) : (+ <span className="text-muted">+ Point at a dot to read what the agent tried. Click it to open the experiment.+ </span>+ )}+ </div></SectionCard>)}diff --git a/products/autoresearch/frontend/pipeline/AgentSearchOverlay.tsx b/products/autoresearch/frontend/pipeline/AgentSearchOverlay.tsxindex 65546173d96a..b79dfa7f7a52 100644--- a/products/autoresearch/frontend/pipeline/AgentSearchOverlay.tsx+++ b/products/autoresearch/frontend/pipeline/AgentSearchOverlay.tsx@@ -6,11 +6,53 @@ import { dayjs } from 'lib/dayjs'import type { AgentSearch } from '../agentSearch'+/** A ring around one point with a label above it, or below it near the top where the run band labels sit. */+function PointMarker({+ x,+ y,+ label,+ plotTop,+ plotRight,+ color,+}: {+ x: number+ y: number+ label: string+ plotTop: number+ plotRight: number+ color: string+}): JSX.Element {+ return (+ <g>+ <circle cx={x} cy={y} r={8} fill="none" stroke={color} strokeWidth={2} />+ <text+ x={x}+ y={y - 12 < plotTop + 14 ? y + 20 : y - 12}+ fontSize={11}+ fontWeight={600}+ textAnchor={x > plotRight - 60 ? 'end' : 'middle'}+ fill="var(--color-text-primary)"+ stroke="var(--color-bg-surface-primary)"+ strokeWidth={3}+ paintOrder="stroke"+ >+ {label}+ </text>+ </g>+ )+}+/**- * Run bands, the best-so-far step line and the live model marker, drawn over the scatter.+ * Run bands, the best-so-far step line, the live model's realized AUC, and the live and scored-alongside markers, drawn over the scatter.* The parent pins the x domain to [0.5, N + 0.5], so x maps linearly from `seq`.*/-export function AgentSearchOverlay({ search }: { search: AgentSearch }): JSX.Element {+export function AgentSearchOverlay({+ search,+ liveRealized,+}: {+ search: AgentSearch+ liveRealized: number | null+}): JSX.Element {const clipId = useId()const { dimensions, scales } = useChartLayout()const { plotLeft, plotTop, plotWidth, plotHeight } = dimensions@@ -32,8 +74,9 @@ export function AgentSearchOverlay({ search }: { search: AgentSearch }): JSX.Eleconst stepPath = segments.join(' ')const live = search.points.find((p) => p.isLiveModel && p.holdoutScore != null)- const liveX = live ? xOf(live.seq) : null- const liveY = live?.holdoutScore != null ? scales.y(live.holdoutScore) : null+ const alongside = search.points.find((p) => p.isScoredAlongside && p.holdoutScore != null)+ const realizedY = liveRealized != null ? scales.y(liveRealized) : null+ const plotRight = plotLeft + plotWidthreturn (<svg@@ -80,25 +123,51 @@ export function AgentSearchOverlay({ search }: { search: AgentSearch }): JSX.Ele)})}<path d={stepPath} fill="none" stroke="var(--success)" strokeWidth={1.5} strokeOpacity={0.8} />- {liveX != null && liveY != null && (- <g>- <circle cx={liveX} cy={liveY} r={8} fill="none" stroke="var(--success)" strokeWidth={2} />+ {realizedY != null && (+ <g data-attr="autoresearch-search-overlay-realized">+ <line+ x1={plotLeft}+ x2={plotRight}+ y1={realizedY}+ y2={realizedY}+ stroke="var(--color-text-secondary)"+ strokeWidth={1.5}+ strokeDasharray="6 4"+ /><text- x={liveX}- // Near the top, the run band labels take the space above the marker.- y={liveY - 12 < plotTop + 14 ? liveY + 20 : liveY - 12}- fontSize={11}- fontWeight={600}- textAnchor={liveX > plotLeft + plotWidth - 40 ? 'end' : 'middle'}- fill="var(--color-text-primary)"+ x={plotLeft + 4}+ y={realizedY + 12}+ fontSize={10}+ textAnchor="start"+ fill="var(--color-text-secondary)"stroke="var(--color-bg-surface-primary)"strokeWidth={3}paintOrder="stroke">- Live model+ {`Live model on real outcomes · ${liveRealized?.toFixed(3)}`}</text></g>)}+ {alongside?.holdoutScore != null && (+ <PointMarker+ x={xOf(alongside.seq)}+ y={scales.y(alongside.holdoutScore)}+ label="Scored alongside"+ plotTop={plotTop}+ plotRight={plotRight}+ color="var(--color-text-secondary)"+ />+ )}+ {live?.holdoutScore != null && (+ <PointMarker+ x={xOf(live.seq)}+ y={scales.y(live.holdoutScore)}+ label="Live model"+ plotTop={plotTop}+ plotRight={plotRight}+ color="var(--success)"+ />+ )}</g></svg>)diff --git a/products/autoresearch/frontend/pipeline/ExperimentDrawer.tsx b/products/autoresearch/frontend/pipeline/ExperimentDrawer.tsxnew file mode 100644index 000000000000..243c251d9d53--- /dev/null+++ b/products/autoresearch/frontend/pipeline/ExperimentDrawer.tsx@@ -0,0 +1,130 @@+import { useActions, useValues } from 'kea'+import { useState } from 'react'++import { LemonButton, LemonModal, LemonTable, LemonTabs, LemonTag, Spinner } from '@posthog/lemon-ui'++import { formatDelta, modelSpecRows } from '../agentSearch'+import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import { EXPERIMENT_STATUS } from './experimentStatus'++type DrawerTab = 'notes' | 'settings' | 'files'++/** One experiment in full: its plain line, status, score and change, then the agent's notes, model settings and run files. */+export function ExperimentDrawer(): JSX.Element {+ const { openedExperiment, artifactsByRun, artifactsByRunLoading } = useValues(autoresearchPipelineLogic)+ const { closeExperiment, viewArtifact } = useActions(autoresearchPipelineLogic)+ const [activeTab, setActiveTab] = useState<DrawerTab>('notes')+ const experiment = openedExperiment+ const status = experiment ? EXPERIMENT_STATUS[experiment.status] : null+ const delta = experiment ? formatDelta(experiment.delta) : null+ const settings = experiment ? modelSpecRows(experiment.modelSpec) : []+ const paths = experiment ? artifactsByRun[experiment.runId] : undefined++ return (+ <LemonModal+ isOpen={!!experiment}+ onClose={() => {+ closeExperiment()+ setActiveTab('notes')+ }}+ title={experiment ? `Run ${experiment.runNumber} · experiment #${experiment.iterationNumber}` : ''}+ width={720}+ >+ {experiment && status && (+ <div className="space-y-3" data-attr="autoresearch-experiment-drawer">+ <div className="text-base font-semibold">{experiment.summary || 'No description'}</div>+ <div className="flex flex-wrap items-center gap-2 text-sm">+ <LemonTag type={status.type}>{status.label}</LemonTag>+ {experiment.isLiveModel && <LemonTag type="completion">Live model</LemonTag>}+ {experiment.isScoredAlongside && <LemonTag type="highlight">Scored alongside</LemonTag>}+ <span className="font-semibold tabular-nums">+ {experiment.holdoutScore != null ? experiment.holdoutScore.toFixed(3) : 'No score'}+ </span>+ {delta && (+ <span className="text-secondary">+ <span+ className={experiment.delta != null && experiment.delta > 0 ? 'text-success' : ''}+ >+ {delta}+ </span>{' '}+ vs the last improvement in this run+ </span>+ )}+ </div>+ <LemonTabs+ activeKey={activeTab}+ onChange={setActiveTab}+ tabs={[+ {+ key: 'notes',+ label: "Agent's notes",+ content: experiment.agentDescription ? (+ <div className="text-sm whitespace-pre-line">{experiment.agentDescription}</div>+ ) : (+ <div className="text-sm text-muted">+ The agent left no notes for this experiment.+ </div>+ ),+ },+ {+ key: 'settings',+ label: 'Model settings',+ content: (+ <LemonTable+ size="small"+ dataSource={settings}+ rowKey="key"+ emptyState="No model settings recorded."+ columns={[+ {+ title: 'Setting',+ dataIndex: 'key',+ render: (_, row) => <span className="font-mono">{row.key}</span>,+ },+ {+ title: 'Value',+ dataIndex: 'value',+ render: (_, row) => (+ <span className="font-mono break-all">{row.value}</span>+ ),+ },+ ]}+ />+ ),+ },+ {+ key: 'files',+ label: 'Files',+ content:+ paths === undefined && artifactsByRunLoading ? (+ <Spinner />+ ) : paths && paths.length > 0 ? (+ <div className="space-y-2">+ <div className="text-xs text-muted">+ Files the agent uploaded for run {experiment.runNumber}.+ </div>+ <div className="flex flex-wrap gap-2">+ {paths.map((path) => (+ <LemonButton+ key={path}+ type="secondary"+ size="small"+ onClick={() => viewArtifact({ runId: experiment.runId, path })}+ data-attr="autoresearch-experiment-drawer-file"+ >+ {path}+ </LemonButton>+ ))}+ </div>+ </div>+ ) : (+ <div className="text-sm text-muted">No files uploaded for this run.</div>+ ),+ },+ ]}+ />+ </div>+ )}+ </LemonModal>+ )+}diff --git a/products/autoresearch/frontend/pipeline/ExperimentLog.tsx b/products/autoresearch/frontend/pipeline/ExperimentLog.tsxindex 224279dc77bd..c69a5918b339 100644--- a/products/autoresearch/frontend/pipeline/ExperimentLog.tsx+++ b/products/autoresearch/frontend/pipeline/ExperimentLog.tsx@@ -1,8 +1,8 @@import { useActions, useValues } from 'kea'-import { LemonButton, LemonSegmentedButton } from '@posthog/lemon-ui'+import { LemonButton, LemonSegmentedButton, LemonTag } from '@posthog/lemon-ui'-import type { ExperimentLogFilter } from '../agentSearch'+import { type ExperimentLogFilter, ruledOut } from '../agentSearch'import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'import { ExperimentLogEntry } from './ExperimentLogEntry'import { SectionCard } from './SectionCard'@@ -10,18 +10,18 @@ import { TrainingRunRow } from './TrainingRunRow'const FILTER_OPTIONS: { value: ExperimentLogFilter; label: string }[] = [{ value: 'all', label: 'All' },- { value: 'kept', label: 'Kept' },- { value: 'discarded', label: 'Discarded' },+ { value: 'kept', label: 'Improved' },+ { value: 'discarded', label: 'No gain' },{ value: 'crashed', label: 'Crashed' },]-/** Every experiment, grouped by training run, newest first. Only the latest run shows its experiments by default. */+/** Every run, newest first, with its experiments and the approaches it ruled out. Only the latest run shows its experiments by default. */export function ExperimentLog(): JSX.Element {const { experimentLogGroups, experimentLogFilter, expandedLogRunIds } = useValues(autoresearchPipelineLogic)const { setExperimentLogFilter, toggleLogRun } = useActions(autoresearchPipelineLogic)return (<SectionCard- title="Experiment log"+ title="Runs"actions={<LemonSegmentedButtonsize="xsmall"@@ -34,6 +34,7 @@ export function ExperimentLog(): JSX.Element {>{experimentLogGroups.map((group, index) => {const showEntries = index === 0 || expandedLogRunIds.includes(group.run.id)+ const ruledOutLabels = showEntries ? ruledOut(group.run) : []return (<TrainingRunRow key={group.run.id} run={group.run} runNumber={group.runNumber}>{group.entries.length === 0 ? (@@ -44,12 +45,8 @@ export function ExperimentLog(): JSX.Element {)) : showEntries ? (<div className="border-t">- {group.entries.map((entry, entryIndex) => (- <ExperimentLogEntry- key={entry.seq}- entry={entry}- defaultOpen={index === 0 && entryIndex === 0}- />+ {group.entries.map((entry) => (+ <ExperimentLogEntry key={entry.seq} entry={entry} />))}</div>) : (@@ -63,6 +60,16 @@ export function ExperimentLog(): JSX.Element {</LemonButton></div>)}+ {ruledOutLabels.length > 0 && (+ <div className="border-t px-3 py-2 flex flex-wrap items-center gap-1 text-xs">+ <span className="text-muted">Ruled out:</span>+ {ruledOutLabels.map((label, labelIndex) => (+ <LemonTag key={labelIndex} size="small">+ {label}+ </LemonTag>+ ))}+ </div>+ )}</TrainingRunRow>)})}diff --git a/products/autoresearch/frontend/pipeline/ExperimentLogEntry.tsx b/products/autoresearch/frontend/pipeline/ExperimentLogEntry.tsxindex b0c1bd0b24ab..60852b44ef0f 100644--- a/products/autoresearch/frontend/pipeline/ExperimentLogEntry.tsx+++ b/products/autoresearch/frontend/pipeline/ExperimentLogEntry.tsx@@ -1,81 +1,53 @@import { useActions } from 'kea'-import { LemonCollapse, LemonTag } from '@posthog/lemon-ui'+import { LemonButton, LemonTag } from '@posthog/lemon-ui'-import { type SearchPoint, formatDelta, formatModelSpec } from '../agentSearch'+import { type SearchPoint, formatDelta } from '../agentSearch'import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import { EXPERIMENT_STATUS } from './experimentStatus'-const STATUS_TAG: Record<SearchPoint['status'], { type: 'success' | 'default' | 'danger'; label: string }> = {- kept: { type: 'success', label: 'Kept' },- discarded: { type: 'default', label: 'Discarded' },- crashed: { type: 'danger', label: 'Crashed' },-}--/** One experiment in the log as one line, with the agent's own notes behind a toggle. */-export function ExperimentLogEntry({- entry,- defaultOpen = false,-}: {- entry: SearchPoint- defaultOpen?: boolean-}): JSX.Element {- const { experimentDetailsOpened } = useActions(autoresearchPipelineLogic)- const tag = STATUS_TAG[entry.status]- const spec = formatModelSpec(entry.modelSpec)+/** One experiment in the log as one line. Click it to open the experiment. */+export function ExperimentLogEntry({ entry }: { entry: SearchPoint }): JSX.Element {+ const { openExperiment } = useActions(autoresearchPipelineLogic)+ const status = EXPERIMENT_STATUS[entry.status]const delta = formatDelta(entry.delta)- const hasNotes = (!!entry.agentDescription && entry.agentDescription !== entry.summary) || !!specreturn (- <div className="border-t first:border-t-0 px-3 py-2 space-y-1">- <div className="flex items-center gap-2 min-w-0">- <span className="text-sm font-semibold shrink-0">#{entry.iterationNumber}</span>- <LemonTag type={tag.type} size="small" className="shrink-0">- {tag.label}- </LemonTag>- {entry.isLiveModel && (- <LemonTag type="completion" size="small" className="shrink-0">- Live model- </LemonTag>- )}- <span className="text-sm truncate flex-1 min-w-0" title={entry.summary}>- {entry.summary}- </span>- <span className="text-xs text-muted tabular-nums shrink-0">- {entry.holdoutScore != null ? `AUC ${entry.holdoutScore.toFixed(3)}` : 'No score'}+ <div className="border-t first:border-t-0 px-1 py-0.5">+ <LemonButton+ fullWidth+ size="small"+ onClick={() => openExperiment(entry, 'log')}+ data-attr="autoresearch-experiment-log-entry"+ tooltip={`${status.label}. Open the experiment.`}+ >+ <span className="flex items-center gap-2 min-w-0 w-full font-normal">+ <span className={`size-2 rounded-full shrink-0 ${status.dotClassName}`} aria-label={status.label} />+ <span className="text-xs text-muted tabular-nums shrink-0">#{entry.iterationNumber}</span>+ <span className="text-sm truncate flex-1 min-w-0">{entry.summary || 'No description'}</span>+ {entry.isLiveModel && (+ <LemonTag type="completion" size="small" className="shrink-0">+ Live model+ </LemonTag>+ )}+ {entry.isScoredAlongside && (+ <LemonTag type="highlight" size="small" className="shrink-0">+ Scored alongside+ </LemonTag>+ )}{delta && (- <span className={entry.delta != null && entry.delta > 0 ? 'text-success ml-2' : 'ml-2'}>+ <span+ className={`text-xs tabular-nums shrink-0 ${+ entry.delta != null && entry.delta > 0 ? 'text-success' : 'text-muted'+ }`}+ >{delta}</span>)}+ <span className="text-xs font-semibold tabular-nums shrink-0 w-10 text-right">+ {entry.holdoutScore != null ? entry.holdoutScore.toFixed(3) : '—'}+ </span></span>- </div>- {hasNotes && (- <LemonCollapse- embedded- size="xsmall"- defaultActiveKey={defaultOpen ? 'notes' : undefined}- onChange={(key) => key === 'notes' && experimentDetailsOpened(entry)}- panels={[- {- key: 'notes',- header: "Agent's working notes",- dataAttr: 'autoresearch-experiment-details',- content: (- <div className="space-y-1">- {entry.agentDescription && (- <div className="text-sm whitespace-pre-line">{entry.agentDescription}</div>- )}- {spec && (- <div className="text-xs text-muted font-mono break-words">- {spec.className}- {spec.params && ` · ${spec.params}`}- </div>- )}- </div>- ),- },- ]}- />- )}+ </LemonButton></div>)}diff --git a/products/autoresearch/frontend/pipeline/LiveModelCard.tsx b/products/autoresearch/frontend/pipeline/LiveModelCard.tsxdeleted file mode 100644index 780d521beafe..000000000000--- a/products/autoresearch/frontend/pipeline/LiveModelCard.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { useValues } from 'kea'--import { LemonTag, Tooltip } from '@posthog/lemon-ui'--import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'-import { FeatureImportanceChart } from './FeatureImportanceChart'-import { MetricCard } from './MetricCard'-import { SectionCard } from './SectionCard'--/** The champion model: its metrics, feature drivers, and the agent's description. Renders nothing before a champion exists. */-export function LiveModelCard(): JSX.Element | null {- const { champion } = useValues(autoresearchPipelineLogic)- if (!champion) {- return null- }- return (- <SectionCard- title={- <>- Live model- {champion.is_preliminary && (- <Tooltip title="Promoted on holdout AUC alone. Realized metrics confirm it once prediction horizons elapse.">- <LemonTag type="warning">Preliminary</LemonTag>- </Tooltip>- )}- </>- }- >- <div className="grid grid-cols-2 gap-3">- <MetricCard- label="Holdout AUC"- value={champion.holdout_score?.toFixed(3) ?? '—'}- tooltip="Offline AUC of the champion model, measured on held-out training data. Higher is better."- />- <MetricCard- label="Realized AUC"- value={champion.realized_score?.toFixed(3) ?? '—'}- tooltip="AUC of the champion model measured against actual outcomes once predictions matured. Higher is better."- />- <MetricCard- label="Calibration error"- value={champion.calibration_error?.toFixed(3) ?? '—'}- tooltip="Expected calibration error (ECE): how far predicted probabilities drift from observed rates. Lower is better."- />- </div>- <FeatureImportanceChart explanation={champion.model_explanation} />- {champion.agent_description && (- <div className="text-sm text-muted italic">"{champion.agent_description}"</div>- )}- </SectionCard>- )-}diff --git a/products/autoresearch/frontend/pipeline/LiveModelDrivers.tsx b/products/autoresearch/frontend/pipeline/LiveModelDrivers.tsxnew file mode 100644index 000000000000..b8dc19293095--- /dev/null+++ b/products/autoresearch/frontend/pipeline/LiveModelDrivers.tsx@@ -0,0 +1,28 @@+import { useValues } from 'kea'++import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import { FeatureImportanceChart } from './FeatureImportanceChart'+import { MetricCard } from './MetricCard'+import { SectionCard } from './SectionCard'++/** What drives the live model's predictions, and how well its probabilities match observed rates. Renders nothing before a champion exists. */+export function LiveModelDrivers(): JSX.Element | null {+ const { champion } = useValues(autoresearchPipelineLogic)+ if (!champion) {+ return null+ }+ return (+ <SectionCard title="What drives the live model">+ {champion.calibration_error != null && (+ <div className="max-w-xs">+ <MetricCard+ label="Calibration error"+ value={champion.calibration_error.toFixed(3)}+ tooltip="Expected calibration error (ECE): how far predicted probabilities drift from observed rates. Lower is better."+ />+ </div>+ )}+ <FeatureImportanceChart explanation={champion.model_explanation} />+ </SectionCard>+ )+}diff --git a/products/autoresearch/frontend/pipeline/OnlinePerformanceTab.tsx b/products/autoresearch/frontend/pipeline/OnlinePerformanceTab.tsxindex 88f135724584..a1594ec3e93c 100644--- a/products/autoresearch/frontend/pipeline/OnlinePerformanceTab.tsx+++ b/products/autoresearch/frontend/pipeline/OnlinePerformanceTab.tsx@@ -11,6 +11,7 @@ import { accuracyStats, accuracySummary, percent } from '../onlinePerformance'import { eventName } from '../pipelineQuestion'import { ConfusionMatrixCard } from './ConfusionMatrixCard'import { EmptyTab } from './EmptyTab'+import { LiveModelDrivers } from './LiveModelDrivers'import { MetricCard } from './MetricCard'import { RealizedAucChart } from './RealizedAucChart'import { ScoreNowButton } from './ScoreNowButton'@@ -81,7 +82,12 @@ export function OnlinePerformanceTab(): JSX.Element {}if (!latestChampionPerformance || !pipeline) {- return <NotCheckedYet />+ return (+ <div className="space-y-6">+ <NotCheckedYet />+ <LiveModelDrivers />+ </div>+ )}const target = eventName(pipeline.target_event)@@ -124,6 +130,8 @@ export function OnlinePerformanceTab(): JSX.Element {</SectionCard>)}+ <LiveModelDrivers />+<LemonCollapseclassName="bg-surface-primary"panels={[diff --git a/products/autoresearch/frontend/pipeline/StatusBrief.tsx b/products/autoresearch/frontend/pipeline/StatusBrief.tsxnew file mode 100644index 000000000000..048641cb4ecb--- /dev/null+++ b/products/autoresearch/frontend/pipeline/StatusBrief.tsx@@ -0,0 +1,96 @@+import { useActions, useValues } from 'kea'++import { LemonCollapse, Tooltip } from '@posthog/lemon-ui'++import type { BriefModel } from '../agentSearch'+import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import { SectionCard } from './SectionCard'++function ModelScores({ title, tooltip, model }: { title: string; tooltip: string; model: BriefModel }): JSX.Element {+ return (+ <div className="rounded bg-surface-secondary p-3 space-y-1 min-w-0" data-attr="autoresearch-brief-model">+ <Tooltip title={tooltip}>+ <div className="text-xs font-semibold text-muted uppercase tracking-wide truncate cursor-help">+ {model.runNumber != null ? `${title} · run ${model.runNumber}` : title}+ </div>+ </Tooltip>+ <div className="flex items-baseline gap-2">+ <span className="text-lg font-bold tabular-nums">+ {model.realizedScore != null ? model.realizedScore.toFixed(3) : 'Not checked yet'}+ </span>+ {model.realizedScore != null && <span className="text-xs text-secondary">on real outcomes</span>}+ </div>+ <div className="flex justify-between gap-2 text-xs text-secondary">+ <span>In training</span>+ <span className="tabular-nums">{model.holdoutScore != null ? model.holdoutScore.toFixed(3) : '—'}</span>+ </div>+ </div>+ )+}++/** The top of the Agent research tab: where the live model stands, how the newest scored model compares, and what comes next. */+export function StatusBrief(): JSX.Element | null {+ const { statusBrief } = useValues(autoresearchPipelineLogic)+ const { fullNotesOpened } = useActions(autoresearchPipelineLogic)+ if (!statusBrief) {+ return null+ }+ const { runNumber, readerSummary, factualLine, nextSteps, distillation, recommendedNext, live, scoredAlongside } =+ statusBrief+ return (+ <SectionCard+ title="Where things stand"+ actions={runNumber != null && <span className="text-xs text-muted">Updated after run {runNumber}</span>}+ >+ {(readerSummary || factualLine) && <p className="text-sm mb-0">{readerSummary || factualLine}</p>}+ {live && (+ <div className="grid grid-cols-1 @md:grid-cols-2 gap-2">+ <ModelScores+ title="Live"+ tooltip="The model that scores people now. Real outcomes is the AUC against what people really did. In training is the AUC on held-out training data."+ model={live}+ />+ {scoredAlongside && (+ <ModelScores+ title="Scored alongside"+ tooltip="The newest model that PostHog scores next to the live one and checks against real outcomes. A run replaces the live model on its own when it wins."+ model={scoredAlongside}+ />+ )}+ </div>+ )}+ {nextSteps.length > 0 && (+ <div className="text-sm">+ <div className="text-muted">Next, the agent plans to:</div>+ <ol className="list-decimal pl-5 mb-0">+ {nextSteps.map((step) => (+ <li key={step}>{step}</li>+ ))}+ </ol>+ </div>+ )}+ {(distillation || recommendedNext) && (+ <LemonCollapse+ embedded+ size="xsmall"+ onChange={(key) => key === 'notes' && fullNotesOpened()}+ panels={[+ {+ key: 'notes',+ header: "Read the agent's full notes",+ dataAttr: 'autoresearch-agent-full-notes',+ content: (+ <div className="space-y-1 text-sm text-secondary">+ {distillation && <div className="whitespace-pre-line">{distillation}</div>}+ {recommendedNext && (+ <div className="whitespace-pre-line">Next it plans to: {recommendedNext}</div>+ )}+ </div>+ ),+ },+ ]}+ />+ )}+ </SectionCard>+ )+}diff --git a/products/autoresearch/frontend/pipeline/SteerAgentBar.tsx b/products/autoresearch/frontend/pipeline/SteerAgentBar.tsxnew file mode 100644index 000000000000..c0f91b147200--- /dev/null+++ b/products/autoresearch/frontend/pipeline/SteerAgentBar.tsx@@ -0,0 +1,66 @@+import { useActions, useValues } from 'kea'++import { LemonButton, LemonCollapse, LemonTag } from '@posthog/lemon-ui'++import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import { SuggestionForm } from './SuggestionForm'+import { SuggestionList } from './SuggestionList'++/** A collapsed bar to suggest ideas for the next run, next to the button that starts one. */+export function SteerAgentBar(): JSX.Element {+ const { pipeline, startTrainingResultLoading, hasLiveTrainingRun, queuedSuggestionCount } =+ useValues(autoresearchPipelineLogic)+ const { startTraining, steerOpened } = useActions(autoresearchPipelineLogic)+ const trainDisabledReason = startTrainingResultLoading+ ? 'Starting…'+ : pipeline?.status === 'paused'+ ? 'Resume the model to train it'+ : hasLiveTrainingRun+ ? 'A training run is already in progress'+ : undefined+ return (+ <div className="flex flex-col @md:flex-row @md:items-start gap-2">+ <LemonCollapse+ className="flex-1 min-w-0 bg-surface-primary"+ onChange={(key) => key === 'steer' && steerOpened()}+ panels={[+ {+ key: 'steer',+ dataAttr: 'autoresearch-steer-agent',+ header: (+ <span className="flex flex-wrap items-center gap-x-2 gap-y-1 min-w-0">+ <span className="font-semibold">Steer the next run</span>+ <span className="text-xs text-muted font-normal">+ Suggest an idea for the agent to try+ </span>+ {queuedSuggestionCount > 0 && (+ <LemonTag size="small">{`${queuedSuggestionCount} queued`}</LemonTag>+ )}+ </span>+ ),+ content: (+ <div className="space-y-3">+ <div className="text-xs text-muted">+ The agent reads queued suggestions at the start of each batch of experiments, then+ acts on or dismisses each one.+ </div>+ <SuggestionForm />+ <SuggestionList />+ </div>+ ),+ },+ ]}+ />+ <LemonButton+ type="primary"+ onClick={() => void startTraining()}+ data-attr="autoresearch-model-train"+ loading={startTrainingResultLoading}+ disabledReason={trainDisabledReason}+ className="self-start"+ >+ Run training+ </LemonButton>+ </div>+ )+}diff --git a/products/autoresearch/frontend/pipeline/SuggestionList.tsx b/products/autoresearch/frontend/pipeline/SuggestionList.tsxnew file mode 100644index 000000000000..81f1a5f1256a--- /dev/null+++ b/products/autoresearch/frontend/pipeline/SuggestionList.tsx@@ -0,0 +1,63 @@+import { useActions, useValues } from 'kea'++import { LemonBanner, LemonTag, Spinner } from '@posthog/lemon-ui'++import { dayjs } from 'lib/dayjs'++import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'+import {+ AutoresearchSuggestionApi,+ AutoresearchSuggestionPriorityEnumApi,+ AutoresearchSuggestionStatusEnumApi,+} from '../generated/api.schemas'++const SUGGESTION_STATUS: Record<+ AutoresearchSuggestionStatusEnumApi,+ { type: 'success' | 'default' | 'danger' | 'highlight'; label: string }+> = {+ queued: { type: 'default', label: 'Queued' },+ picked_up: { type: 'highlight', label: 'Picked up' },+ acted_on: { type: 'success', label: 'Acted on' },+ dismissed: { type: 'danger', label: 'Dismissed' },+}++const SUGGESTION_PRIORITY: Record<AutoresearchSuggestionPriorityEnumApi, string> = {+ consider: 'Consider',+ try_next: 'Try next',+}++/** Past suggestions and the agent's response to each. */+export function SuggestionList(): JSX.Element {+ const { suggestions, suggestionsLoading, suggestionsError } = useValues(autoresearchPipelineLogic)+ const { loadSuggestions } = useActions(autoresearchPipelineLogic)+ return suggestionsLoading ? (+ <Spinner />+ ) : suggestionsError ? (+ <LemonBanner+ type="error"+ action={{+ children: 'Retry',+ onClick: () => loadSuggestions(),+ 'data-attr': 'autoresearch-model-suggestions-retry',+ }}+ >+ Couldn't load the suggestions. Try again, and if it keeps happening contact support.+ </LemonBanner>+ ) : suggestions.length === 0 ? (+ <div className="text-muted text-sm">No suggestions yet. Send one above to steer the next run.</div>+ ) : (+ <div className="space-y-2">+ {suggestions.map((s: AutoresearchSuggestionApi) => (+ <div key={s.id} className="rounded bg-surface-secondary p-3 space-y-1">+ <div className="flex items-center gap-2">+ <LemonTag type={SUGGESTION_STATUS[s.status].type}>{SUGGESTION_STATUS[s.status].label}</LemonTag>+ <span className="text-xs text-muted">{s.priority ? SUGGESTION_PRIORITY[s.priority] : ''}</span>+ <span className="text-xs text-muted">{dayjs(s.created_at).fromNow()}</span>+ </div>+ <div className="text-sm">{s.prompt}</div>+ {s.agent_response && <div className="text-sm text-muted italic">Agent: {s.agent_response}</div>}+ </div>+ ))}+ </div>+ )+}diff --git a/products/autoresearch/frontend/pipeline/SuggestionsTab.tsx b/products/autoresearch/frontend/pipeline/SuggestionsTab.tsxdeleted file mode 100644index c46da445a172..000000000000--- a/products/autoresearch/frontend/pipeline/SuggestionsTab.tsx+++ /dev/null@@ -1,78 +0,0 @@-import { useActions, useValues } from 'kea'--import { LemonBanner, LemonTag, Spinner } from '@posthog/lemon-ui'--import { dayjs } from 'lib/dayjs'--import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'-import {- AutoresearchSuggestionApi,- AutoresearchSuggestionPriorityEnumApi,- AutoresearchSuggestionStatusEnumApi,-} from '../generated/api.schemas'-import { SectionCard } from './SectionCard'-import { SuggestionForm } from './SuggestionForm'--const SUGGESTION_STATUS: Record<- AutoresearchSuggestionStatusEnumApi,- { type: 'success' | 'default' | 'danger' | 'highlight'; label: string }-> = {- queued: { type: 'default', label: 'Queued' },- picked_up: { type: 'highlight', label: 'Picked up' },- acted_on: { type: 'success', label: 'Acted on' },- dismissed: { type: 'danger', label: 'Dismissed' },-}--const SUGGESTION_PRIORITY: Record<AutoresearchSuggestionPriorityEnumApi, string> = {- consider: 'Consider',- try_next: 'Try next',-}--export function SuggestionsTab(): JSX.Element {- const { suggestions, suggestionsLoading, suggestionsError } = useValues(autoresearchPipelineLogic)- const { loadSuggestions } = useActions(autoresearchPipelineLogic)- return (- <SectionCard- title="Steer the agent"- description="Inject a free-text hypothesis into the training loop. The agent reads queued suggestions at the start of each iteration batch and decides whether to act on, apply, or dismiss each one."- >- <SuggestionForm />- {suggestionsLoading ? (- <Spinner />- ) : suggestionsError ? (- <LemonBanner- type="error"- action={{- children: 'Retry',- onClick: () => loadSuggestions(),- 'data-attr': 'autoresearch-model-suggestions-retry',- }}- >- Couldn't load the suggestions. Try again, and if it keeps happening contact support.- </LemonBanner>- ) : suggestions.length === 0 ? (- <div className="text-muted text-sm">No suggestions yet. Send one above to steer the next run.</div>- ) : (- <div className="space-y-2">- {suggestions.map((s: AutoresearchSuggestionApi) => (- <div key={s.id} className="rounded bg-surface-secondary p-3 space-y-1">- <div className="flex items-center gap-2">- <LemonTag type={SUGGESTION_STATUS[s.status].type}>- {SUGGESTION_STATUS[s.status].label}- </LemonTag>- <span className="text-xs text-muted">- {s.priority ? SUGGESTION_PRIORITY[s.priority] : ''}- </span>- <span className="text-xs text-muted">{dayjs(s.created_at).fromNow()}</span>- </div>- <div className="text-sm">{s.prompt}</div>- {s.agent_response && (- <div className="text-sm text-muted italic">Agent: {s.agent_response}</div>- )}- </div>- ))}- </div>- )}- </SectionCard>- )-}diff --git a/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx b/products/autoresearch/frontend/pipeline/TrainingRunRow.tsxindex 6ddbf6a266b4..9ca6eb2843f4 100644--- a/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx+++ b/products/autoresearch/frontend/pipeline/TrainingRunRow.tsx@@ -9,6 +9,7 @@ import { dayjs } from 'lib/dayjs'import { LemonMarkdownWithMermaid } from 'lib/lemon-ui/LemonMarkdown/LemonMarkdownWithMermaid'import { urls } from 'scenes/urls'+import { runHeadline } from '../agentSearch'import { autoresearchPipelineLogic, trainingRunProgress } from '../autoresearchPipelineLogic'import { type AutoresearchRunApi, AutoresearchTrainingRunApi } from '../generated/api.schemas'import { RunFeatureComparison } from './RunFeatureComparison'@@ -52,7 +53,12 @@ function RunReport({ runId }: { runId: string }): JSX.Element | null {)}-/** One training run in the experiment log: its header, the experiments passed as children, and its report and bundle on expand. */+const RUN_ROLE = {+ live: { type: 'completion', label: 'Live model' },+ scored_alongside: { type: 'highlight', label: 'Scored alongside' },+} as const++/** One training run in the log: its headline, the experiments passed as children, and its report and bundle on expand. */export function TrainingRunRow({run,runNumber,@@ -62,7 +68,8 @@ export function TrainingRunRow({runNumber: numberchildren?: ReactNode}): JSX.Element {- const { expandedRunId, artifactsByRun, artifactsByRunLoading, featureFlags } = useValues(autoresearchPipelineLogic)+ const { expandedRunId, artifactsByRun, artifactsByRunLoading, featureFlags, runRoles } =+ useValues(autoresearchPipelineLogic)const { toggleRunArtifacts, viewArtifact, reportNotebookOpened } = useActions(autoresearchPipelineLogic)const reportNotebookShortId = featureFlags[FEATURE_FLAGS.AUTORESEARCH_REPORT_NOTEBOOK]? run.summary?.report_notebook_short_id@@ -74,51 +81,66 @@ export function TrainingRunRow({const duration =run.started_at && run.completed_at ? dayjs(run.completed_at).from(dayjs(run.started_at), true) : nullconst runStatus = RUN_STATUS[run.status]+ const role = runRoles[run.id] ? RUN_ROLE[runRoles[run.id]] : null+ const { headline, detail } = runHeadline(run, runNumber)+ const improved = run.iterations.filter((it) => it.status === 'kept').lengthconst progressSummary =run.status === 'failed' && progress.iterationCount === 0- ? 'Failed before any iterations'- : `${progress.iterationCount} ${progress.iterationCount === 1 ? 'experiment' : 'experiments'} · ${- progress.bestHoldoutScore != null- ? `best AUC ${progress.bestHoldoutScore.toFixed(3)}`- : 'no score yet'- }`+ ? 'Failed before any experiments'+ : `${progress.iterationCount} ${progress.iterationCount === 1 ? 'experiment' : 'experiments'}, ${improved} improved`return (<div className="border rounded">- <div className="p-3 flex justify-between items-center">- <div className="flex items-center gap-2">- <LemonButton- size="small"- icon={<IconChevronRight className={`transition-transform ${isExpanded ? 'rotate-90' : ''}`} />}- onClick={() => toggleRunArtifacts(run.id)}- tooltip={isExpanded ? 'Hide report and bundle' : 'Show report and bundle'}- />- <div className="space-y-0.5">- <div className="text-sm font-semibold flex items-center gap-1">- <Tooltip title={dayjs(startedAt).format('MMM D, YYYY HH:mm')}>- <span>- Run {runNumber} · <span translate="no">{dayjs(startedAt).fromNow()}</span>- </span>- </Tooltip>- {run.task_url && (- <Link- to={run.task_url}- target="_blank"- className="text-muted hover:text-primary"- title="Open sandbox task"- >- <IconExternal className="text-sm" />- </Link>- )}- {run.status === 'running' && <Spinner className="ml-2 inline" />}- </div>- <div className="text-xs text-muted">- <span className="font-mono">{run.id.slice(0, 8)}</span> · {progressSummary}- {duration ? ` · took ${duration}` : ''}- </div>+ <div className="p-3 flex items-start gap-2">+ <LemonButton+ size="small"+ icon={<IconChevronRight className={`transition-transform ${isExpanded ? 'rotate-90' : ''}`} />}+ onClick={() => toggleRunArtifacts(run.id)}+ tooltip={isExpanded ? 'Hide report and bundle' : 'Show report and bundle'}+ />+ <div className="flex-1 min-w-0 space-y-0.5">+ <div className="flex items-center gap-2 min-w-0">+ <span className="text-sm font-semibold truncate flex-1 min-w-0" title={headline}>+ {headline}+ </span>+ {progress.bestHoldoutScore != null && (+ <span className="text-sm font-semibold tabular-nums shrink-0">+ {progress.bestHoldoutScore.toFixed(3)}+ </span>+ )}+ </div>+ <div className="flex flex-wrap items-center gap-x-1 gap-y-1 text-xs text-muted">+ <Tooltip title={dayjs(startedAt).format('MMM D, YYYY HH:mm')}>+ <span>+ {run.reader_summary?.trim() ? `Run ${runNumber} · ` : ''}+ {dayjs(startedAt).format('MMM D')} · {progressSummary}+ {duration ? ` · ${duration}` : ''}+ </span>+ </Tooltip>+ {run.task_url && (+ <Link+ to={run.task_url}+ target="_blank"+ className="text-muted hover:text-primary"+ title="Open sandbox task"+ >+ <IconExternal className="text-sm" />+ </Link>+ )}+ {run.status === 'running' && <Spinner className="inline" />}+ {role && (+ <LemonTag type={role.type} size="small">+ {role.label}+ </LemonTag>+ )}+ {run.status !== 'completed' && (+ <LemonTag type={runStatus.type} size="small">+ {runStatus.label}+ </LemonTag>+ )}</div>+ {detail && <div className="text-xs text-secondary">{detail}</div>}</div>- <LemonTag type={runStatus.type}>{runStatus.label}</LemonTag></div>{isExpanded && (<div className="border-t p-3 space-y-3">diff --git a/products/autoresearch/frontend/pipeline/TrainingTab.tsx b/products/autoresearch/frontend/pipeline/TrainingTab.tsxindex c07094bc375d..405a30491d90 100644--- a/products/autoresearch/frontend/pipeline/TrainingTab.tsx+++ b/products/autoresearch/frontend/pipeline/TrainingTab.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { IconRefresh } from '@posthog/icons'-import { LemonBanner, LemonButton, Spinner } from '@posthog/lemon-ui'+import { LemonBanner, Spinner } from '@posthog/lemon-ui'import { autoresearchPipelineLogic } from '../autoresearchPipelineLogic'import { AgentSearchChart } from './AgentSearchChart'@@ -10,36 +10,11 @@ import { EmptyTab } from './EmptyTab'import { ExperimentLog } from './ExperimentLog'export function TrainingTab(): JSX.Element {- const {- pipeline,- trainingRuns,- trainingRunsLoading,- trainingRunsError,- startTrainingResultLoading,- hasLiveTrainingRun,- } = useValues(autoresearchPipelineLogic)- const { startTraining, loadTrainingRuns } = useActions(autoresearchPipelineLogic)- const trainDisabledReason = startTrainingResultLoading- ? 'Starting…'- : pipeline?.status === 'paused'- ? 'Resume the model to train it'- : hasLiveTrainingRun- ? 'A training run is already in progress'- : undefined+ const { trainingRuns, trainingRunsLoading, trainingRunsError } = useValues(autoresearchPipelineLogic)+ const { loadTrainingRuns } = useActions(autoresearchPipelineLogic)return (<div className="space-y-4 min-w-0">- <div className="flex items-center gap-2">- <LemonButton- type="primary"- onClick={() => void startTraining()}- data-attr="autoresearch-model-train"- loading={startTrainingResultLoading}- disabledReason={trainDisabledReason}- >- Run training- </LemonButton>- </div>{/* Polling reloads the runs while one is live, so keep the loaded runs on screen during a reload. */}{trainingRuns.length === 0 && trainingRunsLoading ? (<Spinner />diff --git a/products/autoresearch/frontend/pipeline/experimentStatus.ts b/products/autoresearch/frontend/pipeline/experimentStatus.tsnew file mode 100644index 000000000000..dc733195f772--- /dev/null+++ b/products/autoresearch/frontend/pipeline/experimentStatus.ts@@ -0,0 +1,11 @@+import type { SearchPoint } from '../agentSearch'++/** How an experiment's status reads to people. A kept experiment improved on the one before it. */+export const EXPERIMENT_STATUS: Record<+ SearchPoint['status'],+ { type: 'success' | 'default' | 'danger'; label: string; color: string; dotClassName: string }+> = {+ kept: { type: 'success', label: 'Improved', color: 'var(--success)', dotClassName: 'bg-success' },+ discarded: { type: 'default', label: 'No gain', color: 'var(--color-text-secondary)', dotClassName: 'bg-muted' },+ crashed: { type: 'danger', label: 'Crashed', color: 'var(--danger)', dotClassName: 'bg-danger' },+}