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(onboarding): context-first onboarding reusing wizard cloud run (#66486)

Fernando Gomes606d4e981e6b
diff --git a/bin/ensure-local-setup b/bin/ensure-local-setup
index c78aa72ad565..b2ca4f3894f0 100755
--- a/bin/ensure-local-setup
+++ b/bin/ensure-local-setup
@@ -33,6 +33,7 @@ WIZARD_SCOPES = [
"insight:write",
"query:read",
"notebook:write",
+ "wizard_session:write"
]
diff --git a/frontend/public/hedgehog/self-driving-hog.png b/frontend/public/hedgehog/self-driving-hog.png
new file mode 100644
index 000000000000..3c92424d28ac
Binary files /dev/null and b/frontend/public/hedgehog/self-driving-hog.png differ
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a209e71ea736..da64199c51a9 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2760,6 +2760,38 @@ snapshots:
hash: v1.k794b7964.9d70ea02558f2ef94600839f5baec7be56ba352ce8f0e026754b79112b488f03.9Lr83f7fP3zgd0Jnmxkcl6WaLVQCV_E1yLtBDbcvfkM
layout-impersonation-reason-modal--upgrade-to-read-write--light:
hash: v1.k794b7964.439dc8957d5cd87372de3bb4d9eca7fe709be1f2796cdf9a65cf5cc6ceeb662b.i4Llp0CW2-32owDxA3h2qD_fNnlB0ON6e_z9twN3iuU
+ layout-nav-bar-installation-status--all-states--dark:
+ hash: v1.k794b7964.d4cd8a0e68eb7a8934c190510512afd4f4c30fa99335f40e78f9585fb181a549.sSPU_PnpVJHx1X6u1B05Wv7C7r42QYnZpJ9AeIjY35c
+ layout-nav-bar-installation-status--all-states--light:
+ hash: v1.k794b7964.a48dd0f6bb481b853619c3b011719f7a88c4929677914cbcbbec8a20a981c7eb.Tz0Ty5PdGCrcg2ercNyuwvhz1KnH2oBDXTh8T9yRArQ
+ layout-nav-bar-installation-status--cloud-run-in-progress--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.JGXjIq1zcXXtDrXXhqK-MrVHSgspJxcobbsVfI6TA14
+ layout-nav-bar-installation-status--cloud-run-in-progress--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.pq8p4hFmVvRPa5b9mEsr421MZGFYBFcuPQSJjJuye0M
+ layout-nav-bar-installation-status--collapsed-nav--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.AE6FHv2bcfCc5R5eO3UxDBttSK55F-c8vfohsRHUOeg
+ layout-nav-bar-installation-status--collapsed-nav--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.kyOMo0shHGy_HR-ISgzgiE5Mwiu7GnmAka8yzvbWw5M
+ layout-nav-bar-installation-status--collapsed-nav-cloud-run--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020._AurWZkRM2I6--pXr4-o19-SgfHBQ0voYtXHvQN987w
+ layout-nav-bar-installation-status--collapsed-nav-cloud-run--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.Yj2q4Nj8TLeq-ylQXhtkA_ZYUsqexoyB0hzCGOC7Avg
+ layout-nav-bar-installation-status--flag-off--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.5LPSVec2cVBz9VWNzTdfhXhSUH8PUzVmT-T2EsZkW4c
+ layout-nav-bar-installation-status--flag-off--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.3XSyIHdJVnmDPzpJiqlVA73hHFQsK4dxkS-xptIds1U
+ layout-nav-bar-installation-status--hidden--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.xRI5X4JcR10iS7GS-7Ssixj7LhyphiMkNzcTeZ0zuNE
+ layout-nav-bar-installation-status--hidden--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.XsrC8c6rGSLUxUJ1V5tTVjaMwz0tpRDphUyC4Hl_qzk
+ layout-nav-bar-installation-status--incomplete-onboarding--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.g0tr50lQLGphRfxfrAvJ3kgxmNd9LcGLyf8I_iL6Czo
+ layout-nav-bar-installation-status--incomplete-onboarding--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.FBlp1Bm8TdONwRgxK08W8cteSh6RhHNiVUB2BpLyWQo
+ layout-nav-bar-installation-status--local-session-active--dark:
+ hash: v1.k794b7964.8147d6d169af167868bdf292f919e40073423ae49dffcc468831f34eef2fd020.EITCH6oreQApfcBumW0XPJ2jZ_mGiajcs4QgpusFQ0A
+ layout-nav-bar-installation-status--local-session-active--light:
+ hash: v1.k794b7964.3862c2f44a83857e0b8723b7239b046f57fdfd567c0077480f353c351c9b321a.dlSfwZqhbIYc_dvTH75ZoyYJMihnh_iAkr8hcOw1t14
layout-project-tree--all-products--dark:
hash: v1.k794b7964.cd8b935f69a2cd2a2508f76af290cefb427c152da1e16da4a00a13323cdd9db3.1CCRxEt9aLJdov9fkKkA15aVxOCDGHTPub1O7bze484
layout-project-tree--all-products--light:
@@ -7260,10 +7292,122 @@ snapshots:
hash: v1.k794b7964.680c73650188584210cf88e9e94dea6b3ac98d0e7360cdce093e12b385421c09.V-JqKwXKZjrhFIIU7CH7hEB1mmt-AB77Ne3RLQkMLNQ
scenes-other-onboarding--workflows-custom-installation-instructions--light:
hash: v1.k794b7964.f5e839e44fc9b7af87152af7683c8a0b7d27f59cfeb25e59f7fdc4f57a1d242d.3mszucatM9SOwqdvrUaGWy1BH3DcvT58Li11Hl8VfkQ
+ scenes-other-onboarding-connect-data--connecting--dark:
+ hash: v1.k794b7964.59f96f7b6102b81524fe52d51ca88ca8dadb1702a307fd7976737864a9088a53.eO9mz6WENzTopgbZIyuZ6fZ6K73TWyK0zpSmsllgamw
+ scenes-other-onboarding-connect-data--connecting--light:
+ hash: v1.k794b7964.5b338475ab40e23c3c7df99665746ec76622e5a063c35969ee683a4a5179a1d3.6STqoe7n5Uxz8BWHZw_UpQUpG9ccZJGY7noNzzdMbTc
+ scenes-other-onboarding-connect-data--loading--dark:
+ hash: v1.k794b7964.cff95b9c6cd8993906e6c5d3734a032440d3ccb0017fe5da49357a240533f528.eA247Lw54fjpxxUbFb6tpHp6XlIWC-Mm0wjTzxeygyk
+ scenes-other-onboarding-connect-data--loading--light:
+ hash: v1.k794b7964.003f072de0cb2b35ef54ac9f418af4a58f29fd9c646b399b6423ee678732ad53.0srRwCdU2Q_X-Rgew5OrdpzcbSUgtG_VqDYkEiJA7kk
+ scenes-other-onboarding-connect-data--picker--dark:
+ hash: v1.k794b7964.cff95b9c6cd8993906e6c5d3734a032440d3ccb0017fe5da49357a240533f528.P-Fo6sZAj_nHgIVIJUzi_s9kCDz3EA3fikc_EwidLSY
+ scenes-other-onboarding-connect-data--picker--light:
+ hash: v1.k794b7964.f083877853d6068a01c9f31582525d06f727b0c442d2485aae9e55ee33cbdd91.EQ3t-Afb0a933J_TWCrbzn4kgtuxOmJim1_u8c6ySRI
+ scenes-other-onboarding-connect-data--searching--dark:
+ hash: v1.k794b7964.4dfe30e4eb72702ecbe738b0171e9b4b1248c7650702bc3b1036abde0f882cf5.CIGvBp0xqjxixv7mvyTx23W1JbS5O4UgyhhwdWmz8MA
+ scenes-other-onboarding-connect-data--searching--light:
+ hash: v1.k794b7964.d5096577fad44f35c23e70a3ce2baf1fde5619b4ccc62d200639b8260d23deaa.0czfvMgcpCeTUA3pM_4IStk5TFVWTyEsiAcURgV1CSc
+ scenes-other-onboarding-connect-data--searching-empty--dark:
+ hash: v1.k794b7964.c085d8e2525a239ebfa0674ce610350da4d7fd5f574fb7a5adbd51e4e632595c.lDRO-S0EV4HXSnZ5NKcRKVtrXpdXp_1EZrDilS_RXPE
+ scenes-other-onboarding-connect-data--searching-empty--light:
+ hash: v1.k794b7964.024aa0fc5f3b8a45b26908456dda88616f4c20aace6107556a0f38d1be7933cb.8elv50MLAQzusw3ULW0148JmHs2cBw0Ry7qYs59ea4c
+ scenes-other-onboarding-connect-data--with-connected-source--dark:
+ hash: v1.k794b7964.9ff8c7351c60e7795d73c6bd8b5acfbc68f98bbd9723e06dadb41d5741fb3da9.iV9GduYUxpZaxgVKQ4aZ5OQyfHH38NE9HJ1bQRCXVBE
+ scenes-other-onboarding-connect-data--with-connected-source--light:
+ hash: v1.k794b7964.06446de6c861c43300008a041b7b4a1e17722178ed540089489ead06b6224f0b.ByLedO_F2tAefEViHmnFDkditVMrV9Ip_hTJxIeuguE
+ scenes-other-onboarding-installation-progress--all-states--dark:
+ hash: v1.k794b7964.0a20dd9745c5c0cb9218a57a10b2f5775fe47768e42ec2d7fc6050ac9cb5ba3f.f7wIA68ob5CeJD7g2WMObeAouxX48LysMyCFee1Nhtc
+ scenes-other-onboarding-installation-progress--all-states--light:
+ hash: v1.k794b7964.84bc1cdf2393b3c8e60513ec1c974ac89e8b57f633d86e6d06bf421b6db55116.JDxXjltCxeFtrIfJyOtQwpTKpmuCU03hkgQkmuKPU2k
+ scenes-other-onboarding-installation-progress--completed--dark:
+ hash: v1.k794b7964.f873f5cd6ed92c2c996100aeb2dc3561c05eef61a19e62ecf3a0a8ef3362df3f.EN0-xcFn77_w5XgpO1XMtt0QFzzeCI4MXP3_nZbjM_U
+ scenes-other-onboarding-installation-progress--completed--light:
+ hash: v1.k794b7964.ae3737a3612265d86f945aa1a35ab38ff4dd2b91ba2587fa75d317d04dd84bd8.6N4y0DnDxgHUXJ9aZI9_qovuZABn2FM_KEDHoKzOsU0
+ scenes-other-onboarding-installation-progress--connecting--dark:
+ hash: v1.k794b7964.88ee5c432ee6bc83b1dc1f1d44ad4612b2b18b0b62808ea0c4175c7835810a66.-X7mQanLZf7YmO1K1Lf_1P2fQogx1njST-UkFd-hitA
+ scenes-other-onboarding-installation-progress--connecting--light:
+ hash: v1.k794b7964.10e5daf699a87a22c9e6eb2debc30d98ad143164bfeca9d37e1a84172b1a3917.v1St8xxGJvpmhEog42RyGaRlgngKi2WiFwwqURs8qnA
+ scenes-other-onboarding-installation-progress--failed-clone--dark:
+ hash: v1.k794b7964.b367d6930c3a427c3c76721541da2b5a69d6026a2af7048a1928887374013702.3wNcM6ngav3Ja3G3Jk329o0maGdv4KzTHXX_7mmlZLk
+ scenes-other-onboarding-installation-progress--failed-clone--light:
+ hash: v1.k794b7964.19d4372a7d94d2d4374aec17b89ce081fa9f16bed1761c8a391ff665e4fb12a0.-3PAzSj_DF60usjqJS4zwtFmDfoZiioEr2A7IxsnYfs
+ scenes-other-onboarding-installation-progress--failed-no-detail--dark:
+ hash: v1.k794b7964.6df130ee2a3fdfc1c029f5f81318696a8077e818eb831950d95fbf7034dabcf7.xO7LaNniBBlD1dPLkT4_ZteGgt6G2H6A0UrKMfByHzM
+ scenes-other-onboarding-installation-progress--failed-no-detail--light:
+ hash: v1.k794b7964.5991f74c2c2c03dfc42df0586a3a5526c2c1c3077dbb4cce75ba192be46316c7.465tarsHPZF2CCJFmJGY17i6qWZrYPQO4FGwLkfoLpc
+ scenes-other-onboarding-installation-progress--failed-provisioning--dark:
+ hash: v1.k794b7964.6f232eda4339190a4f8f5083c2d1c5e50b94b673d1fd7ab1fda8a95b4d3bce08.S7bjTikG5rNKu9QmIBQiVeDoMywDv2MTQZoTZ6YUAV4
+ scenes-other-onboarding-installation-progress--failed-provisioning--light:
+ hash: v1.k794b7964.cc7c7f9cd6e345a1dad49131a3dfbb57404fa4bd3b16bcf322d48c748c4c6e97.VQRyqi9UtAMvKNXXN8DQXGdlTathTJ3UePI0FErmiHw
+ scenes-other-onboarding-installation-progress--failed-wizard--dark:
+ hash: v1.k794b7964.b7ba105af0a2ef8ff07d15f20691086625b9511eec6851ef3aa0a92be03aa8e9.WOWyfrPE1PjYFvKJaso0t9OZUlTTCOs0Cswu1P-ITxE
+ scenes-other-onboarding-installation-progress--failed-wizard--light:
+ hash: v1.k794b7964.8d687e80b53eb492b92b67f6906c9603f98e5a4063448954b79081da9c76bd81.BifPAIKybTaFKMRFdM6hA-grT-km140b9kbYwxMEisU
+ scenes-other-onboarding-installation-progress--floating-dismissible--dark:
+ hash: v1.k794b7964.e8e629803313321ffd2690f6f6fa5089ff61b9381b928cd2a2c6c540ea632465.n8_g4KZMIO54o97zTGnIAPUIDE4OnUgLWbnF97lbCh0
+ scenes-other-onboarding-installation-progress--floating-dismissible--light:
+ hash: v1.k794b7964.9e32fd1807a9a2465fcba46f56c802dae8f9d856d182e354470c82089e070984.nb5Qkw5_GPgZYAqxxxVVzE1yd4l81p3lZLGwoani7Ao
+ scenes-other-onboarding-installation-progress--playground--dark:
+ hash: v1.k794b7964.4a02bd8e5e38437c539c859610516a6d51366f2b11afd22da5b8b92e392ea645.k3D9_w6AW7OJ_Bhhn8FqaSHVAC3frcuwsJ8FMm23aEk
+ scenes-other-onboarding-installation-progress--playground--light:
+ hash: v1.k794b7964.b23f7f8fc3c802d5680a246ae795e32ab07944e6e9fbbc32bb86caffbcaccc4f.dRVlYa44DBOBRMeaZ1loa1yWHRjqHVaYi1RbQJEirtA
+ scenes-other-onboarding-installation-progress--pull-request-ready--dark:
+ hash: v1.k794b7964.c0c9216c1cc6ae0c18e14cd5bb40b711340a84244074259d4cb72d8424d14bd7.YHOGdFDadbSNg1ySgTiUbEyYcybpzfUb_N16SZnBESE
+ scenes-other-onboarding-installation-progress--pull-request-ready--light:
+ hash: v1.k794b7964.c55b4c07211d18fdd68b48977d1d6135ce89010fb95a74be822326bddffe832b.rguLqKN3ooCm8ni2g0xdFkhteqcC0hbKOxUxoetyxGY
+ scenes-other-onboarding-installation-progress--running-provisioning--dark:
+ hash: v1.k794b7964.94c10c5ecabf7e2c35d4030c310e2f0b0210515da443fff2887cc4f2eeadf857.4gMrr55hMDbcJWFHiG0GrgzC2rQUfy9CZ2ekuub-bcU
+ scenes-other-onboarding-installation-progress--running-provisioning--light:
+ hash: v1.k794b7964.bd06d5d83b40158d3477b90ccb4655ce0a7cb31710626fecba579f4db3aa0db0.NxKvxht8bosMmbVce6kPS-uzEdp5H6Mp1Hd8vR8r9UQ
+ scenes-other-onboarding-installation-progress--running-wizard--dark:
+ hash: v1.k794b7964.4a02bd8e5e38437c539c859610516a6d51366f2b11afd22da5b8b92e392ea645.D8RXEVE30rTmmEvMwKqDbxnHF-xVWukJjx17d1pnJTY
+ scenes-other-onboarding-installation-progress--running-wizard--light:
+ hash: v1.k794b7964.b23f7f8fc3c802d5680a246ae795e32ab07944e6e9fbbc32bb86caffbcaccc4f.UhFiTjIRyPy7xqbLxLpx76ylkO88PnFzTezR-Oshfkk
scenes-other-onboarding-product-selection--base--dark:
- hash: v1.k794b7964.969e986f558f7f984b6c0eaab5b20559154809a9205f14168981f7dc010fb15c.tp4BRGSOK0yZTjSbx9grcYqP_PTjfwtC_HTIMbhMORc
+ hash: v1.k794b7964.6b35abf90f865d866bfe83ead0b3d2b6d1686a4efbb6f513d2d3470a36a3928b.51PN1rmvasAVWZFwSu5wHcNhcntw6epUCisAuCTGClY
scenes-other-onboarding-product-selection--base--light:
- hash: v1.k794b7964.81ff1f3f46d9d095660054f7c3a0f6b16239fa9032db5fbc8ac824a710fa766c.AMNAlCkIawTATOwCrRNqTT9INdxdIHOXXysbamZZgSg
+ hash: v1.k794b7964.aa412a66d8dd426bc052ed9dfcff6407481d29126aa19c2522912abb582d0bb3.ex6768hN0un9VFnIJYgpVru3-L-2hMuP8otcRusqtx4
+ scenes-other-onboarding-turn-on-your-sources--codebase-not-connected--dark:
+ hash: v1.k794b7964.f0b260fd91ecf3b551fa05abf6cf9bd4dd941167116076b52bc7e473faad750d.4rlCsndcSuACbhFW2BFukTYIls77a22iu9hcASa6VVU
+ scenes-other-onboarding-turn-on-your-sources--codebase-not-connected--light:
+ hash: v1.k794b7964.e0fcaa079f4277b0f8f377c48d5af25dd13880d434c3288a4f6fa68eb1fd5f61.Cutjp5--WwOYFODAYqqyzCwQiJzISFEtFf5h62a8QmQ
+ scenes-other-onboarding-turn-on-your-sources--default--dark:
+ hash: v1.k794b7964.55cc900bbf87d5f49763dde7a1e797a2d642701d020a6c1eb227a80b5f922bef.R_M8I_gNABLLheMzo4IKohSZ_NXMJl0G4hOYlof4DYM
+ scenes-other-onboarding-turn-on-your-sources--default--light:
+ hash: v1.k794b7964.ce56c10cb866870e46cbf39b72472fa8b775b28c4b43bdc271b7389a4c17cb58.3mf2uE2x44ydDYNvfVufEkuQNvKsS0jv-_h9HaCytjQ
+ scenes-other-onboarding-turn-on-your-sources--installing--dark:
+ hash: v1.k794b7964.8609ff257bfd96471493de9057ca62c9dfe0b1be9acc68040901a190a723b7a1.hyoOd4OE1uWqQxs0fM1gelQD2saeBV88rhHBfO4DSzQ
+ scenes-other-onboarding-turn-on-your-sources--installing--light:
+ hash: v1.k794b7964.590622ed5297b876808a485cec16410eb702136bbdcb79095aa6008570391411.H-VFafR-EQ7dJwFfa6LZKOeh9fC48tdZahHT3AkFEL4
+ scenes-other-onboarding-wizard-cloud-run--connected--dark:
+ hash: v1.k794b7964.b27c577a62c3e47cc7a0917231b2af5e680ea5c698fa16d75b4022f9b82de3c8.wcnq-pC4TGQ9ijVmgcSdF4Y0ExumqDrCYvvGkgdVTso
+ scenes-other-onboarding-wizard-cloud-run--connected--light:
+ hash: v1.k794b7964.160218c52d4ec68f6b9ab5b759fcb4fcb487c9e8c0066117b6b622fe9fa68aba.62m6VFC7FPwx0uDqb1QFcPRAcoQSrWfjoa31YChjebg
+ scenes-other-onboarding-wizard-cloud-run--not-connected--dark:
+ hash: v1.k794b7964.92f6748367f48e84137421d12cd06dbed93cd283224ef223c2b51423eca709bf.XP5DWCP2ZmKqYt3TWvrlNj8d0ZYCLa_e2_xn2rHDPvI
+ scenes-other-onboarding-wizard-cloud-run--not-connected--light:
+ hash: v1.k794b7964.e47960ce3187732b7e0f35eb5ef5bd5617f0097908806b662ff24b28b8f82091.b5N57QpypwDzjAit9wGL4PZAbw0CFheVsE0m1i3eI08
+ scenes-other-onboarding-wizard-cloud-run--playground--dark:
+ hash: v1.k794b7964.b2feecc661458ca5039f0ab6263dce6cfa4b34b7390e66a13ee0fb0d120def7e.WPmldl1Ne8Z25Qp-CrbG6rl2KYpDJNoNRmyRWPkjhn0
+ scenes-other-onboarding-wizard-cloud-run--playground--light:
+ hash: v1.k794b7964.50bf99b6d89ef586c14617f3dc8ce12b3a8d99f794b3c5239ed214fcad284146.aMkYyN7f9MsUG75thr_h82pTZmlReDHXXxVItL1No4A
+ scenes-other-onboarding-wizard-cloud-run--pull-request-queued--dark:
+ hash: v1.k794b7964.3069f1824db30b78cdb1142ad23c4d2cce49abe8e3919dc8ddc91d2c44dc8c47.60_6XIseWPhsaDkstpaacDfBZ8iKaPe7fyU-rE90lEo
+ scenes-other-onboarding-wizard-cloud-run--pull-request-queued--light:
+ hash: v1.k794b7964.7ec7e9d1698b2e62f5228a13c1991d64086be0fbc9840457922b154816df2431._3G5m4OvpJfstbF-BUJDMQTFS2FoeE9XTKma9jqxcrU
+ scenes-other-onboarding-wizard-cloud-run--repo-picker-open--dark:
+ hash: v1.k794b7964.b27c577a62c3e47cc7a0917231b2af5e680ea5c698fa16d75b4022f9b82de3c8.dkAJzTjKSUDPqLlCEJGqvhmRwTr2r-VHlcT8fH4uY-Q
+ scenes-other-onboarding-wizard-cloud-run--repo-picker-open--light:
+ hash: v1.k794b7964.328392d2d599698983c7b66e37c85c98d02067df7543fe215500277f774f628c.RZ-FkA8Z_wKviBGQMgQ5SwSSDp6JGNy-0gIouLHetac
+ scenes-other-onboarding-wizard-cloud-run--repo-selected--dark:
+ hash: v1.k794b7964.b2feecc661458ca5039f0ab6263dce6cfa4b34b7390e66a13ee0fb0d120def7e.O9G-GIjj0XrLACkq_mg9zCU60hg0zMkkUpSHz2f9VUc
+ scenes-other-onboarding-wizard-cloud-run--repo-selected--light:
+ hash: v1.k794b7964.50bf99b6d89ef586c14617f3dc8ce12b3a8d99f794b3c5239ed214fcad284146.oxZGa1QI9uJ2QoyAQbdzsHg13hJdk8rINK-mhUqgULQ
+ scenes-other-onboarding-wizard-cloud-run--run-it-yourself--dark:
+ hash: v1.k794b7964.b47c4a7d9e5841fdc8d70a435424ac91e2546a3b6becd9f6d649203cf6490183.WFhh4-Ml3BPa72xy_h0PoQ-N9pa2WDwgRdu8ekPT0Wc
+ scenes-other-onboarding-wizard-cloud-run--run-it-yourself--light:
+ hash: v1.k794b7964.cabea59cead5a63f867d0315becf9f5d1b488340305be7134e352166f067fb40.FFpoYgYVURL8Ob8tbMfOenNkVqXHAK6VSSexTyZjJmI
scenes-other-onboarding-wizard-progress-fab--hidden--light:
hash: v1.k794b7964.0d3a4f8e7f33f2272e482ad27457ab4049c226bc79f1890c6fa226f23591deba.e_cl0m4YPweYHNfhJMUGz23I399q0SBrD5KIaOKFm2Y
scenes-other-onboarding-wizard-progress-fab--hidden-by-panel--light:
@@ -7292,6 +7436,38 @@ snapshots:
hash: v1.k794b7964.d71edca979d6b2f8bffdec56369d58c6836516fdf055ed3d4154d877e39885bb.wFm_V5SLfvkUraIfrRKVTGrAFLInu1skroKRh2YJChk
scenes-other-onboarding-wizard-progress-tracker--running--light:
hash: v1.k794b7964.f5369826708b010cb25bfc3a92f8013a168ae6e3b9721e4c2527e1739f2f0a2b.fO171E9T_aXdHuwocYd2_261sekGGr6J5cOmTVdoowE
+ scenes-other-onboarding-wizard-sync-card--all-states--dark:
+ hash: v1.k794b7964.751f43e3bf5ddfba6bd997f3a23f5596195a0383390cea676689f5ded6d794cb.Tjux7X_LWnwTs_hn799nvhP_LabiJpXm1p5483STmjc
+ scenes-other-onboarding-wizard-sync-card--all-states--light:
+ hash: v1.k794b7964.0ffbac8423073d516edb037d247a21f1affa7a6bcaa31e3ec85c50ae9f2289df.KwtEwCJg9sHP2jJS3HEoQLLU6-DryKxvO35dqWzmi2I
+ scenes-other-onboarding-wizard-sync-card--cloud-keeping-ci-green--dark:
+ hash: v1.k794b7964.698010f52d1f6a068af50f838d560fdd3fd0b0c499697e0e08d8747cb5d0ad53.xB2q7n60ow5WFoZ7-b-cNpXgqog-zIqMkJWdXhzOsf4
+ scenes-other-onboarding-wizard-sync-card--cloud-keeping-ci-green--light:
+ hash: v1.k794b7964.9a604165bf1835302e43f8334c28b27201a7f3715a905bcc9d2d38a915371b0b.8svPLE7SFPZgsXoxi7Zojt8uB5fQGj81e9a4GnMrkDY
+ scenes-other-onboarding-wizard-sync-card--cloud-wizard-running--dark:
+ hash: v1.k794b7964.c69534afe39d0311b0ed3247beb145b94381706a25f2e6c7b5d3415c87564375.BhFx814SkAQ06867es0znUZpC7Ar-2iigoAaAJO4grQ
+ scenes-other-onboarding-wizard-sync-card--cloud-wizard-running--light:
+ hash: v1.k794b7964.0cfae6b396d23d4bf84998b078b2bc21d231cff6ca91c6ad72287015ffbc3612.xqAxC2OFrTOOAjYibZDZmt8pAGWh1rVgpWUrdZieRe4
+ scenes-other-onboarding-wizard-sync-card--completed--dark:
+ hash: v1.k794b7964.7be369e4455f47e7ca44caf0a77f1b7b91e94998059d2ee9079a35b1db4d643a.AhKLZtANlSx9XG_w2XCEM-pV6fXWWp8b7TO9amdDXWs
+ scenes-other-onboarding-wizard-sync-card--completed--light:
+ hash: v1.k794b7964.74517a371e77e79819faf936409917cfebc320d14767b3b43e72ca40c20f75b4.-ktzzMAdNYqQuR-WSmKfBNz02nhrKjQz08TbztIO_RY
+ scenes-other-onboarding-wizard-sync-card--connecting--dark:
+ hash: v1.k794b7964.aad9bbedbc6eff07374afdd9a5d5d98b6dbcaade09c87439e85df0395f257216.d1hBw_OfNoNyrR_DIIN828DlzVagmn1723NMc4PSUtg
+ scenes-other-onboarding-wizard-sync-card--connecting--light:
+ hash: v1.k794b7964.8ff9d181c4b98b932aa9491cee3b63307c93778fe82926179120324695ec1936.Vr1OqWSeKG5Q01QexQX3H2V2tT1PpVhM8XE-HCeYTzE
+ scenes-other-onboarding-wizard-sync-card--failed--dark:
+ hash: v1.k794b7964.0699d0268f15fd6d9502d0642c901b5d233088e66dae63e4529bf8dfad525932.bjaXmHatF5FslsTRdwe4gWrjbUlM3Nu8PtCehHTYzqo
+ scenes-other-onboarding-wizard-sync-card--failed--light:
+ hash: v1.k794b7964.50b5fa9355ae6176715bf17f02954d776dbcf74ed53ba5cb084f7272aa6334f0.-yDywPBww0uwHwzLiX9q3z4nDZBtEDJ0mbhXQX24T7s
+ scenes-other-onboarding-wizard-sync-card--local-running--dark:
+ hash: v1.k794b7964.8ebd0fb0b9db1f2cc68bcb63d890a44003403e27688a938e5cb04fbffb3b5d5e.yI70PdoKLWuUKMz4yvqpgQmPCJx7WjRu-g85Tt_m7n4
+ scenes-other-onboarding-wizard-sync-card--local-running--light:
+ hash: v1.k794b7964.644de0941a464befbdd1c1173307918762ec7bf580d08b6bb73e0170da71ab57.5vo2PyQfwdHSirsLkTypR4P6PHWRN7GJmU_JwNWSgjs
+ scenes-other-onboarding-wizard-sync-card--playground--dark:
+ hash: v1.k794b7964.c69534afe39d0311b0ed3247beb145b94381706a25f2e6c7b5d3415c87564375.yoqL-l9uwnSk7HPL43goI5OURF9xTvFpndNX2oKlHys
+ scenes-other-onboarding-wizard-sync-card--playground--light:
+ hash: v1.k794b7964.0cfae6b396d23d4bf84998b078b2bc21d231cff6ca91c6ad72287015ffbc3612.D_3QkuWWnYtitl6lT72dKDF4F4Pw9hfTKs5zBOkY8f4
scenes-other-org-member-invites--current-user-is-admin--dark:
hash: v1.k794b7964.a513d2d2902b9bed180ef998cfa04a5e291f1cc8072d67739072199cf25debec.Ubcb2mL9HqKazuyRseAkOQVNa1J9hrioFTBZpVnE8PE
scenes-other-org-member-invites--current-user-is-admin--light:
diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.ts
index 5fe39b79c80e..da1b1a09f8ac 100644
--- a/frontend/src/generated/core/api.schemas.ts
+++ b/frontend/src/generated/core/api.schemas.ts
@@ -3753,9 +3753,24 @@ export interface GitHubBranchesResponseApi {
}
export interface GitHubRepoApi {
+ /** GitHub repository numeric identifier. */
id: number
+ /** Repository short name (without the owner prefix). */
name: string
+ /** Fully-qualified repository name as 'owner/repo'. */
full_name: string
+ /** Whether the repository is private. */
+ private?: boolean
+ /** The repository's default branch (e.g. 'main'). */
+ default_branch?: string
+ /** Primary programming language GitHub detected for the repository. */
+ language?: string
+ /** ISO 8601 timestamp of the most recent push, useful for sorting by recent activity. */
+ pushed_at?: string
+ /** Whether the repository is archived. */
+ archived?: boolean
+ /** Whether the PostHog GitHub App has write access — required to open pull requests. */
+ can_push?: boolean
}
export interface GitHubReposResponseApi {
diff --git a/frontend/src/layout/panel-layout/InstallationStatusNavButton.stories.tsx b/frontend/src/layout/panel-layout/InstallationStatusNavButton.stories.tsx
new file mode 100644
index 000000000000..0371770f4907
--- /dev/null
+++ b/frontend/src/layout/panel-layout/InstallationStatusNavButton.stories.tsx
@@ -0,0 +1,275 @@
+import { MOCK_TEAM_ID } from 'lib/api.mock'
+
+import type { Meta, StoryObj } from '@storybook/react'
+import { useMountedLogic } from 'kea'
+import { useEffect } from 'react'
+
+import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardActiveSessionDetectorLogic'
+import {
+ activeCloudRunLogic,
+ type CloudRunHandle,
+} from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic'
+import { projectLogic } from 'scenes/projectLogic'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { InstallationStatusNavButton } from './InstallationStatusNavButton'
+import { installationStatusNavLogic } from './installationStatusNavLogic'
+
+type Story = StoryObj<typeof InstallationStatusNavButton>
+
+const meta: Meta<typeof InstallationStatusNavButton> = {
+ title: 'Layout/Nav Bar/Installation Status',
+ component: InstallationStatusNavButton,
+ parameters: {
+ layout: 'padded',
+ viewMode: 'story',
+ featureFlags: [{ 'onboarding-wizard-sidebar': 'test' }],
+ msw: {
+ mocks: {
+ get: {
+ '/api/projects/:projectId/wizard/sessions/latest/': () => [204, ''],
+ },
+ },
+ },
+ mockDate: '2024-05-01 12:00:00',
+ },
+ decorators: [
+ (Story) => (
+ <div className="w-[240px] bg-surface-primary rounded border border-primary overflow-hidden">
+ <div className="p-2 border-b border-primary text-xs text-muted uppercase tracking-wide">Sidebar</div>
+ <div className="p-1 flex flex-col gap-px">
+ <Story />
+ </div>
+ </div>
+ ),
+ ],
+ args: {
+ iconOnly: false,
+ },
+ argTypes: {
+ iconOnly: { control: 'boolean' },
+ },
+}
+
+export default meta
+
+// ── Helpers ──────────────────────────────────────────────────────────────────
+
+function makeCloudRunHandle(overrides?: Partial<CloudRunHandle>): CloudRunHandle {
+ const startedAt = new Date(Date.now() - 134_000).toISOString()
+ return {
+ taskId: 'task-abc',
+ runId: 'run-xyz',
+ startedAt,
+ ...overrides,
+ }
+}
+
+/** Hook: sets the team as fully onboarded. */
+function useTeamOnboarded(): void {
+ useMountedLogic(teamLogic)
+ useEffect(() => {
+ teamLogic.actions.loadCurrentTeamSuccess({
+ id: 1,
+ name: 'Test Team',
+ completed_snippet_onboarding: true,
+ has_completed_onboarding_for: { product_analytics: true },
+ ingested_event: true,
+ is_demo: false,
+ } as any)
+ }, [])
+}
+
+/** Hook: sets the team as not yet onboarded. */
+function useTeamNotOnboarded(): void {
+ useMountedLogic(teamLogic)
+ useEffect(() => {
+ teamLogic.actions.loadCurrentTeamSuccess({
+ id: 1,
+ name: 'Test Team',
+ completed_snippet_onboarding: false,
+ has_completed_onboarding_for: {},
+ ingested_event: false,
+ is_demo: false,
+ } as any)
+ }, [])
+}
+
+/** Hook: simulates an active cloud run. */
+function useCloudRun(overrides?: Partial<CloudRunHandle>): void {
+ useMountedLogic(activeCloudRunLogic)
+ useEffect(() => {
+ const handle = makeCloudRunHandle(overrides)
+ // The handle is project-scoped; stamp whichever project the storybook environment resolves.
+ activeCloudRunLogic.actions.setActiveCloudRun(
+ handle.taskId,
+ handle.runId,
+ handle.startedAt!,
+ projectLogic.values.currentProjectId ?? MOCK_TEAM_ID
+ )
+ }, [overrides])
+}
+
+/** Hook: simulates an active local wizard session. */
+function useLocalSession(): void {
+ useMountedLogic(wizardActiveSessionDetectorLogic)
+ useEffect(() => {
+ wizardActiveSessionDetectorLogic.actions.markActive()
+ }, [])
+}
+
+// ── Stories ──────────────────────────────────────────────────────────────────
+
+/** Flag is off — the component does not render. */
+export const FlagOff: Story = {
+ parameters: {
+ featureFlags: [],
+ },
+ decorators: [
+ (Story) => {
+ useTeamNotOnboarded()
+ return <Story />
+ },
+ ],
+}
+
+/** User is fully onboarded and there is no active run — nothing to show. */
+export const Hidden: Story = {
+ decorators: [
+ (Story) => {
+ useTeamOnboarded()
+ return <Story />
+ },
+ ],
+}
+
+/** User hasn't completed onboarding — muted "Complete setup" dot. */
+export const IncompleteOnboarding: Story = {
+ decorators: [
+ (Story) => {
+ useTeamNotOnboarded()
+ return <Story />
+ },
+ ],
+}
+
+/** Cloud run in progress — pulsing accent dot, elapsed time. */
+export const CloudRunInProgress: Story = {
+ decorators: [
+ (Story) => {
+ useTeamOnboarded()
+ useCloudRun({ startedAt: new Date(Date.now() - 60_000).toISOString() })
+ return <Story />
+ },
+ ],
+}
+
+/** Local wizard session detected — pulsing accent dot. */
+export const LocalSessionActive: Story = {
+ decorators: [
+ (Story) => {
+ useMountedLogic(installationStatusNavLogic)
+ useTeamOnboarded()
+ useLocalSession()
+ return <Story />
+ },
+ ],
+}
+
+/** Collapsed sidebar — iconOnly mode. */
+export const CollapsedNav: Story = {
+ args: {
+ iconOnly: true,
+ },
+ decorators: [
+ (Story) => {
+ useTeamNotOnboarded()
+ return <Story />
+ },
+ ],
+}
+
+/** Collapsed nav with a cloud run in progress. */
+export const CollapsedNavCloudRun: Story = {
+ args: {
+ iconOnly: true,
+ },
+ decorators: [
+ (Story) => {
+ useTeamOnboarded()
+ useCloudRun({ startedAt: new Date(Date.now() - 60_000).toISOString() })
+ return <Story />
+ },
+ ],
+}
+
+// ── Gallery ──────────────────────────────────────────────────────────────────
+
+function StateBlock({ label, children }: { label: string; children: React.ReactNode }): JSX.Element {
+ return (
+ <div className="flex flex-col gap-1">
+ <span className="text-xs text-muted">{label}</span>
+ <div className="w-[240px] bg-surface-primary rounded border border-primary overflow-hidden">
+ <div className="p-2 border-b border-primary text-xs text-muted uppercase tracking-wide">Sidebar</div>
+ <div className="p-1 flex flex-col gap-px">{children}</div>
+ </div>
+ </div>
+ )
+}
+
+/** Wraps the button with team set to fully onboarded (no run active → hidden). */
+function OnboardedVariant(): JSX.Element {
+ useMountedLogic(installationStatusNavLogic)
+ useTeamOnboarded()
+ return <InstallationStatusNavButton iconOnly={false} />
+}
+
+/** Wraps the button with team not onboarded. */
+function NotOnboardedVariant({ iconOnly }: { iconOnly: boolean }): JSX.Element {
+ useMountedLogic(installationStatusNavLogic)
+ useTeamNotOnboarded()
+ return <InstallationStatusNavButton iconOnly={iconOnly} />
+}
+
+/** Wraps the button with a cloud run in progress. */
+function CloudRunVariant({ iconOnly, startedAtOffset }: { iconOnly: boolean; startedAtOffset: number }): JSX.Element {
+ useMountedLogic(installationStatusNavLogic)
+ useTeamOnboarded()
+ useCloudRun({ startedAt: new Date(Date.now() - startedAtOffset).toISOString() })
+ return <InstallationStatusNavButton iconOnly={iconOnly} />
+}
+
+/** Wraps the button with a local session active. */
+function LocalSessionVariant({ iconOnly }: { iconOnly: boolean }): JSX.Element {
+ useMountedLogic(installationStatusNavLogic)
+ useTeamOnboarded()
+ useLocalSession()
+ return <InstallationStatusNavButton iconOnly={iconOnly} />
+}
+
+/** Every state in one frame for side-by-side review. */
+export const AllStates: Story = {
+ parameters: { controls: { disable: true } },
+ render: () => (
+ <div className="flex flex-col gap-4">
+ <StateBlock label="Hidden (onboarded)">
+ <OnboardedVariant />
+ </StateBlock>
+ <StateBlock label="Incomplete onboarding">
+ <NotOnboardedVariant iconOnly={false} />
+ </StateBlock>
+ <StateBlock label="Cloud run in progress">
+ <CloudRunVariant iconOnly={false} startedAtOffset={60_000} />
+ </StateBlock>
+ <StateBlock label="Local session active">
+ <LocalSessionVariant iconOnly={false} />
+ </StateBlock>
+ <StateBlock label="Collapsed (incomplete)">
+ <NotOnboardedVariant iconOnly={true} />
+ </StateBlock>
+ <StateBlock label="Collapsed (cloud run)">
+ <CloudRunVariant iconOnly={true} startedAtOffset={60_000} />
+ </StateBlock>
+ </div>
+ ),
+}
diff --git a/frontend/src/layout/panel-layout/InstallationStatusNavButton.tsx b/frontend/src/layout/panel-layout/InstallationStatusNavButton.tsx
new file mode 100644
index 000000000000..6a56297a285a
--- /dev/null
+++ b/frontend/src/layout/panel-layout/InstallationStatusNavButton.tsx
@@ -0,0 +1,190 @@
+import { useActions, useMountedLogic, useValues } from 'kea'
+import { useEffect, useRef, useState } from 'react'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
+import { cn } from 'lib/utils/css-classes'
+import { elapsedSecondsFrom } from 'lib/utils/datetime'
+import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardActiveSessionDetectorLogic'
+import {
+ activeCloudRunLogic,
+ type CloudRunHandle,
+} from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic'
+import { installationProgressLogic } from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic'
+
+import { installationStatusNavLogic, type NavInstallationPhase } from './installationStatusNavLogic'
+
+// 1Hz clock — only ticks while `enabled` is true (i.e. a run with startedAt is active).
+function useNow(enabled: boolean): number {
+ const [now, setNow] = useState(() => Date.now())
+ useEffect(() => {
+ if (!enabled) {
+ return
+ }
+ const id = window.setInterval(() => setNow(Date.now()), 1000)
+ return () => window.clearInterval(id)
+ }, [enabled])
+ return now
+}
+
+function phaseDotClass(phase: NavInstallationPhase): string {
+ switch (phase) {
+ case 'completed':
+ return 'bg-success'
+ case 'error':
+ return 'bg-danger'
+ case 'idle':
+ return 'bg-muted'
+ case 'connecting':
+ case 'running':
+ return 'bg-accent animate-pulse'
+ }
+}
+
+/**
+ * Mounts `installationProgressLogic` only when a cloud run is active, and reports the phase
+ * back to the parent via a callback. This avoids opening a wizard-session SSE connection for
+ * every authenticated user — the logic's `afterMount` calls `connectSession()`, and
+ * `wizardSessionStreamLogic` has no empty-workflow guard. Mirrors the `WizardSyncLocalGate` pattern.
+ */
+function CloudRunPhaseReporter({
+ handle,
+ onPhase,
+}: {
+ handle: CloudRunHandle
+ onPhase: (phase: NavInstallationPhase | null) => void
+}): null {
+ const { installationProgress } = useValues(
+ installationProgressLogic({ mode: 'cloud', runId: handle.runId, taskId: handle.taskId })
+ )
+ useEffect(() => {
+ onPhase(installationProgress.isCurrent ? installationProgress.phase : null)
+ }, [installationProgress, onPhase])
+ return null
+}
+
+/**
+ * A small running status indicator shown in the sidebar footer, gated behind
+ * `ONBOARDING_WIZARD_SIDEBAR`. Surfaces an active wizard run (cloud or local)
+ * or, when onboarding is incomplete, a "Complete setup" link.
+ *
+ * Follows the same icon/menu pattern as NotificationsMenu — adapts to collapsed
+ * vs expanded nav via `ButtonPrimitive`'s `iconOnly` / `menuItem` props.
+ */
+export function InstallationStatusNavButton({ iconOnly = false }: { iconOnly?: boolean }): JSX.Element | null {
+ const sidebarEnabled = useFeatureFlag('ONBOARDING_WIZARD_SIDEBAR', 'test')
+ // Gate BEFORE mounting any logic: the inner component mounts the session detector (directly and
+ // via installationStatusNavLogic's connect), whose afterMount starts a 60s REST poll. Flag-off
+ // users must not pay that traffic (INC-886 pattern, mirrors WizardProgressFab).
+ if (!sidebarEnabled) {
+ return null
+ }
+ return <InstallationStatusNavButtonInner iconOnly={iconOnly} />
+}
+
+function InstallationStatusNavButtonInner({ iconOnly }: { iconOnly: boolean }): JSX.Element | null {
+ const { shouldShow, isRunActive, phase: logicPhase, onboardingUrl } = useValues(installationStatusNavLogic)
+ const { openDialog } = useActions(installationStatusNavLogic)
+
+ // The detector must be mounted to run the cheap REST poll that surfaces local sessions.
+ useMountedLogic(wizardActiveSessionDetectorLogic)
+ const { activeCloudRun } = useValues(activeCloudRunLogic)
+
+ // Cloud-run phase is reported via a child component that only mounts when a run is active —
+ // avoids opening an SSE stream for every user on every page (INC-886 pattern).
+ const [cloudPhase, setCloudPhase] = useState<NavInstallationPhase | null>(null)
+ const handlePhase = useRef(setCloudPhase)
+ handlePhase.current = setCloudPhase
+
+ // Derive the effective phase: prefer cloud progress when available, fall back to the logic phase.
+ const effectivePhase: NavInstallationPhase = cloudPhase ?? logicPhase
+
+ // Elapsed time — only meaningful for cloud runs (we have the kickoff timestamp).
+ const startedAt = activeCloudRun?.startedAt ?? null
+ const showElapsed = !!startedAt && isRunActive
+ const now = useNow(showElapsed)
+ const elapsedSeconds = startedAt ? elapsedSecondsFrom(startedAt, now) : 0
+
+ // Pulse when the dot's phase changes.
+ const [badgePulse, setBadgePulse] = useState(false)
+ const prevPhaseRef = useRef(effectivePhase)
+ useEffect(() => {
+ if (effectivePhase !== prevPhaseRef.current) {
+ prevPhaseRef.current = effectivePhase
+ setBadgePulse(true)
+ const timer = window.setTimeout(() => setBadgePulse(false), 600)
+ return () => window.clearTimeout(timer)
+ }
+ }, [effectivePhase])
+
+ if (!shouldShow) {
+ return null
+ }
+
+ const handleClick = (): void => {
+ if (isRunActive) {
+ openDialog()
+ } else {
+ window.location.href = onboardingUrl
+ }
+ }
+
+ const tooltipParts: string[] = []
+ if (isRunActive) {
+ if (effectivePhase === 'completed') {
+ tooltipParts.push('PostHog setup complete')
+ } else if (effectivePhase === 'error') {
+ tooltipParts.push('Setup encountered an error')
+ } else {
+ tooltipParts.push('PostHog setup is in progress')
+ }
+ if (showElapsed) {
+ const m = Math.floor(elapsedSeconds / 60)
+ const s = Math.floor(elapsedSeconds % 60)
+ tooltipParts.push(`${m}:${s.toString().padStart(2, '0')}`)
+ }
+ } else {
+ tooltipParts.push('Finish setting up PostHog')
+ }
+
+ const tooltipContent = tooltipParts.join(' · ')
+ const statusLabel = isRunActive ? 'Installation status' : 'Complete setup'
+
+ return (
+ <>
+ {activeCloudRun && <CloudRunPhaseReporter handle={activeCloudRun} onPhase={handlePhase.current} />}
+ <ButtonPrimitive
+ tooltip={iconOnly ? tooltipContent : undefined}
+ tooltipPlacement="right"
+ tooltipCloseDelayMs={0}
+ iconOnly={iconOnly}
+ menuItem={!iconOnly}
+ onClick={handleClick}
+ className="group"
+ data-attr="installation-status-nav-button"
+ >
+ <span
+ className={cn(
+ 'flex text-secondary group-hover:text-primary transition-transform duration-300',
+ badgePulse ? 'scale-125' : 'scale-100'
+ )}
+ >
+ <span className={cn('inline-block size-2 rounded-full', phaseDotClass(effectivePhase))} />
+ </span>
+ {!iconOnly && (
+ <>
+ <span className="-ml-[2px]">{statusLabel}</span>
+ {showElapsed && (
+ <span className="ml-auto text-xs text-muted tabular-nums">
+ {Math.floor(elapsedSeconds / 60)}:
+ {Math.floor(elapsedSeconds % 60)
+ .toString()
+ .padStart(2, '0')}
+ </span>
+ )}
+ </>
+ )}
+ </ButtonPrimitive>
+ </>
+ )
+}
diff --git a/frontend/src/layout/panel-layout/NavBarFooter.tsx b/frontend/src/layout/panel-layout/NavBarFooter.tsx
index 1fb30ad76eed..d5618fc03dbc 100644
--- a/frontend/src/layout/panel-layout/NavBarFooter.tsx
+++ b/frontend/src/layout/panel-layout/NavBarFooter.tsx
@@ -10,6 +10,8 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { cn } from 'lib/utils/css-classes'
import { urls } from 'scenes/urls'
+import { InstallationStatusNavButton } from './InstallationStatusNavButton'
+
export function NavBarFooter({ isLayoutNavCollapsed }: { isLayoutNavCollapsed: boolean }): JSX.Element {
const isNotificationsEnabled = useFeatureFlag('REAL_TIME_NOTIFICATIONS')
@@ -31,6 +33,7 @@ export function NavBarFooter({ isLayoutNavCollapsed }: { isLayoutNavCollapsed: b
})}
>
{isNotificationsEnabled && <NotificationsMenu iconOnly={isLayoutNavCollapsed} />}
+ <InstallationStatusNavButton iconOnly={isLayoutNavCollapsed} />
<Link
to={urls.settings('project')}
buttonProps={{ menuItem: isLayoutNavCollapsed ? false : true }}
diff --git a/frontend/src/layout/panel-layout/installationStatusNavLogic.ts b/frontend/src/layout/panel-layout/installationStatusNavLogic.ts
new file mode 100644
index 000000000000..481056b9711a
--- /dev/null
+++ b/frontend/src/layout/panel-layout/installationStatusNavLogic.ts
@@ -0,0 +1,71 @@
+import { connect, kea, path, selectors } from 'kea'
+
+import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/wizardActiveSessionDetectorLogic'
+import { activeCloudRunLogic } from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic'
+import { wizardSyncUiLogic } from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/wizardSyncUiLogic'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import type { installationStatusNavLogicType } from './installationStatusNavLogicType'
+
+export type NavInstallationPhase = 'running' | 'completed' | 'error' | 'connecting' | 'idle'
+
+/**
+ * Coordinates whether to show an "Installation status" item in the sidebar footer,
+ * and what label / badge tone to display.
+ *
+ * Data sources (all already exist):
+ * - `activeCloudRunLogic.activeCloudRun` — persisted cloud-run handle
+ * - `wizardActiveSessionDetectorLogic.hasActiveSession` — cheap REST poll for local wizard runs
+ * - `teamLogic.hasOnboardedAnyProduct`, `currentTeam.ingested_event` — onboarding relevance
+ * - `wizardSyncUiLogic` — shared dialog state with the floating FAB
+ */
+export const installationStatusNavLogic = kea<installationStatusNavLogicType>([
+ path(['layout', 'panel-layout', 'installationStatusNavLogic']),
+ connect(() => ({
+ values: [
+ activeCloudRunLogic,
+ ['activeCloudRun', 'panelMounted'],
+ wizardActiveSessionDetectorLogic,
+ ['hasActiveSession'],
+ teamLogic,
+ ['hasOnboardedAnyProduct', 'currentTeam'],
+ wizardSyncUiLogic,
+ ['dialogOpen'],
+ ],
+ actions: [wizardSyncUiLogic, ['openDialog']],
+ })),
+ selectors({
+ /** Whether the nav item should render at all. */
+ shouldShow: [
+ (s) => [s.hasOnboardedAnyProduct, s.currentTeam, s.activeCloudRun, s.hasActiveSession, s.panelMounted],
+ (hasOnboardedAnyProduct, currentTeam, activeCloudRun, hasActiveSession, panelMounted): boolean => {
+ // Panel-mounted inline progress already shows the run — avoid double-surfacing
+ if (panelMounted) {
+ return false
+ }
+ // Cloud or local run in flight
+ if (activeCloudRun || hasActiveSession) {
+ return true
+ }
+ // Onboarding is still relevant (no events yet, or no product completed)
+ if (!hasOnboardedAnyProduct && currentTeam && !currentTeam.ingested_event) {
+ return true
+ }
+ return false
+ },
+ ],
+
+ /** Whether an active run (cloud or local) is the reason we're showing. */
+ isRunActive: [
+ (s) => [s.activeCloudRun, s.hasActiveSession],
+ (activeCloudRun, hasActiveSession): boolean => !!(activeCloudRun || hasActiveSession),
+ ],
+
+ /** High-level phase for the badge tone: 'running' while in flight, 'idle' for incomplete onboarding. */
+ phase: [(s) => [s.isRunActive], (isRunActive): NavInstallationPhase => (isRunActive ? 'running' : 'idle')],
+
+ /** URL to navigate to on click when no run is active. */
+ onboardingUrl: [() => [], (): string => urls.onboarding()],
+ }),
+])
diff --git a/frontend/src/lib/components/AuthorizedUrlList/AuthorizedUrlList.tsx b/frontend/src/lib/components/AuthorizedUrlList/AuthorizedUrlList.tsx
index 131a1b03776d..9f2dac54e30c 100644
--- a/frontend/src/lib/components/AuthorizedUrlList/AuthorizedUrlList.tsx
+++ b/frontend/src/lib/components/AuthorizedUrlList/AuthorizedUrlList.tsx
@@ -28,6 +28,8 @@ export interface AuthorizedUrlListProps {
allowAdd?: boolean
allowDelete?: boolean
launchInSameTab?: boolean
+ /** Drop the verbose "there are no authorized URLs" explainer box (e.g. compact onboarding). */
+ hideEmptyState?: boolean
}
export function AuthorizedUrlList({
@@ -44,6 +46,7 @@ export function AuthorizedUrlList({
allowDelete = true,
showLaunch = true,
launchInSameTab = false,
+ hideEmptyState = false,
}: AuthorizedUrlListProps & { addText?: string }): JSX.Element {
const logic = authorizedUrlListLogic({
experimentId: experimentId ?? null,
@@ -66,13 +69,15 @@ export function AuthorizedUrlList({
return (
<div className="flex flex-col gap-2" data-attr="authorized-urls-table">
- <EmptyState
- experimentId={experimentId}
- productTourId={productTourId}
- actionId={actionId}
- type={type}
- displaySuggestions={displaySuggestions}
- />
+ {!hideEmptyState && (
+ <EmptyState
+ experimentId={experimentId}
+ productTourId={productTourId}
+ actionId={actionId}
+ type={type}
+ displaySuggestions={displaySuggestions}
+ />
+ )}
{isAddUrlFormVisible ? (
<div className="border rounded p-2 bg-surface-primary">
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 20570f14bc7e..495a352f20ec 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -1,6 +1,6 @@
-import { LemonSelectOptions } from '@posthog/lemon-ui'
+import type { LemonSelectOptions } from '@posthog/lemon-ui'
-import { ChartDisplayCategory, ChartDisplayType, Region, SDKKey, SSOProvider } from '../types'
+import { ChartDisplayCategory, ChartDisplayType, Region, SDKKey, type SSOProvider } from '../types'
// Sync with backend DISPLAY_TYPES_TO_CATEGORIES
export const DISPLAY_TYPES_TO_CATEGORIES: Record<ChartDisplayType, ChartDisplayCategory> = {
@@ -388,7 +388,7 @@ export const FEATURE_FLAGS = {
NOTEBOOKS_COLLABORATION: 'notebooks-collaboration', // owner: #team-platform-features
NOTEBOOKS_COLLAPSIBLE_SECTIONS: 'notebooks-collapsible-sections', // owner: @benjackwhite
ONBOARDING_DATA_WAREHOUSE_VALUE_PROP: 'onboarding-data-warehouse-value-prop', // owner: @fercgomes #team-growth multivariate=control,table,query
- ONBOARDING_FLOW_VARIANT: 'onboarding-flow-variant', // owner: @fercgomes #team-growth multivariate=legacy,redesign — selects the whole onboarding experience; legacy is the existing flow
+ ONBOARDING_FLOW_VARIANT: 'onboarding-flow-variant', // owner: @fercgomes #team-growth multivariate=control,self-driving — selects the whole onboarding experience; control is the existing flow (the historical `legacy` value is an alias of control)
ONBOARDING_HIDE_BREADCRUMBS: 'onboarding-hide-breadcrumbs', // owner: @fercgomes #team-growth, multivariate=true, hides breadcrumbs during onboarding to reduce distractions
ONBOARDING_MOBILE_INSTALL_HELPER: 'onboarding-mobile-install-helper', // owner: @fercgomes #team-growth multivariate=control,test — target $device_type=Mobile at the flag level
ONBOARDING_NAVBAR: 'onboarding-navbar', // owner: @fercgomes #team-growth, hides the navbar during onboarding to reduce distractions multivariate=true
@@ -396,6 +396,8 @@ export const FEATURE_FLAGS = {
ONBOARDING_PRODUCT_SELECTION_HEADING: 'onboarding-product-selection-heading', // owner: @fercgomes #team-growth, payload overrides the heading copy on the first onboarding page
ONBOARDING_SESSION_REPLAY_MEDIA: 'onboarding-session-replay-media', // owner: @fercgomes #team-growth multivariate=control,screenshot,demo
ONBOARDING_SOCIAL_PROOF_INFO: 'onboarding-social-proof-info', // owner: @fercgomes #team-growth, payload overrides social proof strings per product
+ ONBOARDING_WIZARD_CLOUD_RUN: 'onboarding-wizard-cloud-run', // owner: @fercgomes #team-growth multivariate=control,test — gates the "open a PR for me" cloud wizard option on the install step
+ ONBOARDING_WIZARD_SIDEBAR: 'onboarding-wizard-sidebar', // owner: @fercgomes #team-growth multivariate=control,test — gates the installation status item in the sidebar footer
ONBOARDING_WIZARD_SYNC: 'onboarding-wizard-sync', // owner: @fercgomes #team-growth multivariate=control,test — gates the live wizard sync progress panel
OWNER_ONLY_BILLING: 'owner-only-billing', // owner: @pawelcebula #team-billing
PAGE_REPORTS_AVERAGE_PAGE_VIEW: 'page-reports-average-page-view', // owner: @jordanm-posthog #team-web-analytics
diff --git a/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx b/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx
index 189bc3b82a9d..48dbe2cda54b 100644
--- a/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx
+++ b/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx
@@ -1,22 +1,48 @@
import { useActions, useValues } from 'kea'
import { useEffect, useMemo } from 'react'
-import { LemonInputSelect, LemonInputSelectOption } from '@posthog/lemon-ui'
+import {
+ IconC,
+ IconCode,
+ IconCPlusPlus,
+ IconCSharp,
+ IconDart,
+ IconElixir,
+ IconFlutter,
+ IconGitBranch,
+ IconGo,
+ IconJava,
+ IconJavascript,
+ IconKotlin,
+ IconLock,
+ IconPHP,
+ IconPython,
+ IconReact,
+ IconRuby,
+ IconRust,
+ IconSwift,
+} from '@posthog/icons'
+import { LemonInputSelect, LemonInputSelectOption, LemonTag } from '@posthog/lemon-ui'
+import { dayjs } from 'lib/dayjs'
import { LemonField } from 'lib/lemon-ui/LemonField'
+import type { GitHubRepoApi } from 'products/integrations/frontend/generated/api.schemas'
+
import { githubIntegrationLogic } from './githubIntegrationLogic'
export type GitHubRepositoryPickerProps = {
integrationId: number
value: string
onChange: (value: string) => void
+ className?: string
}
export const GitHubRepositoryPicker = ({
value,
onChange,
integrationId,
+ className,
}: GitHubRepositoryPickerProps): JSX.Element => {
const { options, loading } = useRepositories(integrationId)
@@ -29,6 +55,7 @@ export const GitHubRepositoryPicker = ({
placeholder="Select a repository..."
options={options}
loading={loading}
+ className={className}
/>
)
}
@@ -49,6 +76,84 @@ export const GitHubRepositorySelectField = ({ integrationId }: { integrationId:
)
}
+// Epoch ms for sorting; repos cached before pushed_at existed (or with a bad value) sort last.
+function pushedAtMs(pushedAt?: string): number {
+ const parsed = pushedAt ? Date.parse(pushedAt) : 0
+ return Number.isNaN(parsed) ? 0 : parsed
+}
+
+// GitHub's primary-language string → its brand icon. Keyed lowercase; TypeScript has no dedicated icon
+// so it borrows JavaScript's, and anything unmapped falls back to a generic code glyph.
+const LANGUAGE_ICONS: Record<string, typeof IconCode> = {
+ python: IconPython,
+ javascript: IconJavascript,
+ typescript: IconJavascript,
+ java: IconJava,
+ kotlin: IconKotlin,
+ swift: IconSwift,
+ ruby: IconRuby,
+ rust: IconRust,
+ go: IconGo,
+ php: IconPHP,
+ 'c#': IconCSharp,
+ 'c++': IconCPlusPlus,
+ c: IconC,
+ dart: IconDart,
+ elixir: IconElixir,
+ react: IconReact,
+ flutter: IconFlutter,
+}
+
+// The dropdown row: owner/repo plus the metadata that helps the user pick the right one and know it'll
+// work — language, default branch, recency, private/archived, and whether we can actually open PRs there.
+function RepoOptionLabel({ repo }: { repo: GitHubRepoApi }): JSX.Element {
+ const meta: JSX.Element[] = []
+ if (repo.language) {
+ const LanguageIcon = LANGUAGE_ICONS[repo.language.toLowerCase()] ?? IconCode
+ meta.push(
+ <span key="language" className="flex items-center gap-0.5">
+ <LanguageIcon />
+ {repo.language}
+ </span>
+ )
+ }
+ if (repo.default_branch) {
+ meta.push(
+ <span key="branch" className="flex items-center gap-0.5">
+ <IconGitBranch />
+ {repo.default_branch}
+ </span>
+ )
+ }
+ if (repo.pushed_at) {
+ meta.push(<span key="pushed">Updated {dayjs(repo.pushed_at).fromNow()}</span>)
+ }
+ if (repo.can_push === false) {
+ meta.push(
+ <span key="no-write" className="text-warning">
+ No write access
+ </span>
+ )
+ }
+
+ return (
+ <div className="flex flex-col gap-0.5 py-0.5 min-w-0">
+ <div className="flex items-center gap-1.5 min-w-0">
+ <span className="truncate">{repo.full_name}</span>
+ {repo.private && <IconLock className="shrink-0 text-muted" />}
+ {repo.archived && (
+ <LemonTag size="small" type="muted">
+ Archived
+ </LemonTag>
+ )}
+ </div>
+ {meta.length > 0 && (
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted">{meta}</div>
+ )}
+ </div>
+ )
+}
+
export function useRepositories(integrationId: number): { options: LemonInputSelectOption[]; loading: boolean } {
const logic = githubIntegrationLogic({ id: integrationId })
const { repositories, repositoriesLoading } = useValues(logic)
@@ -58,7 +163,14 @@ export function useRepositories(integrationId: number): { options: LemonInputSel
loadRepositories()
}, [loadRepositories])
- const options = useMemo(() => repositories.map((r) => ({ key: r.name, label: r.full_name })), [repositories])
+ const options = useMemo(
+ () =>
+ // Most-recently-pushed first so the repo the user is working in floats to the top.
+ [...repositories]
+ .sort((a, b) => pushedAtMs(b.pushed_at) - pushedAtMs(a.pushed_at))
+ .map((r) => ({ key: r.name, label: r.full_name, labelComponent: <RepoOptionLabel repo={r} /> })),
+ [repositories]
+ )
return { options, loading: repositoriesLoading }
}
diff --git a/frontend/src/scenes/AuthenticatedShell.tsx b/frontend/src/scenes/AuthenticatedShell.tsx
index ff42856bc3b6..62f7a7eb10b4 100644
--- a/frontend/src/scenes/AuthenticatedShell.tsx
+++ b/frontend/src/scenes/AuthenticatedShell.tsx
@@ -8,7 +8,7 @@ import { ToastCloseButton } from 'lib/lemon-ui/LemonToast/LemonToast'
import { apiStatusLogic } from 'lib/logic/apiStatusLogic'
import { eventIngestionRestrictionLogic } from 'lib/logic/eventIngestionRestrictionLogic'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { WizardProgressFab } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardProgressFab'
+import { WizardSyncFab } from 'scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncFab'
import { GlobalModals } from '~/layout/GlobalModals'
import { GlobalShortcuts } from '~/layout/GlobalShortcuts'
@@ -40,7 +40,7 @@ export default function AuthenticatedShell({ children }: { children: React.React
<Command />
<ImpersonationNotice />
<SelfReadOnlyNotice />
- <WizardProgressFab />
+ <WizardSyncFab />
{featureFlags[FEATURE_FLAGS.EXPERIMENTS_DW_AA_TEST] === 'test' && (
<div data-attr="experiments-dw-aa-test-variant" className="hidden" />
)}
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts b/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts
index a15faa69afa5..8f3cc6d7a99b 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts
+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.test.ts
@@ -609,9 +609,9 @@ describe('onboardingLogic — flow composition', () => {
expect(logic.values.onboardingFlowVariant).toBe('legacy')
})
- it('returns redesign when the flag selects it', () => {
- setVariant('redesign')
- expect(logic.values.onboardingFlowVariant).toBe('redesign')
+ it('returns self-driving when the flag selects it', () => {
+ setVariant('self-driving')
+ expect(logic.values.onboardingFlowVariant).toBe('self-driving')
})
it('falls back to legacy for an unregistered variant', () => {
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
index 7f7ef7f26da1..f0ca328f0c60 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
@@ -1,6 +1,8 @@
import { actions, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
+import { lemonToast } from '@posthog/lemon-ui'
+
import { type SetupTaskId } from 'lib/components/ProductSetup'
import { globalSetupLogic } from 'lib/components/ProductSetup/globalSetupLogic'
import { OrganizationMembershipLevel } from 'lib/constants'
@@ -8,6 +10,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { isKeyOf } from 'lib/utils/guards'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
+import { getRelativeNextPath } from 'lib/utils/url'
import { billingLogic } from 'scenes/billing/billingLogic'
import { resolveOnboardingFlowVariant } from 'scenes/onboarding/onboardingVariants'
import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'
@@ -78,6 +81,9 @@ export const onboardingLogic = kea<onboardingLogicType>([
completeOnboarding: (options?: { redirectUrlOverride?: string }) => ({
redirectUrlOverride: options?.redirectUrlOverride,
}),
+ // Completion for the context-first flow, which has no selected product. Marks onboarding done
+ // (so sceneLogic stops redirecting here) and credits the sources the user turned on.
+ completeContextOnboarding: true,
setSubscribedDuringOnboarding: (subscribedDuringOnboarding: boolean) => ({ subscribedDuringOnboarding }),
setTeamPropertiesForProduct: (productKey: ProductKey) => ({ productKey }),
setWaitForBilling: (waitForBilling: boolean) => ({ waitForBilling }),
@@ -569,6 +575,50 @@ export const onboardingLogic = kea<onboardingLogicType>([
}
teamLogic.actions.updateCurrentTeam({ has_completed_onboarding_for: completedMap })
},
+ completeContextOnboarding: async () => {
+ // Idempotency guard — Finish can fire twice on a double-click.
+ if (values.isCompleting) {
+ return
+ }
+ actions.setIsCompleting(true)
+ const team = values.currentTeam
+ // The posthog-js install always backs product analytics; credit the extra context sources
+ // the user turned on so their products are marked onboarded (and intents recorded).
+ const products: ProductKey[] = [ProductKey.PRODUCT_ANALYTICS]
+ if (team?.session_recording_opt_in) {
+ products.push(ProductKey.SESSION_REPLAY)
+ }
+ if (team?.autocapture_exceptions_opt_in) {
+ products.push(ProductKey.ERROR_TRACKING)
+ }
+ if (team?.surveys_opt_in) {
+ products.push(ProductKey.SURVEYS)
+ }
+ for (const productKey of products) {
+ eventUsageLogic.actions.reportOnboardingCompleted(productKey)
+ actions.recordProductIntentOnboardingComplete({ product_type: productKey })
+ }
+ // Populating has_completed_onboarding_for flips teamLogic.hasOnboardedAnyProduct true, so
+ // sceneLogic stops redirecting back into onboarding. Await the PATCH before navigating —
+ // updateCurrentTeam is NOT optimistic, so leaving early would race a still-stale currentTeam
+ // and sceneLogic could bounce a not-yet-ingested team straight back here.
+ const completedMap: Record<string, boolean> = { ...team?.has_completed_onboarding_for }
+ for (const productKey of products) {
+ completedMap[productKey] = true
+ }
+ try {
+ await teamLogic.asyncActions.updateCurrentTeam({ has_completed_onboarding_for: completedMap })
+ router.actions.push(
+ getRelativeNextPath(router.values.searchParams['next'], window.location) ?? urls.default()
+ )
+ } catch {
+ lemonToast.error("Couldn't finish onboarding. Please try again.")
+ } finally {
+ // Always reset: the context flow has no productKey, so the updateCurrentTeam
+ // success/failure listeners below (gated on productKey) never clear it for us.
+ actions.setIsCompleting(false)
+ }
+ },
skipOnboarding: () => {
// Quick Start does not auto-open here. The button remains in the scene title
// bar so users can open it manually. Auto-opening it conflicted with the welcome
diff --git a/frontend/src/scenes/onboarding/legacy/productRecommendations.ts b/frontend/src/scenes/onboarding/legacy/productRecommendations.ts
index f7798fa5bdd7..0aac6e8b7301 100644
--- a/frontend/src/scenes/onboarding/legacy/productRecommendations.ts
+++ b/frontend/src/scenes/onboarding/legacy/productRecommendations.ts
@@ -56,7 +56,7 @@ export const USE_CASE_OPTIONS: ReadonlyArray<UseCaseDefinition> = [
{
key: 'monitor_ai',
title: 'Monitor AI applications',
- description: 'Track and analyze AI usage, costs, and performance for AI applications',
+ description: 'Track and analyze AI usage, costs, and performance',
iconKey: 'IconLlmAnalytics',
iconColor: 'rgb(182 42 217)',
products: [ProductKey.AI_OBSERVABILITY, ProductKey.PRODUCT_ANALYTICS],
diff --git a/frontend/src/scenes/onboarding/legacy/productSelection/ProductSelection.tsx b/frontend/src/scenes/onboarding/legacy/productSelection/ProductSelection.tsx
index 33f40d5f82a7..66e84cfd1184 100644
--- a/frontend/src/scenes/onboarding/legacy/productSelection/ProductSelection.tsx
+++ b/frontend/src/scenes/onboarding/legacy/productSelection/ProductSelection.tsx
@@ -7,10 +7,10 @@ import { Logomark } from 'lib/brand/Logomark'
import { getFeatureFlagPayload } from 'lib/logic/featureFlagLogic'
import { availableOnboardingProducts, getProductIcon } from 'scenes/onboarding/shared/utils'
-import { ProductKey } from '~/queries/schema/schema-general'
+import type { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingExitAction } from '../exit'
-import { UseCaseDefinition } from '../productRecommendations'
+import type { UseCaseDefinition } from '../productRecommendations'
import { productSelectionLogic } from './productSelectionLogic'
type AvailableOnboardingProductKey = keyof typeof availableOnboardingProducts
@@ -193,6 +193,7 @@ function ProductSelectionStep(): JSX.Element {
{availableOtherProducts.length > 0 && availableRecommendedProducts.length > 0 && !showAllProducts && (
<div className="flex justify-center mt-4">
<button
+ type="button"
onClick={() => setShowAllProducts(true)}
className="text-muted hover:text-default text-sm flex items-center gap-1 cursor-pointer"
>
@@ -238,6 +239,7 @@ function ProductSelectionStep(): JSX.Element {
</LemonButton>
)}
<button
+ type="button"
className="text-muted hover:text-default text-sm cursor-pointer"
onClick={() => setStep('choose_path')}
>
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock.tsx
index 17044a8d40a8..6653b5ba3eab 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock.tsx
+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock.tsx
@@ -1,10 +1,11 @@
import './WizardCommandBlock.scss'
-import { ComponentType, useState } from 'react'
+import { type ComponentType, useState } from 'react'
import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'
import { cn } from 'lib/utils/css-classes'
import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'
+import { WIZARD_HOG_URL } from 'scenes/onboarding/shared/wizardHog'
import androidImage from '../logos/android.svg'
import angularImage from '../logos/angular.svg'
@@ -42,8 +43,6 @@ const WIZARD_FRAMEWORKS: { name: string; icon: string | ComponentType }[] = [
{ name: 'Python', icon: pythonImage },
]
-export const WIZARD_HOG_URL = 'https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png'
-
export function WizardCommandBlock(): JSX.Element {
const { wizardCommand, isCloudOrDev } = useWizardCommand()
const [castKey, setCastKey] = useState(0)
diff --git a/frontend/src/scenes/onboarding/onboardingVariantRegistry.tsx b/frontend/src/scenes/onboarding/onboardingVariantRegistry.tsx
index 034cbcbe9667..37c9f1769159 100644
--- a/frontend/src/scenes/onboarding/onboardingVariantRegistry.tsx
+++ b/frontend/src/scenes/onboarding/onboardingVariantRegistry.tsx
@@ -1,6 +1,6 @@
import { LegacyOnboarding } from './legacy/LegacyOnboarding'
import type { OnboardingFlowVariant } from './onboardingVariants'
-import { RedesignOnboarding } from './redesign/RedesignOnboarding'
+import { SelfDrivingOnboarding } from './self-driving/SelfDrivingOnboarding'
/**
* Maps each shipped variant to its host component. Add a variant here and in
@@ -8,5 +8,5 @@ import { RedesignOnboarding } from './redesign/RedesignOnboarding'
*/
export const onboardingVariantRegistry: Record<OnboardingFlowVariant, () => JSX.Element | null> = {
legacy: LegacyOnboarding,
- redesign: RedesignOnboarding,
+ 'self-driving': SelfDrivingOnboarding,
}
diff --git a/frontend/src/scenes/onboarding/onboardingVariants.test.ts b/frontend/src/scenes/onboarding/onboardingVariants.test.ts
index 1acaf09421ac..412950e60e1d 100644
--- a/frontend/src/scenes/onboarding/onboardingVariants.test.ts
+++ b/frontend/src/scenes/onboarding/onboardingVariants.test.ts
@@ -15,16 +15,24 @@ describe('onboardingVariants', () => {
).toBe('legacy')
})
- it('maps the original control flag value to legacy', () => {
+ it('maps the control flag value to legacy', () => {
expect(
resolveOnboardingFlowVariant({ [FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]: 'control' } as FeatureFlagsSet)
).toBe('legacy')
})
- it('returns redesign when the flag selects it', () => {
+ it('maps the historical legacy flag value to legacy, same as control', () => {
expect(
- resolveOnboardingFlowVariant({ [FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]: 'redesign' } as FeatureFlagsSet)
- ).toBe('redesign')
+ resolveOnboardingFlowVariant({ [FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]: 'legacy' } as FeatureFlagsSet)
+ ).toBe('legacy')
+ })
+
+ it('returns self-driving when the flag selects it', () => {
+ expect(
+ resolveOnboardingFlowVariant({
+ [FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]: 'self-driving',
+ } as FeatureFlagsSet)
+ ).toBe('self-driving')
})
it('falls back to legacy for an unregistered variant', () => {
@@ -41,8 +49,8 @@ describe('onboardingVariants', () => {
expect(onboardingVariantChrome('legacy')).toBe('minimal')
})
- it('redesign keeps the minimal top bar', () => {
- expect(onboardingVariantChrome('redesign')).toBe('minimal')
+ it('self-driving owns the whole viewport (no chrome)', () => {
+ expect(onboardingVariantChrome('self-driving')).toBe('none')
})
})
})
diff --git a/frontend/src/scenes/onboarding/onboardingVariants.ts b/frontend/src/scenes/onboarding/onboardingVariants.ts
index 1132727ac61d..d8fcf8f83afe 100644
--- a/frontend/src/scenes/onboarding/onboardingVariants.ts
+++ b/frontend/src/scenes/onboarding/onboardingVariants.ts
@@ -1,8 +1,8 @@
import { FEATURE_FLAGS } from 'lib/constants'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
-/** Shipped onboarding variants. `legacy` is the existing experience; `redesign` is the new (stubbed) one. */
-export type OnboardingFlowVariant = 'legacy' | 'redesign'
+/** Shipped onboarding variants. `legacy` is the existing experience; `self-driving` is the redesigned one. */
+export type OnboardingFlowVariant = 'legacy' | 'self-driving'
/**
* Chrome rendered around an onboarding variant.
@@ -26,21 +26,18 @@ const DEFAULT_VARIANT_CONFIG: OnboardingVariantConfig = { chrome: 'minimal' }
*/
export const ONBOARDING_FLOW_VARIANTS: Record<OnboardingFlowVariant, OnboardingVariantConfig> = {
legacy: { chrome: 'minimal' },
- redesign: { chrome: 'minimal' },
+ 'self-driving': { chrome: 'none' },
}
/**
- * Resolve the active flow variant from the raw flag value, defaulting to `legacy`. Unknown values
- * and the original `control` flag value (which selected the existing design) both map to `legacy`.
+ * Resolve the active flow variant from the raw flag value. The flag's variant values are `control`
+ * and `self-driving`; only `self-driving` selects the redesign. Everything else — `control`, the
+ * historical `legacy` value (treated as an alias of control), unknown values, booleans, unset —
+ * maps to the internal `legacy` variant (the existing design).
*/
export function resolveOnboardingFlowVariant(featureFlags: FeatureFlagsSet): OnboardingFlowVariant {
const variant = featureFlags[FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]
- if (variant === 'control') {
- return 'legacy'
- }
- return typeof variant === 'string' && variant in ONBOARDING_FLOW_VARIANTS
- ? (variant as OnboardingFlowVariant)
- : DEFAULT_VARIANT
+ return variant === 'self-driving' ? 'self-driving' : DEFAULT_VARIANT
}
export function onboardingVariantChrome(variant: OnboardingFlowVariant): OnboardingVariantChrome {
diff --git a/frontend/src/scenes/onboarding/redesign/RedesignOnboarding.tsx b/frontend/src/scenes/onboarding/redesign/RedesignOnboarding.tsx
deleted file mode 100644
index 7446c5fca510..000000000000
--- a/frontend/src/scenes/onboarding/redesign/RedesignOnboarding.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Host for the redesigned onboarding experience. WIP.
- */
-export function RedesignOnboarding(): JSX.Element {
- return (
- <div className="flex h-full items-center justify-center p-8">
- <p className="text-muted">The redesigned onboarding experience is under construction.</p>
- </div>
- )
-}
diff --git a/frontend/src/scenes/onboarding/self-driving/ContextBillingStep.tsx b/frontend/src/scenes/onboarding/self-driving/ContextBillingStep.tsx
new file mode 100644
index 000000000000..8e826b463222
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/ContextBillingStep.tsx
@@ -0,0 +1,215 @@
+import { useActions, useValues } from 'kea'
+
+import { IconCheck } from '@posthog/icons'
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
+
+import { BillingUpgradeCTA } from 'lib/components/BillingUpgradeCTA'
+import { pluralize } from 'lib/utils/strings'
+import { billingLogic } from 'scenes/billing/billingLogic'
+import { paymentEntryLogic } from 'scenes/billing/paymentEntryLogic'
+import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'
+
+import { ProductKey } from '~/queries/schema/schema-general'
+import { type BillingProductV2Type } from '~/types'
+
+/**
+ * Inline billing step body for the context-first onboarding flow.
+ *
+ * No flow navigation lives here; the parent shell owns Back/Continue/Skip. The only action this
+ * step fires is the payment-entry flow, which opens the globally mounted PaymentEntryModal (see
+ * layout/GlobalModals) over the card and returns to the same URL. Nothing here redirects away.
+ */
+
+// Compact free-tier allowance, shown so "start free" reads as an honest offer rather than a teaser.
+function FreeTierRow({ value, unit, name }: { value: number; unit: string; name: string }): JSX.Element {
+ const formatted = Intl.NumberFormat('en', {
+ notation: 'compact',
+ compactDisplay: 'short',
+ maximumFractionDigits: 1,
+ }).format(value)
+
+ return (
+ <li className="flex items-center gap-2">
+ <IconCheck className="size-4 text-success shrink-0" />
+ <span className="text-sm">
+ <strong>
+ {formatted} {pluralize(value, unit, undefined, false)}
+ </strong>{' '}
+ <span className="text-muted">/ month {name}, free</span>
+ </span>
+ </li>
+ )
+}
+
+function FreeTierSummary(): JSX.Element | null {
+ const { billing } = useValues(billingLogic)
+
+ const allowances = (billing?.products ?? [])
+ .filter((product) => product.type in availableOnboardingProducts)
+ .map((product) => {
+ const freePlan = product.plans.find((plan) => plan.plan_key?.startsWith('free'))
+ return {
+ name: product.name,
+ unit: freePlan?.unit ?? '',
+ value: freePlan?.free_allocation ?? 0,
+ }
+ })
+ .filter((allowance) => allowance.unit && allowance.value > 0)
+
+ if (allowances.length === 0) {
+ return null
+ }
+
+ return (
+ <ul className="flex flex-col gap-1.5 m-0 p-0 list-none">
+ {allowances.map((allowance) => (
+ <FreeTierRow key={allowance.name} value={allowance.value} unit={allowance.unit} name={allowance.name} />
+ ))}
+ </ul>
+ )
+}
+
+function SubscribedState({ onContinue }: { onContinue: () => void }): JSX.Element {
+ return (
+ <div className="flex flex-col gap-3">
+ <div className="flex items-start gap-3 p-4 border border-success rounded-lg bg-success-highlight">
+ <IconCheck className="size-5 text-success shrink-0 mt-0.5" />
+ <div className="flex-1 min-w-0">
+ <p className="m-0 text-sm font-semibold">You're on the pay-as-you-go plan</p>
+ <p className="m-0 text-xs text-muted">
+ Every tool is unlocked. You still get the monthly free tier on each. You only pay for usage
+ beyond it.
+ </p>
+ </div>
+ </div>
+ <p className="text-xs text-muted m-0">Change or cancel any time from billing settings.</p>
+ <LemonButton type="primary" status="alt" onClick={onContinue} className="self-end">
+ Continue
+ </LemonButton>
+ </div>
+ )
+}
+
+function PlanChoice({
+ platformProduct,
+ onContinue,
+}: {
+ platformProduct: BillingProductV2Type | null
+ onContinue: () => void
+}): JSX.Element {
+ const { startPaymentEntryFlow } = useActions(paymentEntryLogic)
+ // Guard the subscribe button against double-submit: `isLoading` covers the returning-customer
+ // activate call, `paymentEntryModalOpen` covers a new customer once the Stripe modal is up.
+ const { isLoading, paymentEntryModalOpen } = useValues(paymentEntryLogic)
+ const subscribing = isLoading || paymentEntryModalOpen
+
+ const subscribe = (): void => {
+ // Returning the user to the same URL keeps them in the onboarding flow once payment resolves.
+ startPaymentEntryFlow(platformProduct, window.location.pathname + window.location.search)
+ }
+
+ return (
+ <div className="flex flex-wrap gap-3">
+ <p className="text-sm text-muted m-0 w-full">
+ Start free, no card required. You only pay for usage past the monthly free tier on each tool.
+ </p>
+
+ <div className="flex flex-1 basis-72 flex-col gap-3 p-4 border border-primary rounded-lg">
+ <div className="flex items-baseline justify-between gap-2">
+ <p className="m-0 text-base font-semibold">Free</p>
+ <p className="m-0 text-sm text-muted">$0 / month</p>
+ </div>
+ <FreeTierSummary />
+ <p className="m-0 text-xs text-muted">
+ Usage pauses at the free tier instead of charging you. Good for trying things out.
+ </p>
+ <LemonButton
+ type="secondary"
+ fullWidth
+ center
+ onClick={onContinue}
+ className="mt-auto"
+ data-attr="context-onboarding-free"
+ >
+ Continue on free
+ </LemonButton>
+ </div>
+
+ <div className="flex flex-1 basis-72 flex-col gap-3 p-4 border-2 border-accent rounded-lg">
+ <div className="flex items-baseline justify-between gap-2">
+ <div>
+ <p className="m-0 text-base font-semibold">Pay-as-you-go</p>
+ <p className="m-0 text-xs text-muted">Free tier included</p>
+ </div>
+ <p className="m-0 text-sm text-muted">based on usage</p>
+ </div>
+ <ul className="flex flex-col gap-1.5 m-0 p-0 list-none">
+ {[
+ 'Every tool unlocked, no caps',
+ 'Same monthly free tier on each tool',
+ 'Add a card now, pay only past the free tier',
+ ].map((line) => (
+ <li key={line} className="flex items-center gap-2">
+ <IconCheck className="size-4 text-success shrink-0" />
+ <span className="text-sm">{line}</span>
+ </li>
+ ))}
+ </ul>
+ <BillingUpgradeCTA
+ type="primary"
+ status="alt"
+ fullWidth
+ center
+ className="mt-auto"
+ loading={subscribing}
+ disabledReason={subscribing ? 'Opening payment…' : undefined}
+ disableClientSideRouting
+ onClick={subscribe}
+ data-attr="context-onboarding-subscribe"
+ >
+ Add payment method
+ </BillingUpgradeCTA>
+ </div>
+ </div>
+ )
+}
+
+export function ContextBillingStep({ onContinue }: { onContinue: () => void }): JSX.Element {
+ const { billing, billingLoading } = useValues(billingLogic)
+
+ if (!billing && billingLoading) {
+ return (
+ <div className="flex items-center justify-center py-12">
+ <Spinner className="text-2xl text-muted size-8" />
+ </div>
+ )
+ }
+
+ // No billing at all (e.g. self-hosted without a license), so nothing to subscribe to here.
+ if (!billing) {
+ return (
+ <div className="flex flex-col gap-3">
+ <p className="text-sm text-muted m-0">
+ Billing isn't configured on this instance, so there's nothing to pick here.
+ </p>
+ <div className="flex items-center justify-between gap-2">
+ <LemonButton type="secondary" to="https://posthog.com/pricing" targetBlank>
+ See pricing
+ </LemonButton>
+ <LemonButton type="primary" status="alt" onClick={onContinue}>
+ Continue
+ </LemonButton>
+ </div>
+ </div>
+ )
+ }
+
+ if (billing.has_active_subscription) {
+ return <SubscribedState onContinue={onContinue} />
+ }
+
+ const platformProduct =
+ billing.products?.find((product) => product.type === ProductKey.PLATFORM_AND_SUPPORT) ?? null
+
+ return <PlanChoice platformProduct={platformProduct} onContinue={onContinue} />
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/ContextInviteStep.tsx b/frontend/src/scenes/onboarding/self-driving/ContextInviteStep.tsx
new file mode 100644
index 000000000000..06a1a6051e3c
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/ContextInviteStep.tsx
@@ -0,0 +1,62 @@
+import { useActions, useValues } from 'kea'
+
+import { IconCheckCircle } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
+import { inviteLogic } from 'scenes/settings/organization/inviteLogic'
+import { InviteTeamMatesComponent } from 'scenes/settings/organization/InviteModal'
+
+/**
+ * Body of the "Invite your team" step in the context-first onboarding flow.
+ *
+ * Reuses the real bulk-invite UI (`InviteTeamMatesComponent`) and logic (`inviteLogic`) so teammates
+ * can be invited by email inline, no redirect to settings. Navigation (Back/Continue/Skip) is owned
+ * by the parent shell; this renders body content only.
+ */
+export function ContextInviteStep(): JSX.Element {
+ const { preflight } = useValues(preflightLogic)
+ const { invitesToSend, canSubmit, isInviting, inviteContainsOwnerLevel } = useValues(inviteLogic)
+ const { inviteTeamMembers } = useActions(inviteLogic)
+
+ const emailServiceAvailable = !!preflight?.email_service_available
+ const hasFilledEmail = invitesToSend.some(({ target_email }) => !!target_email)
+ const hasInvalidEmail = invitesToSend.some(({ isValid }) => !isValid)
+
+ const sendDisabledReason = hasInvalidEmail
+ ? 'Enter a valid email address'
+ : inviteContainsOwnerLevel && !canSubmit
+ ? 'Type "send invites" to confirm inviting owners'
+ : !canSubmit
+ ? 'Fill out all fields first'
+ : undefined
+
+ return (
+ <div className="flex flex-col gap-4">
+ <p className="text-sm text-muted m-0">
+ PostHog gets better with the people who know the product. Bring your teammates in so they can steer the
+ agents too.
+ </p>
+
+ {/* Reuses the real invite rows + logic: email, optional name, org level, add/remove. */}
+ <InviteTeamMatesComponent hideProjectAccessSelector />
+
+ {/* Only email-based invites get a dedicated send action; without an email service each row
+ generates its own invite link via the component's per-row submit button. */}
+ {emailServiceAvailable && (
+ <div className="flex justify-end">
+ <LemonButton
+ type="primary"
+ icon={<IconCheckCircle />}
+ onClick={() => inviteTeamMembers()}
+ loading={isInviting}
+ disabledReason={!hasFilledEmail ? 'Add a teammate to invite' : sendDisabledReason}
+ data-attr="context-onboarding-send-invites"
+ >
+ Send invites
+ </LemonButton>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/ContextOnboarding.tsx b/frontend/src/scenes/onboarding/self-driving/ContextOnboarding.tsx
new file mode 100644
index 000000000000..6dd3d3652353
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/ContextOnboarding.tsx
@@ -0,0 +1,646 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import { type ReactNode, useEffect, useState } from 'react'
+
+import { IconArrowLeft, IconArrowRight, IconCheckCircle, IconCloud, IconGithub, IconTerminal } from '@posthog/icons'
+import { LemonButton, LemonSegmentedButton, LemonSwitch, LemonTag, Link } from '@posthog/lemon-ui'
+
+import { AuthorizedUrlList } from 'lib/components/AuthorizedUrlList/AuthorizedUrlList'
+import { AuthorizedUrlListType } from 'lib/components/AuthorizedUrlList/authorizedUrlListLogic'
+import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { Spinner } from 'lib/lemon-ui/Spinner'
+import { cn } from 'lib/utils/css-classes'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { ProductKey } from '~/queries/schema/schema-general'
+
+import selfDrivingHog from 'public/hedgehog/self-driving-hog.png'
+
+import { onboardingLogic } from '../legacy/onboardingLogic'
+import {
+ useWizardTakeoverActive,
+ WizardProgressTracker,
+} from '../legacy/sdks/OnboardingInstallStep/WizardProgressTracker'
+import { useWizardCommand } from '../shared/SetupWizardBanner'
+import { availableOnboardingProducts, getProductIcon, toSentenceCase } from '../shared/utils'
+import { ContextBillingStep } from './ContextBillingStep'
+import { ContextInviteStep } from './ContextInviteStep'
+import { ContextWarehouseStep } from './ContextWarehouseStep'
+import { activeCloudRunLogic, type CloudRunHandle } from './sdks/OnboardingInstallStep/activeCloudRunLogic'
+import { installationProgressLogic } from './sdks/OnboardingInstallStep/installationProgressLogic'
+import { WizardCloudRunBlock } from './sdks/OnboardingInstallStep/WizardCloudRunBlock'
+import { wizardCloudRunLogic } from './sdks/OnboardingInstallStep/wizardCloudRunLogic'
+import { WizardCommandBlock } from './sdks/OnboardingInstallStep/WizardCommandBlock'
+import { WizardFrameworkBadges } from './sdks/OnboardingInstallStep/WizardModeShell'
+
+/**
+ * Context-first onboarding (prototype, legacy variant). A fixed linear flow, one thing per step,
+ * that replaces "pick a use case → pick products". Steps configure the context PostHog runs on.
+ * Real where cheap (install command, source toggles → team props); warehouse/billing/invite and
+ * completion wiring are still thin and marked for follow-up.
+ */
+
+// ---- Steps ---------------------------------------------------------------------------------------
+
+function WelcomeStep(): JSX.Element {
+ return (
+ <div className="flex flex-col items-center text-center gap-5">
+ <img src={selfDrivingHog} alt="A hedgehog riding in a self-driving car" className="w-full rounded-lg" />
+ <div className="flex flex-col gap-2">
+ <h1 className="text-2xl font-bold m-0">Let's make your product self-driving</h1>
+ <p className="text-muted max-w-md mx-auto m-0">
+ PostHog runs on your product's context. We'll get it flowing in a few steps, then agents can start
+ finding and fixing things, with you steering.
+ </p>
+ </div>
+ </div>
+ )
+}
+
+type InstallMode = 'cloud' | 'local'
+
+// One wizard, two ways to run it: have us run it and open a PR (the self-driving path), or run the
+// CLI yourself. A segmented control switches between them. The cloud path only exists behind
+// ONBOARDING_WIZARD_CLOUD_RUN on cloud/dev; elsewhere this collapses to just the local command.
+// hideHog keeps the compact onboarding card free of the wizard hedgehog.
+function InstallOptions({ onContinue }: { onContinue: () => void }): JSX.Element {
+ const cloudRunEnabled = useFeatureFlag('ONBOARDING_WIZARD_CLOUD_RUN', 'test')
+ const { isCloudOrDev } = useWizardCommand()
+ const { activeCloudRun } = useValues(activeCloudRunLogic)
+ const { clearActiveCloudRun } = useActions(activeCloudRunLogic)
+ const [mode, setMode] = useState<InstallMode>('cloud')
+ const offerCloud = cloudRunEnabled && isCloudOrDev
+ // GROW-95: once a cloud run is spawned you cannot also run it locally, so the local tab is blocked and
+ // the view pins to the cloud run's progress until it is cleared (e.g. via the failure fallback below).
+ const localBlocked = !!activeCloudRun
+ const effectiveMode: InstallMode = localBlocked ? 'cloud' : mode
+
+ // A failed cloud run's fallback: drop the dead run (unblocks local, clears its FAB) and switch to the command.
+ const runItYourself = (): void => {
+ clearActiveCloudRun()
+ setMode('local')
+ }
+
+ // Self-hosted: the wizard CLI / cloud run only target cloud + dev, so both wizard blocks render
+ // nothing. Show a real, actionable fallback instead of an empty step.
+ if (!isCloudOrDev) {
+ return (
+ <div className="flex flex-col gap-3">
+ <p className="text-sm text-muted m-0">
+ Install the PostHog SDK for your framework and your product's context starts flowing in, ready for
+ agents to act on.
+ </p>
+ <LemonButton type="primary" to="https://posthog.com/docs/getting-started/install" targetBlank>
+ Read the install docs
+ </LemonButton>
+ </div>
+ )
+ }
+
+ return (
+ <div className="flex flex-col gap-4">
+ {/* Establishes the priority order: the easy path (we run it, you get a PR) up front; the
+ toggle below is the actor sub-choice; manual docs are the quiet fallback at the bottom. */}
+ {offerCloud ? (
+ <p className="text-sm text-muted text-center m-0">
+ Get your product's context flowing so agents can start finding and fixing things. The easiest way is
+ to let us set it up and open a PR you just review and merge.
+ </p>
+ ) : (
+ <p className="text-sm text-muted text-center m-0">
+ Run the wizard to get your product's context flowing so agents can start finding and fixing things.
+ </p>
+ )}
+ {/* Frameworks are the same whichever way the wizard runs, so the badges sit above the selector. */}
+ {isCloudOrDev && (
+ <div className="pb-2">
+ <WizardFrameworkBadges />
+ </div>
+ )}
+ {offerCloud && (
+ <LemonSegmentedButton
+ fullWidth
+ value={effectiveMode}
+ onChange={(value) => setMode(value)}
+ options={[
+ {
+ value: 'cloud',
+ label: 'Open a pull request',
+ icon: <IconCloud />,
+ 'data-attr': 'context-wizard-mode-cloud',
+ },
+ {
+ value: 'local',
+ label: 'Run it yourself',
+ icon: <IconTerminal />,
+ disabledReason: localBlocked ? 'A cloud run is in progress.' : undefined,
+ 'data-attr': 'context-wizard-mode-local',
+ },
+ ]}
+ />
+ )}
+ {/* No onQueued: unlike the legacy install step, this flow's footer Continue is always
+ enabled (install is non-blocking), so a queued cloud run needs no extra unblock signal. */}
+ {offerCloud && effectiveMode === 'cloud' ? (
+ // GROW-96: kicking off the cloud run is the step's "next" action, so onQueued advances the flow.
+ <WizardCloudRunBlock hideHog onRetryLocally={runItYourself} onQueued={onContinue} />
+ ) : (
+ <WizardCommandBlock hideHog />
+ )}
+ <p className="text-xs text-muted m-0 text-center">
+ Rather wire it up by hand?{' '}
+ <Link to="https://posthog.com/docs/getting-started/install" target="_blank">
+ Read the install docs
+ </Link>
+ </p>
+ </div>
+ )
+}
+
+// When wizard sync is on and a LOCAL run is in flight, swap the options for the live tracker. A cloud
+// run is already surfaced by the unified Installation layer (WizardCloudRunBlock → InstallationProgressView),
+// and the cloud wizard posts to the same session — so suppress the legacy tracker when a cloud run is
+// active to avoid showing two progress components.
+function InstallStepWithSync({ onContinue }: { onContinue: () => void }): JSX.Element {
+ const isTakeoverActive = useWizardTakeoverActive()
+ const { activeCloudRun } = useValues(activeCloudRunLogic)
+ const { setPanelMounted } = useActions(activeCloudRunLogic)
+ const showLegacyTracker = isTakeoverActive && !activeCloudRun
+ // While the inline legacy tracker shows a local run on this step, claim the shared inline-panel flag
+ // so the detached WizardSyncFab hides and the run is not shown in two places.
+ useEffect(() => {
+ if (showLegacyTracker) {
+ setPanelMounted(true)
+ return () => setPanelMounted(false)
+ }
+ }, [showLegacyTracker, setPanelMounted])
+ return showLegacyTracker ? <WizardProgressTracker /> : <InstallOptions onContinue={onContinue} />
+}
+
+function InstallStep({ onContinue }: { onContinue: () => void }): JSX.Element {
+ const isSyncEnabled = useFeatureFlag('ONBOARDING_WIZARD_SYNC', 'test')
+ return isSyncEnabled ? <InstallStepWithSync onContinue={onContinue} /> : <InstallOptions onContinue={onContinue} />
+}
+
+interface ToolToggle {
+ label: string
+ description?: string
+ checked: boolean
+ onChange: (checked: boolean) => void
+ disabled?: boolean
+}
+
+interface ToolSource {
+ productKey: ProductKey
+ /** Whether this tool is configured to produce meaningful context. */
+ active: boolean
+ /** Shown under the tool name when context comes from something other than the toggles below. */
+ note?: string
+ toggles: ToolToggle[]
+ /** Extra config rendered under the toggles (e.g. web analytics authorized domains). */
+ extra?: ReactNode
+ /** Spans both grid columns — for the card that carries extra config (web analytics domains). */
+ wide?: boolean
+}
+
+// Tint a `rgb(r g b)` color string into a faint background fill for the icon chip.
+function tint(color: string): string {
+ return color.replace(/\)$/, ' / 0.12)')
+}
+
+// Card status reflects config, the SDK, and any in-flight install. The install delivers the SDK every
+// source needs, so while it runs a turned-on source is "Installing" and a turned-off one reads
+// "Available" — turn it on and it gets installed too. Otherwise it's "Active" once events arrive,
+// "Needs install" if on with nothing running, or "Off".
+function statusFor(
+ active: boolean,
+ sdkInstalled: boolean,
+ installing: boolean
+): { type: 'muted' | 'success' | 'warning' | 'primary'; label: string; loading?: boolean } {
+ if (!active) {
+ return installing ? { type: 'muted', label: 'Available' } : { type: 'muted', label: 'Off' }
+ }
+ if (installing) {
+ return { type: 'primary', label: 'Installing', loading: true }
+ }
+ return sdkInstalled ? { type: 'success', label: 'Active' } : { type: 'warning', label: 'Needs install' }
+}
+
+function ToolCard({
+ source,
+ sdkInstalled,
+ installing,
+}: {
+ source: ToolSource
+ sdkInstalled: boolean
+ installing: boolean
+}): JSX.Element {
+ const product = availableOnboardingProducts[source.productKey as keyof typeof availableOnboardingProducts]
+ const color = product?.iconColor ?? 'var(--color-text-secondary)'
+ const status = statusFor(source.active, sdkInstalled, installing)
+
+ return (
+ <div
+ className={cn(
+ 'flex h-full flex-col gap-3 p-4 rounded-lg border transition-colors',
+ source.active ? 'border-accent' : 'border-primary',
+ source.wide && 'sm:col-span-2'
+ )}
+ >
+ <div className="flex items-center gap-3">
+ <div
+ className="size-9 rounded-md flex items-center justify-center shrink-0"
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ backgroundColor: tint(color) }}
+ >
+ {getProductIcon(product?.icon, { iconColor: color, className: 'text-lg' })}
+ </div>
+ <div className="flex-1 min-w-0">
+ <p className="m-0 text-sm font-semibold">{toSentenceCase(product?.name ?? source.productKey)}</p>
+ {source.note && <p className="m-0 text-xs text-muted">{source.note}</p>}
+ </div>
+ <LemonTag type={status.type} icon={status.loading ? <Spinner textColored /> : undefined}>
+ {status.label}
+ </LemonTag>
+ </div>
+ <div className="flex flex-col gap-2">
+ {source.toggles.map((toggle) => (
+ <div key={toggle.label} className="flex items-center justify-between gap-3">
+ <div className="min-w-0">
+ <p className={cn('m-0 text-sm', toggle.disabled && 'text-muted')}>{toggle.label}</p>
+ {toggle.description && <p className="m-0 text-xs text-muted">{toggle.description}</p>}
+ </div>
+ <LemonSwitch
+ checked={toggle.checked}
+ onChange={toggle.onChange}
+ disabled={toggle.disabled}
+ size="small"
+ />
+ </div>
+ ))}
+ </div>
+ {source.extra && <div>{source.extra}</div>}
+ </div>
+ )
+}
+
+interface CodebaseAccess {
+ connected: boolean
+ /** GitHub org/account the integration is connected to, shown in the connected state. */
+ displayName: string | null
+ /** OAuth URL to connect GitHub (activate codebase access) from here. */
+ connectUrl: string
+}
+
+// Codebase access is a context source too — agents read the connected repo. Unlike the SDK-backed
+// sources it doesn't ride the install; it's live as soon as GitHub is connected, so a user who skipped
+// connecting during install can turn it on here.
+function CodebaseAccessCard({ codebase }: { codebase: CodebaseAccess }): JSX.Element {
+ return (
+ <div
+ className={cn(
+ 'flex h-full flex-col gap-3 p-4 rounded-lg border transition-colors',
+ codebase.connected ? 'border-accent' : 'border-primary'
+ )}
+ >
+ <div className="flex items-center gap-3">
+ <div
+ className="size-9 rounded-md flex items-center justify-center shrink-0"
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ backgroundColor: tint('rgb(100 116 139)') }}
+ >
+ <IconGithub className="text-lg" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <p className="m-0 text-sm font-semibold">Codebase access</p>
+ <p className="m-0 text-xs text-muted">Let agents read your code to find and fix issues.</p>
+ </div>
+ <LemonTag type={codebase.connected ? 'success' : 'muted'}>
+ {codebase.connected ? 'Active' : 'Off'}
+ </LemonTag>
+ </div>
+ {codebase.connected ? (
+ <div className="flex items-center gap-1.5 text-xs text-muted mt-auto">
+ <IconCheckCircle className="text-success" />
+ <span>Connected{codebase.displayName ? ` to ${codebase.displayName}` : ''}</span>
+ </div>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconGithub />}
+ to={codebase.connectUrl}
+ disableClientSideRouting
+ className="self-start mt-auto"
+ >
+ Connect GitHub
+ </LemonButton>
+ )}
+ </div>
+ )
+}
+
+function SourcesStep(): JSX.Element {
+ const { activeCloudRun } = useValues(activeCloudRunLogic)
+ // GitHub connection drives the codebase-access source, available whether or not a run is in flight.
+ const { githubIntegration, connectGitHubUrl } = useValues(wizardCloudRunLogic)
+ const codebase: CodebaseAccess = {
+ connected: !!githubIntegration,
+ displayName: githubIntegration?.display_name ?? null,
+ connectUrl: connectGitHubUrl,
+ }
+ // Subscribe to the install stream only when a run exists — keeps this step from opening an SSE for
+ // everyone who never triggered one.
+ return activeCloudRun ? (
+ <SourcesStepWithRun run={activeCloudRun} codebase={codebase} />
+ ) : (
+ <SourcesStepInner installing={false} repository={null} codebase={codebase} />
+ )
+}
+
+// While a cloud run is connecting/running, the sources it would feed aren't live yet. Pass that down
+// along with the repo it's landing in, so the step can name the install target once.
+function SourcesStepWithRun({ run, codebase }: { run: CloudRunHandle; codebase: CodebaseAccess }): JSX.Element {
+ const { installationProgress } = useValues(
+ installationProgressLogic({ mode: 'cloud', runId: run.runId, taskId: run.taskId })
+ )
+ const { selectedRepository } = useValues(wizardCloudRunLogic)
+ const installing = installationProgress.phase === 'connecting' || installationProgress.phase === 'running'
+ return (
+ <SourcesStepInner
+ installing={installing}
+ repository={installing ? selectedRepository : null}
+ codebase={codebase}
+ />
+ )
+}
+
+// Exported for Storybook: the presentational sources step takes `installing`, the install's repo, and the
+// codebase-access state as props, so stories can render every state without standing up the live logics.
+export function SourcesStepInner({
+ installing,
+ repository,
+ codebase,
+}: {
+ installing: boolean
+ repository: string | null
+ codebase: CodebaseAccess
+}): JSX.Element {
+ const { currentTeam } = useValues(teamLogic)
+ const { updateCurrentTeam } = useActions(teamLogic)
+
+ const autocaptureOn = !currentTeam?.autocapture_opt_out
+ const replayOn = !!currentTeam?.session_recording_opt_in
+ // Web analytics scopes to the team's authorized domains (app_urls); without one it has nothing to track.
+ const hasAuthorizedDomain = (currentTeam?.app_urls?.length ?? 0) > 0
+ // Every source here collects through the posthog-js SDK; ingested_event is our proxy for it being
+ // installed and sending. Until then, turned-on sources read as "Needs install".
+ const sdkInstalled = !!currentTeam?.ingested_event
+
+ const sources: ToolSource[] = [
+ {
+ productKey: ProductKey.PRODUCT_ANALYTICS,
+ active: autocaptureOn,
+ toggles: [
+ {
+ label: 'Autocapture events',
+ description: 'Clicks, pageviews, and inputs captured automatically.',
+ checked: autocaptureOn,
+ onChange: (checked) => updateCurrentTeam({ autocapture_opt_out: !checked }),
+ },
+ {
+ label: 'Heatmaps',
+ description: 'Aggregate clicks, scrolls, and mouse movement.',
+ checked: !!currentTeam?.heatmaps_opt_in,
+ onChange: (checked) => updateCurrentTeam({ heatmaps_opt_in: checked }),
+ },
+ ],
+ },
+ {
+ productKey: ProductKey.SESSION_REPLAY,
+ active: replayOn,
+ toggles: [
+ {
+ label: 'Record sessions',
+ checked: replayOn,
+ onChange: (checked) => updateCurrentTeam({ session_recording_opt_in: checked }),
+ },
+ {
+ label: 'Console logs',
+ checked: !!currentTeam?.capture_console_log_opt_in,
+ onChange: (checked) => updateCurrentTeam({ capture_console_log_opt_in: checked }),
+ disabled: !replayOn,
+ },
+ {
+ label: 'Network performance',
+ checked: !!currentTeam?.capture_performance_opt_in,
+ onChange: (checked) => updateCurrentTeam({ capture_performance_opt_in: checked }),
+ disabled: !replayOn,
+ },
+ ],
+ },
+ {
+ productKey: ProductKey.ERROR_TRACKING,
+ active: !!currentTeam?.autocapture_exceptions_opt_in,
+ toggles: [
+ {
+ label: 'Capture exceptions',
+ description: 'Errors and stack traces as they happen.',
+ checked: !!currentTeam?.autocapture_exceptions_opt_in,
+ onChange: (checked) => updateCurrentTeam({ autocapture_exceptions_opt_in: checked }),
+ },
+ ],
+ },
+ {
+ productKey: ProductKey.WEB_ANALYTICS,
+ active: autocaptureOn && hasAuthorizedDomain,
+ toggles: [
+ {
+ label: 'Web vitals',
+ description: 'Load times and layout shifts from real users.',
+ checked: !!currentTeam?.autocapture_web_vitals_opt_in,
+ onChange: (checked) => updateCurrentTeam({ autocapture_web_vitals_opt_in: checked }),
+ },
+ ],
+ extra: (
+ <div className="flex flex-col gap-1.5">
+ <p className="m-0 text-sm">Authorized domains</p>
+ <p className="m-0 text-xs text-muted">Add the domains you want web analytics to track.</p>
+ <AuthorizedUrlList
+ type={AuthorizedUrlListType.WEB_ANALYTICS}
+ allowWildCards={false}
+ showLaunch={false}
+ displaySuggestions={false}
+ hideEmptyState
+ addText="Add a domain"
+ />
+ </div>
+ ),
+ },
+ ]
+
+ return (
+ <div className="flex flex-col gap-4">
+ <p className="text-sm text-muted m-0">
+ {!installing ? (
+ "Active sources feed context to PostHog. Turn on what's relevant — you can change these any time."
+ ) : repository ? (
+ <>
+ Installing PostHog into <span className="font-mono text-default">{repository}</span>. Turn on
+ anything you want included.
+ </>
+ ) : (
+ 'Installing PostHog. Turn on anything you want included.'
+ )}
+ </p>
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
+ <CodebaseAccessCard codebase={codebase} />
+ {sources.map((source) => (
+ <ToolCard
+ key={source.productKey}
+ source={source}
+ sdkInstalled={sdkInstalled}
+ installing={installing}
+ />
+ ))}
+ </div>
+ </div>
+ )
+}
+
+// ---- Shell ---------------------------------------------------------------------------------------
+
+interface StepDef {
+ id: string
+ title: string
+ Content: (props: { onContinue: () => void }) => JSX.Element
+ skippable?: boolean
+ /** Step provides its own primary action (e.g. plan picks), so suppress the footer Continue. */
+ hideContinue?: boolean
+ /** Tailwind `max-w-*` for the card on this step. Defaults to `max-w-xl`; wider steps (e.g. billing
+ * with side-by-side plan cards) opt into more room. */
+ maxWidth?: string
+}
+
+const STEPS: StepDef[] = [
+ { id: 'welcome', title: '', Content: WelcomeStep },
+ { id: 'install', title: 'Install PostHog', Content: InstallStep },
+ { id: 'sources', title: 'Turn on your sources', Content: SourcesStep, skippable: true, maxWidth: 'max-w-3xl' },
+ { id: 'warehouse', title: 'Connect your data', Content: ContextWarehouseStep, skippable: true },
+ {
+ id: 'billing',
+ title: 'Pick a plan',
+ Content: ContextBillingStep,
+ hideContinue: true,
+ maxWidth: 'max-w-3xl',
+ },
+ { id: 'invite', title: 'Invite your team', Content: ContextInviteStep, skippable: true },
+]
+
+// The card: chrome (sm+ panel; full-bleed on mobile) plus the content flex-column. Width varies per
+// step via StepDef.maxWidth — LegacyOnboarding just provides the backdrop + logo.
+const CARD_CLASSES =
+ 'relative w-full flex flex-col gap-5 overflow-hidden p-0 transition-[max-width] duration-300 sm:max-h-[calc(100dvh-7rem)] sm:p-8 md:p-10 sm:bg-surface-primary sm:rounded-xl sm:shadow-md sm:border sm:border-primary'
+
+export function ContextOnboarding(): JSX.Element {
+ const { completeContextOnboarding } = useActions(onboardingLogic)
+ const { isCompleting } = useValues(onboardingLogic)
+ // Initialize from the URL so a refresh — or an OAuth callback that lands back on ?step=install
+ // (e.g. the GitHub connect flow) — resumes where it left off instead of restarting at welcome.
+ const [stepIndex, setStepIndex] = useState(() => {
+ const fromUrl = STEPS.findIndex((s) => s.id === router.values.searchParams['step'])
+ return fromUrl >= 0 ? fromUrl : 0
+ })
+
+ const step = STEPS[stepIndex]
+ const isFirst = stepIndex === 0
+ const isLast = stepIndex === STEPS.length - 1
+
+ // Keep ?step= in sync as the user moves so the URL stays resumable, preserving any other params
+ // (like the integration ids the GitHub callback appends).
+ const goToStep = (index: number): void => {
+ setStepIndex(index)
+ router.actions.replace(router.values.location.pathname, {
+ ...router.values.searchParams,
+ step: STEPS[index].id,
+ })
+ }
+
+ const goNext = (): void => {
+ if (isLast) {
+ // Marks onboarding complete (credits the sources turned on) and navigates out, so
+ // sceneLogic doesn't bounce the user back into onboarding.
+ completeContextOnboarding()
+ return
+ }
+ goToStep(stepIndex + 1)
+ }
+ const goBack = (): void => goToStep(Math.max(0, stepIndex - 1))
+
+ return (
+ // This div is the card: chrome + per-step width. On sm+ it's capped to the viewport so the middle
+ // scrolls internally; on mobile the chrome drops and content flows (the page scrolls).
+ <div className={cn(CARD_CLASSES, step.maxWidth ?? 'max-w-xl')}>
+ {/* Pinned header: back button + progress share one row. Equal-width side slots keep the
+ progress dots centered in the card regardless of whether the back button is shown. */}
+ <div className="shrink-0 flex flex-col items-center gap-4">
+ <div className="flex items-center gap-2 w-full">
+ <div className="w-8 shrink-0 flex justify-start">
+ {!isFirst && (
+ <LemonButton
+ icon={<IconArrowLeft />}
+ size="small"
+ onClick={goBack}
+ tooltip="Go back"
+ aria-label="Go back"
+ />
+ )}
+ </div>
+ <div className="flex-1 flex items-center justify-center gap-1.5">
+ {STEPS.map((s, i) => (
+ <div
+ key={s.id}
+ className={`h-1.5 rounded-full transition-all ${
+ i === stepIndex ? 'w-6 bg-accent' : 'w-1.5 bg-border'
+ }`}
+ />
+ ))}
+ </div>
+ <div className="w-8 shrink-0" />
+ </div>
+ {step.title && <h1 className="text-2xl font-bold text-center m-0">{step.title}</h1>}
+ </div>
+
+ {/* Scrollable middle: fade edges + hover scrollbar so tall steps don't hard-crop. */}
+ <ScrollableShadows direction="vertical" styledScrollbars className="flex-1 min-h-0" contentClassName="px-1">
+ <step.Content onContinue={goNext} />
+ </ScrollableShadows>
+
+ {/* Pinned footer — omitted when the step has neither Skip nor a footer Continue (it supplies
+ its own actions, e.g. the plan picks on billing). */}
+ {(step.skippable || !step.hideContinue) && (
+ <div className="shrink-0 flex items-center justify-between gap-2">
+ {step.skippable ? (
+ <LemonButton type="tertiary" size="small" onClick={goNext}>
+ Skip for now
+ </LemonButton>
+ ) : (
+ <span />
+ )}
+ {!step.hideContinue && (
+ <LemonButton
+ type="primary"
+ status="alt"
+ sideIcon={<IconArrowRight />}
+ onClick={goNext}
+ loading={isLast && isCompleting}
+ >
+ {isLast ? 'Finish' : isFirst ? 'Get started' : 'Continue'}
+ </LemonButton>
+ )}
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.stories.tsx b/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.stories.tsx
new file mode 100644
index 000000000000..378f9a07f9de
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.stories.tsx
@@ -0,0 +1,242 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { waitFor } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
+
+import { mswDecorator } from '~/mocks/browser'
+import { toPaginatedResponse } from '~/mocks/handlers'
+import { ExternalDataSourceType, SourceConfig } from '~/queries/schema/schema-general'
+
+import { ContextWarehouseStep } from './ContextWarehouseStep'
+
+// The catalog endpoint (`external_data_sources/wizard`) returns the source picker contents.
+// Stripe carries a flat secret-key field so the inline wizard renders a visible form input when
+// selected — the real Stripe config nests auth behind a select + OAuth option, which would pull in
+// integration calls we don't need to demonstrate the connect form.
+const AVAILABLE_SOURCES: Record<string, SourceConfig> = {
+ Stripe: {
+ name: 'Stripe' as ExternalDataSourceType,
+ label: 'Stripe',
+ iconPath: '/static/services/stripe.png',
+ caption: 'Connect your Stripe account to sync revenue, subscriptions, and invoices into PostHog.',
+ featured: true,
+ fields: [
+ {
+ name: 'stripe_secret_key',
+ label: 'API key',
+ type: 'password',
+ required: true,
+ placeholder: 'rk_live_...',
+ secret: true,
+ },
+ ],
+ },
+ Hubspot: {
+ name: 'Hubspot' as ExternalDataSourceType,
+ label: 'HubSpot',
+ iconPath: '/static/services/hubspot.png',
+ caption: '',
+ featured: true,
+ fields: [],
+ },
+ Postgres: {
+ name: 'Postgres' as ExternalDataSourceType,
+ label: 'PostgreSQL',
+ iconPath: '/static/services/postgres.png',
+ caption: '',
+ featured: true,
+ fields: [],
+ },
+ Zendesk: {
+ name: 'Zendesk' as ExternalDataSourceType,
+ label: 'Zendesk',
+ iconPath: '/static/services/zendesk.png',
+ caption: '',
+ featured: true,
+ fields: [],
+ },
+ // Non-featured sources sit behind the "Show N more" toggle.
+ Salesforce: {
+ name: 'Salesforce' as ExternalDataSourceType,
+ label: 'Salesforce',
+ iconPath: '/static/services/salesforce.png',
+ caption: '',
+ featured: false,
+ fields: [],
+ },
+ Snowflake: {
+ name: 'Snowflake' as ExternalDataSourceType,
+ label: 'Snowflake',
+ iconPath: '/static/services/snowflake.png',
+ caption: '',
+ featured: false,
+ fields: [],
+ },
+ Chargebee: {
+ name: 'Chargebee' as ExternalDataSourceType,
+ label: 'Chargebee',
+ iconPath: '/static/services/chargebee.png',
+ caption: '',
+ featured: false,
+ fields: [],
+ },
+}
+
+// One already-connected source so the green "Connected" row renders. The `connectors` selector flags
+// a catalog source as connected when this list holds a matching `source_type`.
+const CONNECTED_STRIPE_SOURCE = {
+ id: 'stripe-source-id',
+ source_type: 'Stripe',
+ prefix: '',
+ status: 'Completed',
+ schemas: [],
+ created_at: '2026-06-01T00:00:00Z',
+}
+
+// Wrap the step in a card that mirrors the real onboarding surface so the body reads like the
+// actual scene rather than a bare component.
+function OnboardingCard({ children }: { children: React.ReactNode }): JSX.Element {
+ return (
+ <div className="min-h-screen bg-primary p-8">
+ <div className="max-w-xl mx-auto bg-surface-primary border border-primary rounded-xl p-8">
+ <h2 className="text-xl font-semibold mb-4">Connect your data</h2>
+ {children}
+ </div>
+ </div>
+ )
+}
+
+const meta: Meta<typeof ContextWarehouseStep> = {
+ title: 'Scenes-Other/Onboarding/Connect data',
+ component: ContextWarehouseStep,
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2026-06-26',
+ },
+ decorators: [
+ (Story) => (
+ <OnboardingCard>
+ <Story />
+ </OnboardingCard>
+ ),
+ mswDecorator({
+ get: {
+ '/api/environments/:team_id/external_data_sources/wizard': () => [200, AVAILABLE_SOURCES],
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof ContextWarehouseStep>
+
+// Picker — the default view: featured sources listed with a "Show more" toggle below.
+export const Picker: Story = {}
+
+// Searching — typing filters the list to the single matching source.
+export const Searching: Story = {
+ play: async ({ canvasElement }) => {
+ const searchInput = await waitFor(() => {
+ const input = canvasElement.querySelector<HTMLInputElement>('input[type="search"]')
+ if (!input) {
+ throw new Error('Search input not rendered')
+ }
+ return input
+ })
+
+ await userEvent.type(searchInput, 'stripe')
+
+ // Only Stripe should remain, and the other featured sources should be filtered out.
+ await waitFor(() => {
+ if (!canvasElement.textContent?.includes('Stripe')) {
+ throw new Error('Filtered source not visible')
+ }
+ if (canvasElement.textContent?.includes('PostgreSQL')) {
+ throw new Error('Non-matching source still visible')
+ }
+ })
+ },
+}
+
+// SearchingEmpty — a query that matches nothing surfaces the empty state.
+export const SearchingEmpty: Story = {
+ play: async ({ canvasElement }) => {
+ const searchInput = await waitFor(() => {
+ const input = canvasElement.querySelector<HTMLInputElement>('input[type="search"]')
+ if (!input) {
+ throw new Error('Search input not rendered')
+ }
+ return input
+ })
+
+ await userEvent.type(searchInput, 'nonexistent source')
+
+ await waitFor(() => {
+ if (!canvasElement.textContent?.includes('No sources match')) {
+ throw new Error('Empty state not visible')
+ }
+ })
+ },
+}
+
+// Connecting — clicking a source row swaps the picker for the inline source wizard, pre-selected to
+// Stripe and showing its connection form (the "API key" field).
+export const Connecting: Story = {
+ play: async ({ canvasElement }) => {
+ const stripeRow = await waitFor(() => {
+ const row = Array.from(canvasElement.querySelectorAll<HTMLButtonElement>('button')).find((button) =>
+ button.textContent?.includes('Stripe')
+ )
+ if (!row) {
+ throw new Error('Stripe source row not rendered')
+ }
+ return row
+ })
+
+ await userEvent.click(stripeRow)
+
+ // The inline wizard's step-2 form should render the Stripe secret-key input.
+ await waitFor(() => {
+ if (!canvasElement.querySelector('[data-attr="stripe_secret_key"]')) {
+ throw new Error('Wizard connection form not rendered')
+ }
+ })
+ },
+}
+
+// WithConnectedSource — one source already connected shows as a green "Connected" row above the
+// remaining picker.
+export const WithConnectedSource: Story = {
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/environments/:team_id/external_data_sources/': () => [
+ 200,
+ toPaginatedResponse([CONNECTED_STRIPE_SOURCE]),
+ ],
+ },
+ },
+ },
+ },
+ play: async ({ canvasElement }) => {
+ await waitFor(() => {
+ if (!canvasElement.textContent?.includes('Connected')) {
+ throw new Error('Connected row not rendered')
+ }
+ })
+ },
+}
+
+// Loading — the catalog request never resolves, so the skeleton placeholder stays on screen.
+export const Loading: Story = {
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/environments/:team_id/external_data_sources/wizard': () => new Promise(() => {}),
+ },
+ },
+ },
+ },
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.tsx b/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.tsx
new file mode 100644
index 000000000000..900a632e0ec1
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/ContextWarehouseStep.tsx
@@ -0,0 +1,158 @@
+import { BindLogic, useValues } from 'kea'
+import { useState } from 'react'
+
+import { IconArrowLeft, IconCheckCircle, IconPlus } from '@posthog/icons'
+import { LemonButton, LemonCard, LemonInput, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
+
+import { ExternalDataSourceType, SourceConfig } from '~/queries/schema/schema-general'
+
+import { availableSourcesLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/availableSourcesLogic'
+import { NewSourcesWizard } from 'products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene'
+import { sourceWizardLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic'
+import { SourceIcon } from 'products/data_warehouse/frontend/shared/components/SourceIcon'
+
+/**
+ * "Connect your data" body for the context-first onboarding flow. Lets the user connect an external
+ * data source (Stripe, Postgres, Hubspot, …) inline (picker plus the real source wizard) so business
+ * context (revenue, usage, support) lands in PostHog for agents to reason over. No full-page redirect.
+ *
+ * Body content only: the parent shell owns the title, progress, and Back/Skip/Continue navigation.
+ * Reuses availableSourcesLogic (the source catalog) and sourceWizardLogic (connect flow + the
+ * already-connected join). This component mounts no new logic of its own.
+ */
+export function ContextWarehouseStep(): JSX.Element {
+ const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)
+
+ if (availableSourcesLoading) {
+ return (
+ <div className="flex flex-col gap-2">
+ <LemonSkeleton className="h-4 w-2/3" />
+ <LemonSkeleton className="h-12" repeat={3} />
+ </div>
+ )
+ }
+
+ // availableSourcesLogic returns null on a 403 (no warehouse access) and leaves it null on any
+ // load error. Once loading has finished, null means "couldn't load" — show that, not a skeleton
+ // forever. The step is skippable, so the user can still move on.
+ if (availableSources === null) {
+ return (
+ <p className="text-sm text-muted m-0">
+ Couldn't load data sources right now. You can connect one later from settings, or skip for now to keep
+ going.
+ </p>
+ )
+ }
+
+ return (
+ <BindLogic logic={sourceWizardLogic} props={{ availableSources }}>
+ <ContextWarehouseStepInner />
+ </BindLogic>
+ )
+}
+
+function ContextWarehouseStepInner(): JSX.Element {
+ const { connectors } = useValues(sourceWizardLogic)
+ // null = picker, otherwise show the inline wizard pre-selected to this source.
+ const [connectingTo, setConnectingTo] = useState<ExternalDataSourceType | null>(null)
+ const [showAll, setShowAll] = useState(false)
+ const [search, setSearch] = useState('')
+
+ const releasedConnectors = connectors.filter((c: SourceConfig) => !c.unreleasedSource)
+ const connectedConnectors = releasedConnectors.filter((c: SourceConfig) => c.existingSource)
+ const connectableConnectors = releasedConnectors.filter((c: SourceConfig) => !c.existingSource)
+
+ const featuredConnectors = connectableConnectors.filter((c: SourceConfig) => c.featured)
+ const hiddenConnectors = connectableConnectors.filter((c: SourceConfig) => !c.featured)
+ // A search shows every matching source; with no search, lead with featured + a "show more" toggle.
+ const searchTerm = search.trim().toLowerCase()
+ const pickerConnectors = searchTerm
+ ? connectableConnectors.filter((c: SourceConfig) => (c.label ?? c.name).toLowerCase().includes(searchTerm))
+ : showAll
+ ? connectableConnectors
+ : featuredConnectors
+
+ if (connectingTo) {
+ return (
+ <div className="flex flex-col gap-3">
+ <div>
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<IconArrowLeft />}
+ onClick={() => setConnectingTo(null)}
+ >
+ Back to sources
+ </LemonButton>
+ </div>
+ <LemonCard hoverEffect={false} className="p-4">
+ <NewSourcesWizard
+ hideBackButton
+ initialSource={connectingTo}
+ allowedSources={connectableConnectors.map((c: SourceConfig) => c.name)}
+ onComplete={() => setConnectingTo(null)}
+ />
+ </LemonCard>
+ </div>
+ )
+ }
+
+ return (
+ <div className="flex flex-col gap-4">
+ <p className="text-sm text-muted m-0">
+ Pull in business context like revenue, usage, and support so agents can connect it to product behavior.
+ No ETL; PostHog syncs directly. 1M rows synced free every month.
+ </p>
+
+ {connectedConnectors.length > 0 && (
+ <div className="flex flex-col gap-2">
+ {connectedConnectors.map((connector: SourceConfig) => (
+ <div
+ key={connector.name}
+ className="flex items-center gap-3 p-3 rounded-lg border border-success bg-success-highlight"
+ >
+ <SourceIcon type={connector.name} size="small" disableTooltip />
+ <span className="flex-1 min-w-0 font-medium text-sm truncate">
+ {connector.label ?? connector.name}
+ </span>
+ <LemonTag type="success" icon={<IconCheckCircle />}>
+ Connected
+ </LemonTag>
+ </div>
+ ))}
+ </div>
+ )}
+
+ <LemonInput type="search" placeholder="Search sources" value={search} onChange={setSearch} />
+
+ {pickerConnectors.length > 0 ? (
+ <div className="flex flex-col gap-2">
+ {pickerConnectors.map((connector: SourceConfig) => (
+ <button
+ key={connector.name}
+ type="button"
+ onClick={() => setConnectingTo(connector.name)}
+ className="flex items-center gap-3 p-3 rounded-lg border border-primary bg-surface-primary text-left cursor-pointer hover:border-accent"
+ >
+ <SourceIcon type={connector.name} size="small" disableTooltip />
+ <span className="flex-1 min-w-0 font-medium text-sm truncate">
+ {connector.label ?? connector.name}
+ </span>
+ <span className="text-xs text-muted shrink-0">Connect</span>
+ </button>
+ ))}
+ </div>
+ ) : (
+ searchTerm && <p className="text-sm text-muted m-0">No sources match "{search}".</p>
+ )}
+
+ {!searchTerm && !showAll && hiddenConnectors.length > 0 && (
+ <div>
+ <LemonButton type="secondary" size="small" icon={<IconPlus />} onClick={() => setShowAll(true)}>
+ Show {hiddenConnectors.length} more source{hiddenConnectors.length === 1 ? '' : 's'}
+ </LemonButton>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.scss b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.scss
new file mode 100644
index 000000000000..74c173018ff1
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.scss
@@ -0,0 +1,42 @@
+// Mobile: no decorative backdrop; the card chrome drops away and content sits on a plain surface.
+.OnboardingDottedBg {
+ background-color: var(--color-bg-surface-primary);
+}
+
+// `sm`+ (≥640px): dotted paper grid + faint amber glow, copied from the paper-desk auth variant
+// (scenes/authentication/shared/paperDesk/PaperDesk.scss) so onboarding and sign-in/sign-up share the
+// exact same backdrop. Multi-layer background (per-layer size/repeat), not achievable via Tailwind.
+// Unlike paper-desk (light-only), the base color lives here too so it can flip with the theme without
+// competing against a Tailwind `bg-*` utility's cascade layer.
+@media (min-width: 640px) {
+ .OnboardingDottedBg {
+ background-color: #eef0e7;
+ background-image:
+ radial-gradient(72% 72% at 50% 38%, rgb(247 165 1 / 5%), transparent 70%),
+ radial-gradient(rgb(17 17 17 / 5.5%) 1.4px, transparent 1.4px);
+ background-repeat: no-repeat, repeat;
+ background-size:
+ auto,
+ 16px 16px;
+ }
+
+ // Onboarding also runs in dark mode (paper-desk is light-only), so swap the parchment base and
+ // invert the dot tint there. The grid geometry (1.4px dots, 16px cell) and amber glow are unchanged.
+ [theme='dark'] .OnboardingDottedBg {
+ background-color: var(--color-bg-surface-tertiary);
+ background-image:
+ radial-gradient(72% 72% at 50% 38%, rgb(247 165 1 / 4%), transparent 70%),
+ radial-gradient(rgb(255 255 255 / 6%) 1.4px, transparent 1.4px);
+ }
+}
+
+// Use-case / product cards: a soft warm off-white inset on the white card (light) and the secondary
+// surface in dark. Slightly darker than the card so they read as recessed tiles rather than bright
+// white islands. Not gated by breakpoint: these are content, present at every width.
+.OnboardingProductCard {
+ background-color: #f5f6ee;
+}
+
+[theme='dark'] .OnboardingProductCard {
+ background-color: var(--color-bg-surface-secondary);
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.tsx b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.tsx
new file mode 100644
index 000000000000..9511f00ffa44
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboarding.tsx
@@ -0,0 +1,25 @@
+import './SelfDrivingOnboarding.scss'
+
+import { PostHogLogo } from 'lib/brand/v2'
+
+import { ContextOnboarding } from './ContextOnboarding'
+
+/**
+ * Host for the self-driving onboarding experience: dotted backdrop, logo, and a centered card that
+ * holds the context-first step flow. Selected via `onboardingVariantRegistry` when the
+ * `ONBOARDING_FLOW_VARIANT` flag resolves to `'self-driving'`.
+ */
+export function SelfDrivingOnboarding(): JSX.Element | null {
+ return (
+ <div className="OnboardingDottedBg min-h-screen flex flex-col items-center justify-center p-4 sm:p-6">
+ {/* Logo above the card, group centered (paper-desk positioning). Gradient in light, white in dark. */}
+ <span className="block mb-6">
+ <PostHogLogo className="h-7 w-auto block dark:hidden sm:h-8" />
+ <PostHogLogo variant="mono" color="white" className="h-7 w-auto hidden dark:block sm:h-8" />
+ </span>
+ {/* The card chrome and its per-step width live inside ContextOnboarding (so the width can vary
+ by step); here we just center it under the logo. */}
+ <ContextOnboarding />
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/SourcesStep.stories.tsx b/frontend/src/scenes/onboarding/self-driving/SourcesStep.stories.tsx
new file mode 100644
index 000000000000..6bd37226b4ef
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/SourcesStep.stories.tsx
@@ -0,0 +1,76 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { type ReactNode } from 'react'
+
+import { mswDecorator } from '~/mocks/browser'
+import preflightJson from '~/mocks/fixtures/_preflight.json'
+
+import { SourcesStepInner } from './ContextOnboarding'
+
+/**
+ * The "Turn on your sources" step in isolation. Rendered as the presentational sub-component
+ * (SourcesStepInner) with `installing` driven by an arg — mirrors the ContextWarehouseStep pattern, so
+ * the in-flight state is exercised without standing up the cloud-run TaskRun stream (no EventSource).
+ *
+ * Source active/off state comes from the default mock team (autocapture is on by default, so Product
+ * analytics renders active); the badge each card shows then depends on `installing` and the SDK.
+ */
+
+// Wrap the step in a card that mirrors the real onboarding surface (the sources step is the wide variant).
+function OnboardingCard({ children }: { children: ReactNode }): JSX.Element {
+ return (
+ <div className="min-h-screen bg-primary p-8">
+ <div className="max-w-3xl mx-auto bg-surface-primary border border-primary rounded-xl p-8">
+ <h1 className="text-2xl font-bold text-center mb-5">Turn on your sources</h1>
+ {children}
+ </div>
+ </div>
+ )
+}
+
+const meta: Meta<typeof SourcesStepInner> = {
+ title: 'Scenes-Other/Onboarding/Turn on your sources',
+ component: SourcesStepInner,
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2023-05-25',
+ },
+ decorators: [
+ (Story) => (
+ <OnboardingCard>
+ <Story />
+ </OnboardingCard>
+ ),
+ mswDecorator({
+ get: {
+ '/_preflight': { ...preflightJson, cloud: true, realm: 'cloud' },
+ '/stats': {},
+ '/events': {},
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof SourcesStepInner>
+
+const CONNECTED_CODEBASE = { connected: true, displayName: 'acme-co', connectUrl: '#' }
+
+/** Default: each card shows its config status — "Active" once events flow, "Needs install" when turned
+ * on with nothing installed, "Off" when disabled. Codebase access is connected, so it reads "Active". */
+export const Default: Story = { args: { installing: false, repository: null, codebase: CONNECTED_CODEBASE } }
+
+/** While an install is in flight (into the named repo), turned-on sources read "Installing" and
+ * turned-off ones read "Available" — turn any on and it gets installed too. */
+export const Installing: Story = {
+ args: { installing: true, repository: 'acme-co/web', codebase: CONNECTED_CODEBASE },
+ // The install-in-progress spinner is the point of this story — it never resolves, so skip
+ // the test runner's default "wait for loaders to hide" check.
+ parameters: { testOptions: { waitForLoadersToDisappear: false } },
+}
+
+/** GitHub not connected — the codebase-access card offers a "Connect GitHub" button to activate it as a
+ * source, independent of the SDK install. */
+export const CodebaseNotConnected: Story = {
+ args: { installing: false, repository: null, codebase: { connected: false, displayName: null, connectUrl: '#' } },
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.stories.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.stories.tsx
new file mode 100644
index 000000000000..e64e3a56ec22
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.stories.tsx
@@ -0,0 +1,212 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { InstallationProgress, InstallationStepStatus } from './installationProgressLogic'
+import { InstallationProgressContent } from './InstallationProgressView'
+
+/**
+ * Every state of the Installation layer's progress view, driven by fixtures (the component is pure, so
+ * no streams/mocks). Covers the happy path and each failure point so the error UI is reviewable at a
+ * glance.
+ */
+const meta: Meta<typeof InstallationProgressContent> = {
+ title: 'Scenes-Other/Onboarding/Installation Progress',
+ component: InstallationProgressContent,
+ // Provide the local-fallback callback to every story so the failed-run states show the full
+ // "Run it yourself" + "Read the docs" recovery (no-op on non-error phases).
+ argTypes: { onRetryLocally: { action: 'retry-locally' } },
+ // Most stories here render an in-progress spinner by design (connecting/running phases), which never
+ // resolves — skip the test runner's default "wait for loaders to hide" check.
+ parameters: { testOptions: { waitForLoadersToDisappear: false } },
+ // Width-bound to the onboarding card so the stepper wraps as it does in product.
+ decorators: [
+ (Story) => (
+ <div className="max-w-xl">
+ <Story />
+ </div>
+ ),
+ ],
+}
+export default meta
+type Story = StoryObj<typeof InstallationProgressContent>
+
+const STAGES = ['Provisioning sandbox', 'Cloning repository', 'Running setup wizard', 'Opening pull request']
+
+// Pipeline steps with a status per stage (index-aligned to STAGES), with optional detail on one stage.
+function steps(
+ statuses: InstallationStepStatus[],
+ detail?: { at: number; text: string }
+): InstallationProgress['steps'] {
+ return STAGES.map((label, i) => ({
+ id: `setup:${i}`,
+ label,
+ status: statuses[i] ?? 'pending',
+ detail: detail && detail.at === i ? detail.text : null,
+ }))
+}
+
+function progress(overrides: Partial<InstallationProgress>): InstallationProgress {
+ return { phase: 'running', steps: [], error: null, prUrl: null, isCurrent: true, ...overrides }
+}
+
+export const Connecting: Story = {
+ args: { progress: progress({ phase: 'connecting' }) },
+}
+
+export const RunningProvisioning: Story = {
+ args: { progress: progress({ steps: steps(['in_progress', 'pending', 'pending', 'pending']) }) },
+}
+
+export const RunningWizard: Story = {
+ args: {
+ progress: progress({
+ steps: steps(['completed', 'completed', 'in_progress', 'pending'], { at: 2, text: 'Detecting Next.js' }),
+ }),
+ },
+}
+
+export const Completed: Story = {
+ args: {
+ progress: progress({
+ phase: 'completed',
+ steps: steps(['completed', 'completed', 'completed', 'completed']),
+ prUrl: 'https://github.com/acme-co/web/pull/42',
+ }),
+ },
+}
+
+// The PR is open but the run keeps going (keeping CI green): "Pull request ready" headline + the review
+// CTA surface mid-run, and the keep-green step shows as active rather than the run looking stuck.
+export const PullRequestReady: Story = {
+ args: {
+ progress: progress({
+ phase: 'running',
+ prUrl: 'https://github.com/acme-co/web/pull/42',
+ steps: [
+ { id: 'setup:sandbox', label: 'Set up sandbox', status: 'completed', detail: null },
+ { id: 'setup:clone', label: 'Cloned repository', status: 'completed', detail: null },
+ { id: 'setup:wizard', label: 'Ran PostHog setup wizard', status: 'completed', detail: null },
+ { id: 'setup:agent', label: 'Started agent', status: 'completed', detail: null },
+ { id: 'deliver:pr', label: 'Opened pull request', status: 'completed', detail: null },
+ { id: 'deliver:ci', label: 'Keeping CI green', status: 'in_progress', detail: null },
+ ],
+ }),
+ },
+}
+
+export const FailedProvisioning: Story = {
+ args: {
+ progress: progress({
+ phase: 'error',
+ steps: steps(['failed', 'pending', 'pending', 'pending']),
+ error: { title: 'Installation failed', detail: 'Could not provision a sandbox, capacity limit reached.' },
+ }),
+ },
+}
+
+export const FailedClone: Story = {
+ args: {
+ progress: progress({
+ phase: 'error',
+ steps: steps(['completed', 'failed', 'pending', 'pending']),
+ error: { title: 'Installation failed', detail: 'git clone failed: repository not found or no access.' },
+ }),
+ },
+}
+
+export const FailedWizard: Story = {
+ args: {
+ progress: progress({
+ phase: 'error',
+ steps: steps(['completed', 'completed', 'failed', 'pending']),
+ error: { title: 'Installation failed', detail: 'PostHog setup wizard failed with exit code 1.' },
+ }),
+ },
+}
+
+export const FailedNoDetail: Story = {
+ args: {
+ progress: progress({
+ phase: 'error',
+ steps: steps(['completed', 'completed', 'completed', 'failed']),
+ error: { title: 'Installation failed', detail: null },
+ }),
+ },
+}
+
+// The floating FAB variant, terminal, so the dismiss affordance shows.
+export const FloatingDismissible: Story = {
+ args: {
+ progress: progress({
+ phase: 'completed',
+ steps: steps(['completed', 'completed', 'completed', 'completed']),
+ prUrl: 'https://github.com/acme-co/web/pull/42',
+ }),
+ },
+ argTypes: { onDismiss: { action: 'dismissed' } },
+ decorators: [
+ (Story) => (
+ <div className="w-[340px]">
+ <Story />
+ </div>
+ ),
+ ],
+}
+
+// Every state in one canvas for review (GROW-98). Reuses the individual stories' fixtures so each one
+// keeps a single source of truth.
+export const AllStates: Story = {
+ parameters: { controls: { disable: true } },
+ render: () => {
+ const states: { label: string; args: Story['args'] }[] = [
+ { label: 'Connecting', args: Connecting.args },
+ { label: 'Running: provisioning', args: RunningProvisioning.args },
+ { label: 'Running: wizard', args: RunningWizard.args },
+ { label: 'Pull request ready', args: PullRequestReady.args },
+ { label: 'Completed', args: Completed.args },
+ { label: 'Failed: provisioning', args: FailedProvisioning.args },
+ { label: 'Failed: wizard', args: FailedWizard.args },
+ { label: 'Failed: no detail', args: FailedNoDetail.args },
+ ]
+ return (
+ <div className="flex flex-col gap-5">
+ {states.map(({ label, args }) => (
+ <div key={label} className="flex flex-col gap-1">
+ <span className="text-xs font-medium text-muted">{label}</span>
+ <InstallationProgressContent progress={args!.progress!} onRetryLocally={() => {}} />
+ </div>
+ ))}
+ </div>
+ )
+ },
+}
+
+// Configure the progress view live from the controls panel (GROW-98).
+interface PlaygroundArgs {
+ phase: InstallationProgress['phase']
+ completedSteps: number
+ currentTask: string
+ prReady: boolean
+}
+
+export const Playground: StoryObj<PlaygroundArgs> = {
+ argTypes: {
+ phase: { control: 'select', options: ['connecting', 'running', 'completed', 'error'] },
+ completedSteps: { control: { type: 'range', min: 0, max: 4 } },
+ currentTask: { control: 'text' },
+ prReady: { control: 'boolean' },
+ },
+ args: { phase: 'running', completedSteps: 2, currentTask: 'Detecting Next.js', prReady: false },
+ render: (args) => {
+ const statuses: InstallationStepStatus[] = [0, 1, 2, 3].map((i) =>
+ i < args.completedSteps ? 'completed' : i === args.completedSteps ? 'in_progress' : 'pending'
+ )
+ const built = progress({
+ phase: args.phase,
+ steps: steps(statuses, args.currentTask ? { at: args.completedSteps, text: args.currentTask } : undefined),
+ prUrl: args.prReady || args.phase === 'completed' ? 'https://github.com/acme-co/web/pull/42' : null,
+ error:
+ args.phase === 'error' ? { title: 'Installation failed', detail: 'Something stopped the run.' } : null,
+ })
+ return <InstallationProgressContent progress={built} onRetryLocally={() => {}} />
+ },
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.tsx
new file mode 100644
index 000000000000..6c857384a7a6
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/InstallationProgressView.tsx
@@ -0,0 +1,187 @@
+import { useActions, useValues } from 'kea'
+import { useEffect } from 'react'
+
+import { IconCheckCircle, IconPullRequest, IconTerminal, IconX } from '@posthog/icons'
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+
+import { activeCloudRunLogic } from './activeCloudRunLogic'
+import { InstallationProgress, installationProgressLogic, InstallationStepStatus } from './installationProgressLogic'
+
+// Timeline dot for a single step.
+function StepIcon({ status }: { status: InstallationStepStatus }): JSX.Element {
+ if (status === 'completed') {
+ return <IconCheckCircle className="text-success text-base" />
+ }
+ if (status === 'failed') {
+ return <IconX className="text-danger text-base" />
+ }
+ if (status === 'in_progress') {
+ return <Spinner className="text-base" textColored />
+ }
+ return <span className="w-4 h-4 rounded-full border-2 border-border" />
+}
+
+/**
+ * Presentational renderer for an `InstallationProgress`: a text header, a connected step timeline, and
+ * the terminal payoff (PR link) or failure detail. Pure (no logic/streams) so every state, including
+ * the error variants, is storyable in isolation. The container `InstallationProgressView` feeds it live
+ * progress from the Installation layer.
+ */
+export function InstallationProgressContent({
+ progress,
+ onDismiss,
+ onRetryLocally,
+}: {
+ progress: InstallationProgress
+ onDismiss?: () => void
+ /** When set, a failed run offers a "Run it yourself" button (switches the install step to the local
+ * command). Omitted where no local fallback exists (e.g. the floating FAB), which shows only docs. */
+ onRetryLocally?: () => void
+}): JSX.Element {
+ const { phase, steps, error, prUrl } = progress
+
+ // The PR is opened mid-run: while the run keeps going (keeping CI green), surface it as ready rather
+ // than an indefinite "setting up". Terminal phases keep their own headline.
+ const prReady = !!prUrl && phase !== 'completed' && phase !== 'error'
+
+ const headline =
+ phase === 'completed'
+ ? 'PostHog is wired up'
+ : phase === 'error'
+ ? (error?.title ?? "Setup didn't finish")
+ : prReady
+ ? 'Pull request ready'
+ : 'Setting up PostHog'
+ const subtitle =
+ phase === 'completed'
+ ? prUrl
+ ? 'We opened a pull request for you to review.'
+ : "You're all set."
+ : phase === 'error'
+ ? "We couldn't finish the setup."
+ : prReady
+ ? "Review it whenever you like; we'll keep CI green in the meantime."
+ : phase === 'connecting'
+ ? 'Getting things ready…'
+ : 'Working on it — feel free to keep going.'
+
+ return (
+ <div
+ className="rounded-lg border border-border bg-bg-light p-4 flex flex-col gap-3"
+ data-attr="installation-progress"
+ >
+ <div className="flex items-start justify-between gap-2">
+ <div className="min-w-0">
+ <h4 className={cn('font-semibold m-0', phase === 'error' && 'text-danger')}>{headline}</h4>
+ <p className="text-sm text-muted m-0">{subtitle}</p>
+ </div>
+ {onDismiss && (
+ <LemonButton
+ size="small"
+ icon={<IconX />}
+ onClick={onDismiss}
+ tooltip="Dismiss"
+ aria-label="Dismiss"
+ />
+ )}
+ </div>
+
+ {steps.length > 0 && (
+ <ol className="flex flex-col m-0 p-0 list-none">
+ {steps.map((step, i) => (
+ <li key={step.id} className="flex gap-3">
+ <div className="flex flex-col items-center pt-0.5">
+ <StepIcon status={step.status} />
+ {i < steps.length - 1 && <div className="w-px flex-1 bg-border my-1 min-h-[0.75rem]" />}
+ </div>
+ <div className="flex-1 min-w-0 pb-3">
+ <div
+ className={cn(
+ 'text-sm',
+ step.status === 'pending' && 'text-muted',
+ step.status === 'failed' && 'text-danger font-medium',
+ step.status === 'in_progress' && 'font-medium'
+ )}
+ >
+ {step.label}
+ </div>
+ {step.detail && <div className="text-xs text-muted truncate">{step.detail}</div>}
+ </div>
+ </li>
+ ))}
+ </ol>
+ )}
+
+ {phase === 'error' && error?.detail && (
+ <div className="text-sm text-danger bg-danger-highlight rounded p-2">{error.detail}</div>
+ )}
+
+ {phase === 'error' && (
+ // The cloud run failed — offer self-serve recovery so the user isn't stuck: run the wizard
+ // themselves (switches the install step to the local command) or follow the manual docs.
+ <div className="flex flex-wrap gap-2">
+ {onRetryLocally && (
+ <LemonButton type="primary" onClick={onRetryLocally} icon={<IconTerminal />}>
+ Run it yourself
+ </LemonButton>
+ )}
+ <LemonButton
+ type={onRetryLocally ? 'secondary' : 'primary'}
+ to="https://posthog.com/docs/getting-started/install"
+ targetBlank
+ >
+ Read the docs
+ </LemonButton>
+ </div>
+ )}
+
+ {prUrl && (
+ <LemonButton type="primary" to={prUrl} targetBlank icon={<IconPullRequest />} center>
+ Review pull request
+ </LemonButton>
+ )}
+ </div>
+ )
+}
+
+/**
+ * Container: streams a cloud run's progress from the Installation layer and renders it. Inline on the
+ * install step (sets `panelMounted` to hide the floating FAB) or inside the FAB itself (`floating`).
+ */
+export function InstallationProgressView({
+ runId,
+ taskId,
+ floating = false,
+ onDismiss,
+ onRetryLocally,
+}: {
+ runId: string
+ taskId: string
+ /** Rendered in the floating FAB rather than inline on the install step. */
+ floating?: boolean
+ onDismiss?: () => void
+ /** Forwarded to the failed-run fallback (see InstallationProgressContent). */
+ onRetryLocally?: () => void
+}): JSX.Element {
+ const { installationProgress } = useValues(installationProgressLogic({ mode: 'cloud', runId, taskId }))
+ const { setPanelMounted } = useActions(activeCloudRunLogic)
+
+ // While shown inline on the install step, hide the floating FAB so the same run isn't in two places.
+ useEffect(() => {
+ if (floating) {
+ return
+ }
+ setPanelMounted(true)
+ return () => setPanelMounted(false)
+ }, [floating, setPanelMounted])
+
+ return (
+ <InstallationProgressContent
+ progress={installationProgress}
+ onDismiss={onDismiss}
+ onRetryLocally={onRetryLocally}
+ />
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.stories.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.stories.tsx
new file mode 100644
index 000000000000..4bb32bcb58df
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.stories.tsx
@@ -0,0 +1,328 @@
+import { Meta, StoryObj } from '@storybook/react'
+import { waitFor } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
+import { useMountedLogic } from 'kea'
+import { router } from 'kea-router'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { useDelayedOnMountEffect, useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+import { App } from 'scenes/App'
+import { urls } from 'scenes/urls'
+
+import { mswDecorator, useStorybookMocks } from '~/mocks/browser'
+import { billingJson } from '~/mocks/fixtures/_billing'
+import preflightJson from '~/mocks/fixtures/_preflight.json'
+import { IntegrationType } from '~/types'
+
+import { onboardingLogic } from '../../../legacy/onboardingLogic'
+import { activeCloudRunLogic } from './activeCloudRunLogic'
+import { WizardCloudRunBlock } from './WizardCloudRunBlock'
+import { wizardCloudRunLogic } from './wizardCloudRunLogic'
+
+/**
+ * Stories for the "open a PR for me" cloud-run option on the context-first onboarding install step.
+ * Rendered through the full `<App />` scene: the welcome step shows first, then a play function clicks
+ * "Get started" to land on the install step where the cloud-run block lives (it connects to
+ * onboardingLogic, so the scene is its natural habitat).
+ *
+ * The block only appears when ONBOARDING_WIZARD_CLOUD_RUN='test' (set via the featureFlags parameter)
+ * and preflight reports cloud/dev (so `isCloudOrDev` is true).
+ */
+
+const githubIntegration: IntegrationType = {
+ id: 1,
+ kind: 'github',
+ display_name: 'acme-co',
+ icon_url: '/static/services/github.png',
+ config: { account: { name: 'acme-co', type: 'Organization' }, repository_selection: 'all' },
+ created_at: '2024-01-01T00:00:00Z',
+}
+
+// Metadata-rich repos so the picker's option rows (language, default branch, recency, private/archived,
+// write access) are exercised. pushed_at values are relative to the story's mockDate (2023-05-25).
+const githubReposResponse = {
+ repositories: [
+ {
+ id: 1,
+ name: 'web',
+ full_name: 'acme-co/web',
+ private: false,
+ default_branch: 'main',
+ language: 'TypeScript',
+ pushed_at: '2023-05-24T10:00:00Z',
+ archived: false,
+ can_push: true,
+ },
+ {
+ id: 2,
+ name: 'api',
+ full_name: 'acme-co/api',
+ private: true,
+ default_branch: 'master',
+ language: 'Python',
+ pushed_at: '2023-05-11T10:00:00Z',
+ archived: false,
+ can_push: true,
+ },
+ {
+ id: 3,
+ name: 'mobile-app',
+ full_name: 'acme-co/mobile-app',
+ private: true,
+ default_branch: 'develop',
+ language: 'Swift',
+ pushed_at: '2023-02-01T10:00:00Z',
+ archived: true,
+ can_push: false,
+ },
+ ],
+ has_more: false,
+}
+
+const meta: Meta = {
+ title: 'Scenes-Other/Onboarding/Wizard Cloud Run',
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2023-05-25',
+ featureFlags: {
+ [FEATURE_FLAGS.ONBOARDING_WIZARD_CLOUD_RUN]: 'test',
+ [FEATURE_FLAGS.ONBOARDING_FLOW_VARIANT]: 'self-driving',
+ },
+ // These stories render the full app shell around a wizard step that's mid-flight by design
+ // (connecting/polling/queued) — skip the test runner's default "wait for loaders to hide" check.
+ testOptions: { waitForLoadersToDisappear: false },
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ '/_preflight': { ...preflightJson, cloud: true, realm: 'cloud' },
+ '/stats': {},
+ '/events': {},
+ '/api/billing/': { ...billingJson },
+ '/api/environments/:team_id/integrations/:id/github_repos': githubReposResponse,
+ },
+ post: {
+ // Accepting the kickoff lets the live (non-snapshot) story walk all the way to the
+ // queued state by clicking the button.
+ '/api/wizard/cloud_run': () => [201, { task_id: 'task-1', run_id: 'run-1', status: 'queued' }],
+ },
+ patch: {
+ '/api/environments/:team_id/add_product_intent/': {},
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj
+
+// Click a footer/body button by its exact label, waiting for it to mount first.
+async function clickButton(text: string): Promise<void> {
+ await waitFor(() => {
+ const btn = Array.from(document.querySelectorAll('button')).find((b) => b.textContent?.trim() === text)
+ if (!btn) {
+ throw new Error(`button "${text}" not ready`)
+ }
+ })
+ const btn = Array.from(document.querySelectorAll('button')).find((b) => b.textContent?.trim() === text)
+ await userEvent.click(btn as Element)
+}
+
+/**
+ * Lands on the context-first install step with a given set of integrations, optionally driving
+ * wizardCloudRunLogic into a later state. The logic is mounted up front so `drive` can dispatch
+ * before the install-step block renders; the play then advances welcome → install.
+ */
+function cloudRunStory({
+ integrations,
+ drive,
+ waitForSelector,
+ extraPlay,
+}: {
+ integrations: IntegrationType[]
+ drive?: () => void
+ waitForSelector: string
+ extraPlay?: () => Promise<void>
+}): Story {
+ return {
+ render: () => {
+ useMountedLogic(onboardingLogic)
+ useMountedLogic(wizardCloudRunLogic)
+ useMountedLogic(activeCloudRunLogic)
+
+ useStorybookMocks({
+ get: {
+ '/api/environments/:team_id/integrations': { results: integrations },
+ },
+ })
+
+ useDelayedOnMountEffect(() => {
+ // activeCloudRun is persisted (survives a refresh mid-run) — clear any handle left
+ // over from an earlier story in the same browser session before driving this one.
+ activeCloudRunLogic.actions.clearActiveCloudRun()
+ router.actions.push(urls.onboarding())
+ drive?.()
+ })
+
+ return <App />
+ },
+ parameters: { testOptions: { waitForSelector } },
+ play: async () => {
+ await clickButton('Get started')
+ await extraPlay?.()
+ },
+ }
+}
+
+/** No GitHub integration yet — the block offers a "Connect GitHub" button. */
+export const NotConnected: Story = cloudRunStory({
+ integrations: [],
+ waitForSelector: '[data-attr="wizard-cloud-run-connect-github"]',
+})
+
+/** GitHub connected, no repo chosen — repo picker shown, "Install PostHog here" disabled. */
+export const Connected: Story = cloudRunStory({
+ integrations: [githubIntegration],
+ waitForSelector: '[data-attr="wizard-cloud-run-open-pr"]',
+})
+
+/** Repo selected — the primary button is enabled and ready to fire. The picker's
+ * option keys are repo names, so we select by name ('web' → labelled 'acme-co/web'). */
+export const RepoSelected: Story = cloudRunStory({
+ integrations: [githubIntegration],
+ drive: () => wizardCloudRunLogic.actions.setSelectedRepository('web'),
+ waitForSelector: '[data-attr="wizard-cloud-run-open-pr"]',
+})
+
+/** Repo picker opened — shows the metadata-rich option rows: language, default branch, recency, a lock
+ * for private repos, an "Archived" tag, and a "No write access" warning where we can't open PRs. */
+export const RepoPickerOpen: Story = cloudRunStory({
+ integrations: [githubIntegration],
+ waitForSelector: '[data-attr="select-github-repository"]',
+ extraPlay: async () => {
+ await waitFor(() => {
+ if (!document.querySelector('[data-attr="select-github-repository"] input')) {
+ throw new Error('repo picker not ready')
+ }
+ })
+ await userEvent.click(document.querySelector('[data-attr="select-github-repository"] input') as Element)
+ // full_name only appears in the open dropdown (nothing is selected), so this confirms it's open.
+ await waitFor(() => {
+ if (!Array.from(document.querySelectorAll('span')).some((el) => el.textContent === 'acme-co/mobile-app')) {
+ throw new Error('repo options not open')
+ }
+ })
+ },
+})
+
+/**
+ * Run kicked off — non-blocking confirmation; the FAB takes over from here. Renders the block directly
+ * (not through the full click-through `<App />` flow the other stories use): the queued state only
+ * needs cloudRunStatus/selectedRepository seeded before mount, and going through "Get started" plus the
+ * install step's own async setup raced the delayed-mount effect that drives every other story here.
+ */
+export const PullRequestQueued: Story = {
+ render: () => {
+ useMountedLogic(onboardingLogic)
+ useMountedLogic(wizardCloudRunLogic)
+ useMountedLogic(activeCloudRunLogic)
+
+ useStorybookMocks({
+ get: {
+ '/api/environments/:team_id/integrations': { results: [githubIntegration] },
+ },
+ })
+
+ useOnMountEffect(() => {
+ activeCloudRunLogic.actions.clearActiveCloudRun()
+ wizardCloudRunLogic.actions.setSelectedRepository('web')
+ wizardCloudRunLogic.actions.startCloudRunSuccess()
+ })
+
+ return (
+ <div className="max-w-xl">
+ <WizardCloudRunBlock />
+ </div>
+ )
+ },
+ parameters: { testOptions: { waitForSelector: '[data-attr="wizard-cloud-run-queued"]' } },
+}
+
+/** The other half of the same wizard — toggling to "Run it yourself" reveals the CLI command. */
+export const RunItYourself: Story = cloudRunStory({
+ integrations: [],
+ waitForSelector: '[data-attr="wizard-command-block"]',
+ extraPlay: async () => {
+ await waitFor(() => {
+ if (!document.querySelector('[data-attr="context-wizard-mode-local"]')) {
+ throw new Error('install-mode toggle not ready')
+ }
+ })
+ await userEvent.click(document.querySelector('[data-attr="context-wizard-mode-local"]') as Element)
+ },
+})
+
+interface PlaygroundArgs {
+ githubConnected: boolean
+ repository: '' | 'web' | 'api' | 'mobile-app'
+ pullRequestQueued: boolean
+}
+
+/**
+ * Interactive harness for the whole cloud-run flow: the controls panel drives whether GitHub is
+ * connected, which repo is picked, and whether the PR has been queued. Keyed on the args so flipping
+ * a control remounts the scene and re-derives state from scratch — the logic reducers (selected repo,
+ * run status) don't reset on their own, and the connected/not state comes from a render-time mock.
+ */
+function CloudRunPlayground({ githubConnected, repository, pullRequestQueued }: PlaygroundArgs): JSX.Element {
+ useMountedLogic(onboardingLogic)
+ useMountedLogic(wizardCloudRunLogic)
+ useMountedLogic(activeCloudRunLogic)
+
+ useStorybookMocks({
+ get: {
+ '/api/environments/:team_id/integrations': {
+ results: githubConnected ? [githubIntegration] : [],
+ },
+ },
+ })
+
+ useDelayedOnMountEffect(() => {
+ activeCloudRunLogic.actions.clearActiveCloudRun()
+ router.actions.push(urls.onboarding())
+ if (repository) {
+ wizardCloudRunLogic.actions.setSelectedRepository(repository)
+ }
+ if (pullRequestQueued) {
+ wizardCloudRunLogic.actions.startCloudRunSuccess()
+ }
+ })
+
+ return <App />
+}
+
+/** Fully controllable: flip GitHub on/off, pick a repo, and queue the PR straight from the controls panel. */
+export const Playground: StoryObj<PlaygroundArgs> = {
+ args: { githubConnected: true, repository: 'web', pullRequestQueued: false },
+ argTypes: {
+ githubConnected: {
+ control: 'boolean',
+ description: 'Whether a GitHub integration exists — off shows the "Connect GitHub" button',
+ },
+ repository: {
+ control: 'select',
+ options: ['', 'web', 'api', 'mobile-app'],
+ description: 'Repository to pre-select — empty leaves "Install PostHog here" disabled',
+ },
+ pullRequestQueued: {
+ control: 'boolean',
+ description: 'Whether the run has been kicked off — on shows the queued confirmation',
+ },
+ },
+ render: (args) => <CloudRunPlayground key={JSON.stringify(args)} {...args} />,
+ parameters: { testOptions: { waitForSelector: '[data-attr="wizard-cloud-run-open-pr"]' } },
+ play: async () => {
+ await clickButton('Get started')
+ },
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.tsx
new file mode 100644
index 000000000000..242126a6fc2c
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCloudRunBlock.tsx
@@ -0,0 +1,161 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useRef } from 'react'
+
+import { IconCheckCircle, IconChevronDown, IconGithub, IconPullRequest } from '@posthog/icons'
+import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { GitHubRepositoryPicker } from 'lib/integrations/GitHubIntegrationHelpers'
+import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'
+
+import { activeCloudRunLogic } from './activeCloudRunLogic'
+import { InstallationProgressView } from './InstallationProgressView'
+import { wizardCloudRunLogic } from './wizardCloudRunLogic'
+import { WizardModeShell } from './WizardModeShell'
+
+/**
+ * The primary, "we'll do it for you" way to run the wizard: connect GitHub, pick a
+ * repo, and we run the same instrumentation wizard on our infra and open a pull
+ * request you review and merge. Shares WizardModeShell (hog + framework badges)
+ * with the local command tab so both read as one wizard.
+ *
+ * Deliberately non-blocking: kicking off a run flips to live progress — the
+ * Installation layer (installationProgressLogic / InstallationProgressView)
+ * streams the run's pipeline — and the user can hit Continue right away.
+ */
+export function WizardCloudRunBlock({
+ onQueued,
+ hideHog = false,
+ onRetryLocally,
+}: {
+ onQueued?: () => void
+ hideHog?: boolean
+ /** Forwarded to the install progress view so a failed run can offer "Run it yourself". */
+ onRetryLocally?: () => void
+}): JSX.Element {
+ const { isCloudOrDev } = useWizardCommand()
+ const syncEnabled = useFeatureFlag('ONBOARDING_WIZARD_SYNC', 'test')
+ const { githubIntegration, selectedRepository, cloudRunStatus, connectGitHubUrl } = useValues(wizardCloudRunLogic)
+ const { activeCloudRun } = useValues(activeCloudRunLogic)
+ const { setSelectedRepository, startCloudRun } = useActions(wizardCloudRunLogic)
+
+ // Fire onQueued once per kickoff, the moment the run is handed off. It advances the install step
+ // (GROW-96), so it must not repeat while the status stays 'queued' (the callback identity changes
+ // each render). Reset when the run leaves 'queued' so a later run can advance the flow again.
+ const queuedAdvancedRef = useRef(false)
+ useEffect(() => {
+ if (cloudRunStatus === 'queued') {
+ if (!queuedAdvancedRef.current) {
+ queuedAdvancedRef.current = true
+ onQueued?.()
+ }
+ } else {
+ queuedAdvancedRef.current = false
+ }
+ }, [cloudRunStatus, onQueued])
+
+ // The cloud wizard only targets cloud (US/EU) and dev instances; nothing to
+ // offer on self-hosted.
+ if (!isCloudOrDev) {
+ return <></>
+ }
+
+ // A spawned run (persisted handle) shows live progress and survives revisits, where the local
+ // cloudRunStatus resets. While a run is active the parent blocks the local command (GROW-95), so
+ // this is the only thing the cloud tab shows.
+ if (activeCloudRun) {
+ return (
+ <InstallationProgressView
+ runId={activeCloudRun.runId}
+ taskId={activeCloudRun.taskId}
+ onRetryLocally={onRetryLocally}
+ />
+ )
+ }
+
+ if (cloudRunStatus === 'queued') {
+ const repoLabel = selectedRepository ? <span className="font-mono">{selectedRepository}</span> : 'your repo'
+ // The brief window after kickoff before the run handle settles. With sync on the Installation
+ // layer takes over above; without sync we cannot observe the run, so set honest expectations.
+ return (
+ <LemonBanner type="info">
+ <div className="space-y-1" data-attr="wizard-cloud-run-queued">
+ {syncEnabled ? (
+ <>
+ <div className="font-semibold">Starting your cloud run…</div>
+ <div className="text-sm text-muted">
+ Kicking off the wizard on {repoLabel}. Progress will appear here in a moment and stays
+ in the corner as you keep going.
+ </div>
+ </>
+ ) : (
+ <>
+ <div className="font-semibold">Cloud run queued for {repoLabel}.</div>
+ <div className="text-sm text-muted">
+ If it succeeds we'll open a pull request in your repo to review. We can't show live
+ progress here, so keep an eye on your repository.
+ </div>
+ </>
+ )}
+ </div>
+ </LemonBanner>
+ )
+ }
+
+ return (
+ <WizardModeShell hideHog={hideHog} data-attr="wizard-cloud-run-block">
+ <p className="text-sm text-muted mb-0">
+ We'll run the wizard against your repo and open a pull request with the SDK installed and your context
+ flowing. Review it and merge whenever you're ready.
+ </p>
+
+ {!githubIntegration ? (
+ <LemonButton
+ type="secondary"
+ icon={<IconGithub />}
+ to={connectGitHubUrl}
+ disableClientSideRouting
+ data-attr="wizard-cloud-run-connect-github"
+ className={hideHog ? 'self-center' : 'self-start'}
+ >
+ Connect GitHub
+ </LemonButton>
+ ) : (
+ <div className="flex w-full flex-col gap-2">
+ <div className="flex items-center gap-2">
+ <div className="relative flex-1">
+ <IconGithub className="absolute left-2 top-1/2 -translate-y-1/2 z-10 text-base text-muted pointer-events-none" />
+ <GitHubRepositoryPicker
+ integrationId={githubIntegration.id}
+ value={selectedRepository ?? ''}
+ onChange={(repository) => setSelectedRepository(repository)}
+ // Make the combobox read as a dropdown, not a text field: the LemonInput
+ // root defaults to `cursor: text` (unlayered SCSS), so override with `!`.
+ className="pl-7 pr-7 !cursor-pointer"
+ />
+ {!selectedRepository && (
+ <IconChevronDown className="absolute right-2 top-1/2 -translate-y-1/2 z-10 text-base text-muted pointer-events-none" />
+ )}
+ </div>
+ <LemonButton
+ type="primary"
+ icon={<IconPullRequest />}
+ onClick={() => startCloudRun()}
+ loading={cloudRunStatus === 'submitting'}
+ disabledReason={selectedRepository ? undefined : 'Pick a repository first'}
+ data-attr="wizard-cloud-run-open-pr"
+ >
+ Install PostHog here
+ </LemonButton>
+ </div>
+ <div className="flex items-center gap-1.5 text-xs text-muted">
+ <IconCheckCircle className="text-success" />
+ <span>
+ Connected{githubIntegration.display_name ? ` to ${githubIntegration.display_name}` : ''}
+ </span>
+ </div>
+ </div>
+ )}
+ </WizardModeShell>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCommandBlock.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCommandBlock.tsx
new file mode 100644
index 000000000000..857c9b3c69af
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardCommandBlock.tsx
@@ -0,0 +1,36 @@
+import { useState } from 'react'
+
+import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'
+import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'
+
+import { WizardModeShell } from './WizardModeShell'
+
+export function WizardCommandBlock({ hideHog = false }: { hideHog?: boolean } = {}): JSX.Element {
+ const { wizardCommand, isCloudOrDev } = useWizardCommand()
+ const [castKey, setCastKey] = useState(0)
+
+ // The `npx @posthog/wizard` CLI only targets cloud (US/EU) and dev instances —
+ // self-hosted deployments have no preconfigured endpoint, so we hide the block
+ // entirely rather than show a command that can't work. Matches SetupWizardBanner.
+ if (!isCloudOrDev) {
+ return <></>
+ }
+
+ return (
+ <WizardModeShell hogCastKey={castKey} hideHog={hideHog} data-attr="wizard-command-block">
+ <CommandBlock
+ command={wizardCommand}
+ copyLabel="Wizard command"
+ ariaLabel="Copy wizard command"
+ size="md"
+ decoration="rainbow"
+ className="bg-bg-light border border-border hover:border-primary"
+ onCopy={(key) => setCastKey(key)}
+ />
+ <p className="text-xs text-muted mb-0">
+ Auto-detects your framework, installs the SDK, and sets up event capture. Commit the changes and open a
+ PR when you're ready.
+ </p>
+ </WizardModeShell>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.scss b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.scss
new file mode 100644
index 000000000000..27ac66c5a66a
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.scss
@@ -0,0 +1,29 @@
+// Hedgehog "casting a spell" wobble — played by remounting the <img> element
+// with a fresh key, so the animation runs from the start on every copy click.
+
+.WizardModeShell__hogCast {
+ animation: WizardModeShell-hogCast 500ms ease-out;
+}
+
+/* stylelint-disable-next-line keyframes-name-pattern */
+@keyframes WizardModeShell-hogCast {
+ 0% {
+ transform: rotate(0deg);
+ }
+
+ 20% {
+ transform: rotate(-8deg);
+ }
+
+ 50% {
+ transform: rotate(5deg);
+ }
+
+ 80% {
+ transform: rotate(-2deg);
+ }
+
+ 100% {
+ transform: rotate(0deg);
+ }
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.tsx
new file mode 100644
index 000000000000..7290cc0b7313
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardModeShell.tsx
@@ -0,0 +1,108 @@
+import './WizardModeShell.scss'
+
+import type { ComponentType, ReactNode } from 'react'
+
+import { cn } from 'lib/utils/css-classes'
+import { WIZARD_HOG_URL } from 'scenes/onboarding/shared/wizardHog'
+
+import androidImage from '../../../legacy/sdks/logos/android.svg'
+import angularImage from '../../../legacy/sdks/logos/angular.svg'
+import { AstroLogo } from '../../../legacy/sdks/logos/AstroLogo'
+import djangoImage from '../../../legacy/sdks/logos/django.svg'
+import flaskImage from '../../../legacy/sdks/logos/flask.svg'
+import { IOSLogo } from '../../../legacy/sdks/logos/IOSLogo'
+import laravelImage from '../../../legacy/sdks/logos/laravel.svg'
+import nextjsImage from '../../../legacy/sdks/logos/nextjs.svg'
+import nuxtImage from '../../../legacy/sdks/logos/nuxt.svg'
+import pythonImage from '../../../legacy/sdks/logos/python.svg'
+import railsImage from '../../../legacy/sdks/logos/rails.svg'
+import reactImage from '../../../legacy/sdks/logos/react.svg'
+import { ReactRouterLogo } from '../../../legacy/sdks/logos/ReactRouterLogo'
+import svelteImage from '../../../legacy/sdks/logos/svelte.svg'
+import vueImage from '../../../legacy/sdks/logos/vue.svg'
+
+// Frameworks the wizard can set up — the same whichever way it runs, so both modes show them.
+const WIZARD_FRAMEWORKS: { name: string; icon: string | ComponentType }[] = [
+ { name: 'Next.js', icon: nextjsImage },
+ { name: 'React', icon: reactImage },
+ { name: 'Angular', icon: angularImage },
+ { name: 'Vue', icon: vueImage },
+ { name: 'Nuxt', icon: nuxtImage },
+ { name: 'Astro', icon: AstroLogo },
+ { name: 'SvelteKit', icon: svelteImage },
+ { name: 'Django', icon: djangoImage },
+ { name: 'Flask', icon: flaskImage },
+ { name: 'Laravel', icon: laravelImage },
+ { name: 'React Native', icon: reactImage },
+ { name: 'iOS', icon: IOSLogo },
+ { name: 'Android', icon: androidImage },
+ { name: 'Ruby on Rails', icon: railsImage },
+ { name: 'React Router', icon: ReactRouterLogo },
+ { name: 'Python', icon: pythonImage },
+]
+
+export function WizardFrameworkBadges(): JSX.Element {
+ return (
+ <div className="flex flex-wrap gap-1.5 items-center justify-center">
+ <span className="text-xs text-muted">Supports:</span>
+ {WIZARD_FRAMEWORKS.map((fw) => (
+ <span
+ key={fw.name}
+ className="inline-flex items-center gap-1 text-xs text-muted bg-bg-light border border-border rounded px-1.5 py-0.5"
+ >
+ {typeof fw.icon === 'string' ? (
+ <img src={fw.icon} alt="" className="w-3 h-3 shrink-0" />
+ ) : (
+ <span className="inline-flex w-3 h-3 shrink-0 [&_svg]:!w-3 [&_svg]:!h-3">
+ <fw.icon />
+ </span>
+ )}
+ {fw.name}
+ </span>
+ ))}
+ </div>
+ )
+}
+
+/**
+ * Shared chrome for both install modes, so the cloud and local tabs read as one
+ * wizard rather than two unrelated panels: the hedgehog on the left, the
+ * mode-specific content on the right. The framework badges are rendered once
+ * above the mode selector (shared by both), not here. `hogCastKey` replays the
+ * hog's "casting" wobble when bumped — the command tab bumps it on copy; the
+ * cloud tab leaves it at 0 (a static hog).
+ */
+export function WizardModeShell({
+ children,
+ hogCastKey = 0,
+ hideHog = false,
+ 'data-attr': dataAttr,
+}: {
+ children: ReactNode
+ hogCastKey?: number
+ /** Drop the hedgehog (e.g. the compact context-first onboarding card has no room for it). */
+ hideHog?: boolean
+ 'data-attr'?: string
+}): JSX.Element {
+ return (
+ <div className="flex gap-6" data-attr={dataAttr}>
+ {!hideHog && (
+ <img
+ key={`hog-${hogCastKey}`}
+ src={WIZARD_HOG_URL}
+ alt="PostHog wizard hedgehog"
+ className={cn(
+ 'w-28 h-28 hidden sm:block shrink-0 self-center',
+ hogCastKey > 0 && 'WizardModeShell__hogCast'
+ )}
+ />
+ )}
+ {/* With the hog hidden (compact context-first card), center the content at its natural
+ width instead of stretching it full-bleed — so the command block and the GitHub-connect
+ block sit centered without expanding. With the hog shown, keep the left-aligned column. */}
+ <div className={cn('flex-1 flex flex-col justify-center gap-3', hideHog && 'items-center text-center')}>
+ {children}
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.stories.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.stories.tsx
new file mode 100644
index 000000000000..8c31fd6d306c
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.stories.tsx
@@ -0,0 +1,200 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { InstallationProgress, InstallationStepStatus } from '../installationProgressLogic'
+import { WizardSyncCard, WizardSyncMode } from './WizardSyncCard'
+
+/**
+ * The detached wizard sync widget (collapsed), driven by fixtures so every cloud and local state is
+ * reviewable in isolation. The component is pure, so no streams or mocks are needed.
+ */
+const meta: Meta<typeof WizardSyncCard> = {
+ title: 'Scenes-Other/Onboarding/Wizard Sync Card',
+ component: WizardSyncCard,
+ argTypes: {
+ onExpand: { action: 'expand' },
+ onDismiss: { action: 'dismiss' },
+ },
+ // Most stories here render an in-progress spinner by design (connecting/running phases), which never
+ // resolves — skip the test runner's default "wait for loaders to hide" check.
+ parameters: { testOptions: { waitForLoadersToDisappear: false } },
+ decorators: [
+ (Story) => (
+ <div className="bg-primary p-8 flex justify-end">
+ <Story />
+ </div>
+ ),
+ ],
+}
+export default meta
+type Story = StoryObj<typeof WizardSyncCard>
+
+// Cloud pipeline steps with a status per stage, plus an optional live detail on one stage.
+function cloudSteps(
+ statuses: InstallationStepStatus[],
+ detail?: { at: number; text: string }
+): InstallationProgress['steps'] {
+ const labels = [
+ 'Set up sandbox',
+ 'Cloned repository',
+ 'Ran PostHog setup wizard',
+ 'Started agent',
+ 'Opened pull request',
+ 'Keeping CI green',
+ ]
+ return labels.map((label, i) => ({
+ id: `setup:${i}`,
+ label,
+ status: statuses[i] ?? 'pending',
+ detail: detail && detail.at === i ? detail.text : null,
+ }))
+}
+
+function progress(overrides: Partial<InstallationProgress>): InstallationProgress {
+ return { phase: 'running', steps: [], error: null, prUrl: null, isCurrent: true, ...overrides }
+}
+
+export const Connecting: Story = {
+ args: { mode: 'cloud', elapsedSeconds: 3, progress: progress({ phase: 'connecting' }) },
+}
+
+// Cloud, wizard phase: the wizard's live sub-task ("Capturing events") leads the card.
+export const CloudWizardRunning: Story = {
+ args: {
+ mode: 'cloud',
+ elapsedSeconds: 134,
+ progress: progress({
+ steps: cloudSteps(['completed', 'completed', 'in_progress', 'pending', 'pending', 'pending'], {
+ at: 2,
+ text: 'Capturing events',
+ }),
+ }),
+ },
+}
+
+// Cloud, agent has opened the PR and is keeping CI green.
+export const CloudKeepingCiGreen: Story = {
+ args: {
+ mode: 'cloud',
+ elapsedSeconds: 921,
+ progress: progress({
+ prUrl: 'https://github.com/acme-co/web/pull/42',
+ steps: cloudSteps(['completed', 'completed', 'completed', 'completed', 'completed', 'in_progress']),
+ }),
+ },
+}
+
+// Local run: the wizard's own tasks are the steps.
+export const LocalRunning: Story = {
+ args: {
+ mode: 'local',
+ elapsedSeconds: 47,
+ progress: progress({
+ steps: [
+ { id: 'plan', label: 'Plan event tracking', status: 'completed', detail: null },
+ { id: 'install', label: 'Install PostHog', status: 'in_progress', detail: null },
+ { id: 'capture', label: 'Capture events', status: 'pending', detail: null },
+ { id: 'verify', label: 'Verify it works', status: 'pending', detail: null },
+ ],
+ }),
+ },
+}
+
+export const Completed: Story = {
+ args: {
+ mode: 'cloud',
+ elapsedSeconds: 1820,
+ progress: progress({
+ phase: 'completed',
+ prUrl: 'https://github.com/acme-co/web/pull/42',
+ steps: cloudSteps(['completed', 'completed', 'completed', 'completed', 'completed', 'completed']),
+ }),
+ },
+}
+
+export const Failed: Story = {
+ args: {
+ mode: 'cloud',
+ elapsedSeconds: 312,
+ progress: progress({
+ phase: 'error',
+ steps: cloudSteps(['completed', 'completed', 'failed', 'pending', 'pending', 'pending']),
+ error: { title: 'Setup hit a snag', detail: 'The setup wizard could not finish.' },
+ }),
+ },
+}
+
+// Every state in one canvas, for side-by-side review (GROW-98). Reuses the individual stories' args so
+// there is a single source of truth for each fixture.
+export const AllStates: Story = {
+ parameters: { controls: { disable: true } },
+ render: () => {
+ const states: { label: string; args: Story['args'] }[] = [
+ { label: 'Connecting', args: Connecting.args },
+ { label: 'Cloud, wizard running', args: CloudWizardRunning.args },
+ { label: 'Cloud, keeping CI green', args: CloudKeepingCiGreen.args },
+ { label: 'Local, running', args: LocalRunning.args },
+ { label: 'Completed', args: Completed.args },
+ { label: 'Failed', args: Failed.args },
+ ]
+ return (
+ <div className="flex flex-col gap-5 items-end">
+ {states.map(({ label, args }) => (
+ <div key={label} className="flex flex-col gap-1 items-end">
+ <span className="text-xs text-muted">{label}</span>
+ <WizardSyncCard
+ progress={args!.progress!}
+ elapsedSeconds={args!.elapsedSeconds!}
+ mode={args!.mode!}
+ onExpand={() => {}}
+ onDismiss={() => {}}
+ />
+ </div>
+ ))}
+ </div>
+ )
+ },
+}
+
+// Configure the card live from the controls panel (GROW-98): pick phase, mode, how many steps are done,
+// the current task label, and elapsed, and the fixture is built from those.
+interface PlaygroundArgs {
+ phase: InstallationProgress['phase']
+ mode: WizardSyncMode
+ elapsedSeconds: number
+ completedSteps: number
+ currentTask: string
+}
+
+export const Playground: StoryObj<PlaygroundArgs> = {
+ argTypes: {
+ phase: { control: 'select', options: ['connecting', 'running', 'completed', 'error'] },
+ mode: { control: 'inline-radio', options: ['cloud', 'local'] },
+ elapsedSeconds: { control: { type: 'number', min: 0 } },
+ completedSteps: { control: { type: 'range', min: 0, max: 6 } },
+ currentTask: { control: 'text' },
+ },
+ args: { phase: 'running', mode: 'cloud', elapsedSeconds: 134, completedSteps: 2, currentTask: 'Capturing events' },
+ render: (args) => {
+ const statuses: InstallationStepStatus[] = [0, 1, 2, 3, 4, 5].map((i) =>
+ i < args.completedSteps ? 'completed' : i === args.completedSteps ? 'in_progress' : 'pending'
+ )
+ const built = progress({
+ phase: args.phase,
+ steps: cloudSteps(
+ statuses,
+ args.currentTask ? { at: args.completedSteps, text: args.currentTask } : undefined
+ ),
+ prUrl: args.phase === 'completed' ? 'https://github.com/acme-co/web/pull/42' : null,
+ error: args.phase === 'error' ? { title: 'Setup hit a snag', detail: 'Something stopped the run.' } : null,
+ })
+ return (
+ <WizardSyncCard
+ progress={built}
+ elapsedSeconds={args.elapsedSeconds}
+ mode={args.mode}
+ onExpand={() => {}}
+ onDismiss={() => {}}
+ />
+ )
+ },
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.tsx
new file mode 100644
index 000000000000..d9cf4bb95c12
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncCard.tsx
@@ -0,0 +1,134 @@
+import {
+ IconCheckCircle,
+ IconCloud,
+ IconExpand45,
+ IconLaptop,
+ IconPullRequest,
+ IconWarning,
+ IconX,
+} from '@posthog/icons'
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+
+import { InstallationProgress } from '../installationProgressLogic'
+import { currentTaskLabel, formatElapsed, pipClass, stepCounts, syncHeadline, toneTextClass } from './helpers'
+
+export type WizardSyncMode = 'cloud' | 'local'
+
+// Leading glyph for the prominent task line: it carries the run's tone (accent while working, green on
+// success, red on failure). Shared with the launcher and dialog.
+export function StatusGlyph({ progress }: { progress: InstallationProgress }): JSX.Element {
+ if (progress.phase === 'completed') {
+ return <IconCheckCircle className="text-success text-xl shrink-0" />
+ }
+ if (progress.phase === 'error') {
+ return <IconWarning className="text-danger text-xl shrink-0" />
+ }
+ return <Spinner className="text-xl shrink-0 text-accent" textColored />
+}
+
+// Tiny chip naming where the run is happening, so cloud and local runs read distinctly.
+function ModeChip({ mode }: { mode: WizardSyncMode }): JSX.Element {
+ return (
+ <span className="inline-flex items-center gap-1 text-xs text-muted">
+ {mode === 'cloud' ? <IconCloud className="text-sm" /> : <IconLaptop className="text-sm" />}
+ {mode === 'cloud' ? 'Cloud run' : 'On your machine'}
+ </span>
+ )
+}
+
+/**
+ * The collapsed detached widget: the wizard's current task takes top billing, with the phase, where it
+ * is running, elapsed time, and a per-step pip strip as supporting context. Pure and position-agnostic
+ * (the FAB wrapper pins it to the corner) so every state is storyable. Clicking the body, or the expand
+ * control, opens the full dialog.
+ */
+export function WizardSyncCard({
+ progress,
+ elapsedSeconds,
+ mode,
+ onExpand,
+ onDismiss,
+}: {
+ progress: InstallationProgress
+ elapsedSeconds: number
+ mode: WizardSyncMode
+ onExpand: () => void
+ onDismiss?: () => void
+}): JSX.Element {
+ const { completed, total } = stepCounts(progress.steps)
+ const task = currentTaskLabel(progress)
+
+ return (
+ <div
+ className="w-[340px] bg-surface-primary rounded-xl border border-primary shadow-xl shadow-black/10 overflow-hidden"
+ role="status"
+ aria-live="polite"
+ data-attr="wizard-sync-card"
+ >
+ <button
+ type="button"
+ onClick={onExpand}
+ aria-label="Expand setup details"
+ className="w-full text-left flex flex-col gap-2.5 px-3.5 py-3 hover:bg-fill-highlight-50 transition-colors cursor-pointer"
+ >
+ <div className="flex items-center gap-2.5">
+ <StatusGlyph progress={progress} />
+ <div className="flex-1 min-w-0">
+ <p className={cn('m-0 text-sm font-semibold truncate', toneTextClass(progress))}>{task}</p>
+ <p className="m-0 text-xs text-muted truncate">{syncHeadline(progress)}</p>
+ </div>
+ <span className="text-xs text-muted tabular-nums shrink-0">{formatElapsed(elapsedSeconds)}</span>
+ </div>
+
+ {total > 0 && (
+ <div className="flex items-center gap-2">
+ <div className="flex flex-1 items-center gap-1">
+ {progress.steps.map((step) => (
+ <span key={step.id} className={cn('h-1 flex-1 rounded-full', pipClass(step.status))} />
+ ))}
+ </div>
+ <span className="text-xs text-muted tabular-nums shrink-0">
+ {completed}/{total}
+ </span>
+ </div>
+ )}
+ </button>
+
+ <div className="flex items-center justify-between gap-2 px-3.5 py-2 border-t border-primary">
+ <ModeChip mode={mode} />
+ <div className="flex items-center gap-1">
+ {progress.prUrl && (
+ <LemonButton
+ size="xsmall"
+ type="secondary"
+ to={progress.prUrl}
+ targetBlank
+ icon={<IconPullRequest />}
+ onClick={(e) => e.stopPropagation()}
+ >
+ Review PR
+ </LemonButton>
+ )}
+ <LemonButton
+ size="xsmall"
+ icon={<IconExpand45 />}
+ onClick={onExpand}
+ tooltip="See all the details"
+ aria-label="Expand"
+ />
+ {onDismiss && (
+ <LemonButton
+ size="xsmall"
+ icon={<IconX />}
+ onClick={onDismiss}
+ tooltip="Dismiss"
+ aria-label="Dismiss"
+ />
+ )}
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncFab.tsx b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncFab.tsx
new file mode 100644
index 000000000000..35b4ebb23f9a
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/WizardSyncFab.tsx
@@ -0,0 +1,217 @@
+import { useActions, useMountedLogic, useValues } from 'kea'
+import { useEffect, useState } from 'react'
+
+import { LemonButton, LemonModal } from '@posthog/lemon-ui'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { cn } from 'lib/utils/css-classes'
+import { elapsedSecondsFrom } from 'lib/utils/datetime'
+
+import { wizardActiveSessionDetectorLogic } from '../../../../legacy/sdks/OnboardingInstallStep/wizardActiveSessionDetectorLogic'
+import { activeCloudRunLogic, CloudRunHandle } from '../activeCloudRunLogic'
+import { InstallationProgress, installationProgressLogic } from '../installationProgressLogic'
+import { InstallationProgressContent } from '../InstallationProgressView'
+import { formatElapsed, syncHeadline, toneTextClass } from './helpers'
+import { StatusGlyph, WizardSyncCard, WizardSyncMode } from './WizardSyncCard'
+import { wizardSyncUiLogic } from './wizardSyncUiLogic'
+
+// Corner anchor for the collapsed card and the minimized launcher. The dialog is a portal, so it
+// positions itself.
+const CORNER = 'fixed bottom-5 right-5 z-[60]'
+
+// 1Hz clock for the elapsed timer, scoped to a mounted run so nothing ticks when no run is active.
+function useNow(): number {
+ const [now, setNow] = useState(() => Date.now())
+ useEffect(() => {
+ const id = window.setInterval(() => setNow(Date.now()), 1000)
+ return () => window.clearInterval(id)
+ }, [])
+ return now
+}
+
+// The minimized state: a small pill that restores the card. This is the "activate it back" affordance.
+function WizardSyncLauncher({
+ progress,
+ elapsedSeconds,
+ onRestore,
+}: {
+ progress: InstallationProgress
+ elapsedSeconds: number
+ onRestore: () => void
+}): JSX.Element {
+ return (
+ <button
+ type="button"
+ onClick={onRestore}
+ aria-label="Show PostHog setup progress"
+ data-attr="wizard-sync-launcher"
+ className="flex items-center gap-2 rounded-full bg-surface-primary border border-primary shadow-lg shadow-black/10 pl-2 pr-3 py-1.5 hover:bg-fill-highlight-50 transition-colors cursor-pointer"
+ >
+ <StatusGlyph progress={progress} />
+ <span className="text-sm font-medium">PostHog setup</span>
+ <span className="text-xs text-muted tabular-nums">{formatElapsed(elapsedSeconds)}</span>
+ </button>
+ )
+}
+
+// The expanded "all the details" dialog: the full pipeline plus the terminal payoff or failure.
+function WizardSyncDialog({
+ progress,
+ elapsedSeconds,
+ mode,
+ isOpen,
+ onClose,
+ onClear,
+}: {
+ progress: InstallationProgress
+ elapsedSeconds: number
+ mode: WizardSyncMode
+ isOpen: boolean
+ onClose: () => void
+ onClear?: () => void
+}): JSX.Element {
+ const isTerminal = progress.phase === 'completed' || progress.phase === 'error'
+ return (
+ <LemonModal isOpen={isOpen} onClose={onClose} title="PostHog setup" width={480}>
+ <div className="flex flex-col gap-3">
+ <div className="flex items-center justify-between text-xs">
+ <span className={cn('font-medium', toneTextClass(progress))}>{syncHeadline(progress)}</span>
+ <span className="text-muted tabular-nums">
+ {mode === 'cloud' ? 'Cloud run' : 'On your machine'} · {formatElapsed(elapsedSeconds)}
+ </span>
+ </div>
+ <InstallationProgressContent progress={progress} />
+ {isTerminal && onClear && (
+ <LemonButton type="secondary" onClick={onClear} className="self-end">
+ Dismiss this run
+ </LemonButton>
+ )}
+ </div>
+ </LemonModal>
+ )
+}
+
+// Shared presentation for a single run: the collapsed card or, once dismissed, the launcher, plus the
+// dialog. Owns the elapsed clock and reads the shared dismiss/expand UI state.
+function WizardSyncSurface({
+ progress,
+ startedAt,
+ mode,
+ runKey,
+ onClear,
+}: {
+ progress: InstallationProgress
+ startedAt: string | undefined
+ mode: WizardSyncMode
+ runKey: string
+ onClear?: () => void
+}): JSX.Element {
+ const { dismissedKey, dialogOpen } = useValues(wizardSyncUiLogic)
+ const { dismiss, restore, openDialog, closeDialog } = useActions(wizardSyncUiLogic)
+ const now = useNow()
+ const elapsedSeconds = startedAt ? elapsedSecondsFrom(startedAt, now) : 0
+ const minimized = dismissedKey === runKey
+ // Clearing a finished run also closes the dialog before the surface unmounts.
+ const handleClear = onClear
+ ? () => {
+ closeDialog()
+ onClear()
+ }
+ : undefined
+
+ return (
+ <>
+ <div className={CORNER}>
+ {minimized ? (
+ <WizardSyncLauncher progress={progress} elapsedSeconds={elapsedSeconds} onRestore={restore} />
+ ) : (
+ <WizardSyncCard
+ progress={progress}
+ elapsedSeconds={elapsedSeconds}
+ mode={mode}
+ onExpand={openDialog}
+ onDismiss={() => dismiss(runKey)}
+ />
+ )}
+ </div>
+ <WizardSyncDialog
+ progress={progress}
+ elapsedSeconds={elapsedSeconds}
+ mode={mode}
+ isOpen={dialogOpen}
+ onClose={closeDialog}
+ onClear={handleClear}
+ />
+ </>
+ )
+}
+
+// A cloud run: the Installation layer streams the pipeline; elapsed comes from the handle's kickoff stamp.
+function WizardSyncCloudFab({ handle }: { handle: CloudRunHandle }): JSX.Element {
+ const { installationProgress } = useValues(
+ installationProgressLogic({ mode: 'cloud', runId: handle.runId, taskId: handle.taskId })
+ )
+ const { clearActiveCloudRun } = useActions(activeCloudRunLogic)
+ return (
+ <WizardSyncSurface
+ progress={installationProgress}
+ startedAt={handle.startedAt}
+ mode="cloud"
+ runKey={handle.runId}
+ onClear={clearActiveCloudRun}
+ />
+ )
+}
+
+// A local run: the wizard session is the source; elapsed comes from its started_at. Local runs age out
+// of the detector once terminal, so there is no explicit clear.
+function WizardSyncLocalFab(): JSX.Element | null {
+ const { installationProgress, latestSession } = useValues(installationProgressLogic({ mode: 'local' }))
+ if (!latestSession) {
+ return null
+ }
+ return (
+ <WizardSyncSurface
+ progress={installationProgress}
+ startedAt={latestSession.started_at}
+ mode="local"
+ runKey={latestSession.session_id}
+ />
+ )
+}
+
+// Gate the local SSE behind the cheap detector poll, so a stream is opened only when a run is in flight.
+function WizardSyncLocalGate(): JSX.Element | null {
+ useMountedLogic(wizardActiveSessionDetectorLogic)
+ const { shouldStream } = useValues(wizardActiveSessionDetectorLogic)
+ if (!shouldStream) {
+ return null
+ }
+ return <WizardSyncLocalFab />
+}
+
+/**
+ * The single detached wizard sync widget, mounted app-wide (AuthenticatedShell). It surfaces whichever
+ * run is in flight, cloud or local, in one place: a cloud run (the persisted handle) takes precedence,
+ * otherwise a local wizard session detected by the poll. Replaces the earlier separate cloud-run and
+ * WizardProgressFab so there is one corner widget, never two.
+ */
+export function WizardSyncFab(): JSX.Element | null {
+ const cloudEnabled = useFeatureFlag('ONBOARDING_WIZARD_CLOUD_RUN', 'test')
+ const syncEnabled = useFeatureFlag('ONBOARDING_WIZARD_SYNC', 'test')
+ const { activeCloudRun, panelMounted } = useValues(activeCloudRunLogic)
+
+ // An inline install-step progress view is already showing this run, so stay out of its way. The FAB
+ // is for after the user moves on from the install step. Both inline views (cloud and local) claim
+ // panelMounted, so the run is never shown in two places.
+ if (panelMounted) {
+ return null
+ }
+ if (cloudEnabled && activeCloudRun) {
+ return <WizardSyncCloudFab handle={activeCloudRun} />
+ }
+ if (syncEnabled) {
+ return <WizardSyncLocalGate />
+ }
+ return null
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/helpers.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/helpers.ts
new file mode 100644
index 000000000000..76de6566a165
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/helpers.ts
@@ -0,0 +1,84 @@
+import { InstallationProgress, InstallationStep, InstallationStepStatus } from '../installationProgressLogic'
+
+// "m:ss", or "h:mm:ss" once a run passes the hour mark (cloud runs can be long).
+export function formatElapsed(totalSeconds: number): string {
+ const s = Math.max(0, Math.floor(totalSeconds))
+ const hours = Math.floor(s / 3600)
+ const minutes = Math.floor((s % 3600) / 60)
+ const seconds = s % 60
+ const ss = seconds.toString().padStart(2, '0')
+ if (hours > 0) {
+ return `${hours}:${minutes.toString().padStart(2, '0')}:${ss}`
+ }
+ return `${minutes}:${ss}`
+}
+
+// The short status line shown in the collapsed card header.
+export function syncHeadline(progress: InstallationProgress): string {
+ if (progress.phase === 'completed') {
+ return 'PostHog is set up'
+ }
+ if (progress.phase === 'error') {
+ return progress.error?.title ?? 'Setup hit a snag'
+ }
+ if (progress.prUrl) {
+ return 'Pull request ready'
+ }
+ if (progress.phase === 'connecting') {
+ return 'Getting ready'
+ }
+ return 'Setting up PostHog'
+}
+
+export function activeStep(steps: InstallationStep[]): InstallationStep | null {
+ return steps.find((s) => s.status === 'in_progress') ?? null
+}
+
+// The prominent line: the active step's live detail (the wizard's current sub-task) when present,
+// otherwise the step label. This is what gives the wizard's own work top billing in the card.
+export function currentTaskLabel(progress: InstallationProgress): string | null {
+ if (progress.phase === 'completed') {
+ return progress.prUrl ? 'Pull request is ready to review' : 'Everything is wired up'
+ }
+ if (progress.phase === 'error') {
+ return progress.error?.detail ?? 'Something stopped the run'
+ }
+ const step = activeStep(progress.steps)
+ if (step) {
+ return step.detail ?? step.label
+ }
+ return progress.phase === 'connecting' ? 'Connecting to your run' : 'Getting things ready'
+}
+
+export function stepCounts(steps: InstallationStep[]): { completed: number; total: number } {
+ return {
+ completed: steps.filter((s) => s.status === 'completed').length,
+ total: steps.length,
+ }
+}
+
+// Accent tone for the whole widget, driven by phase. One accent plus the two terminal colors keeps it
+// colorful without going loud.
+export function toneTextClass(progress: InstallationProgress): string {
+ if (progress.phase === 'completed') {
+ return 'text-success'
+ }
+ if (progress.phase === 'error') {
+ return 'text-danger'
+ }
+ return 'text-accent'
+}
+
+// Fill color for a single progress pip, one per step.
+export function pipClass(status: InstallationStepStatus): string {
+ switch (status) {
+ case 'completed':
+ return 'bg-success'
+ case 'in_progress':
+ return 'bg-accent animate-pulse'
+ case 'failed':
+ return 'bg-danger'
+ default:
+ return 'bg-border'
+ }
+}
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/wizardSyncUiLogic.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/wizardSyncUiLogic.ts
new file mode 100644
index 000000000000..3058929c06d4
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/WizardSync/wizardSyncUiLogic.ts
@@ -0,0 +1,39 @@
+import { actions, kea, path, reducers } from 'kea'
+
+import type { wizardSyncUiLogicType } from './wizardSyncUiLogicType'
+
+/**
+ * UI state for the detached wizard sync widget, shared app-wide (mounted by WizardSyncFab):
+ * - `dismissedKey`: the run the user minimized. Keyed by run id (cloud) or session id (local) so a
+ * fresh run is never born already-minimized, and a minimize survives navigation (persisted).
+ * - `dialogOpen`: whether the "all the details" dialog is showing.
+ *
+ * The widget itself owns no run data; the per-mode inner components feed it the normalized progress.
+ */
+export const wizardSyncUiLogic = kea<wizardSyncUiLogicType>([
+ path(['scenes', 'onboarding', 'wizardSyncUiLogic']),
+ actions({
+ dismiss: (key: string) => ({ key }),
+ restore: true,
+ openDialog: true,
+ closeDialog: true,
+ }),
+ reducers({
+ dismissedKey: [
+ null as string | null,
+ { persist: true },
+ {
+ dismiss: (_, { key }) => key,
+ restore: () => null,
+ },
+ ],
+ dialogOpen: [
+ false,
+ {
+ openDialog: () => true,
+ closeDialog: () => false,
+ restore: () => false,
+ },
+ ],
+ }),
+])
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.test.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.test.ts
new file mode 100644
index 000000000000..cbfbc568597e
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.test.ts
@@ -0,0 +1,22 @@
+import { CloudRunHandle, scopedCloudRun } from './activeCloudRunLogic'
+
+const handle: CloudRunHandle = {
+ taskId: 'task-1',
+ runId: 'run-1',
+ startedAt: '2026-01-01T00:00:00Z',
+ projectId: 2,
+}
+
+describe('scopedCloudRun', () => {
+ it.each([
+ // The persisted handle is browser-wide localStorage — a fresh account inheriting another
+ // project's run must never surface it.
+ ['a handle from another project', handle, 7, null],
+ ['a legacy handle without a projectId', { ...handle, projectId: undefined }, 2, null],
+ ['no current project resolved yet', handle, null, null],
+ ['no handle at all', null, 2, null],
+ ['a handle for the current project', handle, 2, handle],
+ ])('returns %s correctly', (_name, persisted, currentProjectId, expected) => {
+ expect(scopedCloudRun(persisted, currentProjectId)).toEqual(expected)
+ })
+})
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.ts
new file mode 100644
index 000000000000..5e85b8b64741
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/activeCloudRunLogic.ts
@@ -0,0 +1,79 @@
+import { actions, connect, kea, path, reducers, selectors } from 'kea'
+
+import { projectLogic } from 'scenes/projectLogic'
+
+import type { activeCloudRunLogicType } from './activeCloudRunLogicType'
+
+export interface CloudRunHandle {
+ taskId: string
+ runId: string
+ /** ISO timestamp stamped at kickoff so the sync widget can show elapsed time (the cloud stream
+ * carries no start field). Optional: runs persisted before this field existed will not have it. */
+ startedAt?: string
+ /** Project the run belongs to. Optional: runs persisted before this field existed will not have
+ * it — those are treated as stale and never surfaced (see `activeCloudRun`). */
+ projectId?: number
+}
+
+// The persisted handle, but only when it belongs to the given project. Handles without a projectId
+// predate the stamp and can't be attributed, so they're stale by definition.
+export function scopedCloudRun(handle: CloudRunHandle | null, currentProjectId: number | null): CloudRunHandle | null {
+ return handle?.projectId != null && handle.projectId === currentProjectId ? handle : null
+}
+
+/**
+ * Holds the active cloud-run handle app-wide so the global progress FAB can keep showing a run after
+ * the user advances past (or unmounts) the install step. Persisted so it also survives a refresh during
+ * a long run. The install step writes it on kickoff; the FAB clears it on dismiss.
+ *
+ * The persisted handle lives in localStorage, which is shared across every account and project on this
+ * browser — so `activeCloudRun` only surfaces a handle stamped with the current project. Without that
+ * gate a fresh account inherits the previous account's run and greets the user with a progress widget
+ * for a run that isn't theirs.
+ */
+export const activeCloudRunLogic = kea<activeCloudRunLogicType>([
+ path(['scenes', 'onboarding', 'activeCloudRunLogic']),
+ connect(() => ({
+ values: [projectLogic, ['currentProjectId']],
+ })),
+ actions({
+ setActiveCloudRun: (taskId: string, runId: string, startedAt: string, projectId: number) => ({
+ taskId,
+ runId,
+ startedAt,
+ projectId,
+ }),
+ clearActiveCloudRun: true,
+ // Set by the inline install-step progress view while it's mounted, so the floating FAB hides
+ // and the two never render the same run at once (mirrors wizardProgressTrackerLogic.panelMounted).
+ setPanelMounted: (mounted: boolean) => ({ mounted }),
+ }),
+ reducers({
+ persistedCloudRun: [
+ null as CloudRunHandle | null,
+ { persist: true },
+ {
+ setActiveCloudRun: (_, { taskId, runId, startedAt, projectId }) => ({
+ taskId,
+ runId,
+ startedAt,
+ projectId,
+ }),
+ clearActiveCloudRun: () => null,
+ },
+ ],
+ panelMounted: [
+ false,
+ {
+ setPanelMounted: (_, { mounted }) => mounted,
+ },
+ ],
+ }),
+ selectors({
+ activeCloudRun: [
+ (s) => [s.persistedCloudRun, s.currentProjectId],
+ (persistedCloudRun, currentProjectId): CloudRunHandle | null =>
+ scopedCloudRun(persistedCloudRun, currentProjectId),
+ ],
+ }),
+])
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.test.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.test.ts
new file mode 100644
index 000000000000..ea3dcafc958c
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.test.ts
@@ -0,0 +1,267 @@
+import type { WizardSessionDTOApi } from 'products/wizard/frontend/generated/api.schemas'
+
+import { cloudProgress, localProgress } from './installationProgressLogic'
+import { TaskRunProgressStep, TaskRunStreamState } from './taskRunStreamLogic'
+
+function taskState(overrides: Partial<TaskRunStreamState> = {}): TaskRunStreamState {
+ return {
+ status: 'in_progress',
+ stage: null,
+ output: null,
+ branch: null,
+ error_message: null,
+ updated_at: '2026-01-01T00:00:00Z',
+ completed_at: null,
+ ...overrides,
+ }
+}
+
+function step(overrides: Partial<TaskRunProgressStep> = {}): TaskRunProgressStep {
+ return {
+ step: 'clone',
+ status: 'in_progress',
+ label: 'Cloning repository',
+ group: 'setup',
+ detail: null,
+ ...overrides,
+ }
+}
+
+function session(overrides: Partial<WizardSessionDTOApi> = {}): WizardSessionDTOApi {
+ return {
+ session_id: 's',
+ team_id: 1,
+ workflow_id: 'posthog-integration',
+ skill_id: '',
+ started_at: '2026-01-01T00:00:00Z',
+ run_phase: 'running',
+ tasks: [],
+ event_plan: null,
+ error: null,
+ created_at: '2026-01-01T00:00:00Z',
+ updated_at: '2026-01-01T00:00:00Z',
+ is_stale: false,
+ ...overrides,
+ } as unknown as WizardSessionDTOApi
+}
+
+describe('installationProgressLogic merge', () => {
+ describe('cloudProgress', () => {
+ it.each([
+ ['no state + idle connection → idle', null, 'idle', 'idle'],
+ ['no state + connecting → connecting', null, 'connecting', 'connecting'],
+ ['no state + open connection → idle', null, 'open', 'idle'],
+ // Queued means nothing has started yet — presenting it as "running" told users the
+ // wizard was working when no worker had picked the run up.
+ ['queued → connecting', 'queued', 'open', 'connecting'],
+ ['in_progress → running', 'in_progress', 'open', 'running'],
+ ['completed → completed', 'completed', 'open', 'completed'],
+ ['failed → error', 'failed', 'open', 'error'],
+ ['cancelled → error', 'cancelled', 'open', 'error'],
+ ])('phase: %s', (_name, status, conn, expected) => {
+ const state = status === null ? null : taskState({ status })
+ expect(cloudProgress(state, [], conn, null).phase).toBe(expected)
+ })
+
+ it('surfaces a stalled queued run as an error instead of an eternal spinner', () => {
+ const result = cloudProgress(taskState({ status: 'queued' }), [], 'open', null, true)
+ expect(result.phase).toBe('error')
+ expect(result.error?.title).toBe("Setup hasn't started")
+ })
+
+ it('ignores the stall flag once the run has left the queue', () => {
+ expect(cloudProgress(taskState({ status: 'in_progress' }), [], 'open', null, true).phase).toBe('running')
+ })
+
+ it.each([
+ ['pending', 'pending'],
+ ['in_progress', 'in_progress'],
+ ['completed', 'completed'],
+ ['failed', 'failed'],
+ ['canceled', 'failed'],
+ ['something-else', 'pending'],
+ ])('maps backend step status %s → %s', (raw, expected) => {
+ const result = cloudProgress(taskState(), [step({ status: raw })], 'open', null)
+ expect(result.steps[0].status).toBe(expected)
+ })
+
+ it('maps a step to id/label/detail', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ group: 'setup', step: 'clone', label: 'Cloning', detail: 'shallow' })],
+ 'open',
+ null
+ )
+ expect(result.steps[0]).toEqual({
+ id: 'setup:clone',
+ label: 'Cloning',
+ status: 'in_progress',
+ detail: 'shallow',
+ })
+ })
+
+ it('enriches an in-progress wizard step with the session in-progress task title', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ step: 'wizard', status: 'in_progress', detail: null })],
+ 'open',
+ session({ tasks: [{ id: 't', title: 'Installing SDK', status: 'in_progress' }] })
+ )
+ expect(result.steps[0].detail).toBe('Installing SDK')
+ })
+
+ it('enriches an in-progress wizard step with the wizard error when the session errored', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ step: 'wizard', status: 'in_progress', detail: null })],
+ 'open',
+ session({ run_phase: 'error', tasks: [] })
+ )
+ expect(result.steps[0].detail).toBe('Wizard hit an error')
+ })
+
+ it('leaves the wizard step detail alone when there is no session', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ step: 'wizard', status: 'in_progress', detail: 'own detail' })],
+ 'open',
+ null
+ )
+ expect(result.steps[0].detail).toBe('own detail')
+ })
+
+ it('does not enrich a non-wizard step', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ step: 'clone', status: 'in_progress', detail: 'shallow' })],
+ 'open',
+ session({ tasks: [{ id: 't', title: 'Installing SDK', status: 'in_progress' }] })
+ )
+ expect(result.steps[0].detail).toBe('shallow')
+ })
+
+ it('does not enrich a completed wizard step', () => {
+ const result = cloudProgress(
+ taskState(),
+ [step({ step: 'wizard', status: 'completed', detail: 'own detail' })],
+ 'open',
+ session({ tasks: [{ id: 't', title: 'Installing SDK', status: 'in_progress' }] })
+ )
+ expect(result.steps[0].detail).toBe('own detail')
+ })
+
+ it('uses the task run error message on failure', () => {
+ expect(
+ cloudProgress(taskState({ status: 'failed', error_message: 'boom' }), [], 'open', null).error
+ ).toEqual({
+ title: 'Installation failed',
+ detail: 'boom',
+ })
+ })
+
+ it('falls back to the wizard session error message', () => {
+ expect(
+ cloudProgress(
+ taskState({ status: 'failed', error_message: null }),
+ [],
+ 'open',
+ session({ error: { message: 'wizard boom' } })
+ ).error
+ ).toEqual({ title: 'Installation failed', detail: 'wizard boom' })
+ })
+
+ it('error detail is null when neither source has a message', () => {
+ expect(cloudProgress(taskState({ status: 'failed', error_message: null }), [], 'open', null).error).toEqual(
+ {
+ title: 'Installation failed',
+ detail: null,
+ }
+ )
+ })
+
+ it('has no error outside an error phase', () => {
+ expect(cloudProgress(taskState({ status: 'in_progress' }), [], 'open', null).error).toBeNull()
+ })
+
+ it.each([
+ [
+ 'output with pr_url',
+ taskState({ status: 'completed', output: { pr_url: 'https://x/pull/1' } }),
+ 'https://x/pull/1',
+ ],
+ ['output without pr_url', taskState({ status: 'completed', output: {} }), null],
+ ['null output', taskState({ status: 'completed', output: null }), null],
+ ['no task state', null, null],
+ ])('prUrl: %s', (_name, state, expected) => {
+ expect(cloudProgress(state, [], 'open', null).prUrl).toBe(expected)
+ })
+
+ it('isCurrent is false only when idle', () => {
+ expect(cloudProgress(null, [], 'idle', null).isCurrent).toBe(false)
+ expect(cloudProgress(taskState({ status: 'in_progress' }), [], 'open', null).isCurrent).toBe(true)
+ expect(cloudProgress(taskState({ status: 'completed' }), [], 'open', null).isCurrent).toBe(true)
+ })
+ })
+
+ describe('localProgress', () => {
+ it.each([
+ ['no session + connecting → connecting', null, 'connecting', 'connecting'],
+ ['no session + open → idle', null, 'open', 'idle'],
+ ['no session + idle → idle', null, 'idle', 'idle'],
+ ['completed → completed', { run_phase: 'completed' }, 'open', 'completed'],
+ ['error → error', { run_phase: 'error' }, 'open', 'error'],
+ ['running + open → running', { run_phase: 'running' }, 'open', 'running'],
+ ['running + connecting conn → connecting', { run_phase: 'running' }, 'connecting', 'connecting'],
+ ['running + error conn → connecting', { run_phase: 'running' }, 'error', 'connecting'],
+ ])('phase: %s', (_name, sessionOverrides, conn, expected) => {
+ const s = sessionOverrides === null ? null : session(sessionOverrides as Partial<WizardSessionDTOApi>)
+ expect(localProgress(s, conn).phase).toBe(expected)
+ })
+
+ it('maps session tasks to steps', () => {
+ const result = localProgress(
+ session({
+ run_phase: 'running',
+ tasks: [
+ { id: 'a', title: 'Detect framework', status: 'completed' },
+ { id: 'b', title: 'Install SDK', status: 'in_progress' },
+ ],
+ }),
+ 'open'
+ )
+ expect(result.steps).toEqual([
+ { id: 'a', label: 'Detect framework', status: 'completed', detail: null },
+ { id: 'b', label: 'Install SDK', status: 'in_progress', detail: null },
+ ])
+ })
+
+ it('surfaces the wizard error on the error phase', () => {
+ expect(
+ localProgress(session({ run_phase: 'error', error: { message: 'wizard boom' } }), 'open').error
+ ).toEqual({
+ title: 'Wizard hit an error',
+ detail: 'wizard boom',
+ })
+ })
+
+ it('error detail is null when the session has no error message', () => {
+ expect(localProgress(session({ run_phase: 'error', error: null }), 'open').error).toEqual({
+ title: 'Wizard hit an error',
+ detail: null,
+ })
+ })
+
+ it('has no error outside the error phase', () => {
+ expect(localProgress(session({ run_phase: 'running' }), 'open').error).toBeNull()
+ })
+
+ it('never has a pr url', () => {
+ expect(localProgress(session({ run_phase: 'completed' }), 'open').prUrl).toBeNull()
+ })
+
+ it('isCurrent is false only when idle', () => {
+ expect(localProgress(null, 'open').isCurrent).toBe(false)
+ expect(localProgress(session({ run_phase: 'running' }), 'open').isCurrent).toBe(true)
+ })
+ })
+})
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.ts
new file mode 100644
index 000000000000..25b51695b254
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/installationProgressLogic.ts
@@ -0,0 +1,237 @@
+import { afterMount, beforeUnmount, connect, kea, key, path, props, selectors } from 'kea'
+
+import type { WizardSessionDTOApi } from 'products/wizard/frontend/generated/api.schemas'
+import { wizardSessionStreamLogic } from 'products/wizard/frontend/wizardSessionStreamLogic'
+
+import type { installationProgressLogicType } from './installationProgressLogicType'
+import { taskRunStreamLogic, TaskRunProgressStep, TaskRunStreamState } from './taskRunStreamLogic'
+
+// The wizard session stream the local CLI publishes to — and the channel a cloud wizard reports its
+// own sub-progress on. Matches wizardProgressTrackerLogic's WORKFLOW_ID.
+const WORKFLOW_ID = 'posthog-integration'
+
+export type InstallationMode = 'local' | 'cloud'
+export type InstallationPhase = 'idle' | 'connecting' | 'running' | 'completed' | 'error'
+export type InstallationStepStatus = 'pending' | 'in_progress' | 'completed' | 'failed'
+
+export interface InstallationStep {
+ id: string
+ label: string
+ status: InstallationStepStatus
+ detail: string | null
+}
+
+export interface InstallationProgress {
+ phase: InstallationPhase
+ steps: InstallationStep[]
+ error: { title: string; detail: string | null } | null
+ prUrl: string | null
+ isCurrent: boolean
+}
+
+export interface InstallationProgressLogicProps {
+ mode: InstallationMode
+ runId?: string
+ taskId?: string
+}
+
+const STEP_STATUSES: Record<string, InstallationStepStatus> = {
+ pending: 'pending',
+ in_progress: 'in_progress',
+ completed: 'completed',
+ failed: 'failed',
+ canceled: 'failed',
+}
+
+function stepStatus(raw: string): InstallationStepStatus {
+ return STEP_STATUSES[raw] ?? 'pending'
+}
+
+// Cloud: the TaskRun is the spine (phase, steps, PR url, terminal error); the wizard session enriches
+// the wizard stage with its live sub-task (absent today while the cloud wizard is WIP — degrades to
+// the bare TaskRun step).
+export function cloudProgress(
+ taskRunState: TaskRunStreamState | null,
+ progressSteps: TaskRunProgressStep[],
+ taskConnectionStatus: string,
+ latestSession: WizardSessionDTOApi | null,
+ isStalled: boolean = false
+): InstallationProgress {
+ let phase: InstallationPhase
+ let stalledError: { title: string; detail: string | null } | null = null
+ if (!taskRunState) {
+ phase = taskConnectionStatus === 'connecting' ? 'connecting' : 'idle'
+ } else if (taskRunState.status === 'queued' && isStalled) {
+ // The run never left the queue (see taskRunStreamLogic's stall timer) — nothing is actually
+ // running, so an eternal spinner would be a lie.
+ phase = 'error'
+ stalledError = {
+ title: "Setup hasn't started",
+ detail: 'The run has been queued for a while without starting. Please try again in a bit.',
+ }
+ } else if (taskRunState.status === 'completed') {
+ phase = 'completed'
+ } else if (taskRunState.status === 'failed' || taskRunState.status === 'cancelled') {
+ phase = 'error'
+ } else if (taskRunState.status === 'queued') {
+ // Queued means nothing has started yet — "getting ready", not "running".
+ phase = 'connecting'
+ } else {
+ phase = 'running'
+ }
+
+ const wizardDetail =
+ latestSession?.tasks?.find((t) => t.status === 'in_progress')?.title ??
+ (latestSession?.run_phase === 'error' ? 'Wizard hit an error' : null)
+
+ const steps: InstallationStep[] = progressSteps.map((p) => {
+ const status = stepStatus(p.status)
+ return {
+ id: `${p.group}:${p.step}`,
+ label: p.label,
+ // A completed run has nothing in flight: clamp a lingering in-progress step (e.g. "Keeping
+ // CI green", emitted in-progress when the PR opened) to completed so the timeline matches.
+ status: phase === 'completed' && status === 'in_progress' ? 'completed' : status,
+ // The "pr" step carries the PR url in `detail` (surfaced as the CTA, not as raw step text).
+ detail:
+ p.step === 'pr'
+ ? null
+ : p.step === 'wizard' && p.status === 'in_progress'
+ ? (wizardDetail ?? p.detail)
+ : p.detail,
+ }
+ })
+
+ const error =
+ phase === 'error'
+ ? (stalledError ?? {
+ title: 'Installation failed',
+ detail:
+ taskRunState?.error_message ??
+ (latestSession?.error as { message?: string } | null)?.message ??
+ null,
+ })
+ : null
+
+ // The agent opens the PR mid-run (while it keeps CI green), so the url arrives via the "pr" progress
+ // step before the run reaches a terminal output. Prefer the terminal output when present.
+ const prStepUrl = progressSteps.find((p) => p.step === 'pr')?.detail
+ const prUrl = taskRunState?.output?.pr_url ?? (prStepUrl && prStepUrl.startsWith('http') ? prStepUrl : null)
+
+ return {
+ phase,
+ steps,
+ error,
+ prUrl,
+ isCurrent: phase !== 'idle',
+ }
+}
+
+// Local: the wizard session is the only source — mirror wizardProgressTrackerLogic's displayState so
+// the existing surfaces behave identically when they migrate onto this layer.
+export function localProgress(
+ latestSession: WizardSessionDTOApi | null,
+ sessionConnectionStatus: string
+): InstallationProgress {
+ if (!latestSession) {
+ return {
+ phase: sessionConnectionStatus === 'connecting' ? 'connecting' : 'idle',
+ steps: [],
+ error: null,
+ prUrl: null,
+ isCurrent: false,
+ }
+ }
+
+ let phase: InstallationPhase
+ if (latestSession.run_phase === 'completed') {
+ phase = 'completed'
+ } else if (latestSession.run_phase === 'error') {
+ phase = 'error'
+ } else if (sessionConnectionStatus === 'connecting' || sessionConnectionStatus === 'error') {
+ phase = 'connecting'
+ } else {
+ phase = 'running'
+ }
+
+ const steps: InstallationStep[] = (latestSession.tasks ?? []).map((t) => ({
+ id: t.id,
+ label: t.title,
+ status: stepStatus(t.status),
+ detail: null,
+ }))
+
+ const error =
+ latestSession.run_phase === 'error'
+ ? {
+ title: 'Wizard hit an error',
+ detail: (latestSession.error as { message?: string } | null)?.message ?? null,
+ }
+ : null
+
+ // A session exists past the early return above, so this is always a current run.
+ return { phase, steps, error, prUrl: null, isCurrent: true }
+}
+
+/**
+ * The Installation layer: one normalized `InstallationProgress` the UI renders, hiding which underlying
+ * stream(s) feed it.
+ * - `mode: 'local'` — the wizard session stream only (the local CLI is the writer).
+ * - `mode: 'cloud'` — the TaskRun pipeline (provision → clone → wizard → agent → PR, plus terminal
+ * status, PR url, error) merged with the wizard session stream (wizard-stage detail).
+ *
+ * Both sources are always connected; in local mode the task source is a no-op (empty runId), so the
+ * merge selector can reference its values unconditionally and just branch on `mode`.
+ */
+export const installationProgressLogic = kea<installationProgressLogicType>([
+ props({} as InstallationProgressLogicProps),
+ key((props) => (props.mode === 'cloud' ? `cloud:${props.runId ?? ''}` : 'local')),
+ path((key) => ['scenes', 'onboarding', 'installationProgressLogic', key]),
+ connect((props: InstallationProgressLogicProps) => ({
+ values: [
+ taskRunStreamLogic({ runId: props.runId ?? '', taskId: props.taskId ?? '' }),
+ ['taskRunState', 'progressSteps', 'connectionStatus as taskConnectionStatus', 'isComplete', 'isStalled'],
+ wizardSessionStreamLogic({ workflowId: WORKFLOW_ID }),
+ ['latestSession', 'connectionStatus as sessionConnectionStatus'],
+ ],
+ actions: [
+ taskRunStreamLogic({ runId: props.runId ?? '', taskId: props.taskId ?? '' }),
+ ['connect as connectTaskRun', 'disconnect as disconnectTaskRun'],
+ wizardSessionStreamLogic({ workflowId: WORKFLOW_ID }),
+ ['connect as connectSession', 'disconnect as disconnectSession'],
+ ],
+ })),
+ selectors({
+ installationProgress: [
+ (s) => [
+ s.taskRunState,
+ s.progressSteps,
+ s.taskConnectionStatus,
+ s.latestSession,
+ s.sessionConnectionStatus,
+ s.isStalled,
+ (_, props) => props.mode,
+ ],
+ (
+ taskRunState,
+ progressSteps,
+ taskConnectionStatus,
+ latestSession,
+ sessionConnectionStatus,
+ isStalled,
+ mode
+ ): InstallationProgress =>
+ mode === 'cloud'
+ ? cloudProgress(taskRunState, progressSteps, taskConnectionStatus, latestSession, isStalled)
+ : localProgress(latestSession, sessionConnectionStatus),
+ ],
+ }),
+ afterMount(({ actions }) => {
+ actions.connectTaskRun()
+ actions.connectSession()
+ }),
+ beforeUnmount(({ actions }) => {
+ actions.disconnectTaskRun()
+ actions.disconnectSession()
+ }),
+])
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.test.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.test.ts
new file mode 100644
index 000000000000..e44c1c7f1243
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.test.ts
@@ -0,0 +1,134 @@
+import { mergeProgressStep, parseTaskRunStreamMessage, TaskRunProgressStep } from './taskRunStreamLogic'
+
+function step(overrides: Partial<TaskRunProgressStep> = {}): TaskRunProgressStep {
+ return {
+ step: 'clone',
+ status: 'in_progress',
+ label: 'Cloning repository',
+ group: 'setup',
+ detail: null,
+ ...overrides,
+ }
+}
+
+describe('taskRunStreamLogic helpers', () => {
+ describe('mergeProgressStep', () => {
+ it('appends a new step', () => {
+ expect(mergeProgressStep([], step())).toEqual([step()])
+ })
+
+ it('updates an existing (group, step) in place, preserving order', () => {
+ const clone = step({ step: 'clone' })
+ const wizard = step({ step: 'wizard', label: 'Running wizard' })
+ const cloneDone = step({ step: 'clone', status: 'completed', label: 'Cloned' })
+ expect(mergeProgressStep([clone, wizard], cloneDone)).toEqual([cloneDone, wizard])
+ })
+
+ it('treats the same step name in a different group as distinct', () => {
+ const inSetup = step({ step: 'open', group: 'setup' })
+ const inPr = step({ step: 'open', group: 'pr_create' })
+ expect(mergeProgressStep([inSetup], inPr)).toEqual([inSetup, inPr])
+ })
+ })
+
+ describe('parseTaskRunStreamMessage', () => {
+ it('parses a task_run_state event with all fields', () => {
+ const raw = JSON.stringify({
+ type: 'task_run_state',
+ status: 'failed',
+ stage: 'wizard',
+ output: { pr_url: 'https://x/pull/1' },
+ branch: 'main',
+ error_message: 'boom',
+ updated_at: '2026-01-01T00:00:00Z',
+ completed_at: '2026-01-01T00:01:00Z',
+ })
+ expect(parseTaskRunStreamMessage(raw)).toEqual({
+ kind: 'state',
+ state: {
+ status: 'failed',
+ stage: 'wizard',
+ output: { pr_url: 'https://x/pull/1' },
+ branch: 'main',
+ error_message: 'boom',
+ updated_at: '2026-01-01T00:00:00Z',
+ completed_at: '2026-01-01T00:01:00Z',
+ },
+ })
+ })
+
+ it('defaults missing optional task_run_state fields to null', () => {
+ const raw = JSON.stringify({
+ type: 'task_run_state',
+ status: 'in_progress',
+ updated_at: '2026-01-01T00:00:00Z',
+ })
+ expect(parseTaskRunStreamMessage(raw)).toEqual({
+ kind: 'state',
+ state: {
+ status: 'in_progress',
+ stage: null,
+ output: null,
+ branch: null,
+ error_message: null,
+ updated_at: '2026-01-01T00:00:00Z',
+ completed_at: null,
+ },
+ })
+ })
+
+ it('parses a _posthog/progress notification into a step', () => {
+ const raw = JSON.stringify({
+ type: 'notification',
+ notification: {
+ method: '_posthog/progress',
+ params: {
+ step: 'clone',
+ status: 'in_progress',
+ label: 'Cloning',
+ group: 'setup',
+ detail: 'shallow',
+ },
+ },
+ })
+ expect(parseTaskRunStreamMessage(raw)).toEqual({
+ kind: 'step',
+ step: { step: 'clone', status: 'in_progress', label: 'Cloning', group: 'setup', detail: 'shallow' },
+ })
+ })
+
+ it('defaults a step with no detail to null', () => {
+ const raw = JSON.stringify({
+ type: 'notification',
+ notification: {
+ method: '_posthog/progress',
+ params: { step: 'clone', status: 'completed', label: 'Cloned', group: 'setup' },
+ },
+ })
+ expect(parseTaskRunStreamMessage(raw)).toEqual({
+ kind: 'step',
+ step: { step: 'clone', status: 'completed', label: 'Cloned', group: 'setup', detail: null },
+ })
+ })
+
+ it.each([
+ [
+ 'a non-progress notification',
+ { type: 'notification', notification: { method: 'other', params: { step: 'x' } } },
+ ],
+ [
+ 'a progress notification without params',
+ { type: 'notification', notification: { method: '_posthog/progress' } },
+ ],
+ ['a notification without a notification field', { type: 'notification' }],
+ ['a keepalive', { type: 'keepalive' }],
+ ['an unknown type', { type: 'whatever' }],
+ ])('returns null for %s', (_name, payload) => {
+ expect(parseTaskRunStreamMessage(JSON.stringify(payload))).toBeNull()
+ })
+
+ it('throws on invalid JSON', () => {
+ expect(() => parseTaskRunStreamMessage('not json')).toThrow(SyntaxError)
+ })
+ })
+})
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.ts
new file mode 100644
index 000000000000..2cfa7eba03e5
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/taskRunStreamLogic.ts
@@ -0,0 +1,241 @@
+import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+
+import { projectLogic } from 'scenes/projectLogic'
+
+import { getTasksRunsStreamRetrieveUrl } from 'products/tasks/frontend/generated/api'
+
+import type { taskRunStreamLogicType } from './taskRunStreamLogicType'
+
+export type TaskRunConnectionStatus = 'idle' | 'connecting' | 'open' | 'closed' | 'error'
+
+// How long a run may sit in `queued` before we call it stalled. Workers normally pick a run up in
+// seconds; minutes of silence means the pipeline isn't running at all.
+export const QUEUED_STALL_MS = 2 * 60 * 1000
+
+/**
+ * Shapes of the SSE payloads the task-run stream pushes (see the tasks stream view). These are stream
+ * messages, not REST serializers, so they're typed here rather than imported from the generated client.
+ */
+export interface TaskRunStreamState {
+ status: string // queued | in_progress | completed | failed | cancelled
+ stage: string | null
+ output: { pr_url?: string | null } | null
+ branch: string | null
+ error_message: string | null
+ updated_at: string
+ completed_at: string | null
+}
+
+export interface TaskRunProgressStep {
+ step: string
+ status: string // in_progress | completed | failed | ...
+ label: string
+ group: string
+ detail: string | null
+}
+
+export interface TaskRunStreamLogicProps {
+ taskId: string
+ runId: string
+}
+
+export type TaskRunStreamMessage =
+ | { kind: 'state'; state: TaskRunStreamState }
+ | { kind: 'step'; step: TaskRunProgressStep }
+
+// Merge a progress step into the list: last-write-wins per (group, step), preserving arrival order.
+export function mergeProgressStep(steps: TaskRunProgressStep[], step: TaskRunProgressStep): TaskRunProgressStep[] {
+ const idx = steps.findIndex((s) => s.step === step.step && s.group === step.group)
+ if (idx === -1) {
+ return [...steps, step]
+ }
+ const next = [...steps]
+ next[idx] = step
+ return next
+}
+
+// Parse one SSE data payload into a typed message, or null if it isn't one we act on (keepalive, a
+// non-progress notification, an unknown type). Throws on invalid JSON — the caller surfaces that.
+export function parseTaskRunStreamMessage(rawData: string): TaskRunStreamMessage | null {
+ const payload = JSON.parse(rawData) as TaskRunStreamState & {
+ type?: string
+ notification?: { method?: string; params?: TaskRunProgressStep }
+ }
+ if (payload.type === 'notification') {
+ const params = payload.notification?.params
+ if (payload.notification?.method !== '_posthog/progress' || !params) {
+ return null
+ }
+ return {
+ kind: 'step',
+ step: {
+ step: params.step,
+ status: params.status,
+ label: params.label,
+ group: params.group,
+ detail: params.detail ?? null,
+ },
+ }
+ }
+ if (payload.type === 'task_run_state') {
+ return {
+ kind: 'state',
+ state: {
+ status: payload.status,
+ stage: payload.stage ?? null,
+ output: payload.output ?? null,
+ branch: payload.branch ?? null,
+ error_message: payload.error_message ?? null,
+ updated_at: payload.updated_at,
+ completed_at: payload.completed_at ?? null,
+ },
+ }
+ }
+ return null
+}
+
+/**
+ * Raw SSE consumer for a single TaskRun (the cloud-run pipeline: provision → clone → wizard → agent →
+ * PR). A private source for the Installation layer — `installationProgressLogic` merges this with the
+ * wizard session stream and exposes a single `InstallationProgress`. Keyed per run so multiple coexist.
+ *
+ * Data events (`task_run_state`, `_posthog/progress` notifications) arrive unnamed via `onmessage`;
+ * `stream-end` closes the stream; rotation (`end`) and transient drops are handled by EventSource's
+ * native reconnect (it replays the `Last-Event-ID` cursor the server stamps on every event).
+ */
+export const taskRunStreamLogic = kea<taskRunStreamLogicType>([
+ props({} as TaskRunStreamLogicProps),
+ key((props) => props.runId),
+ path((key) => ['scenes', 'onboarding', 'taskRunStreamLogic', key]),
+ connect(() => ({
+ values: [projectLogic, ['currentProjectId']],
+ })),
+ actions({
+ connect: true,
+ disconnect: true,
+ taskRunStateUpdated: (state: TaskRunStreamState) => ({ state }),
+ progressStepUpdated: (step: TaskRunProgressStep) => ({ step }),
+ connectionOpened: true,
+ connectionErrored: (error: string) => ({ error }),
+ streamCompleted: true,
+ runStalled: true,
+ }),
+ reducers({
+ taskRunState: [
+ null as TaskRunStreamState | null,
+ {
+ taskRunStateUpdated: (_, { state }) => state,
+ },
+ ],
+ // Last-write-wins per (group, step), kept in arrival order so the UI renders a stable timeline.
+ progressSteps: [
+ [] as TaskRunProgressStep[],
+ {
+ progressStepUpdated: (state, { step }) => mergeProgressStep(state, step),
+ },
+ ],
+ connectionStatus: [
+ 'idle' as TaskRunConnectionStatus,
+ {
+ connect: () => 'connecting',
+ connectionOpened: () => 'open',
+ connectionErrored: () => 'error',
+ disconnect: () => 'closed',
+ streamCompleted: () => 'closed',
+ },
+ ],
+ isComplete: [
+ false,
+ {
+ streamCompleted: () => true,
+ },
+ ],
+ lastError: [
+ null as string | null,
+ {
+ connect: () => null,
+ taskRunStateUpdated: () => null,
+ connectionErrored: (_, { error }) => error,
+ },
+ ],
+ // The run has sat in `queued` past the stall window — the backend never picked it up (e.g.
+ // no Temporal worker is running). Surfaces render this as a failure instead of an eternal
+ // spinner. Cleared as soon as the run reports any non-queued state.
+ isStalled: [
+ false,
+ {
+ runStalled: () => true,
+ taskRunStateUpdated: (state, { state: runState }) => (runState.status === 'queued' ? state : false),
+ connect: () => false,
+ },
+ ],
+ }),
+ listeners(({ values, actions, props, cache }) => ({
+ // Arm a stall timer while the run reports `queued`; any other status disarms it. The timer
+ // rides disposables so unmount (and tab-hide) tears it down with everything else.
+ taskRunStateUpdated: ({ state }) => {
+ if (state.status !== 'queued') {
+ cache.disposables.dispose('queued-stall')
+ return
+ }
+ if (values.isStalled) {
+ return
+ }
+ cache.disposables.add(() => {
+ const timer = window.setTimeout(() => actions.runStalled(), QUEUED_STALL_MS)
+ return () => window.clearTimeout(timer)
+ }, 'queued-stall')
+ },
+ connect: () => {
+ // No run to stream — the Installation layer connects this source even in local mode (where
+ // there's no TaskRun), so stay idle rather than opening a stream to a non-existent run.
+ if (!props.runId) {
+ return
+ }
+ const projectId = values.currentProjectId
+ if (projectId === null) {
+ actions.connectionErrored('No current project — cannot open task run stream.')
+ return
+ }
+
+ cache.disposables.add((): (() => void) => {
+ const url = getTasksRunsStreamRetrieveUrl(String(projectId), props.taskId, props.runId)
+ const eventSource = new EventSource(url, { withCredentials: true })
+
+ eventSource.onopen = actions.connectionOpened
+ eventSource.onmessage = (event: MessageEvent<string>): void => {
+ try {
+ const message = parseTaskRunStreamMessage(event.data)
+ if (message?.kind === 'step') {
+ actions.progressStepUpdated(message.step)
+ } else if (message?.kind === 'state') {
+ actions.taskRunStateUpdated(message.state)
+ }
+ } catch (err) {
+ actions.connectionErrored(`Failed to parse SSE payload: ${String(err)}`)
+ }
+ }
+ // Completion sentinel — close so EventSource doesn't auto-reconnect to a finished run.
+ eventSource.addEventListener('stream-end', () => {
+ actions.streamCompleted()
+ eventSource.close()
+ })
+ eventSource.onerror = (): void => {
+ // CLOSED → browser gave up (won't auto-reconnect); anything else → it's already
+ // retrying (rides the Last-Event-ID cursor), so just surface "reconnecting".
+ if (eventSource.readyState === EventSource.CLOSED) {
+ actions.connectionErrored('EventSource connection closed by server — call connect() to retry')
+ } else {
+ actions.connectionErrored('EventSource transport error — reconnecting')
+ }
+ }
+
+ return () => eventSource.close()
+ }, 'event-source')
+ },
+ disconnect: () => {
+ cache.disposables.dispose('event-source')
+ cache.disposables.dispose('queued-stall')
+ },
+ })),
+])
diff --git a/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/wizardCloudRunLogic.ts b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/wizardCloudRunLogic.ts
new file mode 100644
index 000000000000..6b0b6cd1dea7
--- /dev/null
+++ b/frontend/src/scenes/onboarding/self-driving/sdks/OnboardingInstallStep/wizardCloudRunLogic.ts
@@ -0,0 +1,162 @@
+import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+
+import { lemonToast } from '@posthog/lemon-ui'
+
+import api, { ApiError } from 'lib/api'
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import { IntegrationType, OnboardingStepKey } from '~/types'
+
+import { onboardingLogic } from '../../../legacy/onboardingLogic'
+import { sdksLogic } from '../../../legacy/sdks/sdksLogic'
+import { activeCloudRunLogic } from './activeCloudRunLogic'
+import type { wizardCloudRunLogicType } from './wizardCloudRunLogicType'
+
+export type CloudRunStatus =
+ | 'idle' // No request in flight — show connect / repo-pick / start UI.
+ | 'submitting' // POST to kick off the run is in flight.
+ | 'queued' // Run accepted — the user can keep moving; the FAB carries progress.
+ | 'error' // Kickoff failed.
+
+// Shared with the local CLI wizard so the existing session-sync FAB and the
+// install-step tracker pick up cloud runs with no extra wiring — a cloud run is
+// the same instrumentation workflow, just executed on our infra rather than on
+// the user's machine.
+export const WIZARD_CLOUD_RUN_WORKFLOW_ID = 'posthog-integration'
+
+/**
+ * Drives the "open a PR for me" option on the install step:
+ * - resolves the team's GitHub integration (or the URL to connect one)
+ * - holds the chosen repository
+ * - kicks off the cloud run and tracks its lifecycle
+ *
+ * Live progress and the "your PR is ready" payoff are not owned here — the cloud
+ * run posts wizard sessions under WIZARD_CLOUD_RUN_WORKFLOW_ID, so the existing
+ * session-sync surfaces (wizardProgressTrackerLogic + the global FAB) render them
+ * automatically. This logic only has to get the run started without blocking the
+ * user from continuing onboarding.
+ */
+export const wizardCloudRunLogic = kea<wizardCloudRunLogicType>([
+ path(['scenes', 'onboarding', 'wizardCloudRunLogic']),
+ connect(() => ({
+ values: [
+ integrationsLogic,
+ ['integrations'],
+ teamLogic,
+ ['currentProjectId'],
+ onboardingLogic,
+ ['currentStepProductKey'],
+ sdksLogic,
+ ['selectedSDK'],
+ ],
+ actions: [integrationsLogic, ['loadIntegrations'], activeCloudRunLogic, ['setActiveCloudRun']],
+ })),
+ actions({
+ setSelectedRepository: (repository: string | null) => ({ repository }),
+ startCloudRun: true,
+ startCloudRunSuccess: true,
+ startCloudRunFailure: true,
+ setCloudRunHandle: (taskId: string, runId: string) => ({ taskId, runId }),
+ }),
+ reducers({
+ selectedRepository: [
+ null as string | null,
+ {
+ setSelectedRepository: (_, { repository }) => repository,
+ },
+ ],
+ cloudRunStatus: [
+ 'idle' as CloudRunStatus,
+ {
+ startCloudRun: () => 'submitting',
+ startCloudRunSuccess: () => 'queued',
+ startCloudRunFailure: () => 'error',
+ // Picking a different repo after a failure clears the error so the
+ // primary button is actionable again.
+ setSelectedRepository: (state) => (state === 'error' ? 'idle' : state),
+ },
+ ],
+ // The run handle returned by the kickoff POST. The Installation layer streams progress by run id.
+ cloudRunTaskId: [
+ null as string | null,
+ {
+ setCloudRunHandle: (_, { taskId }) => taskId,
+ },
+ ],
+ cloudRunRunId: [
+ null as string | null,
+ {
+ setCloudRunHandle: (_, { runId }) => runId,
+ },
+ ],
+ }),
+ selectors({
+ githubIntegration: [
+ (s) => [s.integrations],
+ (integrations: IntegrationType[] | null): IntegrationType | null =>
+ integrations?.find((i) => i.kind === 'github') ?? null,
+ ],
+ isGithubConnected: [(s) => [s.githubIntegration], (githubIntegration): boolean => !!githubIntegration],
+ connectGitHubUrl: [
+ (s) => [s.currentStepProductKey],
+ (currentStepProductKey): string => {
+ // Full-page redirect to install/authorize the GitHub App, then back to
+ // the install step. integrationsLogic's callback appends the new
+ // integration id, and loadIntegrations() repopulates githubIntegration,
+ // so the block advances from "connect" to "pick a repo" on return.
+ const next = urls.onboarding({
+ productKey: currentStepProductKey ?? undefined,
+ stepKey: OnboardingStepKey.INSTALL,
+ })
+ return api.integrations.authorizeUrl({ kind: 'github', next })
+ },
+ ],
+ // The cloud wizard auto-detects the framework, so this is a hint rather than a
+ // requirement — only set when the user happens to have picked an SDK manually.
+ skillId: [(s) => [s.selectedSDK], (selectedSDK): string | undefined => selectedSDK?.key],
+ }),
+ listeners(({ values, actions }) => ({
+ startCloudRun: async () => {
+ const { githubIntegration, selectedRepository, currentProjectId } = values
+ if (!githubIntegration || !selectedRepository || !currentProjectId) {
+ actions.startCloudRunFailure()
+ return
+ }
+ // The picker holds the bare repo name; the endpoint wants "owner/repo", where the owner
+ // is the GitHub integration's account.
+ const owner = githubIntegration.config?.account?.name
+ const repository =
+ selectedRepository.includes('/') || !owner ? selectedRepository : `${owner}/${selectedRepository}`
+ try {
+ // Kicks off the cloud run (clone repo → run the wizard → open a PR via a Temporal
+ // workflow) and returns the run handle. Live progress is surfaced by the Installation
+ // layer (installationProgressLogic), which streams this run's TaskRun pipeline merged
+ // with the wizard session detail.
+ const { task_id, run_id } = await api.create<{ task_id: string; run_id: string; status: string }>(
+ 'api/wizard/cloud_run',
+ {
+ project_id: currentProjectId,
+ repository,
+ }
+ )
+ actions.setCloudRunHandle(task_id, run_id)
+ // teamLogic's currentProjectId can be the '@current' placeholder pre-load; by kickoff
+ // time the team is loaded, so this is a plain numeric coercion in practice.
+ actions.setActiveCloudRun(task_id, run_id, new Date().toISOString(), Number(currentProjectId))
+ actions.startCloudRunSuccess()
+ } catch (e) {
+ const detail = e instanceof ApiError ? e.detail : null
+ lemonToast.error(detail || 'Could not start the cloud run. Please try again.')
+ actions.startCloudRunFailure()
+ }
+ },
+ startCloudRunSuccess: () => {
+ // The POST only queues the run — it isn't done. The real outcome (running → completed/error)
+ // is reported by the wizard sync surfaces (inline tracker + FAB) when enabled, so keep this a
+ // neutral acknowledgement rather than claiming the PR is on its way.
+ lemonToast.info('Cloud run queued')
+ },
+ })),
+])
diff --git a/frontend/src/scenes/onboarding/shared/wizardHog.ts b/frontend/src/scenes/onboarding/shared/wizardHog.ts
new file mode 100644
index 000000000000..ccdcc6b2e356
--- /dev/null
+++ b/frontend/src/scenes/onboarding/shared/wizardHog.ts
@@ -0,0 +1,2 @@
+/** Cloudinary URL for the wizard hedgehog image, shared across legacy and self-driving onboarding variants. */
+export const WIZARD_HOG_URL = 'https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png'
diff --git a/posthog/api/integration.py b/posthog/api/integration.py
index 123254569b41..5ebe0cfe7183 100644
--- a/posthog/api/integration.py
+++ b/posthog/api/integration.py
@@ -177,9 +177,25 @@ class NativeEmailIntegrationSerializer(serializers.Serializer):
class GitHubRepoSerializer(serializers.Serializer):
- id = serializers.IntegerField()
- name = serializers.CharField()
- full_name = serializers.CharField()
+ id = serializers.IntegerField(help_text="GitHub repository numeric identifier.")
+ name = serializers.CharField(help_text="Repository short name (without the owner prefix).")
+ full_name = serializers.CharField(help_text="Fully-qualified repository name as 'owner/repo'.")
+ # The fields below come free from GitHub's installation/repositories payload. They are optional so
+ # repositories cached before this change (which stored only id/name/full_name) still validate.
+ private = serializers.BooleanField(required=False, help_text="Whether the repository is private.")
+ default_branch = serializers.CharField(required=False, help_text="The repository's default branch (e.g. 'main').")
+ language = serializers.CharField(
+ required=False, help_text="Primary programming language GitHub detected for the repository."
+ )
+ pushed_at = serializers.CharField(
+ required=False,
+ help_text="ISO 8601 timestamp of the most recent push, useful for sorting by recent activity.",
+ )
+ archived = serializers.BooleanField(required=False, help_text="Whether the repository is archived.")
+ can_push = serializers.BooleanField(
+ required=False,
+ help_text="Whether the PostHog GitHub App has write access — required to open pull requests.",
+ )
class GitHubReposQuerySerializer(serializers.Serializer):
diff --git a/posthog/models/github_integration_base.py b/posthog/models/github_integration_base.py
index 047fed414901..6ee1d201f062 100644
--- a/posthog/models/github_integration_base.py
+++ b/posthog/models/github_integration_base.py
@@ -62,6 +62,29 @@ class GitHubIntegrationError(Exception):
self.status_code = status_code
+def _github_repo_optional_fields(repo: dict) -> dict:
+ """Display fields for a repo, taken off the GitHub payload or a cached entry.
+
+ Returns only the keys that are present and well-typed, so repositories cached before these fields
+ existed keep their original (id, name, full_name) shape and don't sprout nulls. Handles both the
+ raw GitHub shape (nested ``permissions.push``) and the already-flattened cache shape (``can_push``).
+ """
+ optional: dict = {}
+ for key in ("default_branch", "language", "pushed_at"):
+ value = repo.get(key)
+ if isinstance(value, str):
+ optional[key] = value
+ for key in ("private", "archived"):
+ value = repo.get(key)
+ if isinstance(value, bool):
+ optional[key] = value
+ permissions = repo.get("permissions")
+ can_push = permissions.get("push") if isinstance(permissions, dict) else repo.get("can_push")
+ if isinstance(can_push, bool):
+ optional["can_push"] = can_push
+ return optional
+
+
class GitHubIntegrationBase:
"""Installation-token operations shared between team and user GitHub integrations."""
@@ -780,6 +803,7 @@ class GitHubIntegrationBase:
"id": repo["id"],
"name": repo["name"],
"full_name": repo["full_name"],
+ **_github_repo_optional_fields(repo),
}
for repo in repositories
if isinstance(repo, dict)
@@ -998,6 +1022,7 @@ class GitHubIntegrationBase:
"id": repo["id"],
"name": repo["name"],
"full_name": repo["full_name"],
+ **_github_repo_optional_fields(repo),
}
for repo in cached
if isinstance(repo, dict)
diff --git a/posthog/models/test/test_integration_model.py b/posthog/models/test/test_integration_model.py
index 8056a50b0a44..8db67b4a8568 100644
--- a/posthog/models/test/test_integration_model.py
+++ b/posthog/models/test/test_integration_model.py
@@ -1418,6 +1418,47 @@ class TestGitHubIntegrationModel(BaseTest):
mock_list_all.assert_not_called()
assert REGISTRY.get_sample_value("github_integration_cache_accesses_total", labels) == previous_count + 1
+ @patch("posthog.models.integration.GitHubIntegration.list_all_repositories")
+ def test_list_cached_repositories_surfaces_optional_fields_when_present(self, mock_list_all):
+ cached_repositories = [
+ {
+ "id": 1,
+ "name": "posthog",
+ "full_name": "PostHog/posthog",
+ "private": True,
+ "default_branch": "master",
+ "language": "Python",
+ "pushed_at": "2026-06-01T00:00:00Z",
+ "archived": False,
+ "can_push": True,
+ },
+ {"id": 2, "name": "legacy", "full_name": "PostHog/legacy"},
+ ]
+ integration = self.create_integration(
+ {"installation_id": "INSTALL", "account": {"name": "PostHog"}},
+ {"access_token": "ACCESS_TOKEN"},
+ )
+ integration.repository_cache = cached_repositories
+ integration.repository_cache_updated_at = timezone.now()
+ integration.save(update_fields=["repository_cache", "repository_cache_updated_at"])
+
+ repos, _ = GitHubIntegration(integration).list_cached_repositories()
+
+ assert repos[0] == {
+ "id": 1,
+ "name": "posthog",
+ "full_name": "PostHog/posthog",
+ "private": True,
+ "default_branch": "master",
+ "language": "Python",
+ "pushed_at": "2026-06-01T00:00:00Z",
+ "archived": False,
+ "can_push": True,
+ }
+ # Repos cached before these fields existed keep their original shape — optional keys are omitted, not nulled.
+ assert repos[1] == {"id": 2, "name": "legacy", "full_name": "PostHog/legacy"}
+ mock_list_all.assert_not_called()
+
@patch("posthog.models.integration.GitHubIntegration.list_all_repositories")
def test_sync_repository_cache_respects_refresh_cooldown(self, mock_list_all):
cached_repositories = [
diff --git a/products/engineering_analytics/package.json b/products/engineering_analytics/package.json
index d71d00d3620a..28537069ba01 100644
--- a/products/engineering_analytics/package.json
+++ b/products/engineering_analytics/package.json
@@ -14,6 +14,7 @@
"kea-test-utils": "catalog:"
},
"peerDependencies": {
+ "@posthog/icons": "catalog:",
"@types/react": "*",
"react": "*"
}
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/sourceMapsWizardVisuals.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/sourceMapsWizardVisuals.tsx
index 9903e55f2437..19f92e85d8fc 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/sourceMapsWizardVisuals.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/recommendations/sourceMapsWizardVisuals.tsx
@@ -1,9 +1,7 @@
import './sourceMapsWizardVisuals.scss'
import { cn } from 'lib/utils/css-classes'
-
-// Same wizard hedgehog used by the onboarding install step.
-export const WIZARD_HOG_URL = 'https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png'
+import { WIZARD_HOG_URL } from 'scenes/onboarding/shared/wizardHog'
export function WizardHog({ castKey = 0, className }: { castKey?: number; className?: string }): JSX.Element {
return (
diff --git a/products/integrations/frontend/generated/api.schemas.ts b/products/integrations/frontend/generated/api.schemas.ts
index ddb78e938563..f27e67113afb 100644
--- a/products/integrations/frontend/generated/api.schemas.ts
+++ b/products/integrations/frontend/generated/api.schemas.ts
@@ -308,9 +308,24 @@ export interface GitHubBranchesResponseApi {
}
export interface GitHubRepoApi {
+ /** GitHub repository numeric identifier. */
id: number
+ /** Repository short name (without the owner prefix). */
name: string
+ /** Fully-qualified repository name as 'owner/repo'. */
full_name: string
+ /** Whether the repository is private. */
+ private?: boolean
+ /** The repository's default branch (e.g. 'main'). */
+ default_branch?: string
+ /** Primary programming language GitHub detected for the repository. */
+ language?: string
+ /** ISO 8601 timestamp of the most recent push, useful for sorting by recent activity. */
+ pushed_at?: string
+ /** Whether the repository is archived. */
+ archived?: boolean
+ /** Whether the PostHog GitHub App has write access — required to open pull requests. */
+ can_push?: boolean
}
export interface GitHubReposResponseApi {
diff --git a/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx
index b5cdb4474d5f..db3e124be020 100644
--- a/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx
+++ b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx
@@ -5,8 +5,8 @@ import { LemonButton, Spinner } from '@posthog/lemon-ui'
import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'
import { cn } from 'lib/utils/css-classes'
-import { WIZARD_HOG_URL } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock'
import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'
+import { WIZARD_HOG_URL } from 'scenes/onboarding/shared/wizardHog'
import { teamLogic } from 'scenes/teamLogic'
import { mcpAnalyticsOnboardingLogic } from '../mcpAnalyticsOnboardingLogic'
diff --git a/products/mcp_analytics/package.json b/products/mcp_analytics/package.json
index 9313f3459f17..20ec8681285c 100644
--- a/products/mcp_analytics/package.json
+++ b/products/mcp_analytics/package.json
@@ -17,6 +17,7 @@
},
"peerDependencies": {
"@posthog/brand": "catalog:",
+ "@posthog/icons": "catalog:",
"@storybook/react": "catalog:",
"@types/react": "*",
"react": "*"
diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.py
index 0026a558345f..420d581c2912 100644
--- a/products/tasks/backend/facade/api.py
+++ b/products/tasks/backend/facade/api.py
@@ -1455,6 +1455,15 @@ def update_task_run(
new_pr_url = (run.output or {}).get("pr_url") if isinstance(run.output, dict) else None
if new_pr_url and new_pr_url != old_pr_url:
_post_slack_update_for_pr(run)
+ # Surface the PR in the run's progress timeline the moment the agent reports it, so the install
+ # UI advances past "Started agent" instead of waiting on the 15-min CI follow-up loop to emit
+ # these. Steps coalesce by id with the workflow's own pr/ci emissions (frontend mergeProgressStep),
+ # so the double-emit is harmless. Tolerant: a logging/stream hiccup must not fail the PATCH.
+ try:
+ run.emit_progress_event("pr", "completed", "Opened pull request", "setup", detail=new_pr_url)
+ run.emit_progress_event("ci", "in_progress", "Keeping CI green", "setup")
+ except Exception:
+ logger.warning("task_run.pr_progress_emit_failed", extra={"run_id": str(run.id)}, exc_info=True)
return _task_run_detail_to_dto(run)
diff --git a/products/tasks/backend/temporal/process_task/activities/run_wizard.py b/products/tasks/backend/temporal/process_task/activities/run_wizard.py
index 236533f76a38..e262d82a93bb 100644
--- a/products/tasks/backend/temporal/process_task/activities/run_wizard.py
+++ b/products/tasks/backend/temporal/process_task/activities/run_wizard.py
@@ -142,9 +142,10 @@ def run_wizard(input: RunWizardInput) -> None:
emit_agent_log(ctx.run_id, "error", f"PostHog setup wizard timed out after {minutes} minutes")
raise RuntimeError(f"PostHog setup wizard timed out after {minutes} minutes")
if result.exit_code != 0:
- emit_agent_log(
- ctx.run_id, "error", f"PostHog setup wizard failed (exit {result.exit_code}): {result.stderr}"
- )
- raise RuntimeError(f"PostHog setup wizard failed with exit code {result.exit_code}")
+ # The wizard prints its fatal error to stdout (e.g. "Something went wrong: ..."); stderr is
+ # mostly npm noise. Prefer the stdout tail so the real cause shows at error level.
+ detail = (result.stdout or "").strip()[-2000:] or (result.stderr or "").strip()[-2000:]
+ emit_agent_log(ctx.run_id, "error", f"PostHog setup wizard failed (exit {result.exit_code}): {detail}")
+ raise RuntimeError(f"PostHog setup wizard failed (exit {result.exit_code}): {detail}")
emit_agent_log(ctx.run_id, "info", "PostHog setup wizard completed")
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 49e769dfdb04..970dcdd6b4c1 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -24342,9 +24342,24 @@ export namespace Schemas {
}
export interface GitHubRepo {
+ /** GitHub repository numeric identifier. */
id: number;
+ /** Repository short name (without the owner prefix). */
name: string;
+ /** Fully-qualified repository name as 'owner/repo'. */
full_name: string;
+ /** Whether the repository is private. */
+ private?: boolean;
+ /** The repository's default branch (e.g. 'main'). */
+ default_branch?: string;
+ /** Primary programming language GitHub detected for the repository. */
+ language?: string;
+ /** ISO 8601 timestamp of the most recent push, useful for sorting by recent activity. */
+ pushed_at?: string;
+ /** Whether the repository is archived. */
+ archived?: boolean;
+ /** Whether the PostHog GitHub App has write access — required to open pull requests. */
+ can_push?: boolean;
}
export interface GitHubReposRefreshResponse {