Skip to content

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

feat(wizard): add persistent sidebar run state (#126579)

Fernando Gomesd06d091a672d
diff --git a/docs/internal/wizard-runs.md b/docs/internal/wizard-runs.md
index 579798b6e934..f686fcc49591 100644
--- a/docs/internal/wizard-runs.md
+++ b/docs/internal/wizard-runs.md
@@ -67,7 +67,7 @@ The optional `created_after` filter limits results and `count` to runs created a
The browser loads project history once without a date or status cutoff.
While the page is visible, it checks the newest page every five seconds and on tab return, merging discoveries without dropping older runs.
Starting a cloud run from the Library adds the creation response to shared state immediately, without waiting for a poll.
-Onboarding shows only runs created by the signed-in user.
+Onboarding and the original sidebar show only runs created by the signed-in user.
Only runs watched by a visible consumer can open event streams, with at most one run stream per tab.
Every 30 seconds, a bounded fallback refreshes one watched active run and its tasks, rotating through the watched runs.
Hidden tabs pause polling and streams; terminal runs do not open streams.
@@ -96,6 +96,19 @@ Dedicated program steps, such as AI observability, do not use the base integrati
Cloud success lists the artifacts and links to the first pull request for review.
Onboarding does not link to the runs scene; pull-request links open in a new tab so onboarding stays open.
+### Sidebar state
+
+The original sidebar shows all programs and terminal states, with active runs first.
+Its compact summary has no elapsed timer and keeps its dismiss control inside the card.
+Multiple runs show the current program and live activity, with labeled status totals instead of a generic heading and bare count.
+The run panel supports individual dismissal, checkbox selection with batch dismissal, and dismissing all displayed runs.
+Dismissals persist per project and user.
+Dismissal hides only those IDs and does not cancel the runs or hide future runs.
+Dismissed runs release their streams when no other visible consumer watches them; discovery continues for future runs.
+Sidebar links open the run's details directly, even when table pagination or filters exclude its row.
+Removing the linked run from the URL closes its dialog, and pending links never replace a later selection.
+The widget is not mounted in the `today-rail-nav` sidebar.
+
The PATCH request accepts a terminal `status`: `completed`, `failed`, or `cancelled`.
Failed runs can also include an `error_code`.
Local agents can create runs and update runs they created.
@@ -184,6 +197,7 @@ Do not add the CLI and service completion events together when counting runs.
The UI records library selections, create requests and failures, table searches, filters and pagination, detail dialog activity, run refreshes, copied run IDs, workspace opens, and artifact clicks.
It also records confirmed cancellation requests and outcomes.
+The original sidebar records `wizard sidebar state clicked` with visible and active run counts, and `wizard sidebar state dismissed` with dismissed and remaining run counts.
Onboarding records `wizard onboarding state artifact clicked` for artifact-list links and the review button, with `artifact_type`, `artifact_id`, `click_source`, and shared run properties.
`click_source` is `artifact_list` or `review_button`; informational Git diffs are not clickable.
Polling does not create more view events. Clipboard failures do not count as command copies.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 247923da4438..b98ccb4ea752 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8339,9 +8339,9 @@ snapshots:
products-wizard-wizard-install-sync--loading-artifacts--light:
hash: v1.k794b7964.fcc986507301751539abb1f6cdc93bf875569549c3dd1b89db1792dba85a80b6.r2NAiJfA4li00GYj13f-s2v4zkEfBN6fRnRo3cQuEnc
products-wizard-wizard-install-sync--many-tasks--dark:
- hash: v1.k794b7964.1ad7129ba43ec317ad641e2aea7c86434c1c88c2da781fd7717be2459fa4eb78.zPQ8OyhzgTH5-2eNr8j6PuorV9A3iXJ-3wNOt7NQ9rY
+ hash: v1.k794b7964.3b8e51b727deff47ff02ea53f762461f6879cd4c1fc34e9dab7c0ebe0ad459ae.mAZaCjYXV6Omkxo5qS0oiq150y5oWZQsRLaf7vHGrkE
products-wizard-wizard-install-sync--many-tasks--light:
- hash: v1.k794b7964.32757af5f502956330c19fb97c11a879370accef51687fd3d34465ad67974a0c.oN5ENYWTB15SMfoOvh4Zz3VRicAHDAlHGXWfRfxkTdY
+ hash: v1.k794b7964.14ddf9d8daa0fafe83df0fdcea8ea7bfa0a46f7bb65ced9d83ee57d97069e1cd.iFUqo6D7IJoPziqdxMK32xuuM23nVjwarb3NI9rTVyM
products-wizard-wizard-install-sync--running-with-tasks--dark:
hash: v1.k794b7964.bb895d336f44e2951b6824898ddef0b73514445fc3181c1c15c2e0bf49918d3a.jbKHf8wOXxxGlwn0YItYnaSUL9yJhAUJsUASfbv1duY
products-wizard-wizard-install-sync--running-with-tasks--light:
@@ -8366,6 +8366,62 @@ snapshots:
hash: v1.k794b7964.f5f068b9fcb09a322383e37d0e2bd1128ff6adeed932826d62161a1902e9fa91.QO2io3ZYVVvjY9thRJKCoY2e0yBnpSWzHiHDefLz3Dc
products-wizard-wizard-run-diff-viewer--narrow--light:
hash: v1.k794b7964.2ea84850b2a15dfe74254e4439305686f9718b0627f1bc8ca05a0fd428fcebba.qvBX7qTpArw7bMv-azF7FL1HSBhsl9BhNblAoqlGpi8
+ products-wizard-wizard-run-sidebar-widget--completed--dark:
+ hash: v1.k794b7964.71a9693ba7099543574e96ac5d3eff87ead557759ef3348f7c96891e1dae9141.65_7wuuYuTdKgfFxOSuiihUOeiIq-ewMLT2Pryc8Gvc
+ products-wizard-wizard-run-sidebar-widget--completed--light:
+ hash: v1.k794b7964.45359de1124ada6b14580c8a67e1e80f85462001228e09eb798df6c406f024f7.V6RQhbjyvgIhnwr7lj0dKC4Sk1vAG5Gw6ct1ACTOn5w
+ products-wizard-wizard-run-sidebar-widget--empty--dark:
+ hash: v1.k794b7964.7edb126ab5f52f4c83021c3500402674697080984be60a900b7b20e6a23af9f3.3novMKHcPVCpp9wlFO-hLNfouNhqykOwEXliZGuwGc0
+ products-wizard-wizard-run-sidebar-widget--empty--light:
+ hash: v1.k794b7964.a3131a08be4b6d3bd9d6c2b59531dc335f7130770e1954bed13155b02d96dd2c.fh1AmhbFdgaTpZtcOzNbrvM-sK7Ivx_ugbRTT8cvnrI
+ products-wizard-wizard-run-sidebar-widget--failed--dark:
+ hash: v1.k794b7964.d06626e84a7a4aafc5bb747aca75b4166d52a2007291ea79d00e19f1476b0c68.mXbr6g7O_LUzkrhv-tRgJtva1utP1mfu_1qnmRrBjvw
+ products-wizard-wizard-run-sidebar-widget--failed--light:
+ hash: v1.k794b7964.6bfce07966dc6370ee8978d30513921986b432c90226e53f3d10214d718ff58a.YqcC1H85x5JeTLKvh1p_x6qASx8XjWShV0ks3SrPijE
+ products-wizard-wizard-run-sidebar-widget--local-run--dark:
+ hash: v1.k794b7964.04d86fa3549177c086412464f5c73beed71fddf6c4b3a68746b5b451f853dde6.W-eYzBqZAC8NeTPI1q7RWD8JTeJzKaCGr806uugms1Q
+ products-wizard-wizard-run-sidebar-widget--local-run--light:
+ hash: v1.k794b7964.12cacdb009028d754c5a399e3b5bdf1a0127b1067f77c554d4e865f14b3ea6d4.hf6Xda4Xrnhk8MnsugqQ94L1IPhGCuvmS65HaHqHTDI
+ products-wizard-wizard-run-sidebar-widget--long-task-name--dark:
+ hash: v1.k794b7964.86309030c423ee46b327f51be7502adbcb9b5203d90207c76c3dc2b52194697c.UmEOZtR4REBWRqBIb8fUa0oDAVst7vmgTpM1VdKHXzE
+ products-wizard-wizard-run-sidebar-widget--long-task-name--light:
+ hash: v1.k794b7964.87409ef3c77b271ce443cd020fe6546646a19f159def5cca9ad74a72d0c99f0a.rOZgVCrJZ9GKXSV1HRDcSqNyzU7dCNclfUWXCovar8Q
+ products-wizard-wizard-run-sidebar-widget--many-runs--dark:
+ hash: v1.k794b7964.c60422ac49554c92e0f0b70a468aeaca43520005b432d847d69fddfee5796b05.rlCUAIxAGgazj0EgCnyM3zEUen82VTOIqSg97RPamfs
+ products-wizard-wizard-run-sidebar-widget--many-runs--light:
+ hash: v1.k794b7964.b36b26edaea9e4b38ea4d4e58b5a8f96e67a76c9d1ed3fb3b0da2f221b8df4e1.s5s9k4NPEkAorFYD0q7WHZ5fxKb3mgiwCLCjGb7HWiI
+ products-wizard-wizard-run-sidebar-widget--mixed-statuses--dark:
+ hash: v1.k794b7964.a568aab28324a5f6fcc42c27af3b986d83f5eb4d0924be41994370dc528e65ca.UHX2cTU9fzVL5Y7y9EZzxH1ELnofkekAyF3THV6pZZM
+ products-wizard-wizard-run-sidebar-widget--mixed-statuses--light:
+ hash: v1.k794b7964.578af0b3a9070e00ab4bd95296c174b8b34a7201a5c6cb91a986203af5b66261.5KQ_TlQjfAIBBrbMAGW7VfPWw9fOVNuLpQUwPW2VRyI
+ products-wizard-wizard-run-sidebar-widget--multiple-runs--dark:
+ hash: v1.k794b7964.e6c1c492ae401d6e193bb3c7a1b90a1792a38cd585eb657a26bfc15be867c377.5ltu6ecQ-GFEpLXDkkMzOEF-0JDdWTsLJ611fyroi_g
+ products-wizard-wizard-run-sidebar-widget--multiple-runs--light:
+ hash: v1.k794b7964.a1ab6521334ed255356404bccba0493ef6af262ede3570e0241c00ad8046f2e5.-n0hBs7oGdIwsnVHKuO4hfVVQ3yG1gqh74x1ytQv_Qk
+ products-wizard-wizard-run-sidebar-widget--multiple-runs-hovered--dark:
+ hash: v1.k794b7964.c3e97a80b6b7ef036534271b90bf0e2b2ead0c2b74bcc576f87f8c7367f815db.n8PHv4-L7FJb31suzvyNbHKMbrCPdL-8Fo2RMckgcqw
+ products-wizard-wizard-run-sidebar-widget--multiple-runs-hovered--light:
+ hash: v1.k794b7964.6aca699d79bb0dfc80da9305fd8d3c82bf382b4a49f15ae7168d614f8d79139e.YUrKHRPcUUmFf1OpzXRa9ye6ztFFnIA19Xv5W3dDaU4
+ products-wizard-wizard-run-sidebar-widget--multiple-runs-menu-open--dark:
+ hash: v1.k794b7964.8351d7be45e20c07f1d4c84c7a10801ed43f9fd6545d685507f48c11f0661065.9xzyvC-XzptsaN8OBJROP1gALNCtrKUUSPj2br7BwNU
+ products-wizard-wizard-run-sidebar-widget--multiple-runs-menu-open--light:
+ hash: v1.k794b7964.fba9d9d30be910c963a0e7855d175096d3fee41ce157c951149d7a6bd6619f45.gQcXbkwPBk3qcm15uqsLpvTxCY3z6GmBuRLoR9F8yYs
+ products-wizard-wizard-run-sidebar-widget--running-stage--dark:
+ hash: v1.k794b7964.86309030c423ee46b327f51be7502adbcb9b5203d90207c76c3dc2b52194697c.e5fa7NiW5tVIzqlPxIOaSuSIXtTli3un_3AzZjMVaDM
+ products-wizard-wizard-run-sidebar-widget--running-stage--light:
+ hash: v1.k794b7964.87409ef3c77b271ce443cd020fe6546646a19f159def5cca9ad74a72d0c99f0a.Gd9tYv4GkHLndmvXT6427SWEYTylIN-3OqWvuamZCKY
+ products-wizard-wizard-run-sidebar-widget--running-task--dark:
+ hash: v1.k794b7964.86309030c423ee46b327f51be7502adbcb9b5203d90207c76c3dc2b52194697c.AFknmTDobN1RdlP_B8H1AGh8zJ8L7WkvoGldtzByooE
+ products-wizard-wizard-run-sidebar-widget--running-task--light:
+ hash: v1.k794b7964.87409ef3c77b271ce443cd020fe6546646a19f159def5cca9ad74a72d0c99f0a.AlgYDgPSFAfz49Y_QOrx82OcTupVE0sucejctTxU71Y
+ products-wizard-wizard-run-sidebar-widget--running-task-hovered--dark:
+ hash: v1.k794b7964.c2b54798911efe120ca218d126fabe45d3ef9cdaeb7bb8ec15e60dee0c3fe3ac.UXjo18RpQsED_9Q2BpH6B5A7cOQiWglgHbdTElBUhKE
+ products-wizard-wizard-run-sidebar-widget--running-task-hovered--light:
+ hash: v1.k794b7964.73eb1a13b7ba6ee8339506b35824f4f0a399bdbb721060f46522a3551009ffee.G4j116Y_6Igau6ldOUH3bdW4kP6yIaNf8vNry-vpqDg
+ products-wizard-wizard-run-sidebar-widget--starting--dark:
+ hash: v1.k794b7964.76a9c55fbda8085b4fb9faa22bcbff28895a611b346513c8608941452446c2b8.XEL-Vg8i73-4vkbTPtLY-6PWGUlCNMMm3Y7B2QcCBbI
+ products-wizard-wizard-run-sidebar-widget--starting--light:
+ hash: v1.k794b7964.5b372ae3c38ed0f46c5ea387ce750d4f6c7243bccd103bb2661c715b728b962b.X6Z8JoRJf20H63o4tn_IrXctRtKSkunWPsOjR9MzyhM
products-workflows-customerioimportmodal--all-steps-completed--dark:
hash: v1.k794b7964.4433daf4a6f3ad289f37cbc466609a947b254f8b3a027357d05e00a725c57fa9.06a8j_j5NyzCTMMcfO3UH1b6ZIvt9oDgSBHpTJ6JOFk
products-workflows-customerioimportmodal--all-steps-completed--light:
@@ -16827,9 +16883,9 @@ snapshots:
scenes-other-integration-landing-page--slack-not-configured--light:
hash: v1.k794b7964.a12f1b2e9bcce6e07f5dc5b8e07821599e77d131e6431727dd04da5f6613ec1c.LZ2zwIHu0AhggyqW-hnQaE1EO6dAgmDI9Xlu2eWTYKM
scenes-other-onboarding--ai-observability-sdk-install--dark:
- hash: v1.k794b7964.5b47373dd1b34bb418867351c6a7c875eafd5a89ff4900bf73d1bbd83bbc4028.rbB41ZhaYlZsUvDAXal7DLOe0wN6pAz3ausHtz8Yx_U
+ hash: v1.k794b7964.ba2833f07e94e0e08c0a2756c7d09f77eaba0e4b8d5c1d287b6d54e92d384750.JYxMEyUgWYK9AlqdErqVCGVswu8feHXro9hpJJpiXnY
scenes-other-onboarding--ai-observability-sdk-install--light:
- hash: v1.k794b7964.bfd2e57c7b2e1833c68991c08b74f072ba5c3953b1d7f96aa55f18003bf99880.yjYFLiaQSsqczymSDB3YEFUEDMF5aw3f_94ieLyD30A
+ hash: v1.k794b7964.8fff5240f04eba0331be20b23df7c3fbdcea28686ec83341c5b475c54e3a29cf.t8g9cy8SQcbpPSm4Kr9LDBIvyy2HnQ71ABhbIcas8S8
scenes-other-onboarding--alerts--dark:
hash: v1.k794b7964.bb15a17dab8c6d94d7fce821c4eb5530e6c5e353a6f158134443b2e77e344b11.uRoH5DqZUWqQzdv8c5pM__vNu1MjSvicrhSdKKREUnw
scenes-other-onboarding--alerts--light:
@@ -16855,9 +16911,9 @@ snapshots:
scenes-other-onboarding--product-analytics-configuration--light:
hash: v1.k794b7964.ab7c6555aac1606b13277bb37e980da9feab594bf84907ed7f341d5567fa3d3c.Sn8H5UIg4w-xvGU41vmCnPdoNaWETZJ_38e9B62rEXw
scenes-other-onboarding--sdk-install--dark:
- hash: v1.k794b7964.63bc10899dc8449316fff54d82a5eea91abcd01d930e63079fcbfe3a8379acb7.4a5Cj2bUAGVDy3fIEPPZgLdBlS9ruNnOFKD-zGxwIVw
+ hash: v1.k794b7964.85785893b3ee1b41fe89fe73f4074da2f8e08722e4d375dd5301b7033a25660b.Tl2V7JNi2kWXV7ZW-F5DSAIss2HSu3psIuzvZ-HHEas
scenes-other-onboarding--sdk-install--light:
- hash: v1.k794b7964.53fc654e453b35a52b4a955604d814dba783396a18ad29ccc9f259afd16619d0.pWfwqqomEbXRxxb0wM6B2XJjdolwpP3L0Itma4ep20Y
+ hash: v1.k794b7964.f7351fd5520acef75c9b259b944526603762f6e9e482a94ec56819e2b24ca763.NqTI-4Xoc6UVlouSEgeNW47s0rr0CCaySFjw7jmO2wI
scenes-other-onboarding--session-replay-configuration--dark:
hash: v1.k794b7964.53a16b04178eb3346c8589d3d51804548580372721faa6517b10bce388e9d45f.Zqg1N7ez03g_PNyRpSEqtbXOOGOqisAftmJAobkUO3c
scenes-other-onboarding--session-replay-configuration--light:
@@ -16883,13 +16939,13 @@ snapshots:
scenes-other-onboarding--source-maps--light:
hash: v1.k794b7964.9c49408675ee2594b032aaaca5bd6ef9002b2f6d17b58203780e00f4ebf2d7c3.QzcwBedfbSdrOvC2aR3EfiOh_5Q7MEyTIvvhqyknDfc
scenes-other-onboarding--workflows-custom-installation-instructions--dark:
- hash: v1.k794b7964.a355f36bf002a119233c8592bebd8c34a0d3aad8050a01a81d2593f1e32ca904.wr-z1hhmoZg1XERZ_bK76Xjx--dCEmDeb87X8neB598
+ hash: v1.k794b7964.4035744269184179fc704886ada21debba6c2d8da34866ded90124cc4381955d.gw_mH1sCBx8KU1Fw775gxqvTtxDt8oiQbZ3gEoXDmAA
scenes-other-onboarding--workflows-custom-installation-instructions--light:
- hash: v1.k794b7964.0edcc48dfab6e88670a09070350f73a96c21d160bf38ea8027f26492fae286fb.oUJvy8bgtNdYIhWFnn5-9uI7PlAkT21f6ExVDx6jANc
+ hash: v1.k794b7964.589ec185861125f8803b2fc4e5a79d37fe0577663ef494384f2f5e29b3ccbfcb.EIRXV0l8SHGIJjTAfJZM4ppFd57VW3GT36oKO2bhnLs
scenes-other-onboarding-install-step--control-arm--dark:
- hash: v1.k794b7964.63bc10899dc8449316fff54d82a5eea91abcd01d930e63079fcbfe3a8379acb7.nbdS-vOGNFf57M9Nu5wqwR3PC-MM_7eq7nSnDGM95XE
+ hash: v1.k794b7964.85785893b3ee1b41fe89fe73f4074da2f8e08722e4d375dd5301b7033a25660b.8cH01aW_wdljbt8NM5-4YqII7hLHyUIPdAd2DztcRDU
scenes-other-onboarding-install-step--control-arm--light:
- hash: v1.k794b7964.53fc654e453b35a52b4a955604d814dba783396a18ad29ccc9f259afd16619d0.quiFo6I9hNybK-p39LleYzAQ_d5HIu1MtE7i5U8N1Bk
+ hash: v1.k794b7964.f7351fd5520acef75c9b259b944526603762f6e9e482a94ec56819e2b24ca763.2w9awJZwfumhgF4p5zgQwscMAWuXg2iImb-0IBeDfkg
scenes-other-onboarding-install-step--simple-flow--dark:
hash: v1.k794b7964.82e295b93aca26c287b4207345daa25386169a22f859bcf6ffc826dc119fe753.gcs2PUEkwq8sVKLDiV89qsV53RH8PgsAaC1iPJ9WQ04
scenes-other-onboarding-install-step--simple-flow--light:
diff --git a/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx b/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
index 4eee36bc0353..56f07c174b71 100644
--- a/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
+++ b/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
@@ -1,5 +1,9 @@
+import { useValues } from 'kea'
+import { Suspense } from 'react'
+
import { IconGear } from '@posthog/icons'
import { Link } from '@posthog/lemon-ui'
+import { PostHogErrorBoundary } from '@posthog/react'
import { DebugNotice } from 'lib/components/DebugNotice'
import { HelpMenu } from 'lib/components/HelpMenu/HelpMenu'
@@ -8,12 +12,23 @@ import { NotificationsMenu } from 'lib/components/NotificationsMenu/Notification
import { PosthogStatusShownOnlyIfNotOperational } from 'lib/components/PosthogStatus/PosthogStatusShownOnlyIfNotOperational'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { cn } from 'lib/utils/css-classes'
+import { lazyWithRetry } from 'lib/utils/retryImport'
+import { projectLogic } from 'scenes/projectLogic'
import { urls } from 'scenes/urls'
import { PostHogTeamCohortBanner } from './PostHogTeamCohortBanner'
+// Flag-gated, so users without the flag skip the wizard chunk on every page.
+const WizardRunSidebarWidget = lazyWithRetry(() =>
+ import('products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidget').then(({ WizardRunSidebarWidget }) => ({
+ default: WizardRunSidebarWidget,
+ }))
+)
+
export function NavBarFooter({ isLayoutNavCollapsed }: { isLayoutNavCollapsed: boolean }): JSX.Element {
const isNotificationsEnabled = useFeatureFlag('REAL_TIME_NOTIFICATIONS')
+ const wizardUiEnabled = useFeatureFlag('WIZARD_UI_ENABLED')
+ const { currentProjectId } = useValues(projectLogic)
return (
<div className="p-1 flex flex-col gap-px items-start pb-2">
@@ -28,6 +43,18 @@ export function NavBarFooter({ isLayoutNavCollapsed }: { isLayoutNavCollapsed: b
<NavPanelAdvertisement />
+ {wizardUiEnabled && !isLayoutNavCollapsed && currentProjectId !== null && (
+ <div className="w-full pb-1">
+ {/* A local boundary keeps a failed widget chunk from reaching the shell's
+ ChunkLoadErrorBoundary, which reloads the whole app. */}
+ <PostHogErrorBoundary fallback={<></>}>
+ <Suspense fallback={null}>
+ <WizardRunSidebarWidget projectId={String(currentProjectId)} />
+ </Suspense>
+ </PostHogErrorBoundary>
+ </div>
+ )}
+
<div
className={cn('flex flex-col gap-px w-full', {
'items-center': isLayoutNavCollapsed,
diff --git a/frontend/src/scenes/onboarding/OnboardingStep.tsx b/frontend/src/scenes/onboarding/OnboardingStep.tsx
index 8627c4dc4c00..6d5dca919fbd 100644
--- a/frontend/src/scenes/onboarding/OnboardingStep.tsx
+++ b/frontend/src/scenes/onboarding/OnboardingStep.tsx
@@ -87,7 +87,9 @@ export const OnboardingStep = ({
return (
<>
<div className="pb-2">
- <div className={`text-secondary max-w-screen-md mx-auto ${hideHeader && 'hidden'}`}>
+ <div
+ className={clsx('text-secondary mx-auto', !fullWidth && 'max-w-screen-md', hideHeader && 'hidden')}
+ >
<div className="flex flex-col sm:flex-row sm:justify-between sm:items-center items-start gap-2 mt-3 px-4 sm:px-0">
{!hideTitle && (
<h1 className={clsx('font-bold m-0 px-0 sm:px-2 sm:shrink-0', fullWidth && 'text-center')}>
diff --git a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx
index 829472559b20..32a3d7e48a89 100644
--- a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx
+++ b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx
@@ -1,10 +1,10 @@
export function WizardInstallIntro({ description }: { description?: string } = {}): JSX.Element {
return (
- <div className="text-center max-w-xl mx-auto space-y-3">
- <h2 className="text-2xl font-bold">Skip the install. Get 10–20 minutes back.</h2>
+ <div className="space-y-2">
+ <h2 className="text-xl font-bold">Set up with Wizard</h2>
<p className="text-muted">
{description ??
- 'The wizard detects your framework, installs the right SDK, configures your environment variables, and wires up event capture automatically.'}
+ 'The setup agent detects your framework, installs the SDK, and configures event capture.'}
</p>
<p className="text-muted text-xs">LLM inference is on us, no API key needed.</p>
</div>
diff --git a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx
index d29ba19af042..a4bba7bc8f08 100644
--- a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx
+++ b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx
@@ -75,6 +75,7 @@ export function WizardInstallStep(props: VariantProps): JSX.Element {
const canContinue = props.installationComplete || (!!run && (wizardRunIsActive(run) || run.status === 'completed'))
return (
<WizardInstallShell
+ fullWidth={!!run}
continueDisabledReason={canContinue ? undefined : 'Installation is not complete'}
showSkip={!canContinue}
props={props}
@@ -103,7 +104,7 @@ export function WizardInstallStep(props: VariantProps): JSX.Element {
<div className="max-w-xl mx-auto">
<OnboardingInstallOptions wizardOverrides={props.wizardOverrides} />
</div>
- <div className="flex justify-center">
+ <div>
<LemonButton
type="tertiary"
size="small"
@@ -122,11 +123,13 @@ export function WizardInstallStep(props: VariantProps): JSX.Element {
function WizardInstallShell({
children,
+ fullWidth,
continueDisabledReason,
showSkip,
props,
}: {
children: React.ReactNode
+ fullWidth: boolean
continueDisabledReason: string | undefined
showSkip: boolean
props: VariantProps
@@ -152,8 +155,8 @@ function WizardInstallShell({
return (
<OnboardingStep
+ fullWidth={fullWidth}
title={props.installTitle}
- subtitle={props.installSubtitle}
stepKey={OnboardingStepKey.INSTALL}
continueDisabledReason={continueDisabledReason}
showSkip={showSkip}
diff --git a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/index.tsx b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/index.tsx
index c105081fdce3..2267d6cb40ee 100644
--- a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/index.tsx
+++ b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/index.tsx
@@ -3,7 +3,6 @@ import posthog from 'posthog-js'
import { useEffect, useRef, useState } from 'react'
import { isMobile } from 'lib/utils/dom'
-import { humanList } from 'lib/utils/strings'
import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'
import { teamLogic } from 'scenes/teamLogic'
@@ -69,8 +68,7 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstal
? availableOnboardingProducts[currentStepProductKey as keyof typeof availableOnboardingProducts]?.name
: undefined
const isSdkInstallStep = currentFlowStep?.dedupKey === INSTALL_DEDUP_KEYS.POSTHOG_JS
- // With several install steps in one flow, a bare "Install" reads as a duplicate, so the shared
- // posthog-js step is titled after its dedup survivor; the subtitle names the full covered set.
+ // With several install steps in one flow, a bare "Install" reads as a duplicate.
const installStepCount = flow.filter((step) => step.stepKey === OnboardingStepKey.INSTALL).length
const installTitle =
isSdkInstallStep && installStepCount <= 1
@@ -78,12 +76,6 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstal
: productName
? `Install ${productName}`
: 'Install your SDK'
- // The dedup record is what this step actually covers; other products keep their own install step.
- const coveredNames = (currentFlowStep?.additionalProductKeys ?? [currentStepProductKey])
- .map((key) => availableOnboardingProducts[key as keyof typeof availableOnboardingProducts]?.name)
- .filter((name): name is string => !!name)
- const installSubtitle =
- isSdkInstallStep && coveredNames.length > 1 ? `One install covers ${humanList(coveredNames)}.` : undefined
const installationCompleteFromTeam = useInstallationComplete(teamPropertyToVerify)
const installationComplete = hideInstallationCheck || installationCompleteFromTeam
@@ -162,7 +154,6 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstal
header,
wizardOverrides,
installTitle,
- installSubtitle,
compact,
}
diff --git a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/types.ts b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/types.ts
index 35672669c46a..024a1c9a65bc 100644
--- a/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/types.ts
+++ b/frontend/src/scenes/onboarding/sdks/OnboardingInstallStep/types.ts
@@ -41,6 +41,5 @@ export interface VariantProps {
wizardOverrides?: WizardOverrides
/** Step heading, e.g. "Install AI observability"; a lone install step stays a generic "Install". */
installTitle: string
- installSubtitle?: string
compact?: boolean
}
diff --git a/packages/quill/packages/components/AGENTS.md b/packages/quill/packages/components/AGENTS.md
index 797d9683feda..61703e80d156 100644
--- a/packages/quill/packages/components/AGENTS.md
+++ b/packages/quill/packages/components/AGENTS.md
@@ -46,6 +46,7 @@ Rules:
- `viewportRef` reaches the scrolling viewport, and `viewportEndRef` a marker at the end of it. Observe the marker, with the viewport as the root, to load more rows near the end.
- Pagination is opt-in via `pageSize`; the component owns page state, reports user navigation through `onPageChange`, and resets to page 0 when `pageSize` changes. The pager is suppressed when the table has no rows — an empty table shows only its empty state, never a "0–0 of 0" pager.
- Custom empty state via the `empty` prop (ReactNode); default is a minimal "No results".
+- `rowClassName` accepts a class string or a function of the row data to style matching rows.
- `onRowClick` makes non-interactive parts of each row clickable and keyboard accessible. Links, buttons, form controls, editable content, and custom controls keep their own behavior. Add `data-row-click-ignore` to a custom descendant that must not activate the row.
- Don't rebuild tables from `Table` primitives when the data is row/column shaped and needs sorting or pagination — that's what DataTable is for. Drop to the `Table` primitive only for fully custom layouts.
diff --git a/packages/quill/packages/components/src/data-table.test.tsx b/packages/quill/packages/components/src/data-table.test.tsx
index ac1917311463..382c6478a037 100644
--- a/packages/quill/packages/components/src/data-table.test.tsx
+++ b/packages/quill/packages/components/src/data-table.test.tsx
@@ -41,6 +41,21 @@ describe('DataTable', () => {
expect(onRowClick).toHaveBeenCalledWith(data[0])
})
+ it('applies a row class name per row', () => {
+ const columns: ColumnDef<TestRow>[] = [{ accessorKey: 'name', header: 'Name' }]
+ const { container } = render(
+ <DataTable
+ columns={columns}
+ data={[{ name: 'Ada' }, { name: 'Grace' }]}
+ rowClassName={(row) => (row.name === 'Grace' ? 'highlighted-row' : undefined)}
+ />
+ )
+ const rows = container.querySelectorAll('tbody tr')
+
+ expect(rows[0].classList.contains('highlighted-row')).toBe(false)
+ expect(rows[1].classList.contains('highlighted-row')).toBe(true)
+ })
+
it('reports page changes with one-based page numbers', () => {
const onPageChange = jest.fn()
const columns: ColumnDef<TestRow>[] = [{ accessorKey: 'name', header: 'Name' }]
diff --git a/packages/quill/packages/components/src/data-table.tsx b/packages/quill/packages/components/src/data-table.tsx
index 4765cd62e319..483b109dd892 100644
--- a/packages/quill/packages/components/src/data-table.tsx
+++ b/packages/quill/packages/components/src/data-table.tsx
@@ -110,6 +110,8 @@ export interface DataTableProps<TData, TValue> {
data: TData[]
/** Opens or selects a record when the user clicks a non-interactive part of its row. */
onRowClick?: (row: TData) => void
+ /** Optional class name for a row, for example to highlight a selected record. */
+ rowClassName?: (row: TData) => string | undefined
/** Called when the user moves between pages. Page numbers are one-based. */
onPageChange?: (page: number, nextPage: number) => void
/** Sizing/scroll classes for the table container (forwarded to the Table primitive). */
@@ -351,18 +353,20 @@ function DataTableHead<TData>({
}
// Memoized so that a resize, which ends by setting a width on the table, does not render every row again. For the same
-// reason, a caller with its own state should keep `columns`, `onRowClick` and `empty` stable between renders.
+// reason, a caller with its own state should keep `columns`, `onRowClick`, `rowClassName` and `empty` stable between renders.
function DataTableBodyInner<TData, TValue>({
rows,
columns,
filler,
onRowClick,
+ rowClassName,
empty,
}: {
rows: Row<TData>[]
columns: ColumnDef<TData, TValue>[]
filler: boolean
onRowClick?: (row: TData) => void
+ rowClassName?: (row: TData) => string | undefined
empty: React.ReactNode
}): React.ReactElement {
return (
@@ -372,11 +376,11 @@ function DataTableBodyInner<TData, TValue>({
<TableRow
key={row.id}
data-state={row.getIsSelected() ? 'selected' : undefined}
- className={
- onRowClick
- ? 'cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring'
- : undefined
- }
+ className={cn(
+ onRowClick &&
+ 'cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring',
+ rowClassName?.(row.original)
+ )}
tabIndex={onRowClick ? 0 : undefined}
onClick={
onRowClick
@@ -439,6 +443,7 @@ function DataTable<TData, TValue>({
columns,
data,
onRowClick,
+ rowClassName,
className,
stickyHeader,
viewportRef,
@@ -526,6 +531,7 @@ function DataTable<TData, TValue>({
columns={columns}
filler={hasFiller}
onRowClick={onRowClick}
+ rowClassName={rowClassName}
empty={empty}
/>
</Table>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b662e3ba92ad..7ee7092d65c3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5805,6 +5805,9 @@ importers:
kea-loaders:
specifier: 'catalog:'
version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ kea-router:
+ specifier: 'catalog:'
+ version: 3.4.2([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
posthog-js:
specifier: 'catalog:'
version: 1.444.4(@types/[email protected])([email protected])
diff --git a/products/wizard/frontend/components/run-tags/WizardRunEnvironmentIcon.tsx b/products/wizard/frontend/components/run-tags/WizardRunEnvironmentIcon.tsx
new file mode 100644
index 000000000000..aba44ede4404
--- /dev/null
+++ b/products/wizard/frontend/components/run-tags/WizardRunEnvironmentIcon.tsx
@@ -0,0 +1,7 @@
+import { IconCloud, IconLaptop } from '@posthog/icons'
+
+import type { RunEnvironmentEnumApi } from '../../generated/api.schemas'
+
+export function WizardRunEnvironmentIcon({ environment }: { environment: RunEnvironmentEnumApi }): JSX.Element {
+ return environment === 'cloud' ? <IconCloud /> : <IconLaptop />
+}
diff --git a/products/wizard/frontend/components/run/WizardRunTable.tsx b/products/wizard/frontend/components/run/WizardRunTable.tsx
index 158dcff0bba8..7d3bac352c64 100644
--- a/products/wizard/frontend/components/run/WizardRunTable.tsx
+++ b/products/wizard/frontend/components/run/WizardRunTable.tsx
@@ -32,6 +32,7 @@ import { WizardRunsEmptyState } from './WizardRunsEmptyState'
export function WizardRunTable({
runs,
totalRuns,
+ highlightedRunId,
currentUserId,
loading,
failed,
@@ -50,6 +51,7 @@ export function WizardRunTable({
}: {
runs: WizardRunApi[]
totalRuns: number
+ highlightedRunId?: string | null
currentUserId: number | null
loading: boolean
failed: boolean
@@ -252,6 +254,11 @@ export function WizardRunTable({
pageSize={25}
fullWidth
onRowClick={onSelect}
+ rowClassName={(run) =>
+ run.id === highlightedRunId
+ ? 'bg-fill-highlight-100 hover:bg-fill-highlight-100'
+ : undefined
+ }
onPageChange={onPaginate}
/>
</Card>
diff --git a/products/wizard/frontend/logics/wizardRunDetailsLogic.test.ts b/products/wizard/frontend/logics/wizardRunDetailsLogic.test.ts
index d56a00e9d82b..90fe9b756eb1 100644
--- a/products/wizard/frontend/logics/wizardRunDetailsLogic.test.ts
+++ b/products/wizard/frontend/logics/wizardRunDetailsLogic.test.ts
@@ -1,3 +1,4 @@
+import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import posthog from 'posthog-js'
@@ -5,6 +6,7 @@ import { LemonDialog } from '@posthog/lemon-ui'
import { ApiError } from 'lib/api'
import { projectLogic } from 'scenes/projectLogic'
+import { urls } from 'scenes/urls'
import { initKeaTests } from '~/test/init'
@@ -12,6 +14,7 @@ import { wizardRunsPartialUpdate, wizardRunsRetrieve } from '../generated/api'
import type { WizardRunApi, WizardRunGitDiffArtifactApi } from '../generated/api.schemas'
import { loadWizardRunArtifactContent, loadWizardRunArtifacts } from '../lib/wizardApi'
import { wizardRunDetailsLogic } from './wizardRunDetailsLogic'
+import { wizardRunsLogic } from './wizardRunsLogic'
jest.mock('../generated/api', () => ({
wizardRunsList: jest.fn().mockResolvedValue({ count: 0, next: null, previous: null, results: [] }),
@@ -28,10 +31,12 @@ const mockLoadWizardRunArtifactContent = loadWizardRunArtifactContent as jest.Mo
const mockLoadWizardRunArtifacts = loadWizardRunArtifacts as jest.Mock
const mockWizardRunsRetrieve = wizardRunsRetrieve as jest.Mock
+const RUN_ID = '0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b'
+
const gitDiffArtifact: WizardRunGitDiffArtifactApi = {
id: 'artifact-1',
team_id: 1,
- run_id: 'run-1',
+ run_id: RUN_ID,
artifact_type: 'git_diff',
size_bytes: 512,
content_hash: 'diff-hash',
@@ -42,7 +47,7 @@ const gitDiffArtifact: WizardRunGitDiffArtifactApi = {
function makeRun(): WizardRunApi {
return {
- id: 'run-1',
+ id: RUN_ID,
team_id: 1,
created_by_id: 1,
created_by: { id: 1, first_name: 'Ada', last_name: 'Lovelace', email: '[email protected]' },
@@ -92,36 +97,77 @@ describe('wizardRunDetailsLogic', () => {
jest.restoreAllMocks()
})
- it('loads run details and artifacts through separate endpoints', async () => {
- logic.actions.selectRun(makeRun(), 'wizard_datatable')
-
- await expectLogic(logic)
- .toFinishAllListeners()
- .toMatchValues({
- selectedRun: expect.objectContaining({ id: 'run-1' }),
- selectedRunArtifacts: [],
- selectedRunArtifactsInitialLoading: false,
- })
-
- expect(mockWizardRunsRetrieve).toHaveBeenCalledWith(expect.any(String), 'run-1')
- expect(mockLoadWizardRunArtifacts).toHaveBeenCalledWith(expect.any(String), 'run-1')
- expect(mockLoadWizardRunArtifactContent).not.toHaveBeenCalled()
- expect(posthog.capture).toHaveBeenCalledWith(
- 'wizard run detail dialog opened',
- expect.objectContaining({
- wizard_run_id: 'run-1',
- task_run_id: 'run-1',
- run_surface: 'cloud',
- version: '2.6.0',
- source: 'wizard_datatable',
- })
- )
+ it.each(['wizard_datatable', 'wizard_sidebar'] as const)(
+ 'loads details and artifacts from %s even outside the filtered table page',
+ async (source) => {
+ if (source === 'wizard_sidebar') {
+ wizardRunsLogic.actions.loadRunsSuccess(
+ Array.from({ length: 30 }, (_, index) => ({ ...makeRun(), id: `other-${index}` }))
+ )
+ wizardRunsLogic.actions.setSearch('no matching runs')
+ router.actions.push(urls.wizardRuns(), { run: RUN_ID })
+ } else {
+ logic.actions.selectRun(makeRun(), source)
+ }
+
+ await expectLogic(logic)
+ .toFinishAllListeners()
+ .toMatchValues({
+ selectedRun: expect.objectContaining({ id: RUN_ID }),
+ selectedRunArtifacts: [],
+ selectedRunArtifactsInitialLoading: false,
+ })
+
+ expect(mockWizardRunsRetrieve).toHaveBeenCalledWith(expect.any(String), RUN_ID)
+ expect(mockWizardRunsRetrieve).toHaveBeenCalledTimes(1)
+ expect(mockLoadWizardRunArtifacts).toHaveBeenCalledWith(expect.any(String), RUN_ID)
+ expect(mockLoadWizardRunArtifactContent).not.toHaveBeenCalled()
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'wizard run detail dialog opened',
+ expect.objectContaining({
+ wizard_run_id: RUN_ID,
+ task_run_id: RUN_ID,
+ run_surface: 'cloud',
+ version: '2.6.0',
+ source,
+ })
+ )
+
+ if (source === 'wizard_sidebar') {
+ router.actions.push(urls.wizardRuns())
+ } else {
+ logic.actions.selectRun(null)
+ }
+ expect(logic.values.selectedRun).toBeNull()
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'wizard run detail dialog closed',
+ expect.objectContaining({ wizard_run_id: RUN_ID })
+ )
+ }
+ )
+
+ it.each(['back', 'another selection'] as const)('does not reopen a delayed linked run after %s', async (change) => {
+ let resolveRun!: (run: WizardRunApi) => void
+ const otherRun = { ...makeRun(), id: 'other-run' }
+ mockWizardRunsRetrieve
+ .mockReturnValueOnce(new Promise<WizardRunApi>((resolve) => (resolveRun = resolve)))
+ .mockResolvedValue(otherRun)
+ router.actions.push(urls.wizardRuns(), { run: RUN_ID })
+ if (change === 'back') {
+ router.actions.push(urls.wizardRuns())
+ } else {
+ logic.actions.selectRun(otherRun, 'wizard_datatable')
+ }
+ resolveRun(makeRun())
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.selectedRunId).toBe(change === 'back' ? null : otherRun.id)
+ })
- logic.actions.selectRun(null)
- expect(posthog.capture).toHaveBeenCalledWith(
- 'wizard run detail dialog closed',
- expect.objectContaining({ wizard_run_id: 'run-1' })
- )
+ it('ignores a linked run value that is not a run id', async () => {
+ router.actions.push(urls.wizardRuns(), { run: `../../../2/wizard/runs/${RUN_ID}` })
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsRetrieve).not.toHaveBeenCalled()
+ expect(logic.values.selectedRunId).toBeNull()
})
it('loads git diff content only after the artifact is opened', async () => {
@@ -138,11 +184,11 @@ describe('wizardRunDetailsLogic', () => {
selectedRunDiffContent: 'diff content',
runDiffLoading: false,
})
- expect(mockLoadWizardRunArtifactContent).toHaveBeenCalledWith(expect.any(String), 'run-1', 'artifact-1')
+ expect(mockLoadWizardRunArtifactContent).toHaveBeenCalledWith(expect.any(String), RUN_ID, 'artifact-1')
expect(posthog.capture).toHaveBeenCalledWith(
'artifact clicked',
expect.objectContaining({
- wizard_run_id: 'run-1',
+ wizard_run_id: RUN_ID,
type: 'diff',
source: 'artifacts_section',
})
@@ -174,13 +220,13 @@ describe('wizardRunDetailsLogic', () => {
mockWizardRunsRetrieve.mockResolvedValue({ ...makeRun(), status: 'completed', stage: null })
- logic.actions.loadRunDetails({ runId: 'run-1' })
+ logic.actions.loadRunDetails({ runId: RUN_ID })
await expectLogic(logic).toFinishAllListeners()
expect(mockLoadWizardRunArtifacts).toHaveBeenCalledTimes(2)
await expectLogic(logic).toFinishAllListeners()
- logic.actions.loadRunDetails({ runId: 'run-1' })
+ logic.actions.loadRunDetails({ runId: RUN_ID })
await expectLogic(logic).toFinishAllListeners()
expect(mockLoadWizardRunArtifacts).toHaveBeenCalledTimes(2)
expect(
@@ -220,7 +266,7 @@ describe('wizardRunDetailsLogic', () => {
jest.mocked(wizardRunsPartialUpdate).mockRejectedValue(new ApiError('private response content', 503))
}
- logic.actions.cancelRunRequest({ runId: 'run-1' })
+ logic.actions.cancelRunRequest({ runId: RUN_ID })
await expectLogic(logic).toFinishAllListeners()
const events = jest
@@ -230,7 +276,7 @@ describe('wizardRunDetailsLogic', () => {
'wizard run cancel requested',
succeeded ? 'wizard run cancel succeeded' : 'wizard run cancel failed',
])
- expect(events[1][1]).toEqual(expect.objectContaining({ wizard_run_id: 'run-1' }))
+ expect(events[1][1]).toEqual(expect.objectContaining({ wizard_run_id: RUN_ID }))
if (!succeeded) {
expect(events[1][1]).toEqual(expect.objectContaining({ http_status: 503 }))
}
diff --git a/products/wizard/frontend/logics/wizardRunDetailsLogic.ts b/products/wizard/frontend/logics/wizardRunDetailsLogic.ts
index 22ec8e6055c3..811d0f217ee8 100644
--- a/products/wizard/frontend/logics/wizardRunDetailsLogic.ts
+++ b/products/wizard/frontend/logics/wizardRunDetailsLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import type { BreakPointFunction } from 'kea'
import { loaders } from 'kea-loaders'
+import { urlToAction } from 'kea-router'
import posthog from 'posthog-js'
import { LemonDialog, lemonToast } from '@posthog/lemon-ui'
@@ -8,7 +9,9 @@ import { LemonDialog, lemonToast } from '@posthog/lemon-ui'
import { ApiError } from 'lib/api'
import { dayjs } from 'lib/dayjs'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
+import { isUUIDLike } from 'lib/utils/guards'
import { projectLogic } from 'scenes/projectLogic'
+import { urls } from 'scenes/urls'
import { wizardRunsPartialUpdate, wizardRunsRetrieve } from '../generated/api'
import type { WizardRunApi, WizardRunArtifactApi, WizardRunGitDiffArtifactApi } from '../generated/api.schemas'
@@ -24,7 +27,12 @@ type WizardRunDiffContent = {
content: string
}
-export type WizardRunDetailSource = 'fab_click' | 'fab_expand_icon_click' | 'wizard_datatable' | 'wizard_library'
+export type WizardRunDetailSource =
+ | 'fab_click'
+ | 'fab_expand_icon_click'
+ | 'wizard_datatable'
+ | 'wizard_library'
+ | 'wizard_sidebar'
export type WizardRunArtifactSource = 'button' | 'artifacts_section'
export type WizardRunIdLocation = 'bottom_button' | 'run_id_label'
@@ -63,6 +71,7 @@ export interface wizardRunDetailsLogicValues {
}
export interface wizardRunDetailsLogicActions {
+ openLinkedRun: (runId: string) => { runId: string }
cancelRun: (run: WizardRunApi) => { run: WizardRunApi }
cancelRunRequest: ({ runId }: { runId: string }) => { runId: string }
cancelRunRequestFailure: (error: string, errorObject?: unknown) => { error: string; errorObject?: unknown }
@@ -158,6 +167,7 @@ export const wizardRunDetailsLogic = kea<wizardRunDetailsLogicType>([
actions: [wizardRunsLogic, ['refreshRuns']],
})),
actions({
+ openLinkedRun: (runId: string) => ({ runId }),
selectRun: (run: WizardRunApi | null, source?: WizardRunDetailSource) => ({ run, source }),
openRunDiff: (artifact: WizardRunGitDiffArtifactApi) => ({ artifact }),
artifactClicked: (artifact: WizardRunArtifactApi, source: WizardRunArtifactSource) => ({ artifact, source }),
@@ -354,7 +364,31 @@ export const wizardRunDetailsLogic = kea<wizardRunDetailsLogicType>([
],
}),
listeners(({ actions, values, cache }) => ({
+ openLinkedRun: async ({ runId }, breakpoint) => {
+ const projectId = values.currentProjectId
+ if (!projectId || values.selectedRunId === runId) {
+ return
+ }
+ const selectionVersion = cache.selectionVersion ?? 0
+ const isCurrent = (): boolean =>
+ values.currentProjectId === projectId &&
+ cache.linkedRunId === runId &&
+ (cache.selectionVersion ?? 0) === selectionVersion
+ try {
+ const run = await wizardRunsRetrieve(String(projectId), runId)
+ await breakpoint()
+ if (isCurrent()) {
+ actions.selectRun(run, 'wizard_sidebar')
+ }
+ } catch (error) {
+ await breakpoint()
+ if (isCurrent()) {
+ lemonToast.error(requestError(error, "Couldn't open the run. Refresh the page to try again."))
+ }
+ }
+ },
selectRun: ({ run, source }) => {
+ cache.selectionVersion = (cache.selectionVersion ?? 0) + 1
cache.disposables.dispose('wizardRunDetailPolling')
if (!run) {
@@ -370,7 +404,12 @@ export const wizardRunDetailsLogic = kea<wizardRunDetailsLogicType>([
...wizardRunEventProperties(run),
source,
})
- actions.loadRunDetails({ runId: run.id })
+ if (source === 'wizard_sidebar') {
+ cache.terminalArtifactFetchRunId = wizardRunIsActive(run) ? undefined : run.id
+ actions.loadRunDetailsSuccess(run)
+ } else {
+ actions.loadRunDetails({ runId: run.id })
+ }
actions.loadRunArtifacts({ runId: run.id })
if (wizardRunIsActive(run)) {
@@ -472,4 +511,17 @@ export const wizardRunDetailsLogic = kea<wizardRunDetailsLogicType>([
})
},
})),
+ urlToAction(({ actions, values, cache }) => ({
+ [urls.wizardRuns()]: (_, searchParams) => {
+ const previousRunId = cache.linkedRunId
+ // The run id becomes part of the API path, so anything other than a UUID is ignored.
+ const runId = typeof searchParams.run === 'string' && isUUIDLike(searchParams.run) ? searchParams.run : null
+ cache.linkedRunId = runId
+ if (runId) {
+ actions.openLinkedRun(runId)
+ } else if (previousRunId && values.selectedRunId === previousRunId) {
+ actions.selectRun(null)
+ }
+ },
+ })),
])
diff --git a/products/wizard/frontend/scenes/WizardRunsScene.tsx b/products/wizard/frontend/scenes/WizardRunsScene.tsx
index 58033e07475f..37dfcf3db317 100644
--- a/products/wizard/frontend/scenes/WizardRunsScene.tsx
+++ b/products/wizard/frontend/scenes/WizardRunsScene.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
import { IconBook, IconRefresh, IconSearch, IconSparkles } from '@posthog/icons'
import {
@@ -40,6 +41,8 @@ export const scene: SceneExport = {
export function WizardRunsScene(): JSX.Element {
const wizardUiEnabled = useFeatureFlag('WIZARD_UI_ENABLED')
const { user } = useValues(userLogic)
+ const { searchParams } = useValues(router)
+ const highlightedRunId = typeof searchParams.run === 'string' ? searchParams.run : null
const {
environment,
currentProjectId,
@@ -197,6 +200,7 @@ export function WizardRunsScene(): JSX.Element {
<WizardRunTable
runs={filteredRuns}
totalRuns={runs.length}
+ highlightedRunId={highlightedRunId}
currentUserId={user?.id ?? null}
loading={runsInitialLoading}
failed={runsFailed}
diff --git a/products/wizard/frontend/views/onboarding/WizardInstallSync.tsx b/products/wizard/frontend/views/onboarding/WizardInstallSync.tsx
index 7767c1ffd4c8..f7a155727eae 100644
--- a/products/wizard/frontend/views/onboarding/WizardInstallSync.tsx
+++ b/products/wizard/frontend/views/onboarding/WizardInstallSync.tsx
@@ -2,7 +2,6 @@ import { useActions, useValues } from 'kea'
import { ReactNode, useState } from 'react'
import { useInterval } from 'lib/hooks/useInterval'
-import { cn } from 'lib/utils/css-classes'
import { userLogic } from 'scenes/userLogic'
import { wizardRunIsActive } from '../../lib/wizardRunDisplay'
@@ -28,31 +27,28 @@ export function WizardInstallSync({
const [now, setNow] = useState(Date.now)
useInterval(() => setNow(Date.now()), run && wizardRunIsActive(run) ? 1000 : null)
+ if (!run) {
+ return <>{children}</>
+ }
+
return (
<div className="@container/wizard-install">
- <div
- className={cn(
- 'grid grid-cols-1 items-start gap-6',
- run && '@min-[44rem]/wizard-install:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]'
- )}
- >
- <div className="min-w-0 space-y-8" data-attr="wizard-install-instructions">
+ <div className="grid grid-cols-1 items-start gap-6 @min-[44rem]/wizard-install:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]">
+ <div className="min-w-0 space-y-6" data-attr="wizard-install-instructions">
{children}
</div>
- {run && (
- <div className="min-w-0">
- <WizardInstallSyncView
- run={run}
- tasks={tasksByRunId[run.id] ?? []}
- artifacts={artifactsByRunId[run.id] ?? []}
- loading={runDataLoading[run.id] ?? true}
- error={runDataErrors[run.id] ?? null}
- onRetry={() => loadRunData(run, { force: true })}
- onArtifactClick={clickArtifact}
- now={now}
- />
- </div>
- )}
+ <div className="min-w-0">
+ <WizardInstallSyncView
+ run={run}
+ tasks={tasksByRunId[run.id] ?? []}
+ artifacts={artifactsByRunId[run.id] ?? []}
+ loading={runDataLoading[run.id] ?? true}
+ error={runDataErrors[run.id] ?? null}
+ onRetry={() => loadRunData(run, { force: true })}
+ onArtifactClick={clickArtifact}
+ now={now}
+ />
+ </div>
</div>
</div>
)
diff --git a/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.test.tsx b/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.test.tsx
new file mode 100644
index 000000000000..0de034cc27e2
--- /dev/null
+++ b/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.test.tsx
@@ -0,0 +1,25 @@
+import { render, screen } from '@testing-library/react'
+
+import type { WizardRunApi, WizardRunTaskApi } from '../../../generated/api.schemas'
+import { WizardInstallRunProgress } from './WizardInstallRunProgress'
+
+describe('WizardInstallRunProgress', () => {
+ it('keeps the active task visible as the run progresses', () => {
+ const tasks = Array.from({ length: 6 }, (_, index) => ({
+ name: `Task ${index}`,
+ status: index === 4 ? 'running' : index < 4 ? 'completed' : 'created',
+ })) as WizardRunTaskApi[]
+
+ render(
+ <WizardInstallRunProgress
+ run={{ status: 'running', stage: 'executing_wizard' } as WizardRunApi}
+ tasks={tasks}
+ />
+ )
+
+ expect(screen.getByText('Task 3')).toBeTruthy()
+ expect(screen.getByText('Task 4')).toBeTruthy()
+ expect(screen.getByText('Task 5')).toBeTruthy()
+ expect(screen.queryByText('Task 0')).toBeNull()
+ })
+})
diff --git a/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.tsx b/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.tsx
index 69f6699458cb..0451302ad300 100644
--- a/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.tsx
+++ b/products/wizard/frontend/views/onboarding/components/WizardInstallRunProgress.tsx
@@ -41,7 +41,9 @@ export function WizardInstallRunProgress({
tasks: readonly WizardRunTaskApi[]
}): JSX.Element {
const stepStates = wizardRunProgressStates(run)
- const visibleTasks = tasks.slice(0, 3)
+ const activeIndex = tasks.findIndex((task) => task.status === 'running')
+ const start = Math.max(0, activeIndex - 1)
+ const visibleTasks = tasks.slice(start, start + 3)
return (
<>
<div className="mt-3 flex flex-wrap gap-x-3 gap-y-1.5">
diff --git a/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidget.tsx b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidget.tsx
new file mode 100644
index 000000000000..cb0d613bc76e
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidget.tsx
@@ -0,0 +1,25 @@
+import { useActions, useValues } from 'kea'
+
+import { userLogic } from 'scenes/userLogic'
+
+import { wizardRunSyncLogic } from '../../logics/wizardRunSyncLogic'
+import { wizardRunSidebarLogic } from './wizardRunSidebarLogic'
+import { WizardRunSidebarWidgetView } from './WizardRunSidebarWidgetView'
+
+export function WizardRunSidebarWidget({ projectId }: { projectId: string }): JSX.Element | null {
+ const logic = wizardRunSyncLogic({ projectId })
+ const { tasksByRunId } = useValues(logic)
+ const { user } = useValues(userLogic)
+ const sidebarLogic = wizardRunSidebarLogic({ projectId, userId: user?.id ?? 0 })
+ const { visibleRuns } = useValues(sidebarLogic)
+ const { clickState, dismissRuns } = useActions(sidebarLogic)
+ return (
+ <WizardRunSidebarWidgetView
+ key={`${projectId}.${user?.id}`}
+ runs={visibleRuns}
+ tasksByRunId={tasksByRunId}
+ onStateClick={clickState}
+ onDismissRuns={dismissRuns}
+ />
+ )
+}
diff --git a/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.stories.tsx b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.stories.tsx
new file mode 100644
index 000000000000..6a98ac900ec5
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.stories.tsx
@@ -0,0 +1,214 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { useState } from 'react'
+
+import type { WizardRunApi, WizardRunTaskApi } from '../../generated/api.schemas'
+import { WizardRunSidebarWidgetView } from './WizardRunSidebarWidgetView'
+
+const baseRun: WizardRunApi = {
+ id: '00000000-0000-4000-8000-000000000001',
+ team_id: 1,
+ created_by_id: 1,
+ created_by: null,
+ environment: 'cloud',
+ workspace: { type: 'git_repository', repository: 'example/project' },
+ program: {
+ id: 'posthog-integration',
+ name: 'PostHog integration',
+ description: 'Set up PostHog',
+ wizard_version: '2.78.0',
+ command: [],
+ tags: [],
+ required_programs: [],
+ supported_environments: ['cloud'],
+ },
+ status: 'running',
+ stage: 'executing_wizard',
+ error_code: null,
+ error_message: null,
+ created_at: '2026-09-23T10:00:00Z',
+ updated_at: '2026-09-23T10:02:00Z',
+ started_at: '2026-09-23T10:00:30Z',
+ finished_at: null,
+ deadline_at: null,
+}
+
+const localRun: WizardRunApi = {
+ ...baseRun,
+ id: '00000000-0000-4000-8000-000000000002',
+ environment: 'local',
+ workspace: { type: 'local_folder', project_name: 'example-project' },
+ created_at: '2026-09-23T09:58:00Z',
+ started_at: '2026-09-23T09:58:00Z',
+}
+
+const addingEventsTask: WizardRunTaskApi = {
+ name: 'Adding events to the project',
+ status: 'running',
+ created_at: '2026-09-23T10:01:00Z',
+ started_at: '2026-09-23T10:01:00Z',
+ completed_at: null,
+ failed_at: null,
+ error_message: null,
+}
+
+const meta: Meta<typeof WizardRunSidebarWidgetView> = {
+ title: 'Products/Wizard/Wizard run sidebar widget',
+ component: WizardRunSidebarWidgetView,
+ render: function Render(args): JSX.Element {
+ const [dismissed, setDismissed] = useState<string[]>([])
+ return (
+ <WizardRunSidebarWidgetView
+ {...args}
+ runs={args.runs.filter((run) => !dismissed.includes(run.id))}
+ onDismissRuns={(ids) => {
+ args.onDismissRuns(ids)
+ setDismissed((current) => [...current, ...ids])
+ }}
+ />
+ )
+ },
+ parameters: { layout: 'fullscreen', testOptions: { waitForLoadersToDisappear: false } },
+ decorators: [
+ (Story) => (
+ <div className="flex min-h-[420px] w-[560px] bg-surface-secondary p-4">
+ <div className="w-60">
+ <Story />
+ </div>
+ </div>
+ ),
+ ],
+ argTypes: {
+ runs: { control: 'object' },
+ tasksByRunId: { control: 'object' },
+ initialHovered: { control: 'boolean' },
+ initialMenuOpen: { control: 'boolean' },
+ },
+ args: {
+ runs: [baseRun],
+ tasksByRunId: { [baseRun.id]: [addingEventsTask] },
+ onDismissRuns: () => {},
+ initialHovered: false,
+ },
+}
+
+export default meta
+type Story = StoryObj<typeof meta>
+
+export const RunningTask: Story = {}
+
+export const RunningTaskHovered: Story = {
+ args: {
+ initialHovered: true,
+ },
+}
+
+export const RunningStage: Story = {
+ args: {
+ tasksByRunId: {},
+ },
+}
+
+export const Starting: Story = {
+ args: {
+ runs: [{ ...baseRun, status: 'created', stage: 'dispatching', started_at: null }],
+ tasksByRunId: {},
+ },
+}
+
+export const LocalRun: Story = {
+ args: {
+ runs: [localRun],
+ tasksByRunId: { [localRun.id]: [addingEventsTask] },
+ },
+}
+
+export const MultipleRuns: Story = {
+ args: {
+ runs: [baseRun, localRun],
+ tasksByRunId: {
+ [baseRun.id]: [addingEventsTask],
+ [localRun.id]: [],
+ },
+ },
+}
+
+export const MultipleRunsHovered: Story = {
+ args: {
+ ...MultipleRuns.args,
+ initialHovered: true,
+ },
+}
+
+export const MultipleRunsMenuOpen: Story = {
+ args: {
+ ...MultipleRuns.args,
+ initialMenuOpen: true,
+ },
+}
+
+export const Completed: Story = {
+ args: { runs: [{ ...baseRun, status: 'completed', finished_at: '2026-09-23T10:03:00Z' }] },
+}
+
+export const Failed: Story = {
+ args: {
+ runs: [
+ {
+ ...baseRun,
+ status: 'failed',
+ error_message: 'The setup agent stopped.',
+ finished_at: '2026-09-23T10:03:00Z',
+ },
+ ],
+ },
+}
+
+export const MixedStatuses: Story = {
+ args: {
+ runs: [
+ baseRun,
+ { ...localRun, status: 'completed', finished_at: '2026-09-23T10:03:00Z' },
+ {
+ ...baseRun,
+ id: 'audit-run',
+ program: { ...baseRun.program, id: 'analytics-audit', name: 'Analytics audit' },
+ status: 'failed',
+ finished_at: '2026-09-23T10:03:00Z',
+ error_message: 'The audit stopped.',
+ },
+ ],
+ initialMenuOpen: true,
+ },
+}
+
+export const ManyRuns: Story = {
+ args: {
+ runs: Array.from({ length: 36 }, (_, index) => ({
+ ...baseRun,
+ id: `example-run-${index}`,
+ program: { ...baseRun.program, name: index % 2 ? 'Analytics audit' : 'PostHog integration' },
+ status: (['running', 'failed', 'completed'] as const)[index % 3],
+ })),
+ initialMenuOpen: true,
+ },
+}
+
+export const LongTaskName: Story = {
+ args: {
+ tasksByRunId: {
+ [baseRun.id]: [
+ {
+ ...addingEventsTask,
+ name: 'Installing the SDK and configuring autocapture across every page',
+ },
+ ],
+ },
+ },
+}
+
+export const Empty: Story = {
+ args: {
+ runs: [],
+ tasksByRunId: {},
+ },
+}
diff --git a/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.test.tsx b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.test.tsx
new file mode 100644
index 000000000000..32230709ae41
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.test.tsx
@@ -0,0 +1,135 @@
+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'
+
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'
+import { useState } from 'react'
+
+import { initKeaTests } from '~/test/init'
+
+import type { WizardRunApi } from '../../generated/api.schemas'
+import { WizardRunSidebarWidgetView } from './WizardRunSidebarWidgetView'
+
+const runs: WizardRunApi[] = ['PostHog integration', 'Analytics audit', 'Error tracking audit'].map((name, index) => ({
+ id: `run-${index}`,
+ team_id: 1,
+ created_by_id: 1,
+ created_by: null,
+ environment: 'local',
+ workspace: { type: 'local_folder', project_name: 'example-project' },
+ program: {
+ id: name,
+ name,
+ description: '',
+ command: [],
+ wizard_version: '1.0.0',
+ tags: [],
+ required_programs: [],
+ supported_environments: ['local'],
+ },
+ status: 'completed',
+ stage: null,
+ error_code: null,
+ error_message: null,
+ created_at: '2026-09-23T10:00:00Z',
+ updated_at: null,
+ started_at: null,
+ finished_at: null,
+ deadline_at: null,
+}))
+
+function Sidebar({
+ onDismiss,
+ onStateClick,
+}: {
+ onDismiss: (ids: string[]) => void
+ onStateClick: () => void
+}): JSX.Element {
+ const [remaining, setRemaining] = useState(runs)
+ return (
+ <WizardRunSidebarWidgetView
+ runs={remaining}
+ onStateClick={onStateClick}
+ onDismissRuns={(ids) => {
+ onDismiss(ids)
+ setRemaining((current) => current.filter((run) => !ids.includes(run.id)))
+ }}
+ />
+ )
+}
+
+describe('WizardRunSidebarWidgetView', () => {
+ beforeEach(() => initKeaTests())
+ afterEach(() => cleanup())
+
+ it('dismisses a selection together and keeps the panel open for the remaining run', async () => {
+ const dismiss = jest.fn()
+ const click = jest.fn()
+ render(<Sidebar onDismiss={dismiss} onStateClick={click} />)
+ expect(screen.getByText('3 completed')).toBeInTheDocument()
+ expect(screen.queryByText('Wizard runs (3)')).not.toBeInTheDocument()
+ fireEvent.click(screen.getByText('PostHog integration'))
+ const panel = await screen.findByRole('dialog')
+ fireEvent.click(within(panel).getByLabelText('Select PostHog integration'))
+ fireEvent.click(within(panel).getByLabelText('Select Analytics audit'))
+ fireEvent.click(within(panel).getByText('Dismiss selected (2)'))
+ expect(dismiss).toHaveBeenLastCalledWith(['run-0', 'run-1'])
+ expect(within(panel).queryByText('Analytics audit')).not.toBeInTheDocument()
+ expect(within(panel).getByText('Error tracking audit')).toBeInTheDocument()
+ expect(within(panel).getByText('Error tracking audit').closest('a')).toHaveAttribute(
+ 'href',
+ `/project/${MOCK_DEFAULT_TEAM.id}/wizard/runs?run=run-2`
+ )
+ fireEvent.click(within(panel).getByLabelText('Dismiss Error tracking audit'))
+ expect(dismiss).toHaveBeenLastCalledWith(['run-2'])
+ expect(document.querySelector('[data-attr="wizard-run-sidebar-widget"]')).not.toBeInTheDocument()
+ expect(click).toHaveBeenCalledTimes(1)
+ })
+
+ it('dismisses all runs directly from the card', () => {
+ const dismiss = jest.fn()
+ const click = jest.fn()
+ render(<Sidebar onDismiss={dismiss} onStateClick={click} />)
+ fireEvent.click(screen.getByLabelText('Dismiss all runs'))
+ expect(dismiss).toHaveBeenCalledWith(runs.map((run) => run.id))
+ expect(document.querySelector('[data-attr="wizard-run-sidebar-widget"]')).not.toBeInTheDocument()
+ expect(click).not.toHaveBeenCalled()
+ })
+
+ it('tracks the single-run card click while preserving its run link', () => {
+ const click = jest.fn()
+ render(<WizardRunSidebarWidgetView runs={[runs[0]]} onStateClick={click} onDismissRuns={jest.fn()} />)
+ const link = screen.getByText('PostHog integration').closest('a')!
+ expect(link).toHaveAttribute('href', `/project/${MOCK_DEFAULT_TEAM.id}/wizard/runs?run=run-0`)
+ fireEvent.click(link)
+ expect(click).toHaveBeenCalledTimes(1)
+ })
+
+ it('shows the current program and activity without assuming an installation', () => {
+ const audit = { ...runs[1], status: 'running' as const, stage: 'executing_wizard' as const }
+ render(
+ <WizardRunSidebarWidgetView
+ runs={[audit, { ...runs[2], status: 'failed' }]}
+ tasksByRunId={{
+ [audit.id]: [
+ {
+ name: 'Checking event coverage',
+ status: 'running',
+ created_at: '2026-09-23T10:00:00Z',
+ started_at: null,
+ completed_at: null,
+ failed_at: null,
+ error_message: null,
+ },
+ ],
+ }}
+ onDismissRuns={jest.fn()}
+ initialHovered
+ />
+ )
+ expect(screen.getByText('Analytics audit')).toBeInTheDocument()
+ expect(screen.getByText('Checking event coverage')).toBeInTheDocument()
+ expect(screen.getByText('1 running')).toBeInTheDocument()
+ expect(screen.getByText('1 failed')).toBeInTheDocument()
+ })
+})
diff --git a/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.tsx b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.tsx
new file mode 100644
index 000000000000..7415e6472818
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/WizardRunSidebarWidgetView.tsx
@@ -0,0 +1,104 @@
+import { useRef, useState } from 'react'
+
+import { IconX } from '@posthog/icons'
+import { LemonButton, LemonCard } from '@posthog/lemon-ui'
+
+import { Popover } from 'lib/lemon-ui/Popover'
+import { urls } from 'scenes/urls'
+
+import type { WizardRunApi, WizardRunTaskApi } from '../../generated/api.schemas'
+import { WizardRunSidebarPanel } from './components/WizardRunSidebarPanel'
+import { WizardRunSidebarSummary } from './components/WizardRunSidebarSummary'
+
+export interface WizardRunSidebarWidgetViewProps {
+ runs: WizardRunApi[]
+ tasksByRunId?: Record<string, readonly WizardRunTaskApi[]>
+ onStateClick?: () => void
+ onDismissRuns: (runIds: string[]) => void
+ initialHovered?: boolean
+ initialMenuOpen?: boolean
+}
+
+export function WizardRunSidebarWidgetView({
+ runs,
+ tasksByRunId = {},
+ onStateClick,
+ onDismissRuns,
+ initialHovered = false,
+ initialMenuOpen = false,
+}: WizardRunSidebarWidgetViewProps): JSX.Element | null {
+ const [menuOpen, setMenuOpen] = useState(initialMenuOpen)
+ const triggerRef = useRef<HTMLButtonElement>(null)
+ const currentRun = runs[0]
+ if (!currentRun) {
+ return null
+ }
+
+ const multiple = runs.length > 1
+ const dismissRuns = (runIds: string[]): void => {
+ onDismissRuns(runIds)
+ if (runs.every((run) => runIds.includes(run.id))) {
+ setMenuOpen(false)
+ }
+ }
+
+ return (
+ <Popover
+ visible={menuOpen}
+ placement="right-end"
+ fallbackPlacements={['right-start', 'top-end']}
+ padded={false}
+ onClickOutside={(event) => {
+ setMenuOpen(false)
+ if (event instanceof KeyboardEvent) {
+ triggerRef.current?.focus()
+ }
+ }}
+ overlay={
+ <WizardRunSidebarPanel
+ runs={runs}
+ tasksByRunId={tasksByRunId}
+ onDismissRuns={dismissRuns}
+ onNavigate={() => setMenuOpen(false)}
+ />
+ }
+ >
+ <LemonCard className="group/wizard-run flex w-full min-w-0 items-center p-0" hoverEffect={false}>
+ <LemonButton
+ ref={triggerRef}
+ type="tertiary"
+ size="small"
+ fullWidth
+ className="min-w-0 flex-1"
+ sideIcon={null}
+ to={!multiple ? `${urls.wizardRuns()}?run=${encodeURIComponent(currentRun.id)}` : undefined}
+ onClick={() => {
+ onStateClick?.()
+ if (multiple) {
+ setMenuOpen((open) => !open)
+ }
+ }}
+ aria-expanded={multiple ? menuOpen : undefined}
+ aria-haspopup={multiple ? 'dialog' : undefined}
+ data-attr="wizard-run-sidebar-widget"
+ >
+ <WizardRunSidebarSummary
+ runs={runs}
+ tasks={tasksByRunId[currentRun.id] ?? []}
+ hovered={initialHovered}
+ />
+ </LemonButton>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ className="mr-1 shrink-0"
+ icon={<IconX />}
+ tooltip={multiple ? 'Dismiss all runs' : 'Dismiss run'}
+ aria-label={multiple ? 'Dismiss all runs' : 'Dismiss run'}
+ onClick={() => dismissRuns(runs.map((run) => run.id))}
+ data-attr="wizard-run-sidebar-dismiss"
+ />
+ </LemonCard>
+ </Popover>
+ )
+}
diff --git a/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarPanel.tsx b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarPanel.tsx
new file mode 100644
index 000000000000..148b6b1d5a09
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarPanel.tsx
@@ -0,0 +1,77 @@
+import { useEffect, useRef, useState } from 'react'
+
+import { LemonButton } from '@posthog/lemon-ui'
+
+import type { WizardRunApi, WizardRunTaskApi } from '../../../generated/api.schemas'
+import { WizardRunSidebarRun } from './WizardRunSidebarRun'
+
+export function WizardRunSidebarPanel({
+ runs,
+ tasksByRunId,
+ onDismissRuns,
+ onNavigate,
+}: {
+ runs: WizardRunApi[]
+ tasksByRunId: Record<string, readonly WizardRunTaskApi[]>
+ onDismissRuns: (runIds: string[]) => void
+ onNavigate: () => void
+}): JSX.Element {
+ const [selectedIds, setSelectedIds] = useState<string[]>([])
+ const panelRef = useRef<HTMLDivElement>(null)
+ const selectedRuns = runs.filter((run) => selectedIds.includes(run.id))
+ useEffect(() => {
+ panelRef.current?.focus()
+ }, [])
+
+ return (
+ <div
+ ref={panelRef}
+ tabIndex={-1}
+ role="dialog"
+ aria-label="Wizard runs"
+ className="w-80"
+ data-attr="wizard-run-sidebar-widget-runs"
+ >
+ <div className="flex items-center justify-between gap-2 border-b border-primary px-3 py-2">
+ <h4 className="mb-0 text-sm">Wizard runs</h4>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ onClick={() => onDismissRuns(runs.map((run) => run.id))}
+ data-attr="wizard-run-sidebar-dismiss-all"
+ >
+ Dismiss all
+ </LemonButton>
+ </div>
+ <ul className="m-0 max-h-80 list-none overflow-y-auto p-1">
+ {runs.map((run) => (
+ <WizardRunSidebarRun
+ key={run.id}
+ run={run}
+ tasks={tasksByRunId[run.id] ?? []}
+ selected={selectedIds.includes(run.id)}
+ onSelect={(selected) =>
+ setSelectedIds((ids) => (selected ? [...ids, run.id] : ids.filter((id) => id !== run.id)))
+ }
+ onDismiss={() => onDismissRuns([run.id])}
+ onNavigate={onNavigate}
+ />
+ ))}
+ </ul>
+ <div className="flex flex-wrap items-center justify-between gap-2 border-t border-primary px-3 py-2">
+ <span className="text-2xs text-muted">Dismissing a run doesn't stop it.</span>
+ {selectedRuns.length > 0 && (
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ onClick={() => {
+ onDismissRuns(selectedRuns.map((run) => run.id))
+ setSelectedIds([])
+ }}
+ data-attr="wizard-run-sidebar-dismiss-selected"
+ >{`Dismiss selected (${selectedRuns.length})`}</LemonButton>
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarRun.tsx b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarRun.tsx
new file mode 100644
index 000000000000..c0d14bb09ae3
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarRun.tsx
@@ -0,0 +1,69 @@
+import { IconX } from '@posthog/icons'
+import { LemonButton, LemonCheckbox } from '@posthog/lemon-ui'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { urls } from 'scenes/urls'
+
+import { WizardRunEnvironmentIcon } from '../../../components/run-tags/WizardRunEnvironmentIcon'
+import { WizardRunStatusIcon } from '../../../components/run-tags/WizardRunStatusIcon'
+import type { WizardRunApi, WizardRunTaskApi } from '../../../generated/api.schemas'
+import { wizardRunActivityLabel, wizardWorkspaceLabel } from '../../../lib/wizardRunDisplay'
+
+export function WizardRunSidebarRun({
+ run,
+ tasks,
+ selected,
+ onSelect,
+ onDismiss,
+ onNavigate,
+}: {
+ run: WizardRunApi
+ tasks: readonly WizardRunTaskApi[]
+ selected: boolean
+ onSelect: (selected: boolean) => void
+ onDismiss: () => void
+ onNavigate: () => void
+}): JSX.Element {
+ return (
+ <li
+ className="flex min-w-0 items-center gap-2 rounded px-2 py-2 hover:bg-fill-highlight-50"
+ data-run-id={run.id}
+ >
+ <LemonCheckbox
+ checked={selected}
+ onChange={onSelect}
+ aria-label={`Select ${run.program.name}`}
+ data-attr="wizard-run-sidebar-select"
+ />
+ <LinkPrimitive
+ to={`${urls.wizardRuns()}?run=${encodeURIComponent(run.id)}`}
+ onClick={onNavigate}
+ className="flex min-w-0 flex-1 items-start gap-2"
+ data-attr="wizard-run-sidebar-widget-row"
+ >
+ <span className="mt-0.5 shrink-0 text-base">
+ <WizardRunStatusIcon status={run.status} />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-xs font-semibold ph-no-capture">{run.program.name}</span>
+ <span className="block truncate text-xs text-muted ph-no-capture">
+ {wizardRunActivityLabel(run, tasks)}
+ </span>
+ <span className="flex min-w-0 items-center gap-1 text-2xs text-muted ph-no-capture">
+ <WizardRunEnvironmentIcon environment={run.environment} />
+ <span className="truncate">{wizardWorkspaceLabel(run)}</span>
+ </span>
+ </span>
+ </LinkPrimitive>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ icon={<IconX />}
+ aria-label={`Dismiss ${run.program.name}`}
+ tooltip="Dismiss run"
+ onClick={onDismiss}
+ data-attr="wizard-run-sidebar-dismiss"
+ />
+ </li>
+ )
+}
diff --git a/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarSummary.tsx b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarSummary.tsx
new file mode 100644
index 000000000000..8d29a63973a1
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/components/WizardRunSidebarSummary.tsx
@@ -0,0 +1,65 @@
+import { cn } from 'lib/utils/css-classes'
+
+import { WizardRunEnvironmentIcon } from '../../../components/run-tags/WizardRunEnvironmentIcon'
+import { WizardRunStatusIcon } from '../../../components/run-tags/WizardRunStatusIcon'
+import type { WizardRunApi, WizardRunTaskApi } from '../../../generated/api.schemas'
+import { wizardRunActivityLabel, wizardRunIsActive, wizardWorkspaceLabel } from '../../../lib/wizardRunDisplay'
+
+export function WizardRunSidebarSummary({
+ runs,
+ tasks,
+ hovered,
+}: {
+ runs: WizardRunApi[]
+ tasks: readonly WizardRunTaskApi[]
+ hovered: boolean
+}): JSX.Element {
+ const run = runs[0]
+ const counts: { status: WizardRunApi['status']; count: number; label: string }[] = [
+ { status: 'running', count: runs.filter(wizardRunIsActive).length, label: 'running' },
+ { status: 'failed', count: runs.filter((run) => run.status === 'failed').length, label: 'failed' },
+ { status: 'completed', count: runs.filter((run) => run.status === 'completed').length, label: 'completed' },
+ { status: 'cancelled', count: runs.filter((run) => run.status === 'cancelled').length, label: 'canceled' },
+ ]
+ return (
+ <span className="flex w-full min-w-0 items-center gap-2">
+ <span className="shrink-0 text-base">
+ <WizardRunStatusIcon status={run.status} />
+ </span>
+ <span className="min-w-0 flex-1 text-left">
+ <span className="relative block h-4 min-w-0 overflow-hidden">
+ <span
+ className={cn(
+ 'flex flex-col transition-transform duration-200 ease-out motion-reduce:transition-none group-hover/wizard-run:-translate-y-4 group-focus-within/wizard-run:-translate-y-4',
+ hovered ? '-translate-y-4' : 'translate-y-0'
+ )}
+ >
+ <span className="h-4 truncate text-xs font-semibold leading-4 ph-no-capture">
+ {run.program.name}
+ </span>
+ <span className="h-4 truncate text-xs font-semibold leading-4 ph-no-capture">
+ {wizardRunActivityLabel(run, tasks)}
+ </span>
+ </span>
+ </span>
+ {runs.length > 1 ? (
+ <span className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-2xs text-muted">
+ {counts
+ .filter(({ count }) => count > 0)
+ .map(({ status, count, label }) => (
+ <span key={status} className="flex items-center gap-0.5">
+ <WizardRunStatusIcon status={status} />
+ <span>{`${count} ${label}`}</span>
+ </span>
+ ))}
+ </span>
+ ) : (
+ <span className="flex min-w-0 items-center gap-1 text-2xs text-muted ph-no-capture">
+ <WizardRunEnvironmentIcon environment={run.environment} />
+ <span className="truncate">{wizardWorkspaceLabel(run)}</span>
+ </span>
+ )}
+ </span>
+ </span>
+ )
+}
diff --git a/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.test.ts b/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.test.ts
new file mode 100644
index 000000000000..7c05bca31f0f
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.test.ts
@@ -0,0 +1,91 @@
+import { MOCK_DEFAULT_USER } from 'lib/api.mock'
+import { installMockEventSource, MockEventSource } from 'lib/wizard-sync/eventSource.mock'
+
+import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { initKeaTests } from '~/test/init'
+
+import type { WizardRunApi } from '../../generated/api.schemas'
+import { wizardRunSyncLogic } from '../../logics/wizardRunSyncLogic'
+import { wizardRunSidebarLogic } from './wizardRunSidebarLogic'
+
+jest.mock('../../generated/api', () => ({
+ wizardRunsList: jest.fn().mockResolvedValue({ results: [], next: null }),
+ getWizardRunsStreamRetrieveUrl: (_: string, id: string) => `/stream/${id}`,
+}))
+
+const props = { projectId: '1', userId: MOCK_DEFAULT_USER.id }
+function run(id: string): WizardRunApi {
+ return { id, status: 'completed', created_by_id: props.userId } as WizardRunApi
+}
+
+describe('wizardRunSidebarLogic', () => {
+ let logic: ReturnType<typeof wizardRunSidebarLogic.build>
+ let restoreEventSource: () => void
+
+ beforeEach(() => {
+ localStorage.clear()
+ initKeaTests()
+ restoreEventSource = installMockEventSource()
+ logic = wizardRunSidebarLogic(props)
+ logic.mount()
+ })
+ afterEach(() => {
+ logic.unmount()
+ restoreEventSource()
+ localStorage.clear()
+ })
+
+ it('dismisses one, several, or all known runs without hiding future runs, including after reload', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ const sync = wizardRunSyncLogic({ projectId: '1' })
+ const runs = ['first', 'second', 'third'].map((id) => ({ ...run(id), status: 'running' as const }))
+ sync.actions.runsLoaded(runs)
+ logic.actions.clickState()
+ expect(posthog.capture).toHaveBeenCalledWith('wizard sidebar state clicked', {
+ event_source: 'wizard_ui',
+ project_id: '1',
+ run_count: 3,
+ active_run_count: 3,
+ })
+ logic.actions.dismissRuns(['first'])
+ expect(posthog.capture).toHaveBeenCalledWith('wizard sidebar state dismissed', {
+ event_source: 'wizard_ui',
+ project_id: '1',
+ run_count: 1,
+ remaining_run_count: 2,
+ })
+ expect(logic.values.visibleRuns.map((run) => run.id)).toEqual(['second', 'third'])
+ logic.actions.dismissRuns(logic.values.visibleRuns.map((run) => run.id))
+ expect(posthog.capture).toHaveBeenLastCalledWith('wizard sidebar state dismissed', {
+ event_source: 'wizard_ui',
+ project_id: '1',
+ run_count: 2,
+ remaining_run_count: 0,
+ })
+ expect(logic.values.visibleRuns).toEqual([])
+ expect(MockEventSource.instances.every((stream) => stream.readyState === MockEventSource.CLOSED)).toBe(true)
+ sync.actions.runsLoaded([{ ...run('new'), status: 'running' }, ...runs])
+ expect(logic.values.visibleRuns.map((run) => run.id)).toEqual(['new'])
+ expect(MockEventSource.last().url).toBe('/stream/new')
+ logic.unmount()
+
+ initKeaTests()
+ logic = wizardRunSidebarLogic(props)
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ wizardRunSyncLogic({ projectId: '1' }).actions.runsLoaded([run('new'), ...runs])
+ expect(logic.values.visibleRuns.map((run) => run.id)).toEqual(['new'])
+ })
+
+ it('scopes dismissals to the current project and user', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.actions.dismissRuns(['first'])
+ logic.unmount()
+ logic = wizardRunSidebarLogic({ projectId: '2', userId: props.userId + 1 })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.dismissedRunIds).toEqual([])
+ })
+})
diff --git a/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.ts b/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.ts
new file mode 100644
index 000000000000..bcf64124cf2f
--- /dev/null
+++ b/products/wizard/frontend/views/run-sidebar/wizardRunSidebarLogic.ts
@@ -0,0 +1,105 @@
+import {
+ LogicWrapper,
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
+import posthog from 'posthog-js'
+
+import type { WizardRunApi } from '../../generated/api.schemas'
+import { wizardRunIsActive } from '../../lib/wizardRunDisplay'
+import { wizardRunSyncLogic } from '../../logics/wizardRunSyncLogic'
+
+interface WizardRunSidebarProps {
+ projectId: string
+ userId: number
+}
+
+export interface wizardRunSidebarLogicValues {
+ userRuns: WizardRunApi[]
+ dismissedRunIds: string[]
+ visibleRuns: WizardRunApi[]
+}
+
+export interface wizardRunSidebarLogicActions {
+ clickState: () => { value: true }
+ dismissRuns: (runIds: string[]) => { runIds: string[] }
+ syncWatchedRuns: () => { value: true }
+ watchRuns: (source: string, runIds: string[]) => { source: string; runIds: string[] }
+}
+
+export type wizardRunSidebarLogicType = MakeLogicType<
+ wizardRunSidebarLogicValues,
+ wizardRunSidebarLogicActions,
+ WizardRunSidebarProps
+>
+
+export const wizardRunSidebarLogic: LogicWrapper<wizardRunSidebarLogicType> = kea<wizardRunSidebarLogicType>([
+ props({} as WizardRunSidebarProps),
+ key(({ projectId, userId }) => `${projectId}.${userId}`),
+ path((key) => ['products', 'wizard', 'wizardRunSidebarLogic', key]),
+ connect(({ projectId }: WizardRunSidebarProps) => ({
+ values: [wizardRunSyncLogic({ projectId }), ['userRuns']],
+ actions: [wizardRunSyncLogic({ projectId }), ['watchRuns']],
+ })),
+ actions({ clickState: true, dismissRuns: (runIds: string[]) => ({ runIds }), syncWatchedRuns: true }),
+ reducers(({ props: { projectId, userId } }) => ({
+ dismissedRunIds: [
+ [] as string[],
+ { persist: true, storageKey: `${projectId}.${userId}.wizard_sidebar_dismissed_run_ids` },
+ // Store IDs instead of a cutoff so dismissing history cannot hide a subsequently discovered run.
+ { dismissRuns: (state, { runIds }) => [...new Set([...(Array.isArray(state) ? state : []), ...runIds])] },
+ ],
+ })),
+ selectors({
+ visibleRuns: [
+ (s) => [s.userRuns, s.dismissedRunIds],
+ (runs: WizardRunApi[], dismissed: string[]): WizardRunApi[] => {
+ const dismissedIds = new Set(Array.isArray(dismissed) ? dismissed : [])
+ return runs
+ .filter((run) => !dismissedIds.has(run.id))
+ .sort((a, b) => Number(wizardRunIsActive(b)) - Number(wizardRunIsActive(a)))
+ },
+ ],
+ }),
+ listeners(({ actions, values, props: { projectId } }) => ({
+ [wizardRunSyncLogic({ projectId }).actionTypes.runsLoaded]: () => actions.syncWatchedRuns(),
+ [wizardRunSyncLogic({ projectId }).actionTypes.runUpdated]: () => actions.syncWatchedRuns(),
+ syncWatchedRuns: () =>
+ actions.watchRuns(
+ 'sidebar',
+ values.visibleRuns.map((run) => run.id)
+ ),
+ clickState: () => {
+ posthog.capture('wizard sidebar state clicked', {
+ event_source: 'wizard_ui',
+ project_id: projectId,
+ run_count: values.visibleRuns.length,
+ active_run_count: values.visibleRuns.filter(wizardRunIsActive).length,
+ })
+ },
+ dismissRuns: ({ runIds }) => {
+ actions.syncWatchedRuns()
+ posthog.capture('wizard sidebar state dismissed', {
+ event_source: 'wizard_ui',
+ project_id: projectId,
+ run_count: runIds.length,
+ remaining_run_count: values.visibleRuns.length,
+ })
+ },
+ })),
+ afterMount(({ actions, cache }) => {
+ cache.disposables.add(() => {
+ actions.syncWatchedRuns()
+ return () => actions.watchRuns('sidebar', [])
+ }, 'sidebar-run-watch')
+ }),
+])
diff --git a/products/wizard/package.json b/products/wizard/package.json
index 8063a683990f..b1a388dd74ea 100644
--- a/products/wizard/package.json
+++ b/products/wizard/package.json
@@ -10,6 +10,7 @@
"@posthog/quill-primitives": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
+ "kea-router": "catalog:",
"posthog-js": "catalog:"
},
"devDependencies": {