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(signals): inbox redesign behind the inbox-redesign flag (#87990)

Chris Volzer7ea64f350d99
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 262d58bd3afa..803322a01851 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6741,37 +6741,49 @@ snapshots:
scenes-app-inbox-cards--skeleton--light:
hash: v1.k794b7964.24c19ab5df1e4ccb843b1ad726752e3a98aeadaa08595e66cb4b41aff1a9e9a1.Y3z44tkU4jsAYUyXxfl72fTuZ0MKA6_S6TTNCKt5jSg
scenes-app-inbox-detail--pull-request--dark:
- hash: v1.k794b7964.37140dbcaced973d8e6c904b8a043ac318896a9376a6ebdafff3a230b4a24b45.oeKZ68Kq-mPcTLsPgx_BPnDDeIpufPkthkNm-02_WxE
+ hash: v1.k794b7964.e3d35a1f32d39211cf8bd41914c83ec6e4ed9e0251e8b883a8fa62c048dc4165.na0HIQko2FwF9KTcKxD66kvttld6IbR_S0bejyK_1hs
scenes-app-inbox-detail--pull-request--light:
- hash: v1.k794b7964.12d87d423f27d5457d9c4ee375948228cbe13e09cab261685c53b7562cbac80a.GR_PcNYqE9p85PmWyNmpTQecrUF2qkk9XqPuTXCSEyI
+ hash: v1.k794b7964.54ed775e300bcacc3daf06411648d037ff8a8bc464af075cc698621bba55d60d.FAMO3xQ3t4HzSAtM1ArE9WE3S09Wt2gor6oa6bFw6PY
scenes-app-inbox-detail--pull-request-checks-passing--dark:
- hash: v1.k794b7964.7e4e5a1f996b5e460a1037724339f491384dd9d4ee864210242007feeda8cc82.q1-6zO0bs7_96nAab78bt2G2dCGasFHGRZvfwfFcEHo
+ hash: v1.k794b7964.d0cd166ff5d98e9aebca28256c973268456d103f2284bfa4028fd3340e54b4ac.Q9C3OSc3RUZP_QxLTHBh_fW8UuvcX-LF0_6rg0EzNos
scenes-app-inbox-detail--pull-request-checks-passing--light:
- hash: v1.k794b7964.0b0989a039f949d103a1f9648278d95b69a26641798e85636f2a00c77ba30237.70nBSYDjFVSNRGFnkNIRNF9z_7lXO7HmmefU1oC_ul8
+ hash: v1.k794b7964.93eac110a1c55a3e1fea1a647bcdebfc4edacab1c692b7bb6a8e14f40ce24998.T2hnJLD3aYhh50n4l8ixGfMkv5RX991elg8SiRYk3qA
+ scenes-app-inbox-detail--pull-request-files-changed--dark:
+ hash: v1.k794b7964.1a4af70988ed8f8b24a7b6f80f3188f001d0d4be9129163d2474a29b480f5bf6.9K-TUJyQypU8AhCksNd3U6LvECynGRpO0JCMFRIxKvE
+ scenes-app-inbox-detail--pull-request-files-changed--light:
+ hash: v1.k794b7964.826c780cda8c0f675ae00d5d94e3d15086b2971a90d5be70a9a7a2f34565053c.8IrXSfRZrQIb8afy1QhpCW1sF5fMoDWeJ6amVq9cZq4
scenes-app-inbox-detail--pull-request-inline-review--dark:
- hash: v1.k794b7964.ce4edba5148647a2621554d08366b04b26ae557bef2393d9bfce8d79a3a3c8cd.HWouYz0aO5lzZHd5DH6cpEHlYJBU-HBvKBA_xqwuTqc
+ hash: v1.k794b7964.e3d35a1f32d39211cf8bd41914c83ec6e4ed9e0251e8b883a8fa62c048dc4165.C5t7GMqzA1boLDJ9nVTRmk3nC_VRYTe13y_-2phGGNw
scenes-app-inbox-detail--pull-request-inline-review--light:
- hash: v1.k794b7964.2cbd7a17c8013412accc0a04df94a30dbfb70fbbeaddf807d6664138a2e8da79.hkaB080z7xtzFGnDTgFBOOBAL_iTl4sqmZ-izXD5JuU
+ hash: v1.k794b7964.54ed775e300bcacc3daf06411648d037ff8a8bc464af075cc698621bba55d60d.TE0nzlUiGZ4x0DtSJd7cofvbgPhzgzgRc_Z2DbW5yeg
+ scenes-app-inbox-detail--pull-request-legacy--dark:
+ hash: v1.k794b7964.fc68b1f0c1b98be608f162ac7e0702cb46e2667525efb8013bbb9b10329f5ce3.IKa4P49DaSLNT-AZo80Nw0nk1GwYB1ToYPZ0ub_5shA
+ scenes-app-inbox-detail--pull-request-legacy--light:
+ hash: v1.k794b7964.5d072af4c227dc1e66d7d2831a2e7d27d46b9dc492fbf3773141c47db1c91207.KfTpaBzfgdqBpaznNht3-FSVASIZRJTtl1skH0Pt3jA
scenes-app-inbox-detail--report--dark:
- hash: v1.k794b7964.62eb11460d914ea89a7f5ac4a8e8bd61cd37fd438a85601db9bd2113e237fa76.3avQF5se-8PfwPsqMV_w8Oei5DGhOiTekXnXvokCEYk
+ hash: v1.k794b7964.0516b8985888b92018506cee3a0cf40c7f7499027455fb8f6957853a91440557.heUzrn_iZd5CtI3GTUAKNrrP2zEkv-NEUxo3FnmZKF0
scenes-app-inbox-detail--report--light:
- hash: v1.k794b7964.c077494d38909c6943952c6098dad474ba0d599c12cfeb8110b743cd3f6da032.K8QFisC-Tiwala97SkXQzai48eWoMjl3snPFWltfSow
+ hash: v1.k794b7964.f42eb359e62e037d7b75d0348f507dea76b69e442f80adc8b54736e0edcd8da5.42xwdpzwUuNAIMlWPnm3StGJdZdEOr-0lSd9-xtvvmc
+ scenes-app-inbox-detail--report-legacy--dark:
+ hash: v1.k794b7964.928a85486b43f720f99d1e4bc5cc9ac39bc819485db42b3f2a147118e944a78d.tMeLC7oEBMIOeqnvWxlRyot0nDBp_5OJf0SEcpd6zuI
+ scenes-app-inbox-detail--report-legacy--light:
+ hash: v1.k794b7964.c4e51fd2318b33fa286b7ffbcdf8205f8414408b6c0ca9cd5f24888727354c8d.o-Bc8gNn_6DdOZNlyym6uUjT5aeoDrO4xyZkJQy40SQ
scenes-app-inbox-detail--report-minimal--dark:
- hash: v1.k794b7964.677fbeefcfb9d9d911b66e91f67f1a1f06344106a21fb972f28ba983b58fa833.c4onvIoCYvq4F0md3xJeEPd-6g5Z2e2y4a-VYGdlWQM
+ hash: v1.k794b7964.7b457e88868510c008646ab0ed37de232ec66ccbd001e82256e156e44a4cfa23.38qy-CrE1s8-psQTdpOZqMVW5alFzYnH7On3bETCnGU
scenes-app-inbox-detail--report-minimal--light:
- hash: v1.k794b7964.d36545c16661457074f694d150383e3f2b34d77bd7ef878ad9cb371aba138793.W_5W0kYmCIpVsulpnKuYuDpUFbGBuoY6PfyhLJWlRpI
+ hash: v1.k794b7964.1ec199f350734471b4a0b1463ff94a4654a30424276fc64c115c3d65db3cdb41.Tc9W_NbKBqiZUS8nJ_J48f161oSMbOpTNtd99CK-a5I
scenes-app-inbox-detail--run-failed--dark:
- hash: v1.k794b7964.ad33e07815cb0e6e30df99d2063bd8e7309c45b679af8bedcdc5b2c4d856b6b0.cBKvjyVtarEyQOIyakdh7A5r0Z8LwtMQOb4cUIIiAGw
+ hash: v1.k794b7964.18c9ba56db7b5cb2bcb878df2052f4d91526e6fa34a29dfcf96032baf75e8df0.-rwa7P77YEts2Ha8p22f6CCVlogjJUMABDuVmwdaLK8
scenes-app-inbox-detail--run-failed--light:
- hash: v1.k794b7964.dc644c64d38b8833ca4499b0a3044f1f67194a8e782bd567fbc46bf14346dc8b.yA3wdSB6KfJUHHEcsqWj5jWKAyF3gt0mIdRu3wLF0SQ
+ hash: v1.k794b7964.c1bed300d7cddaaa8dcebcc33f50dd827dbb0d65b53b63731fe52be3cd15c1a2.KSlqMmSZLxK3S8qUdpOnIUjSu1jCQWf5IrglKsKVfxQ
scenes-app-inbox-detail--run-in-progress--dark:
- hash: v1.k794b7964.1fdc45ac3ca015d35279899793f5b24617a724ceacf503855ce21403896c528a.4NLHgaNJh-VLJBdPWNNs6ysih41hgVwiz3jHRNSrIvQ
+ hash: v1.k794b7964.49a69fb29439e44e6f3b6376110bb1d735cf6c74a8c0704d8972ac1cfa8b9f73.9DoF8pM0afDuiEdQ2DYpQ49C54TJ17bbBIhIVKGJl8k
scenes-app-inbox-detail--run-in-progress--light:
- hash: v1.k794b7964.3280447230701a3952aaaeaa20546cf4fdd7cb6bf59e774434474db1ff1259b6.FalOTmGMllxGy34FOKz5mKdrUiSuvcektb4p-J7YWHc
+ hash: v1.k794b7964.8d2002086b86de66e0316629979c9ee2bd14c03e77f0789a9b0695064878ec0c.C3WWzKtwOOzcwTHU2NYpeOQV09WQ5stLRYiIs0a5BYk
scenes-app-inbox-detail--run-ready--dark:
- hash: v1.k794b7964.6d107a93e2402c7b631a8b08a499cf66cf263d5824b8ea00d41bc71aad2e2180._kYZFhSpSDrjEmz582Sc82o8G6xkdE1zsWpLRmIQHVQ
+ hash: v1.k794b7964.f4c724bf1571f63ed12f153cd7cae45028c5f842850738c980657a16eaffba47.bZBzfSAW7bDXjjecrjVvRTlPFKmyZ_cUElF_zrVnWZU
scenes-app-inbox-detail--run-ready--light:
- hash: v1.k794b7964.fab9d3eb3072c04885cc093ae23b521cd78a483e1cb2c0c2729a5fae92ab486a.Jb-sfHDLzAMhlMxN-hfCQPegjhow5ztQwsHHU4knVys
+ hash: v1.k794b7964.db7f6bd45e96876356ac107cc821d48bb7f053f91c824ed07d25a0a8be7f6636.OOlpTL2fpns11lgi8vN1cRKSrPLJyrrmOhVa_u1hdPA
scenes-app-inbox-discussreportbutton--with-suggestions--dark:
hash: v1.k794b7964.19c4966106770c2bc0ef734bc3b21cdda4b51d825be2f1432b578ca41ddf1cd2.GYWPYaEs1UjFAXx40U0cHj9p8q91lJEth_6Fx1su_Jk
scenes-app-inbox-discussreportbutton--with-suggestions--light:
@@ -6797,41 +6809,65 @@ snapshots:
scenes-app-inbox-pullrequestdiffview--truncated--light:
hash: v1.k794b7964.58a507666519d2ad2f2a5247605b2c903180639eae9e43580992de250bc8f258._lKwsnOWccjuN6S_pd8IgOfKLzqnIvVqmTh1uETW-TY
scenes-app-inbox-scene--empty--dark:
- hash: v1.k794b7964.2572de9d05a91291ee5c54759632d9e451d42fbc1d76a631c168abd2dad70972.nrzYMXH-uB7esw-8ykrFpAiEoZHliLlEPRPWpZOzxHM
+ hash: v1.k794b7964.18f637086799dbed78b0b1f7b4e515e28ef6384c3d1f73fae36a63268689b34d.nYA0vYbbnNgEVD_KRwpA3pO42DrrVonzElXVtiX3KQg
scenes-app-inbox-scene--empty--light:
- hash: v1.k794b7964.2c92adb4c82dda0e5d316a0a3f8f06a6b426e9fa001edf2ff279340373a2a85c.Lz2dW5ir_CDN81bwkzkH6k71rcBHgob0I7bcwxwBiQg
+ hash: v1.k794b7964.9be5803d6d4ef01e3ac3427ce20e2a27944a5470750c7e1db6107f74c1275337.rH7qOSAE5TAFdExQa3wmCEz6BhUPUsy848kbvaGzzpk
scenes-app-inbox-scene--empty-control--dark:
- hash: v1.k794b7964.6bb999e7dd980b4bb9a6f5d90c07a7290b4fc2573a15f3352f0df7df4626f41a.sjmglF3RwFn90_WbmfnsPDkzheZgV3CIgAl1NWPko0Y
+ hash: v1.k794b7964.03efcbc7b7ab0a990cb5975ce89a45561afa6f1800ed5d54ab50ba9d102c18ae.kQLk9Tk6zDY6eMBe0BbT6WxqnSbGFT8KKfVg-mMqSmU
scenes-app-inbox-scene--empty-control--light:
- hash: v1.k794b7964.bcc336cfa3b3bdc689ddc5a0243792886ed4bda2313e8dc808cb02e2419a49d1.8r6f3WN9J6DRWwaJNr5eYdQ05Q97smejgHKL4bbvMUY
+ hash: v1.k794b7964.e260473c9361bf1993b204da699cc818274a48032e8b5a5ebe54f8bab82bd392.nAnvZ0JDprivxCc103R9zV7AuNS3bexcp92-JPMAGnw
scenes-app-inbox-scene--empty-with-many-scouts--dark:
- hash: v1.k794b7964.ad51c2deb25108d1798f1a457b545d3ac2b44a41db513d8fe82cd2643aade6cb.OdWP3HwXPw42shSujrp65nQZ-kGmszTxTTn7hzYUyg4
+ hash: v1.k794b7964.7b37c09832bd339a3f70ad6bef4e9224903ef88d2d34daea962c6162d4323b70.n8dkuQm69NZJ-8vl4mjQOgB4ESE1OtmITlbCXMlvSX8
scenes-app-inbox-scene--empty-with-many-scouts--light:
- hash: v1.k794b7964.b9a77600fe33803591c05e110e5c8373ea6f9f534088107e6244d4e2887a0248.uBGGTqK8QLmvzTOppyfWjubR-CyIYicZBeB4In3A2u0
+ hash: v1.k794b7964.0c84994341ed9cd1f4767d6e6c54ad028f49e60ebc944885276d83fa01856c31.3WAZPr2nXoGAZRRxPHw9RDbS4jrCWJNdp4fsyZOjFkk
scenes-app-inbox-scene--inbox--dark:
hash: v1.k794b7964.e1e4ab0d21ba58926ab2d57e366734264122b146701a84fe3f442012ec64fc19.6sbEcCnUZmsj3KMtQMzsKHuyPxgs2UIKKF6xN7gufSA
scenes-app-inbox-scene--inbox--light:
hash: v1.k794b7964.ac152ef65c5c6fe25d9b985a44f41279a017eff249d66920bcd77bbc17f78b64.B22XE-debF5iSr7REBQIZ9TrQN2y0pgYWX8tIS-_Vv4
scenes-app-inbox-scene--installing-self-driving--dark:
- hash: v1.k794b7964.0f5b7ce9c7a22d92f31420a483f74d03618a98a2ec1432efcb943e1af6a5d2b7.xoAgktzo4sCbmLekevXh9XG1Jt0LGBMauvn0A6vVbjM
+ hash: v1.k794b7964.269746cc24d0f9d069b7fc19d8426ea0614033f0a548273c5437a047a22cb3bd.hK2SPJ4ZCKtMKqdEOhReNzFC5NqXdUoaSuBgYrHJq00
scenes-app-inbox-scene--installing-self-driving--light:
- hash: v1.k794b7964.44a79a0117f5a912252a4c7c7685fca78693fc92c9b5d06bba7e928913235663.DfHZQMzgqHbKBJAEZ3XBRpom-q0KbSRt_QYmOnJOCAQ
+ hash: v1.k794b7964.41a47fbbfb7f9e86e28b25e0fec8fb1dea400e7808b56c7c2c5f7a6f963553eb.8A4Rn9qwBlPvKpciU4ZTVt01K2UsWFSKdolw-plZfKU
+ scenes-app-inbox-scene--legacy--dark:
+ hash: v1.k794b7964.82fb69396eaab9ceb5a1223541105145370974e4cbb950bfe12ff201770b628b.0CZuUPcENgOU_VVhM4Ooj3YUlrXnMNAWbFCT0JGQzWU
+ scenes-app-inbox-scene--legacy--light:
+ hash: v1.k794b7964.76ea52563f9f53e051fd54634ebfc726b5f5570d3e6c7dd8b0663951c41c7f5c._pNa0ljBd_71oP2dETrcKP92bjh9QWeYpVKcR0LfL-k
+ scenes-app-inbox-scene--legacy-report--dark:
+ hash: v1.k794b7964.9deadf33fcb565f01266462aeaddcbb6dfa839d7518f474d4ee2e690e2742161.oUW5kHKVYyMoWP-1h0m6F7Gl7gvhjU7pfDcxI7WP79o
+ scenes-app-inbox-scene--legacy-report--light:
+ hash: v1.k794b7964.ebb392821dadb22240182d8f0de7e0bc4822fe101654209f11767e8d6a7a89ab.ePPA5rETWZn-47ZTzj_boQlK0xYH2RR5aFfyQ2-0lUQ
+ scenes-app-inbox-scene--legacy-scouts--dark:
+ hash: v1.k794b7964.ccafcee2140f93914459f62a4039c1c7538ecc2d059e1dd6c8577e6fe088e9ea.WZMifs5X7aCwLPl7tYpymRwZrtQ6ovHXvo-T-QWfbKQ
+ scenes-app-inbox-scene--legacy-scouts--light:
+ hash: v1.k794b7964.991250abd9bdbfb0bbe4b9dd2895d32b8ff7595988d80862af28f48bc0b5a5b0._wZQLIddLXrsU5sh20QRYMm0S2nRjD8OBPsMZZfalgU
+ scenes-app-inbox-scene--scouts--dark:
+ hash: v1.k794b7964.e99f6cacaf77cf181c98c3aae54caaa6e4f8f9eeabf8f58ca87d85ae5149226e.sM1hPNY7WeIgRZAIpD4uS5yu4-sTMMJUra3y8dVPLdI
+ scenes-app-inbox-scene--scouts--light:
+ hash: v1.k794b7964.2d0a8abc429f43548f00527d3b176b8650f40ed182ba0475e666bb77f061078a.8XXnj_Uvhd1aNxXyol8047E0OIgWl-NqvOqsNlNro7k
scenes-app-inbox-scene--self-driving-onboarding--dark:
- hash: v1.k794b7964.e72ae40c380837255da720cddfdd3d15f724ef89afc42c07a97574fe729564b1.g3GQWyt4tXpPNvsJQ6owZhCkszpZEyk_0LzugUf7V50
+ hash: v1.k794b7964.5e81eb4ec6083b756cf5ab2de1059f4d804887749b0e8b10da4b991c9c755ab3.q6KeUB_9CSA5o4KSzEj8bv0X3J1zlkDmkmIRJx_5-Qw
scenes-app-inbox-scene--self-driving-onboarding--light:
- hash: v1.k794b7964.e0339822d528a7dc7fa8d13f3d7f1938fc1512011fbdf44579eb8a1269d31d5d.7My7XZH6KRDGhuhHvLRyNAmGHONzRdE25B1pt0d_9v4
+ hash: v1.k794b7964.be24516fea0f4ca4eb7751e66ef806f4302320a6fb47e9aede88d098a22b53af.s4WhJldE5gC0unqZ4TYrWRBtjk-Mh9gnzGczMLEpaM0
scenes-app-inbox-scene--self-driving-onboarding-redesign--dark:
hash: v1.k794b7964.6b7b2950c3a0df456074962aada4405283deea5158415e032f0b0f8f25e5dbc2.tm21mB5drTdEcJGDLgLSUiX8Rvel7_-Yt5GbSLLTwsA
scenes-app-inbox-scene--self-driving-onboarding-redesign--light:
hash: v1.k794b7964.5268ad52b39cdc5bb1d699e6a1a839a552ce397134d6773714e1f5a2d95994b6.FhF72MKwXItKEYkZGQPVBzIVP03-mAXJSlwfA5OlL8I
scenes-app-inbox-scene--self-driving-paused--dark:
- hash: v1.k794b7964.ffc5557c01bbfb5497cbbc60ddec9df93367eef9507d600b9ac37f436eb92985.8pdD_uKVmeemQVwO3E6g526Fq7681IhrC2PA5AKCaiY
+ hash: v1.k794b7964.1b72584882245d09b8622723dfc012a7d854b1419ee4d845829e6dfccda6603f.ox548Px_t_Hecz8z9AlksbbedukN5wWQUoxfrfzlTHM
scenes-app-inbox-scene--self-driving-paused--light:
- hash: v1.k794b7964.1f1c9fbabc723430900b6bd522016ccc1396391d797a87d6c71e44e910af209c.QOPeDKqrxxZE7HyPrTini_ZKF5_WNVMHvCDBfQP2Vwc
+ hash: v1.k794b7964.90aa6c5f7f56f04eaf4458d064731878707f550379c5906ab670e9fd8384e7c6.oyRmXsS9axV-BigXbChZl9ELgOzT9_Rbb7f2lpGykTU
scenes-app-inbox-scene--self-driving-verdict-pending--dark:
hash: v1.k794b7964.570e5dddd645996b94ff94b2c563b32ced3793db3ab5ccf360d16126af3b9a0b.WC_VEZ1N_iX-o4r11w15QWfD8Nzo1gFerTznKiaIX84
scenes-app-inbox-scene--self-driving-verdict-pending--light:
hash: v1.k794b7964.1d230f03b5a074e0816ee4c5dd1b4591cfdf86bb602971a6233019985f1c2677.h7Zlyp6gh4AnCQRve-W4zeSDnhAhhqVM1FIqiYN1gNA
+ scenes-app-inbox-scene--settings--dark:
+ hash: v1.k794b7964.1af5812ea7514da4b7682c458680777a3465755635fe3bd55c63d9003f5dbf35.Tn_xNyX_ZAAAwef19CcNR9ODGCkFlv_x89jNmmECg2Q
+ scenes-app-inbox-scene--settings--light:
+ hash: v1.k794b7964.dd753e8a7abdbfa5891a5b2c62da90282c08aa5e3a608a20cafdd3b35628cfa5._lag-pvviMbZ2S8iO_qLEgggn2Tv4UKDraQEzVgLlYA
+ scenes-app-inbox-scene--triage--dark:
+ hash: v1.k794b7964.2e91d744a4551aaee3420a915bb46220934b937bd1cacc963dc43d2ea4c4a862.fR04GF9ZhD3oJc6BenUt_e7DrqrNJXsMFnXNg2UlVKc
+ scenes-app-inbox-scene--triage--light:
+ hash: v1.k794b7964.1fcdda8455a45b636d29f42c681696c649b26a1339ba5b5890d166ec5bd98aaf.CejUDitmTV84DoeFjFwwFhrEP62iSRHVYAgYCu77zAM
scenes-app-inbox-scoutconfigform--disabled--dark:
hash: v1.k794b7964.c7ec994ac1d65f711be7805c9cae7e3db5c8846f859c77f565faa24618b3b5a2.oDVuzPoCmul8km-CQhaZ7ZwFSLfob_HQTpzZSXkGtgs
scenes-app-inbox-scoutconfigform--disabled--light:
@@ -6853,17 +6889,21 @@ snapshots:
scenes-app-inbox-scoutmcpserverspicker--scout-settings-variant--light:
hash: v1.k794b7964.2f1013abc412adb4544bca6a00209d3051c46969db69d4242ab201ecf5d189f3.YVfbrzpaRzPwuCbeFXmaVOLla0fvhHmAm1CkuaKWCLI
scenes-app-inbox-scoutsroster--large-fleet--dark:
- hash: v1.k794b7964.718d781556e08dc7feb07a7adf0ef3f8b88b106b1625047d9c2af839df1ecb83.19wXi43f_KFsfpTkB30RoYw5c6_Brl7bz9d3A15R4b8
+ hash: v1.k794b7964.93eef32b387248bc4fb19e860267675bdb55ebd544cf31a4d462db8c27db4c42.LW5WPysIjDR4qLLNitsa4Ba5PORL-Z_psDYcc9pjK2A
scenes-app-inbox-scoutsroster--large-fleet--light:
- hash: v1.k794b7964.aae20045053cf353c3447d41c1bbce92aeabb3d6329664da69d05e0325c28346.u6zr3nk4cJN44mL2RSKmpuVTBsL1WmCqsaagwijmiSI
+ hash: v1.k794b7964.5559787c8ef2e02afa6df48151b1b8d17fd41fa24c6803720952e4c8fdcab27d.XdEXQe9tPSTtZm4gGNvlIC0lB2FibngNbILHRDQtnEw
scenes-app-inbox-scoutsroster--narrow--dark:
hash: v1.k794b7964.1feb663b0f7c787baebbb5cb76112af14394d12564bcd84a10f74b4320ce6df7.S20hNzFMJwmUnCS2XnNbS2LL49lgymuQuOUkIWEqeJs
scenes-app-inbox-scoutsroster--narrow--light:
hash: v1.k794b7964.5a75dcc9a78a645e0ca0b5811453e6b975952a00a9ffc6280463b113ad94faea.ulBW3-DilRBC_cyXD6R2MH2g0k_S38zfhKnn3_jWK4I
scenes-app-inbox-scoutsroster--roster--dark:
- hash: v1.k794b7964.1e60b96137099008eb0586a688a6e9778957d2bb22080717cb1b7e85b33914f2.hhm9E7xx3YoKpX0Q0OT_8p4RnX9DWaHcowqBSzbj6E4
+ hash: v1.k794b7964.93f5297e0efc7eb2b3c3f65a27a4a0ed3244dc410d9433f90b48e4ea39d93987.eyirdHer2L8_kERPtGO30CP8DNQfgGx7YF5OeeGWI8M
scenes-app-inbox-scoutsroster--roster--light:
- hash: v1.k794b7964.9e173f8016fb6bee154b07d46ec4762027b2acfc0163a1e143363fe7b9b67b96.KJuuha1IW4YIej_UjUQr13km6Y03K1xrRzxC8Xm2e_k
+ hash: v1.k794b7964.b4468814d26c8c9f36981f976ef67758ec6f266aa495317e18816e829a3b9788.ww77eCyW9m0j1uaTMoxG1s5fA87zzUlKOd6wDMMxVgE
+ scenes-app-inbox-scoutsroster--roster-legacy--dark:
+ hash: v1.k794b7964.1e60b96137099008eb0586a688a6e9778957d2bb22080717cb1b7e85b33914f2.H3lVsEdpIITF7t9xS2eRvSgLFij4FdBV7N9hWskoruE
+ scenes-app-inbox-scoutsroster--roster-legacy--light:
+ hash: v1.k794b7964.43141512a651be54956bfc83ec43a719e32a20cd95f8ab36b618f5f13f2805d8.tFKedkNF5pBnGvjkTk0vkCgNHb1L3PZDdBe3T3gKlc8
scenes-app-inbox-selfdrivingsection--daily-limit-reached--dark:
hash: v1.k794b7964.6bb86cc044462ca9b5d59151d279fb763b8ffc1918c913a4ba5786e9714a9675.F8GMUyNcVBI5ASlEgXgZaNW4sL-8zvLioKKu0JVua34
scenes-app-inbox-selfdrivingsection--daily-limit-reached--light:
@@ -6888,6 +6928,18 @@ snapshots:
hash: v1.k794b7964.aa42dc763078e1431c621efad3dae9f298485890910510fccd861fb1bc9f7d77.Go-OjRKiACFptGQ39DNGs4H4H83nh48PwJQBaoW59CI
scenes-app-inbox-selfdrivingsection--personal-override--light:
hash: v1.k794b7964.11bb568d4acedc2c8471037b636ccceffd9d5132b2831c86911cb3c03dc0e761.Av0epOul8ebcU34b5lat7cvdImPzSkTHhwuYPkfV3WA
+ scenes-app-inbox-signal-cards--generic-fallbacks--dark:
+ hash: v1.k794b7964.0675fbd7acca5320139d134150e70d3cd9e763580b0eb4cbaa93d5756669ae15.pKrX03LXxk8_E-bezOswMJafPsVaFWft7GbSeImpQDQ
+ scenes-app-inbox-signal-cards--generic-fallbacks--light:
+ hash: v1.k794b7964.99a6d0f14c60332de91b3c7eecd0aa469b3ab570dc56a248530902be720605f1.wxsV2n4HR7EbwyJAhKUCb8YLML76Rm7_vAY9HIX2uvI
+ scenes-app-inbox-signal-cards--recording-previews--dark:
+ hash: v1.k794b7964.332fb846f1ddbf430f392188c98ab57a969085094889663e8a21ec75a4d67201.L1IaKE4jStdzeNM6SdUxGGTbAliLekreOFZtPWI-NzE
+ scenes-app-inbox-signal-cards--recording-previews--light:
+ hash: v1.k794b7964.6b527e665e887ea72acf2fcc4d849f2b35f713e93344221c56f9b5b2a6e6d29d.8ZlFVasXh6oOnU0_2GgV1d7HWNrPYXn3bBQwexcQ79w
+ scenes-app-inbox-signal-cards--ticket-attachments--dark:
+ hash: v1.k794b7964.b2f6db82a8095063464ef3b3434876e9034b6656c9df70514f029efee9df897f.QF045sDY1E6jZmQQqjJLXYSiIVy49weLLiPSamAuaK8
+ scenes-app-inbox-signal-cards--ticket-attachments--light:
+ hash: v1.k794b7964.7112d8b521662aca53e79c1e6cdae78db013201d4c154f9274a440f61fd1487a.cHugbyGezFP1V0uARCkm--GepxsGtmimZ8mtuRWouxg
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--dark:
hash: v1.k794b7964.ece1c0e16e4970e264f483296aaee56c6e8f271ffd8149c414ae314b1a72c866.kfMXUu0-mbkWvrPMsm0GPuPwIdcSt9t7DfNYHby-X0I
scenes-app-inbox-signalsourcespanel--armed-but-tools-off--light:
@@ -6928,22 +6980,26 @@ snapshots:
hash: v1.k794b7964.740612fa137e304fc2840a5e41b44ac04614dfd183fd55a72c041e4168f46a04.eInqcr24eNVcNY1idkcXctdumOGkShuBP27l6pf2XsQ
scenes-app-inbox-sourcesteeringmodal--rules-set--light:
hash: v1.k794b7964.d1279fa1214369e191ab56aeef694231fcd401abf93e1854000fdfdcf97399bc.BKbf7ywpJGW7XqCNbou14Du1jqORsoYt5No4mJCVU3Q
- scenes-app-inbox-tabs--pull-requests--dark:
- hash: v1.k794b7964.7a8a1ac4681274dd7f60472421a6f6362d11d3aad177531004cf98c756e505ef.Hy9T2-oIRAyETFxIawc0glbpHyBHV1pYRYaDNjMPVQg
- scenes-app-inbox-tabs--pull-requests--light:
- hash: v1.k794b7964.2fb1e20ff50d808253cae40e732b64a77eef587baa1841d6588881aa1b14dc12.pmqzLo-mx4Ska6m9zG6faXVUD00H_ikLZcrpo0gEDFU
- scenes-app-inbox-tabs--pull-requests-empty--dark:
- hash: v1.k794b7964.1d4af181c6117e856ae22c6626ec9e7fb2da7c3bfc8ff0839753630b8c319f88.-VmOVfKVBzzbKxrJnEv1bIRp_ALt4jCNOUaEdhfGGnY
- scenes-app-inbox-tabs--pull-requests-empty--light:
- hash: v1.k794b7964.2f37e400b13fc58fd9da0cbec33baf774d748b5f657d8e01f211279fa1cc3bc8.WUQwyDFDfAycOKSUi5hu_6_E_GoYzjvaCz81t-nCpxw
+ scenes-app-inbox-tabs--pull-requests-legacy--dark:
+ hash: v1.k794b7964.7a8a1ac4681274dd7f60472421a6f6362d11d3aad177531004cf98c756e505ef.acR7Y_EmrnKN4GzYlFAScr8a4_ZKjmxeCYKzgiwBHro
+ scenes-app-inbox-tabs--pull-requests-legacy--light:
+ hash: v1.k794b7964.2fb1e20ff50d808253cae40e732b64a77eef587baa1841d6588881aa1b14dc12.1MI5WWLUgeiqrwAT4cZW09aAIqNQ9i7X2_ZNyeJC9eQ
scenes-app-inbox-tabs--reports--dark:
- hash: v1.k794b7964.326c71356c4257bb46ed43d558ae3e3e8c3fc4e191ff0eaa509a31b2ef9a773a.bZIRfoqRKOvAChrPpHeRqtcXgxgvHrAexWvT8wlCU8w
+ hash: v1.k794b7964.b851875203cb1bd0a3400aff48d534a3a8a6b9c0c4de772e14fda3bebc184ee8._fkKYLXBLFwm4XY-JCW-qt_QvMOPxaNJBoTBjV0Xt9o
scenes-app-inbox-tabs--reports--light:
- hash: v1.k794b7964.94ebb7bba9a6913dd3f6fe65e288ab7cd0ba0010f7e9f46987c4a22c35ee22ce.TKeJlWO_dGJN0cV7-ZF7b10_xMypFz3Ydq-gcPFz5M0
+ hash: v1.k794b7964.f4135be38741ef164e947e253bd15bc7dc3a211871289de4d4b1ae3e7b62bb9d.FJQSWp36U6B8cU3GhqN_tBXvZfQ1vF5rjKQqyj6uIns
+ scenes-app-inbox-tabs--reports-all-sections-expanded--dark:
+ hash: v1.k794b7964.24802bb819a135b12ca117ad561077e4b6559f3c03f03421a26c7f6cc877a53e.fhsntFF-Rm62PKONeTHL0_1OE3l6r-Ch7duZKk7t558
+ scenes-app-inbox-tabs--reports-all-sections-expanded--light:
+ hash: v1.k794b7964.0f1ae00b821ead313a9fa4bd59bcca6e24cae8db75a5b03a839847fe19c1dad8.vChDCCceuIIo8zVIL_kLJ8DbKjRO40tg9eQDcsmOsdw
scenes-app-inbox-tabs--reports-empty--dark:
- hash: v1.k794b7964.dbd4d6f1610597f52362997cd4eb267f76f0f83389aaad7456b520a4cb7fe3db.x3NKcd2qny9IyD98DEUibNjgw54FUFYjcSu4hzXp3uA
+ hash: v1.k794b7964.fadcb6a49ae519ed7432563af517599477371bc1e9823b09c7a1cc351925b249.FHSWD8X0Bg6UfdgpmdkK_3y1cIiWzBwfN5WCvTWLV2w
scenes-app-inbox-tabs--reports-empty--light:
- hash: v1.k794b7964.ab92b2fbca46d78b4023ef3307438916929cedcd11115bef267c85c47d8c6f5c.tePbIytZ9KkZrM7Zq1agMtedIAjUZezv2poSPKME5NU
+ hash: v1.k794b7964.3a6b3393d02f9fbc789213e7ff4ca0ab90a0cb31962995cc42ce547dff9719fe.Tg74pzAgyn6wyvXNoPcUZuobn29C3aOLd5LoX0aFbCQ
+ scenes-app-inbox-tabs--reports-legacy--dark:
+ hash: v1.k794b7964.326c71356c4257bb46ed43d558ae3e3e8c3fc4e191ff0eaa509a31b2ef9a773a.lE_OH56Yt15Qg1nQy248vuW5943PTrT4nN97jI8miNU
+ scenes-app-inbox-tabs--reports-legacy--light:
+ hash: v1.k794b7964.94ebb7bba9a6913dd3f6fe65e288ab7cd0ba0010f7e9f46987c4a22c35ee22ce.n15PAvBhHiYNF5ax1o5CGeX50_YD3k2bls6SqRPGTFU
scenes-app-inbox-tabs--runs--dark:
hash: v1.k794b7964.4ece3bdc6be5207a77eafc6d9005ce3a065539767d7a4da5f3f2f5f913bb3567.Wu4dnjXImAjEXPa2f8AdBAeJIwpnA-ak02ZeHI87kBo
scenes-app-inbox-tabs--runs--light:
@@ -8313,9 +8369,9 @@ snapshots:
scenes-app-web-analytics-search-ai--web-analytics-page-performance--light:
hash: v1.k794b7964.a6ba7deb703189986a29cd9fb512528232cc1fb8a602716b072fdff8a378695d.dt9pqc4bKRhF4MB52Ph_323zhIke8DbgpLAasOFzFHc
scenes-inbox-scout-tags--editor-and-filter--dark:
- hash: v1.k794b7964.a6c6018c279d1c7b6dc6cfe7ade21997d71bc5a3f970a76ca68f4bd374b1def6.wiY4XKEvSpFFtmciViAMFvc_yZLC5SeA5L6TmAYaNqQ
+ hash: v1.k794b7964.b76b173ee1dc78112e700af267b53d59959164f8ebbc814df2b5f4a3811bcd49.2hfIhAW_k3BdFlo9jtUoJhOyZhS1uQmgafcdvh_CGmg
scenes-inbox-scout-tags--editor-and-filter--light:
- hash: v1.k794b7964.6bb5712bac81268d6d2ca1fbc4b1583d1314cbf80ee574c1f7900f9dc546a6a7.6xHwc2B6VA6cqOdko_N3mpWURaTG7p4hPrv68Zq-Qj0
+ hash: v1.k794b7964.4aed44e2990813028b0e9390cbae48142a07a1d7f977b8bfc69d8ca6025c1a80._qkBooayua1hQrnHoZoNzQ8Oj6iSL_nnwUrNwJ1qoh0
scenes-other-account-connected--github-integration-connected--dark:
hash: v1.k794b7964.fcae9b65af8160ba40bf82664dd9b5a6b9f5a1ddbdedee05bf15ec453eb7aa64.3616s9KNJancKVe-j4dQsJdo3W1CVcwWxRMA24QgU6Q
scenes-other-account-connected--github-integration-connected--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 2f24e7984f10..408688703839 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -346,6 +346,7 @@ export const FEATURE_FLAGS = {
HEALTH_ASK_AI: 'health-ask-ai', // owner: @jordanm-posthog #team-web-analytics, gates the "Ask PostHog AI" buttons on the Health overview
HOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and views
IDENTITY_MATCHING: 'identity-matching', // owner: @fercgomes #team-growth, gates new identity matching scene on marketing analytics
+ INBOX_REDESIGN: 'inbox-redesign', // owner: #team-self-driving, gates the inbox redesign: report sections, triage mode, the Settings tab, and scout cards
INBOX_SLACK_NOTIFICATIONS: 'inbox-slack-notifications', // owner: #team-self-driving, gates the Slack notifications config card in the inbox
INBOX_WELCOME_REDESIGN: 'inbox-welcome-redesign', // owner: #team-self-driving multivariate=control,test — experiment on the inbox self-driving welcome takeover
INSIGHT_DRAG_TO_ZOOM: 'insight-drag-to-zoom', // owner: @sampennington #team-product-analytics, gates x-axis drag-to-zoom on insight charts (trends today, SQL to follow)
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index c2d02209a055..1ec0b80d3888 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -221,6 +221,8 @@ export const productRoutes: Record<string, [string, string]> = {
'/inbox/:tab': ['Inbox', 'inbox'],
'/inbox/scouts/scratchpad': ['Inbox', 'inbox'],
'/inbox/scouts/findings': ['Inbox', 'inbox'],
+ '/inbox/scouts/runs': ['Inbox', 'inbox'],
+ '/inbox/reports/triage': ['Inbox', 'inbox'],
'/inbox/scouts/:skillName': ['Inbox', 'inbox'],
'/inbox/scouts/:skillName/:findingId': ['Inbox', 'inbox'],
'/inbox/:tab/:reportId': ['Inbox', 'inbox'],
@@ -1442,12 +1444,14 @@ export const productUrls = {
codeReview: (): string => '/code-review',
inbox: (tab?: InboxTabKey | ':tab'): string => `/inbox${tab ? `/${tab}` : ''}`,
inboxReport: (tab: InboxTabKey | ':tab', reportId: string | ':reportId'): string => `/inbox/${tab}/${reportId}`,
+ inboxTriage: (): string => '/inbox/reports/triage',
inboxScout: (skillName: string | ':skillName', findingId?: string | ':findingId'): string => {
const segment = findingId ? `/${findingId === ':findingId' ? findingId : encodeURIComponent(findingId)}` : ''
return `/inbox/scouts/${skillName}${segment}`
},
inboxScratchpad: (): string => '/inbox/scouts/scratchpad',
inboxFindings: (): string => '/inbox/scouts/findings',
+ inboxRuns: (): string => '/inbox/scouts/runs',
skills: (): string => '/skills',
skillsCategoryTab: (categoryTab: string): string => `/skills/${categoryTab}`,
skill: (
diff --git a/products/signals/frontend/inbox/InboxScene.stories.tsx b/products/signals/frontend/inbox/InboxScene.stories.tsx
index 41328d1d8253..b80e16a6a242 100644
--- a/products/signals/frontend/inbox/InboxScene.stories.tsx
+++ b/products/signals/frontend/inbox/InboxScene.stories.tsx
@@ -1,10 +1,12 @@
-import type { Meta, StoryObj } from '@storybook/react'
+import type { Decorator, Meta, StoryObj } from '@storybook/react'
import { useMountedLogic } from 'kea'
+import { router } from 'kea-router'
import { useEffect } from 'react'
import { FEATURE_FLAGS } from 'lib/constants'
import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'
import { SELF_DRIVING_WORKFLOW_ID } from 'scenes/onboarding/shared/wizard-sync/workflows'
+import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
@@ -16,14 +18,25 @@ import {
mockSourceConfigs,
mockTask,
mockTeamConfig,
+ pullRequestReports,
} from './__mocks__/inboxMocks'
-import { mockLargeScoutFleet, mockScoutConfigs } from './__mocks__/scoutConfigs'
+import { mockLargeScoutFleet, mockScoutConfigs, mockScoutRuns } from './__mocks__/scoutConfigs'
import { InboxScene } from './InboxScene'
import { INBOX_LAST_UI_STATE_STORAGE_KEY } from './logics/inboxOnboardingLogic'
// Full Inbox scene with a populated report list. Use this to polish the holistic
-// layout: header, tab bar + single border, scope picker, filter bar, and the
-// centered list column. Switch tabs / scope inside the story to exercise each view.
+// layout: header, page tabs, the Reports view switcher, scope picker, filter bar, and the
+// centered list column. Switch tabs / views / scope inside the story to exercise each.
+
+// The scene reads its tab, view, and open surface from the URL.
+function routeTo(pathname: string, searchParams: Record<string, string> = {}): Decorator {
+ return (Story) => {
+ useEffect(() => {
+ router.actions.push(pathname, searchParams)
+ }, [])
+ return <Story />
+ }
+}
const sceneMocks = mswDecorator({
get: {
@@ -32,6 +45,10 @@ const sceneMocks = mswDecorator({
{ results: allReports, count: allReports.length, next: null, previous: null },
],
'/api/projects/:id/signals/reports/available_reviewers': () => [200, mockReviewers],
+ '/api/projects/:id/signals/reports/:reportId': (req) => {
+ const report = allReports.find((candidate) => candidate.id === req.params.reportId)
+ return report ? [200, report] : [404, { detail: 'Not found.' }]
+ },
'/api/projects/:id/signals/reports/:reportId/artefacts': (req) => [
200,
mockArtefacts(req.params.reportId as string),
@@ -61,6 +78,7 @@ const meta: Meta = {
featureFlags: {
[FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,
[FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE]: 'empty-state',
+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,
},
// The scene shell keeps a loader element mounted past the VR wait window, so don't block on it.
testOptions: { waitForLoadersToDisappear: false },
@@ -73,6 +91,58 @@ type Story = StoryObj
export const Inbox: Story = {}
+// Triage mode over the Needs-a-decision queue: one report at a time, keyboard-driven.
+export const Triage: Story = {
+ decorators: [routeTo(urls.inboxTriage())],
+}
+
+export const Scouts: Story = {
+ decorators: [
+ routeTo(urls.inbox('scouts')),
+ mswDecorator({
+ get: {
+ '/api/projects/:id/signals/scout/configs': () => [200, mockScoutConfigs],
+ '/api/projects/:id/signals/scout/runs/recent-per-scout': () => [200, mockScoutRuns(mockScoutConfigs)],
+ },
+ }),
+ ],
+}
+
+export const Settings: Story = {
+ decorators: [routeTo(urls.inbox('settings'))],
+}
+
+// The layout the flag replaces: one tab per report list, the Runs and Configuration tabs, and the
+// setup rail. Story parameters replace the meta's, so the meta-level flags are re-listed.
+const LEGACY_FLAGS = {
+ [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,
+ [FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE]: 'empty-state',
+ [FEATURE_FLAGS.INBOX_REDESIGN]: false,
+}
+
+export const Legacy: Story = {
+ parameters: { featureFlags: LEGACY_FLAGS },
+ decorators: [routeTo(urls.inbox('pulls'))],
+}
+
+export const LegacyReport: Story = {
+ parameters: { featureFlags: LEGACY_FLAGS },
+ decorators: [routeTo(urls.inboxReport('pulls', pullRequestReports[0].id))],
+}
+
+export const LegacyScouts: Story = {
+ parameters: { featureFlags: LEGACY_FLAGS },
+ decorators: [
+ routeTo(urls.inbox('scouts')),
+ mswDecorator({
+ get: {
+ '/api/projects/:id/signals/scout/configs': () => [200, mockScoutConfigs],
+ '/api/projects/:id/signals/scout/runs/recent-per-scout': () => [200, mockScoutRuns(mockScoutConfigs)],
+ },
+ }),
+ ],
+}
+
// Set up (sources enabled) but no reports yet – exercises the empty list states.
export const Empty: Story = {
decorators: [
@@ -91,6 +161,7 @@ export const EmptyControl: Story = {
featureFlags: {
[FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,
[FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE]: 'control',
+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,
},
},
decorators: [
@@ -154,7 +225,11 @@ export const SelfDrivingOnboarding: Story = {
export const SelfDrivingOnboardingRedesign: Story = {
parameters: {
// Story parameters replace the meta's, so the meta-level flag is re-listed here.
- featureFlags: { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true, [FEATURE_FLAGS.INBOX_WELCOME_REDESIGN]: 'test' },
+ featureFlags: {
+ [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true,
+ [FEATURE_FLAGS.INBOX_WELCOME_REDESIGN]: 'test',
+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,
+ },
},
decorators: [
mswDecorator({
diff --git a/products/signals/frontend/inbox/InboxScene.tsx b/products/signals/frontend/inbox/InboxScene.tsx
index eb246d0ff808..c5288931fcbd 100644
--- a/products/signals/frontend/inbox/InboxScene.tsx
+++ b/products/signals/frontend/inbox/InboxScene.tsx
@@ -5,7 +5,7 @@ import React, { useEffect, useRef } from 'react'
import { IconArrowLeft } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
-import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
+import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -17,23 +17,22 @@ import { ScoutDetailView } from './components/config/scouts/ScoutDetailView'
import { ScoutsRoster } from './components/config/scouts/ScoutsRoster'
import { ScoutsRosterActions } from './components/config/scouts/ScoutsRosterActions'
import { ReportDetail, ReportDetailSkeleton } from './components/detail/ReportDetail'
+import { ReportDetailLegacy, ReportDetailSkeletonLegacy } from './components/detail/ReportDetailLegacy'
import { FindingsPanel } from './components/findings/FindingsPanel'
import { InboxOnboardingBanner, InboxOnboardingTakeover } from './components/onboarding/InboxOnboarding'
import { InboxWelcomeRedesign } from './components/onboarding/InboxWelcomeRedesign'
import { ScratchpadPanel } from './components/scratchpad/ScratchpadPanel'
-import { AgentSetupColumn } from './components/shell/AgentSetupColumn'
-import { InboxScopeSelect } from './components/shell/InboxScopeSelect'
+import { InboxListViewLegacy } from './components/shell/InboxListViewLegacy'
import { InboxTabBar } from './components/shell/InboxTabBar'
-import { ArchivedTab } from './components/tabs/ArchivedTab'
-import { NotActionableTab } from './components/tabs/NotActionableTab'
-import { PullRequestsTab } from './components/tabs/PullRequestsTab'
import { ReportsTab } from './components/tabs/ReportsTab'
import { RunsTab } from './components/tabs/RunsTab'
+import { SettingsTab } from './components/tabs/SettingsTab'
+import { InboxTriageView } from './components/triage/InboxTriageView'
import { captureInboxPanelViewed } from './inboxAnalytics'
import { inboxSceneLogic } from './inboxSceneLogic'
import { inboxOnboardingLogic } from './logics/inboxOnboardingLogic'
import { scoutFleetLogic } from './logics/scoutFleetLogic'
-import { INBOX_TAB_DESCRIPTION, InboxTabKey, SignalReport, SignalRun } from './types'
+import { INBOX_LEGACY_TAB_DESCRIPTION, INBOX_TAB_DESCRIPTION, InboxTabKey, SignalReport } from './types'
export const scene: SceneExport = {
component: InboxScene,
@@ -45,10 +44,7 @@ const LazyScoutCreateModal = React.lazy(async () => {
return { default: ScoutCreateModal }
})
-/**
- * Hosts the `#createScout=` modal at the scene level, not in the fleet section: on wide screens
- * `/inbox/config` bounces to the setup rail, where the fleet section may never mount.
- */
+/** Hosts the `#createScout=` modal at the scene level, so it opens from any tab, not just the roster. */
function ScoutTemplateDraftModal(): JSX.Element | null {
const { scoutTemplateDraft } = useValues(inboxSceneLogic)
const { setScoutTemplateDraft } = useActions(inboxSceneLogic)
@@ -71,145 +67,86 @@ function ScoutTemplateDraftModal(): JSX.Element | null {
)
}
-/** Min scene-container width at which the setup rail fits beside the list. */
-const SETUP_RAIL_MIN_PX = 1024
-
-/** Tabs that show the centered report list (scope chrome in the header). Runs/Configuration are special. */
-function isReportListTab(tab: InboxTabKey): boolean {
- return tab === 'pulls' || tab === 'reports' || tab === 'not-actionable' || tab === 'archived'
-}
-
-function ActiveTabBody({
- tab,
- signalRuns,
- signalRunsLoading,
-}: {
- tab: InboxTabKey
- signalRuns: SignalRun[]
- signalRunsLoading: boolean
-}): JSX.Element {
+function ActiveTabBody({ tab }: { tab: InboxTabKey }): JSX.Element | null {
switch (tab) {
- case 'pulls':
- return <PullRequestsTab />
case 'reports':
return <ReportsTab />
- case 'not-actionable':
- return <NotActionableTab />
- case 'archived':
- return <ArchivedTab />
case 'scouts':
return <ScoutsRoster />
- case 'runs':
- return <RunsTab runs={signalRuns} loading={signalRunsLoading} />
- case 'config':
- return <AgentSetupColumn layout="stacked" />
+ case 'settings':
+ return <SettingsTab />
+ // Legacy tab segments are redirected before they can become active under the redesign.
+ default:
+ return null
}
}
/**
- * List view: a tab bar + scope select over the active tab's body, with the agent-setup
- * widgets to the right as a rail when the scene is wide enough (≥ ~72rem). Below that width
- * the rail is dropped and the widgets live in a Configuration tab instead. Each flat report
- * tab (Pull requests / Reports / Not actionable) owns its own filtered request, count,
- * search/filter chrome, and pagination via the keyed `reportListLogic`. Runs is project-wide
- * and chrome-less.
+ * List view: the page tab bar (Reports / Scouts / Settings) over the active tab's body. The Reports
+ * tab owns its filters and keyed report lists; Scouts is the roster in the same column;
+ * Settings is every agent-setup control on one page.
*/
function InboxListView(): JSX.Element {
- const { activeTab, signalRuns, signalRunsLoading } = useValues(inboxSceneLogic)
+ const { activeTab } = useValues(inboxSceneLogic)
const { onboardingMode, isWelcomeRedesign } = useValues(inboxOnboardingLogic)
- const { ref: widthRef, size } = useResizeBreakpoints(
- { 0: 'narrow', [SETUP_RAIL_MIN_PX]: 'wide' },
- { initialSize: 'wide' }
- )
- const wide = size === 'wide'
// Self-driving isn't set up and the inbox is empty: the inbox becomes a single locked "Welcome"
- // tab (the other tabs are visible but disabled) whose body is the onboarding card. The setup rail
- // is dropped too, so the onboarding is the whole story – just run the one command.
+ // tab (the other tabs are visible but disabled) whose body is the onboarding card, so the
+ // onboarding is the whole story – just run the one command.
const onboarding = onboardingMode === 'takeover'
- // The takeover verdict is still settling: commit to neither UI. Rendering the tab bar or the
- // rail here is what caused the normal inbox to flash in and get replaced by the welcome page.
+ // The takeover verdict is still settling: commit to neither UI. Rendering the tab bar here is
+ // what caused the normal inbox to flash in and get replaced by the welcome page.
const pending = onboardingMode === 'pending'
- // The Scouts tab is a full-width table, and the rail's own scout widget just links here — so
- // the rail would be both redundant and the reason the table has nowhere to breathe.
- const showRail = wide && !onboarding && !pending && activeTab !== 'scouts'
- // The rail and the Configuration tab are mutually exclusive – never leave 'config' active
- // (e.g. via a deep link) while the rail shows, or the rail and a config body would both appear.
- const effectiveTab = showRail && activeTab === 'config' ? 'pulls' : activeTab
- // Runs and Configuration don't render `InboxReportList`, so `Inbox viewed` never fires for them.
- // Same once-per-visit guard as the report list: hold Runs until its load settles so the count is real.
- const panelViewFiredRef = useRef<string | null>(null)
+ // Settings renders no report list, so `Inbox viewed` never fires for it. Same once-per-visit
+ // guard as the report list. The panel name predates the tab's rename (see `InboxPanelName`).
+ const panelViewFiredRef = useRef<InboxTabKey | null>(null)
useEffect(() => {
- if (effectiveTab !== 'runs' && effectiveTab !== 'config') {
+ if (activeTab !== 'settings' || onboarding || pending) {
panelViewFiredRef.current = null
return
}
- if (effectiveTab === 'runs' && signalRunsLoading) {
- return
- }
- if (panelViewFiredRef.current === effectiveTab) {
+ if (panelViewFiredRef.current === activeTab) {
return
}
- panelViewFiredRef.current = effectiveTab
- captureInboxPanelViewed({
- panel: effectiveTab,
- itemCount: effectiveTab === 'runs' ? signalRuns.length : null,
- })
- }, [effectiveTab, signalRunsLoading, signalRuns.length])
+ panelViewFiredRef.current = activeTab
+ captureInboxPanelViewed({ panel: 'config' })
+ }, [activeTab, onboarding, pending])
return (
- <div ref={widthRef} className="flex min-h-0 flex-1">
- <div className="flex flex-col min-h-0 flex-1 min-w-0">
- {/* pl-5 (20px) aligns the first tab label with the SceneTitleSection description above;
- pr-6 matches the report list's px-6 so the scope select shares the list's right edge. */}
- {/* The redesigned welcome (experiment test arm) is a full-pane page with no tab
- row at all; control keeps the locked "Welcome" tab over the disabled real tabs. */}
- {!isWelcomeRedesign && !pending && (
- <div className="flex items-end justify-between gap-2 border-b border-primary pl-5 pr-6 shrink-0">
- <InboxTabBar showConfigTab={!wide} onboarding={onboarding} />
- {!onboarding && isReportListTab(effectiveTab) && (
- <div className="pb-1.5">
- <InboxScopeSelect />
- </div>
- )}
+ <div className="flex flex-col min-h-0 flex-1 min-w-0">
+ {/* pl-5 (20px) aligns the first tab label with the SceneTitleSection description above. */}
+ {/* The redesigned welcome (experiment test arm) is a full-pane page with no tab
+ row at all; control keeps the locked "Welcome" tab over the disabled real tabs. */}
+ {!isWelcomeRedesign && !pending && (
+ <div className="border-b border-primary pl-5 pr-6 shrink-0">
+ <InboxTabBar onboarding={onboarding} />
+ </div>
+ )}
+ <div className="flex-1 overflow-auto min-h-0">
+ {pending ? (
+ <div className="mx-auto max-w-4xl px-6 py-4">
+ <CardSkeleton count={4} variant="cards" />
</div>
- )}
- <div className="flex-1 overflow-auto min-h-0">
- {pending ? (
- <div className="mx-auto max-w-4xl px-6 py-4">
- <CardSkeleton count={4} variant="cards" />
- </div>
- ) : onboarding ? (
- isWelcomeRedesign ? (
- <InboxWelcomeRedesign />
- ) : (
- <InboxOnboardingTakeover />
- )
+ ) : onboarding ? (
+ isWelcomeRedesign ? (
+ <InboxWelcomeRedesign />
) : (
- <ActiveTabBody
- tab={effectiveTab}
- signalRuns={signalRuns}
- signalRunsLoading={signalRunsLoading}
- />
- )}
- </div>
+ <InboxOnboardingTakeover />
+ )
+ ) : (
+ <ActiveTabBody tab={activeTab} />
+ )}
</div>
- {showRail && (
- <aside className="shrink-0 w-80 overflow-auto min-h-0 border-l border-primary">
- <AgentSetupColumn layout="rail" />
- </aside>
- )}
</div>
)
}
/**
- * Detail view: replaces the list full-width. Report / PR / Not actionable render the unified
- * `ReportDetail`, which owns its own merged header (back link, title, copy link). The Runs tab no
- * longer opens an in-inbox detail — its rows link out to the standalone Tasks scene.
+ * Detail view: replaces the list full-width. Renders the unified `ReportDetail`, which owns its own
+ * header (back link, actions) and the evidence-first two-column layout.
*/
function InboxDetailView({ report }: { report: SignalReport }): JSX.Element {
- const { activeTab } = useValues(inboxSceneLogic)
+ const { activeTab, isRedesign } = useValues(inboxSceneLogic)
const { reportDetailScrolled } = useActions(inboxSceneLogic)
// Report only the first scroll per report to the logic (which fires `Inbox report scrolled` once),
// so a fast native scroll doesn't dispatch an action on every frame.
@@ -217,7 +154,11 @@ function InboxDetailView({ report }: { report: SignalReport }): JSX.Element {
return (
<div
- className="flex flex-col min-h-0 flex-1 overflow-auto"
+ className={
+ isRedesign
+ ? '-mt-2 flex flex-col min-h-0 flex-1 overflow-auto'
+ : 'flex flex-col min-h-0 flex-1 overflow-auto'
+ }
onScroll={() => {
if (scrolledReportRef.current !== report.id) {
scrolledReportRef.current = report.id
@@ -226,14 +167,18 @@ function InboxDetailView({ report }: { report: SignalReport }): JSX.Element {
}}
>
{/* Key on the report so per-report detail state (e.g. the active diff tab) resets on navigation. */}
- <ReportDetail key={report.id} report={report} tab={activeTab} />
+ {isRedesign ? (
+ <ReportDetail key={report.id} report={report} />
+ ) : (
+ <ReportDetailLegacy key={report.id} report={report} tab={activeTab} />
+ )}
</div>
)
}
/**
- * Shared chrome for the full-width scout panels (scratchpad, findings): a "Scouts" back link over the
- * panel body, rendered full-width over the list like the scout detail. Reached from their callouts.
+ * Shared chrome for the full-width scout panels (scratchpad, findings, runs): a "Scouts" back link
+ * over the panel body, rendered full-width over the list like the scout detail.
*/
function InboxPanelView({ onBack, children }: { onBack: () => void; children: JSX.Element }): JSX.Element {
return (
@@ -254,6 +199,22 @@ function InboxPanelView({ onBack, children }: { onBack: () => void; children: JS
)
}
+/** The runs panel body, with its own once-per-open view event since it renders no report list. */
+function InboxRunsPanel(): JSX.Element {
+ const { signalRuns, signalRunsLoading } = useValues(inboxSceneLogic)
+ // Hold until the load settles so the count is real.
+ const panelViewFiredRef = useRef(false)
+ useEffect(() => {
+ if (signalRunsLoading || panelViewFiredRef.current) {
+ return
+ }
+ panelViewFiredRef.current = true
+ captureInboxPanelViewed({ panel: 'runs', itemCount: signalRuns.length })
+ }, [signalRunsLoading, signalRuns.length])
+
+ return <RunsTab runs={signalRuns} loading={signalRunsLoading} />
+}
+
export function InboxScene(): JSX.Element {
const {
activeTab,
@@ -263,8 +224,11 @@ export function InboxScene(): JSX.Element {
selectedScoutSkillName,
isScratchpadOpen,
isFindingsOpen,
+ isRunsOpen,
+ isTriageOpen,
+ isRedesign,
} = useValues(inboxSceneLogic)
- const { setScratchpadOpen, setFindingsOpen } = useActions(inboxSceneLogic)
+ const { setScratchpadOpen, setFindingsOpen, setRunsOpen } = useActions(inboxSceneLogic)
const { onboardingMode, isWelcomeRedesign } = useValues(inboxOnboardingLogic)
const { searchParams } = useValues(router)
@@ -274,13 +238,29 @@ export function InboxScene(): JSX.Element {
const backOverride =
typeof rawBack === 'string' && rawBack.startsWith('/') && !rawBack.startsWith('//') ? rawBack : null
- // Detail routes (report or scout) render full-width over the list (desktop parity), but the list view
- // stays *mounted* (just hidden) rather than being unmounted. That keeps `reportListLogic` and the scroll
- // container alive, so clicking "back" lands on the same scroll position with the same loaded pages —
- // instead of remounting and resetting to the first page at the top.
- const showDetail = !!selectedReportId || !!selectedScoutSkillName || isScratchpadOpen || isFindingsOpen
+ // Full-width surfaces (report, scout, the scout panels, runs, triage mode) render over the list,
+ // but the list view stays *mounted* (just hidden) rather than being unmounted. That keeps
+ // `reportListLogic` and the scroll container alive, so clicking "back" lands on the same scroll
+ // position with the same loaded pages — instead of remounting and resetting to the first page.
+ const showDetail =
+ !!selectedReportId ||
+ !!selectedScoutSkillName ||
+ isScratchpadOpen ||
+ isFindingsOpen ||
+ isRunsOpen ||
+ isTriageOpen
+
+ // `t` opens triage mode from the report list. Not while a surface covers the list, not while
+ // the inbox is locked behind onboarding, and not with the flag off (there is no triage mode).
+ const listInteractive = isRedesign && !showDetail && activeTab === 'reports' && onboardingMode === 'none'
+ useKeyboardHotkeys(
+ {
+ t: { action: () => router.actions.push(urls.inboxTriage()), disabled: !listInteractive },
+ },
+ [listInteractive]
+ )
- // The two scout panels replace the list without going through any tab, so they'd otherwise leave
+ // The scout panels replace the list without going through any tab, so they'd otherwise leave
// no trace at all. The scout detail reports itself (it has the config to describe).
useEffect(() => {
if (isFindingsOpen) {
@@ -310,7 +290,7 @@ export function InboxScene(): JSX.Element {
? isWelcomeRedesign
? null
: 'Self-driving for your product. Look through code changes and reports from PostHog agents.'
- : INBOX_TAB_DESCRIPTION[activeTab]
+ : (isRedesign ? INBOX_TAB_DESCRIPTION : INBOX_LEGACY_TAB_DESCRIPTION)[activeTab]
}
resourceType={{ type: 'inbox' }}
// Creating a scout is the Scouts tab's primary action, so it sits in the scene
@@ -329,13 +309,15 @@ export function InboxScene(): JSX.Element {
isn't set up, the list view itself swaps in a locked "Welcome" onboarding tab; the
banner sits above the otherwise-normal inbox when there's already work to keep. */}
{onboardingMode === 'banner' && <InboxOnboardingBanner />}
- <InboxListView />
+ {isRedesign ? <InboxListView /> : <InboxListViewLegacy />}
</div>
</div>
{showDetail && (
<div className="flex flex-col -mx-4 flex-1 min-h-0">
- {isFindingsOpen ? (
+ {isTriageOpen ? (
+ <InboxTriageView />
+ ) : isFindingsOpen ? (
<InboxPanelView onBack={() => setFindingsOpen(false)}>
<FindingsPanel />
</InboxPanelView>
@@ -343,14 +325,24 @@ export function InboxScene(): JSX.Element {
<InboxPanelView onBack={() => setScratchpadOpen(false)}>
<ScratchpadPanel />
</InboxPanelView>
+ ) : isRunsOpen ? (
+ <InboxPanelView onBack={() => setRunsOpen(false)}>
+ <InboxRunsPanel />
+ </InboxPanelView>
) : selectedScoutSkillName ? (
<ScoutDetailView skillName={selectedScoutSkillName} />
) : selectedReport ? (
<InboxDetailView report={selectedReport} />
) : selectedReportLoading ? (
- <div className="flex flex-col min-h-0 flex-1 overflow-auto">
- <ReportDetailSkeleton />
- </div>
+ isRedesign ? (
+ <div className="-mt-2 flex flex-col min-h-0 flex-1 overflow-auto">
+ <ReportDetailSkeleton />
+ </div>
+ ) : (
+ <div className="flex flex-col min-h-0 flex-1 overflow-auto">
+ <ReportDetailSkeletonLegacy />
+ </div>
+ )
) : (
<div className="flex flex-1 flex-col items-center justify-center gap-3 text-center">
<div>
@@ -359,7 +351,10 @@ export function InboxScene(): JSX.Element {
This report does not exist. It may have been removed.
</p>
</div>
- <LemonButton type="secondary" to={backOverride ?? urls.inbox(activeTab)}>
+ <LemonButton
+ type="secondary"
+ to={backOverride ?? urls.inbox(isRedesign ? 'reports' : activeTab)}
+ >
{backOverride ? 'Back' : 'Back to inbox'}
</LemonButton>
</div>
diff --git a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts b/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
index bcc77466d4d0..1e280854fbf7 100644
--- a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
+++ b/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
@@ -471,7 +471,11 @@ export function mockBranchDiff(): { diff: string; truncated: boolean } {
index 1a2b3c4..5d6e7f8 100644
--- a/frontend/src/scenes/invites/inviteLogic.ts
+++ b/frontend/src/scenes/invites/inviteLogic.ts
-@@ -42,9 +42,13 @@ export const inviteLogic = kea<inviteLogicType>([
+@@ -3,2 +3,3 @@ import { actions, kea, listeners, path, reducers } from 'kea'
+ import api from 'lib/api'
++import { lemonToast } from 'lib/lemon-ui/LemonToast'
+ import type { inviteLogicType } from './inviteLogicType'
+@@ -42,7 +43,11 @@ export const inviteLogic = kea<inviteLogicType>([
listeners(({ values, actions }) => ({
submitInvites: async () => {
- const recipients = values.invites
@@ -488,19 +492,97 @@ diff --git a/frontend/src/scenes/invites/InviteRow.tsx b/frontend/src/scenes/inv
index 9c8b7a6..2f3e4d5 100644
--- a/frontend/src/scenes/invites/InviteRow.tsx
+++ b/frontend/src/scenes/invites/InviteRow.tsx
-@@ -10,7 +10,7 @@ export function InviteRow({ invite, onChange }: InviteRowProps): JSX.Element {
+@@ -10,8 +10,9 @@ export function InviteRow({ invite, onChange }: InviteRowProps): JSX.Element {
return (
<div className="flex items-center gap-2">
<LemonInput
-- value={invite.email}
-+ value={invite.email}
+ value={invite.email}
+ status={invite.email.trim() ? undefined : 'danger'}
onChange={(email) => onChange({ ...invite, email })}
placeholder="[email protected]"
/>
</div>
- )
- }
+diff --git a/frontend/src/scenes/invites/inviteLogic.test.ts b/frontend/src/scenes/invites/inviteLogic.test.ts
+new file mode 100644
+index 0000000..3b1f0c2
+--- /dev/null
++++ b/frontend/src/scenes/invites/inviteLogic.test.ts
+@@ -0,0 +1,22 @@
++import { expectLogic } from 'kea-test-utils'
++
++import api from 'lib/api'
++
++import { initKeaTests } from '~/test/init'
++
++import { inviteLogic } from './inviteLogic'
++
++describe('inviteLogic', () => {
++ beforeEach(() => {
++ initKeaTests()
++ jest.spyOn(api.invites, 'bulkCreate').mockResolvedValue([])
++ })
++
++ it('skips the request when every recipient is blank', async () => {
++ const logic = inviteLogic()
++ logic.mount()
++ logic.actions.setInvites([{ email: ' ' }])
++ await expectLogic(logic, () => logic.actions.submitInvites()).toFinishAllListeners()
++ expect(api.invites.bulkCreate).not.toHaveBeenCalled()
++ })
++})
+diff --git a/frontend/src/scenes/invites/InviteFormLegacy.tsx b/frontend/src/scenes/invites/InviteFormLegacy.tsx
+deleted file mode 100644
+index 6e5d4c3..0000000
+--- a/frontend/src/scenes/invites/InviteFormLegacy.tsx
++++ /dev/null
+@@ -1,15 +0,0 @@
+-import { LemonButton, LemonInput } from '@posthog/lemon-ui'
+-import { useState } from 'react'
+-
+-/** Single-recipient invite form. Replaced by the multi-row InviteRow list. */
+-export function InviteFormLegacy({ onSubmit }: { onSubmit: (email: string) => void }): JSX.Element {
+- const [email, setEmail] = useState('')
+- return (
+- <form onSubmit={() => onSubmit(email)} className="flex gap-2">
+- <LemonInput value={email} onChange={setEmail} placeholder="[email protected]" />
+- <LemonButton type="primary" htmlType="submit">
+- Invite
+- </LemonButton>
+- </form>
+- )
+-}
+diff --git a/posthog/api/organization_invite.py b/posthog/api/organization_invite.py
+index 7d1e2f3..a9b8c7d 100644
+--- a/posthog/api/organization_invite.py
++++ b/posthog/api/organization_invite.py
+@@ -118,6 +118,10 @@ class OrganizationInviteViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
+ @action(methods=["POST"], detail=False)
+ def bulk(self, request: Request, **kwargs: Any) -> Response:
+ data = request.data if isinstance(request.data, list) else []
++ if not data:
++ raise ValidationError(
++ {"target_email": "Add at least one recipient before sending invites."}, code="required"
++ )
+ serializer = OrganizationInviteSerializer(data=data, many=True, context=self.get_serializer_context())
+ serializer.is_valid(raise_exception=True)
+ serializer.save()
+diff --git a/posthog/api/test/test_organization_invite.py b/posthog/api/test/test_organization_invite.py
+index 4c5d6e7..8f9a0b1 100644
+--- a/posthog/api/test/test_organization_invite.py
++++ b/posthog/api/test/test_organization_invite.py
+@@ -241,6 +241,12 @@ class TestOrganizationInvitesAPI(APIBaseTest):
+ self.assertEqual(response.status_code, status.HTTP_201_CREATED)
+ self.assertEqual(OrganizationInvite.objects.count(), 3)
+
++ def test_bulk_create_rejects_an_empty_payload(self):
++ response = self.client.post("/api/organizations/@current/invites/bulk/", [], format="json")
++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
++ self.assertEqual(response.json()["attr"], "target_email")
++ self.assertEqual(OrganizationInvite.objects.count(), 0)
++
+ def test_bulk_create_reports_invalid_emails(self):
+ response = self.client.post(
+ "/api/organizations/@current/invites/bulk/",
`
return { diff, truncated: false }
}
diff --git a/products/signals/frontend/inbox/components/InboxReportList.test.tsx b/products/signals/frontend/inbox/components/InboxReportList.test.tsx
index d5b1b29244cb..ae21a2e9d1ce 100644
--- a/products/signals/frontend/inbox/components/InboxReportList.test.tsx
+++ b/products/signals/frontend/inbox/components/InboxReportList.test.tsx
@@ -5,7 +5,6 @@ import { act, cleanup, render, screen, waitFor } from '@testing-library/react'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
-import { INBOX_FLAT_TAB_LIST_PARAMS } from '../logics/reportListLogic'
import { SignalReport, SignalReportStatus } from '../types'
import { InboxReportList, InboxReportCardProps } from './InboxReportList'
@@ -89,14 +88,7 @@ describe('InboxReportList', () => {
afterEach(cleanup)
it('keeps paging once the sentinel scrolls into view', async () => {
- render(
- <InboxReportList
- tabKey="reports"
- listParams={INBOX_FLAT_TAB_LIST_PARAMS.reports}
- Card={StubCard}
- emptyState={{ content: <div>empty</div> }}
- />
- )
+ render(<InboxReportList tabKey="reports" Card={StubCard} emptyState={{ content: <div>empty</div> }} />)
await screen.findByText('Report page-1')
// The sentinel only enters the DOM after the first page lands, so the observer has to
diff --git a/products/signals/frontend/inbox/components/InboxReportList.tsx b/products/signals/frontend/inbox/components/InboxReportList.tsx
index 8d0344393f7e..996b34a06934 100644
--- a/products/signals/frontend/inbox/components/InboxReportList.tsx
+++ b/products/signals/frontend/inbox/components/InboxReportList.tsx
@@ -4,8 +4,8 @@ import { ComponentType, JSX, useCallback, useEffect, useRef } from 'react'
import { captureInboxReportsImpressed, captureInboxViewed } from '../inboxAnalytics'
import { inboxSceneLogic } from '../inboxSceneLogic'
import { inboxFiltersLogic } from '../logics/inboxFiltersLogic'
-import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic, ReportListLogicProps } from '../logics/reportListLogic'
-import { InboxFlatListTabKey, SignalReport } from '../types'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic, ReportListLogicProps } from '../logics/reportListLogic'
+import { INBOX_LEGACY_TAB_SECTION, InboxFlatListTabKey, InboxReportSectionKey, SignalReport } from '../types'
import { DismissalReasonValue } from '../utils/dismissalReasons'
import { CardSkeleton } from './cards/CardSkeleton'
import { InboxBulkSelectionBar } from './shell/InboxBulkSelectionBar'
@@ -13,7 +13,7 @@ import { InboxSearchFilterBar } from './shell/InboxSearchFilterBar'
export interface InboxReportCardProps {
report: SignalReport
- tabKey: InboxFlatListTabKey
+ sectionKey: InboxReportSectionKey
onArchive: (reason: DismissalReasonValue, note: string) => void
/** Restore a suppressed report back to the inbox. Only wired on the Archived tab. */
onRestore?: () => void
@@ -21,23 +21,30 @@ export interface InboxReportCardProps {
attached?: boolean
}
-interface InboxReportListProps extends ReportListLogicProps {
+interface InboxReportListProps {
+ tabKey: InboxFlatListTabKey
Card: ComponentType<InboxReportCardProps>
emptyState:
| { content: JSX.Element }
| { icon: JSX.Element; title: string; description: string; extra?: JSX.Element }
}
+/** The keyed list instance behind a legacy tab: the redesign's section with the same server filter. */
+function sectionLogicProps(tabKey: InboxFlatListTabKey): ReportListLogicProps {
+ const sectionKey = INBOX_LEGACY_TAB_SECTION[tabKey]
+ return { sectionKey, listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey] }
+}
+
/**
- * Shared body for the three flat report-list tabs (Pull requests / Reports /
- * Not actionable). Each is the same primitive – only the `listParams` filter and
+ * Shared body for the flat report-list tabs shown with the redesign flag off (Pull requests /
+ * Reports / Not actionable / Archive). Each is the same primitive – only the server filter and
* the empty-state copy differ. Binds the keyed `reportListLogic`, loads the first
* page lazily on mount, shows a skeleton while a known-non-empty tab loads, and
* appends pages via an IntersectionObserver sentinel.
*/
export function InboxReportList(props: InboxReportListProps): JSX.Element {
return (
- <BindLogic logic={reportListLogic} props={{ tabKey: props.tabKey, listParams: props.listParams }}>
+ <BindLogic logic={reportListLogic} props={sectionLogicProps(props.tabKey)}>
<InboxReportListInner {...props} />
</BindLogic>
)
@@ -58,10 +65,10 @@ function InboxReportListInner({ tabKey, Card, emptyState }: InboxReportListProps
// active tab's `total_count` alone says nothing about a user who lands on Pull requests and has
// 200 reports waiting. These share the tab bar's keyed instances, so no extra requests.
const { count: pullsTabCount, countLoading: pullsTabCountLoading } = useValues(
- reportListLogic({ tabKey: 'pulls', listParams: INBOX_FLAT_TAB_LIST_PARAMS.pulls })
+ reportListLogic(sectionLogicProps('pulls'))
)
const { count: reportsTabCount, countLoading: reportsTabCountLoading } = useValues(
- reportListLogic({ tabKey: 'reports', listParams: INBOX_FLAT_TAB_LIST_PARAMS.reports })
+ reportListLogic(sectionLogicProps('reports'))
)
// A badge count is settled once its request is no longer in flight: loaded, refreshed, or failed
// (count stays null). Waiting on the loading flags rather than non-null values means a scope or
@@ -209,7 +216,7 @@ function InboxReportListInner({ tabKey, Card, emptyState }: InboxReportListProps
<Card
key={report.id}
report={report}
- tabKey={tabKey}
+ sectionKey={INBOX_LEGACY_TAB_SECTION[tabKey]}
onArchive={(reason, note) => archiveReport(report.id, reason, note)}
onRestore={() => restoreReport(report.id)}
/>
diff --git a/products/signals/frontend/inbox/components/InboxReportSection.test.tsx b/products/signals/frontend/inbox/components/InboxReportSection.test.tsx
new file mode 100644
index 000000000000..2b37a2e47979
--- /dev/null
+++ b/products/signals/frontend/inbox/components/InboxReportSection.test.tsx
@@ -0,0 +1,140 @@
+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { inboxReportSectionsLogic } from '../logics/inboxReportSectionsLogic'
+import { SignalReportStatus } from '../types'
+import { InboxReportSection } from './InboxReportSection'
+
+// The card and the impression log are unrelated to when rows are fetched, and both pull in the
+// whole inbox scene.
+jest.mock('./cards/ReportCard', () => ({
+ ReportCard: ({ report }: { report: { id: string; title: string } }) => <div>{report.title}</div>,
+}))
+jest.mock('./useReportImpressions', () => ({ useReportImpressions: () => undefined }))
+
+describe('InboxReportSection', () => {
+ let pageRequests: number
+
+ beforeEach(() => {
+ // Section expand/collapse persists to localStorage, which initKeaTests does not clear — wipe
+ // it so each test starts from the default open/closed state rather than a prior test's toggle.
+ localStorage.clear()
+ pageRequests = 0
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ '/api/projects/:team_id/signals/reports/': ({ request }) => {
+ // The header count is a separate count-only request, and a collapsed section is
+ // still entitled to make it.
+ if (new URL(request.url).searchParams.get('limit') !== '1') {
+ pageRequests += 1
+ }
+ return [
+ 200,
+ {
+ count: 1,
+ next: null,
+ previous: null,
+ results: [
+ {
+ id: 'r1',
+ title: 'A report',
+ summary: 'summary',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ },
+ ],
+ },
+ ]
+ },
+ },
+ })
+ initKeaTests()
+ })
+
+ afterEach(cleanup)
+
+ // Four sections render at once. If a collapsed one loaded its rows anyway, every visit would
+ // pull a full page per section for content nobody asked to see.
+ it('loads rows only once the section is expanded', async () => {
+ // Resolved starts collapsed.
+ render(<InboxReportSection sectionKey="resolved" />)
+
+ await screen.findByText('Resolved')
+ expect(screen.queryByText('A report')).not.toBeInTheDocument()
+ expect(pageRequests).toBe(0)
+
+ inboxReportSectionsLogic.findMounted()?.actions.toggleSection('resolved')
+
+ await screen.findByText('A report')
+ await waitFor(() => expect(pageRequests).toBe(1))
+ })
+
+ // A failed first fetch leaves `reportsResponse` null, so the section used to skeleton forever with
+ // no way to recover. It must show a retry instead.
+ it('shows a retry instead of a stuck skeleton when the first fetch fails', async () => {
+ let failPage = true
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ '/api/projects/:team_id/signals/reports/': ({ request }) => {
+ // The header count is a separate request that keeps working.
+ if (new URL(request.url).searchParams.get('limit') === '1') {
+ return [200, { count: 1, next: null, previous: null, results: [] }]
+ }
+ if (failPage) {
+ return [500, {}]
+ }
+ return [
+ 200,
+ {
+ count: 1,
+ next: null,
+ previous: null,
+ results: [
+ {
+ id: 'r1',
+ title: 'A report',
+ summary: 'summary',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ },
+ ],
+ },
+ ]
+ },
+ },
+ })
+
+ render(<InboxReportSection sectionKey="resolved" />)
+ await screen.findByText('Resolved')
+ inboxReportSectionsLogic.findMounted()?.actions.toggleSection('resolved')
+
+ // The failed load surfaces a retry, not a permanent skeleton.
+ await screen.findByText("Couldn't load these reports.")
+
+ // Retrying now succeeds and the row lands, clearing the error.
+ failPage = false
+ fireEvent.click(screen.getByText('Retry'))
+
+ await screen.findByText('A report')
+ expect(screen.queryByText("Couldn't load these reports.")).not.toBeInTheDocument()
+ })
+})
diff --git a/products/signals/frontend/inbox/components/InboxReportSection.tsx b/products/signals/frontend/inbox/components/InboxReportSection.tsx
new file mode 100644
index 000000000000..f9c27ee0095d
--- /dev/null
+++ b/products/signals/frontend/inbox/components/InboxReportSection.tsx
@@ -0,0 +1,156 @@
+import { BindLogic, useActions, useValues } from 'kea'
+import { JSX, useEffect } from 'react'
+
+import { IconChevronDown } from '@posthog/icons'
+import { LemonButton, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+
+import { inboxReportSectionsLogic } from '../logics/inboxReportSectionsLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from '../logics/reportListLogic'
+import {
+ INBOX_REPORT_SECTION_DESCRIPTION,
+ INBOX_REPORT_SECTION_LABEL,
+ INBOX_REPORT_SECTION_TAG,
+ InboxReportSectionKey,
+} from '../types'
+import { CardSkeleton } from './cards/CardSkeleton'
+import { ReportCard } from './cards/ReportCard'
+import { useReportImpressions } from './useReportImpressions'
+
+/** Copy shown in place of the rows when a section matches nothing. */
+const EMPTY_SECTION_COPY: Record<InboxReportSectionKey, string> = {
+ 'needs-decision': 'No reports are waiting for a pull request.',
+ monitoring: 'No pull requests open yet. Start one from a report above.',
+ resolved: 'Nothing resolved or archived yet.',
+ 'not-actionable': 'Nothing has been judged not actionable.',
+}
+
+/**
+ * One section of the Reports list: a collapsible run of report cards over its own filtered request.
+ * The header carries the section's count whether or not it is expanded, so a collapsed section still
+ * says how much is behind it; the rows themselves only load once it opens.
+ */
+export function InboxReportSection({ sectionKey }: { sectionKey: InboxReportSectionKey }): JSX.Element {
+ return (
+ <BindLogic
+ logic={reportListLogic}
+ props={{ sectionKey, listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey] }}
+ >
+ <section className="flex flex-col gap-2">
+ <SectionHeader sectionKey={sectionKey} />
+ <SectionBody sectionKey={sectionKey} />
+ </section>
+ </BindLogic>
+ )
+}
+
+function SectionHeader({ sectionKey }: { sectionKey: InboxReportSectionKey }): JSX.Element {
+ const { count, countLoading } = useValues(reportListLogic)
+ const { openSections } = useValues(inboxReportSectionsLogic)
+ const { toggleSection } = useActions(inboxReportSectionsLogic)
+ const isOpen = openSections[sectionKey]
+ const tag = INBOX_REPORT_SECTION_TAG[sectionKey]
+
+ return (
+ <button
+ type="button"
+ className="flex w-full cursor-pointer items-center gap-2 rounded px-0.5 py-1 text-left"
+ onClick={() => toggleSection(sectionKey)}
+ aria-expanded={isOpen}
+ title={INBOX_REPORT_SECTION_DESCRIPTION[sectionKey]}
+ data-attr={`inbox-report-section-${sectionKey}`}
+ >
+ <span className="flex items-center gap-1 font-mono text-[11px] font-semibold uppercase tracking-widest text-secondary">
+ {INBOX_REPORT_SECTION_LABEL[sectionKey]}
+ {/* Skeleton only while the request is genuinely in flight; on failure `count` stays
+ null, so fall back to the number (0) rather than a permanent skeleton. */}
+ {count === null && countLoading ? (
+ <LemonSkeleton className="h-3 w-4 rounded" />
+ ) : (
+ <span className="tabular-nums">({count ?? 0})</span>
+ )}
+ </span>
+ {tag && (
+ <LemonTag type="completion" size="small">
+ {tag}
+ </LemonTag>
+ )}
+ <div className="h-px flex-1 bg-border-primary" />
+ <IconChevronDown className={cn('text-tertiary transition-transform', isOpen && 'rotate-180')} />
+ </button>
+ )
+}
+
+function SectionBody({ sectionKey }: { sectionKey: InboxReportSectionKey }): JSX.Element | null {
+ const { visibleReports, hiddenReportCount, count, isLoaded, reportsLoadFailed, reportsResponseLoading } =
+ useValues(reportListLogic)
+ const { ensureLoaded, showMore, restoreReport } = useActions(reportListLogic)
+ const { openSections } = useValues(inboxReportSectionsLogic)
+ const isOpen = openSections[sectionKey]
+
+ useReportImpressions(sectionKey, isOpen)
+
+ // Rows are fetched on first expand, not on mount — a collapsed section costs one count request.
+ useEffect(() => {
+ if (isOpen) {
+ ensureLoaded()
+ }
+ }, [isOpen, ensureLoaded])
+
+ if (!isOpen) {
+ return null
+ }
+ // The first fetch failed: kea loaders keep the response null, so `isLoaded` never flips. Show a
+ // retry instead of a skeleton that would otherwise spin forever with no way to recover.
+ if (!isLoaded && reportsLoadFailed) {
+ return (
+ <div className="flex flex-col items-start gap-2 px-1 py-2">
+ <p className="m-0 text-sm text-tertiary">Couldn't load these reports.</p>
+ <LemonButton
+ size="small"
+ type="secondary"
+ onClick={() => ensureLoaded()}
+ data-attr={`inbox-report-section-retry-${sectionKey}`}
+ >
+ Retry
+ </LemonButton>
+ </div>
+ )
+ }
+ // Loading, then empty, then content: `reports` is empty during the first fetch too, and a
+ // section that is about to show ten rows must not flash "nothing here" on the way.
+ if (!isLoaded) {
+ return <CardSkeleton count={Math.min(count || 3, 5)} variant="cards" dashed={sectionKey !== 'monitoring'} />
+ }
+ if (visibleReports.length === 0) {
+ return <p className="px-1 py-2 text-sm text-tertiary">{EMPTY_SECTION_COPY[sectionKey]}</p>
+ }
+
+ return (
+ <div className="flex flex-col gap-1.5">
+ {visibleReports.map((report) => (
+ <ReportCard
+ key={report.id}
+ report={report}
+ sectionKey={sectionKey}
+ onRestore={() => restoreReport(report.id)}
+ />
+ ))}
+ {hiddenReportCount > 0 && (
+ <div className="flex justify-center pt-1">
+ <LemonButton
+ size="small"
+ type="tertiary"
+ onClick={showMore}
+ loading={reportsResponseLoading}
+ disabledReason={reportsResponseLoading ? 'Loading more reports' : undefined}
+ data-attr={`inbox-report-section-show-more-${sectionKey}`}
+ >
+ Show more ({hiddenReportCount})
+ </LemonButton>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/cards/AgentRunCard.tsx b/products/signals/frontend/inbox/components/cards/AgentRunCard.tsx
index e56bd3ef82a5..a438c2887213 100644
--- a/products/signals/frontend/inbox/components/cards/AgentRunCard.tsx
+++ b/products/signals/frontend/inbox/components/cards/AgentRunCard.tsx
@@ -55,7 +55,7 @@ export function AgentRunCard({ report }: { report: SignalReport }): JSX.Element
return (
<Link
- to={urls.inboxReport('runs', report.id)}
+ to={urls.inboxReport('reports', report.id)}
className="group flex w-full items-start gap-3 rounded border border-primary bg-surface-primary px-4 py-3.5 text-left text-inherit no-underline transition-colors duration-150 hover:border-primary hover:bg-surface-secondary"
>
<RunStatusIndicator variant={variant} className="mt-0.5" />
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
index e127fcb26137..99ac663e6bed 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
@@ -2,6 +2,11 @@ import '@testing-library/jest-dom'
import { cleanup, render } from '@testing-library/react'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+
+import { initKeaTests } from '~/test/init'
+
import { SignalReport, SignalReportStatus } from '../../types'
import { ReportCard } from './ReportCard'
@@ -29,8 +34,35 @@ function makeReport(overrides: Partial<SignalReport> = {}): SignalReport {
}
describe('ReportCard', () => {
+ beforeEach(() => {
+ initKeaTests()
+ featureFlagLogic.mount()
+ })
afterEach(cleanup)
+ // The redesign gives a row one action and leaves the status / actionability chips to the section
+ // headers; the legacy list keeps Archive, the "Review" label, and the chips.
+ it.each([
+ [true, 'View report', false],
+ [false, 'Review', true],
+ ])(
+ 'with the redesign flag %p shows %p and archive=chips=%p on a report without a PR',
+ (redesign, label, legacyChrome) => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: redesign,
+ })
+ const report = makeReport({
+ status: SignalReportStatus.CANDIDATE,
+ actionability: 'immediately_actionable',
+ })
+ const { getByText, queryByText } = render(<ReportCard report={report} />)
+ expect(getByText(label)).toBeInTheDocument()
+ expect(queryByText('Archive') !== null).toBe(legacyChrome)
+ expect(queryByText('Queued') !== null).toBe(legacyChrome)
+ expect(queryByText('Actionable') !== null).toBe(legacyChrome)
+ }
+ )
+
it('links the card to the report detail by default', () => {
const { container } = render(<ReportCard report={makeReport()} />)
expect(container.querySelector('a')).toHaveAttribute('href', expect.stringContaining('report-1'))
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
index 24f5ee001cc5..4d3be121fc27 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
@@ -1,18 +1,25 @@
import clsx from 'clsx'
-import { combineUrl, router } from 'kea-router'
+import { router } from 'kea-router'
import { IconArchive, IconUndo } from '@posthog/icons'
import { LemonButton, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { derivePrState } from 'lib/signals/prState'
import { ScoutLink } from 'lib/signals/ScoutLink'
import { scoutDisplayName } from 'lib/signals/signalCardSourceLine'
import { PrBadge } from 'lib/signals/SignalReportPrBadge'
-import { urls } from 'scenes/urls'
-import { InboxFlatListTabKey, SignalReport, SignalReportStatus, SignalSourceProduct } from '../../types'
+import {
+ INBOX_SECTION_LEGACY_TAB,
+ InboxReportSectionKey,
+ SignalReport,
+ SignalReportStatus,
+ SignalSourceProduct,
+} from '../../types'
import { dismissalReasonLabel, DismissalReasonValue } from '../../utils/dismissalReasons'
+import { inboxReportDetailUrl } from '../../utils/inboxReportUrls'
import {
deriveHeadline,
displayConventionalCommitTitle,
@@ -29,7 +36,8 @@ import {
SourceProductIconRow,
sourceProductsTooltipTitle,
} from '../badges/sourceProductIcons'
-import { inboxCardRowClassName, useReportArchive } from './useReportArchive'
+import { inboxCardRowClassName } from './inboxCardRowClassName'
+import { useReportArchive } from './useReportArchive'
// ── Shared card sub-components ────────────────────────────────────────────────
@@ -89,12 +97,20 @@ export function InboxCardSourceMeta({
/**
* Unified inbox list card for reports and pull requests. The presence of a parseable
* implementation PR (`hasPr`) drives the divergences: PR cards get a solid border, a
- * `#1234` state badge, the repo slug in the meta row, and no status/actionability chips;
- * plain reports get a dashed border, a summary placeholder, and the status/actionability chips.
+ * `#1234` state badge, the repo slug in the meta row, no status/actionability chips, and a
+ * "Review" action; plain reports get a dashed border, a summary placeholder, the
+ * status/actionability chips, and "View report".
+ *
+ * Under the redesign the inbox list gives a row one action, the one that moves the report forward;
+ * archiving lives in the report detail pane and the bulk selection bar, where what is being
+ * dismissed is in full view. Other surfaces that embed this card can still opt into a row-level
+ * Archive via `onArchive`. The redesign also drops the status and actionability chips: the section a
+ * row sits in (Needs a PR, Not actionable, ...) already says what they said. With the flag off every
+ * row keeps its chips, its Archive button, and the "Review" label.
*/
export function ReportCard({
report,
- tabKey = 'reports',
+ sectionKey = 'needs-decision',
attached = false,
onArchive,
onRestore,
@@ -102,8 +118,9 @@ export function ReportCard({
preview = false,
}: {
report: SignalReport
- tabKey?: InboxFlatListTabKey
+ sectionKey?: InboxReportSectionKey
attached?: boolean
+ /** Archive from the row. The inbox list omits it; surfaces that embed this card can opt in. */
onArchive?: (reason: DismissalReasonValue, note: string) => void
onRestore?: () => void
/** Internal path the detail view's back button should return to, for cards rendered outside the inbox. */
@@ -112,9 +129,9 @@ export function ReportCard({
* placeholder report id can never be opened (it 404s). */
preview?: boolean
}): JSX.Element {
- const isArchived = tabKey === 'archived'
+ const isArchived = sectionKey === 'resolved'
// Resolved reports are terminal (their implementation PR merged) – shown for reference in the
- // Archive tab. They can't be restored or re-archived; refunding their PR lives in the detail pane.
+ // Resolved section. They can't be restored or re-archived; refunding their PR lives in the detail pane.
const isResolved = report.status === SignalReportStatus.RESOLVED
const prUrl = safeHttpUrl(report.implementation_pr_url)
const prUrlParts = prUrl ? parsePrUrlParts(prUrl) : null
@@ -126,9 +143,13 @@ export function ReportCard({
const conventionalTitle = parseConventionalCommitTitle(report.title)
const cardTitle = displayConventionalCommitTitle(report.title, hasPr ? 'Untitled pull request' : 'Untitled report')
const headline = deriveHeadline(report.summary)
- const detailUrl = backUrl
- ? combineUrl(urls.inboxReport(tabKey, report.id), { back: backUrl }).url
- : urls.inboxReport(tabKey, report.id)
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
+ // The legacy layout addresses a report through the tab that listed it, so its back control returns there.
+ const detailUrl = inboxReportDetailUrl(
+ report.id,
+ backUrl,
+ redesign ? 'reports' : INBOX_SECTION_LEGACY_TAB[sectionKey]
+ )
const { isArchiving, onArchiveClick } = useReportArchive({
reportId: report.id,
@@ -140,7 +161,7 @@ export function ReportCard({
const isRefunded = !!report.refund
- // On the Archive tab, surface why it was dismissed (reason tag + note tooltip) when we have it.
+ // On the Resolved view, surface why it was dismissed (reason tag + note tooltip) when we have it.
// Key off the report still being suppressed, not the tab: a report that was dismissed, restored,
// then resolved keeps its old dismissal artefact, and showing that tag would mislabel finished work.
// The dedicated billing badge already marks refunded reports, so skip the duplicate chip there.
@@ -197,10 +218,12 @@ export function ReportCard({
<div className="flex items-center flex-wrap mt-1.5 min-w-0 gap-x-2.5 gap-y-1 text-xs text-tertiary leading-none select-none">
{hasPr && repoSlug ? <span className="truncate font-mono">{repoSlug}</span> : null}
<InboxCardSourceMeta sourceProducts={report.source_products} scoutSkillName={report.scout_name} />
- {!hasPr && !isStatusRedundantWithActionability(report.status, report.actionability) && (
- <SignalReportStatusBadge status={report.status} />
- )}
- {!hasPr && report.actionability && (
+ {!hasPr &&
+ !redesign &&
+ !isStatusRedundantWithActionability(report.status, report.actionability) && (
+ <SignalReportStatusBadge status={report.status} />
+ )}
+ {!hasPr && !redesign && report.actionability && (
<SignalReportActionabilityBadge actionability={report.actionability} />
)}
{dismissalLabel && (
@@ -271,18 +294,20 @@ export function ReportCard({
)
) : (
<>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconArchive />}
- tooltip="Archive this report"
- aria-label="Archive this report"
- loading={isArchiving}
- onClick={preview ? undefined : onArchiveClick}
- tabIndex={preview ? -1 : undefined}
- >
- Archive
- </LemonButton>
+ {(onArchive || !redesign) && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconArchive />}
+ tooltip="Archive this report"
+ aria-label="Archive this report"
+ loading={isArchiving}
+ onClick={preview ? undefined : onArchiveClick}
+ tabIndex={preview ? -1 : undefined}
+ >
+ Archive
+ </LemonButton>
+ )}
<LemonButton
type="primary"
size="small"
@@ -298,7 +323,7 @@ export function ReportCard({
}
tabIndex={preview ? -1 : undefined}
>
- Review
+ {hasPr || !redesign ? 'Review' : 'View report'}
</LemonButton>
</>
)}
diff --git a/products/signals/frontend/inbox/components/cards/SignalRunCard.tsx b/products/signals/frontend/inbox/components/cards/SignalRunCard.tsx
index 3702d19c7692..6a50677cf12d 100644
--- a/products/signals/frontend/inbox/components/cards/SignalRunCard.tsx
+++ b/products/signals/frontend/inbox/components/cards/SignalRunCard.tsx
@@ -9,8 +9,8 @@ import { urls } from 'scenes/urls'
import { captureInboxRunOpened } from '../../inboxAnalytics'
import { SignalRun } from '../../types'
import { stripScoutPrefix } from '../../utils/scoutRunsWindow'
+import { inboxCardRowClassName } from './inboxCardRowClassName'
import { resolveRunVariant, RunStatusIndicator } from './runStatusVariant'
-import { inboxCardRowClassName } from './useReportArchive'
export function SignalRunCard({ run }: { run: SignalRun }): JSX.Element {
const isScout = run.kind === 'scout'
diff --git a/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts b/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts
new file mode 100644
index 000000000000..dacb09c0d27d
--- /dev/null
+++ b/products/signals/frontend/inbox/components/cards/inboxCardRowClassName.ts
@@ -0,0 +1,16 @@
+import clsx from 'clsx'
+
+/**
+ * Shared row className for inbox cards. Attached rows sit inside a single bordered container
+ * (dividers between items); freestanding cards get their own border (dashed for reports).
+ */
+export function inboxCardRowClassName(attached: boolean, opts?: { dashed?: boolean }): string {
+ return clsx(
+ 'group flex w-full flex-col gap-2.5 @lg:flex-row @lg:items-stretch @lg:gap-3 bg-surface-primary px-4 py-3.5 transition-all duration-150 hover:bg-surface-secondary',
+ attached
+ ? 'border-b border-primary last:border-b-0'
+ : opts?.dashed
+ ? 'rounded border border-dashed border-primary hover:border-secondary'
+ : 'rounded border border-primary hover:border-secondary'
+ )
+}
diff --git a/products/signals/frontend/inbox/components/cards/useReportArchive.ts b/products/signals/frontend/inbox/components/cards/useReportArchive.ts
index 2977fe3c7f82..047951be7d75 100644
--- a/products/signals/frontend/inbox/components/cards/useReportArchive.ts
+++ b/products/signals/frontend/inbox/components/cards/useReportArchive.ts
@@ -1,4 +1,3 @@
-import clsx from 'clsx'
import { useState } from 'react'
import api from 'lib/api'
@@ -72,18 +71,3 @@ export function useReportArchive({
return { isArchiving, onArchiveClick }
}
-
-/**
- * Shared row className for inbox cards. Attached rows sit inside a single bordered container
- * (dividers between items); freestanding cards get their own border (dashed for reports).
- */
-export function inboxCardRowClassName(attached: boolean, opts?: { dashed?: boolean }): string {
- return clsx(
- 'group flex w-full flex-col gap-2.5 @lg:flex-row @lg:items-stretch @lg:gap-3 bg-surface-primary px-4 py-3.5 transition-all duration-150 hover:bg-surface-secondary',
- attached
- ? 'border-b border-primary last:border-b-0'
- : opts?.dashed
- ? 'rounded border border-dashed border-primary hover:border-secondary'
- : 'rounded border border-primary hover:border-secondary'
- )
-}
diff --git a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
index 22e83bdb429c..653a6b59e8f9 100644
--- a/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
+++ b/products/signals/frontend/inbox/components/config/AgentsRoster.tsx
@@ -13,6 +13,7 @@ import {
Tooltip,
} from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTagType } from 'lib/lemon-ui/LemonTag/LemonTag'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -23,7 +24,7 @@ import { signalSourcesLogic } from '../../signalSourcesLogic'
import type { SourceToolDataStatus, SourceToolStatus } from '../../signalSourcesLogic'
import { SignalSourceConfig, SignalSourceConfigStatus, SignalSourceType } from '../../types'
import { getSourceProductMeta } from '../badges/sourceProductIcons'
-import { AGENT_ROSTER_GROUPS, AgentRosterDefinition, AgentRosterSource } from './agentRosterMeta'
+import { AGENT_ROSTER_GROUPS, AgentRosterDefinition, AgentRosterGroup, AgentRosterSource } from './agentRosterMeta'
import { SourceSteeringModal } from './SourceSteeringModal'
type AgentRosterStatus = 'standby' | 'watching' | 'syncing' | 'sync_failed'
@@ -107,6 +108,7 @@ function AgentIcon({ source }: { source: AgentRosterDefinition }): JSX.Element |
return <Icon className={`shrink-0 text-base ${meta.colorClass}`} />
}
+/** The legacy roster's per-row health dot; the redesign relies on the tag alone. */
function StatusDot({
status,
tool,
@@ -454,6 +456,7 @@ const AgentRow = memo(function AgentRow({
onSteer,
onRetryData,
}: AgentRowProps): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const { armed, loading, requiresSetup, syncStatus, entities } = state
const status = resolveAgentStatus(armed, syncStatus)
const toolOff = tool?.enabled === false
@@ -473,7 +476,7 @@ const AgentRow = memo(function AgentRow({
expanded ? 'bg-surface-secondary' : 'hover:bg-surface-secondary'
} ${agent.legacy ? 'opacity-60 hover:opacity-100' : ''}`}
>
- <StatusDot status={status} tool={tool} toolOff={toolOff} />
+ {!redesign && <StatusDot status={status} tool={tool} toolOff={toolOff} />}
<AgentIcon source={agent} />
<div className="flex min-w-0 flex-1 flex-col">
<div className="flex items-center gap-2">
@@ -558,7 +561,30 @@ const AgentRow = memo(function AgentRow({
)
})
+/**
+ * Heading for one group of sources. Under the redesign it is set in the same type as the row titles
+ * so it reads as a section of the Settings card; the legacy rail keeps a muted eyebrow over a
+ * bordered list.
+ */
+function AgentRosterGroupHeader({ group, redesign }: { group: AgentRosterGroup; redesign: boolean }): JSX.Element {
+ if (!redesign) {
+ return <span className="text-xs font-medium text-muted">{group.label}</span>
+ }
+ return <h4 className="m-0 text-sm font-semibold text-default">{group.label}</h4>
+}
+
+function agentGroupClassName(redesign: boolean): string {
+ return redesign ? 'flex flex-col gap-2 pt-2' : 'flex flex-col gap-1'
+}
+
+function agentListClassName(redesign: boolean): string {
+ return redesign
+ ? '-mx-2 divide-y divide-primary'
+ : 'divide-y divide-primary overflow-hidden rounded border border-primary'
+}
+
export function AgentsRoster(): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const {
conversationsConfig,
evalReportsConfig,
@@ -806,22 +832,25 @@ export function AgentsRoster(): JSX.Element {
...group,
agents: group.agents.filter((agent) => !agent.flag || featureFlags[agent.flag]),
}))
+
const allAgents = visibleGroups.flatMap((group) => group.agents)
const armedCount = allAgents.filter((agent) => stateFor(agent.source).armed).length
return (
<div className="flex flex-col gap-3">
- <div className="flex items-center gap-1.5 text-xs text-muted">
- <span className={`size-2 rounded-full ${armedCount ? 'bg-success' : 'bg-border-bold'}`} />
- <span>
- {armedCount} of {allAgents.length} sources on
- </span>
- </div>
+ {!redesign && (
+ <div className="flex items-center gap-1.5 text-xs text-muted">
+ <span className={`size-2 rounded-full ${armedCount ? 'bg-success' : 'bg-border-bold'}`} />
+ <span>
+ {armedCount} of {allAgents.length} sources on
+ </span>
+ </div>
+ )}
{visibleGroups.map((group) => (
- <div key={group.label} className="flex flex-col gap-1">
- <span className="text-xs font-medium text-muted">{group.label}</span>
- <div className="divide-y divide-primary overflow-hidden rounded border border-primary">
+ <div key={group.label} className={agentGroupClassName(redesign)}>
+ <AgentRosterGroupHeader group={group} redesign={redesign} />
+ <div className={agentListClassName(redesign)}>
{group.agents.map((agent) => {
const state = stateFor(agent.source)
// Steering needs a persisted row to write to, so optimistic `new_`
@@ -890,13 +919,14 @@ function AgentRowSkeleton(): JSX.Element {
}
export function AgentsRosterSkeleton(): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
return (
<div className="flex flex-col gap-3">
<LemonSkeleton className="h-3 w-48" />
{AGENT_ROSTER_GROUPS.map((group) => (
- <div key={group.label} className="flex flex-col gap-1">
- <LemonSkeleton className="h-3 w-24" />
- <div className="divide-y divide-primary overflow-hidden rounded border border-primary">
+ <div key={group.label} className={agentGroupClassName(redesign)}>
+ <AgentRosterGroupHeader group={group} redesign={redesign} />
+ <div className={agentListClassName(redesign)}>
{group.agents.map((agent) => (
<AgentRowSkeleton key={agent.source} />
))}
diff --git a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx
index e3fc03628831..5de69fec1542 100644
--- a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx
+++ b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx
@@ -17,6 +17,7 @@ import {
TooltipTrigger,
} from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { GitHubBranchCombobox } from 'lib/integrations/GitHubBranchCombobox'
import { GitHubRepositoryCombobox } from 'lib/integrations/GitHubRepositoryCombobox'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
@@ -307,6 +308,8 @@ function DailyReportLimit(): JSX.Element {
* threshold) that can't live inside that card's single button/link wrapper.
*/
export function SelfDrivingSection(): JSX.Element {
+ // The Settings tab wraps this in its own card; the legacy setup rail does not.
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const { teamConfig, teamConfigLoading, teamConfigUpdating, autostartEnabled, defaultAutostartPriority } =
useValues(signalTeamConfigLogic)
const { patchTeamConfig } = useActions(signalTeamConfigLogic)
@@ -319,7 +322,13 @@ export function SelfDrivingSection(): JSX.Element {
}
return (
- <div className="flex flex-col rounded border border-primary bg-surface-primary overflow-hidden">
+ <div
+ className={
+ redesign
+ ? '-mx-2.5 flex flex-col'
+ : 'flex flex-col rounded border border-primary bg-surface-primary overflow-hidden'
+ }
+ >
<div className="flex items-start gap-2 px-2.5 py-2">
<span className="flex size-7 shrink-0 items-center justify-center rounded bg-surface-secondary text-default [&_svg]:size-4">
<IconRocket />
@@ -338,7 +347,7 @@ export function SelfDrivingSection(): JSX.Element {
</div>
</div>
- <div className="border-t border-primary bg-surface-secondary">
+ <div className={redesign ? 'border-t border-primary' : 'border-t border-primary bg-surface-secondary'}>
{autostartEnabled ? (
<>
{/* Label above the control rather than beside it: the rail is narrow enough that a
diff --git a/products/signals/frontend/inbox/components/config/SlackNotificationsSection.tsx b/products/signals/frontend/inbox/components/config/SlackNotificationsSection.tsx
index 01eab44a53ac..f986bce3d0fe 100644
--- a/products/signals/frontend/inbox/components/config/SlackNotificationsSection.tsx
+++ b/products/signals/frontend/inbox/components/config/SlackNotificationsSection.tsx
@@ -4,6 +4,7 @@ import { ReactNode, useState } from 'react'
import { IconChevronRight } from '@posthog/icons'
import { LemonSelect, LemonSkeleton, LemonSwitch, Link } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { SlackChannelPicker } from 'lib/integrations/SlackIntegrationHelpers'
import { IconSlack } from 'lib/lemon-ui/icons'
@@ -36,11 +37,23 @@ function SlackCardHeader({ title, description }: { title: string; description: R
}
/** Shown when there's no Slack workspace connected – links out to integration settings. */
+/** The Settings tab separates these cards with rules inside its own card; the legacy rail frames each one. */
+function slackCardClassName(redesign: boolean): string {
+ return redesign
+ ? 'flex flex-col gap-3 border-b border-primary py-2.5 first:pt-0 last:border-b-0 last:pb-0'
+ : 'flex flex-col gap-3 rounded border bg-bg-light px-3 py-2.5'
+}
+
function ConnectSlackPrompt(): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
return (
<Link
to={urls.settings('environment-integrations', 'integration-slack')}
- className="group flex items-center justify-between gap-3 rounded border bg-bg-light px-3 py-2.5 no-underline transition-colors hover:border-primary-3000 hover:bg-bg-3000"
+ className={
+ redesign
+ ? 'group -mx-2 flex items-center justify-between gap-3 rounded px-2 py-2.5 no-underline transition-colors hover:bg-surface-secondary'
+ : 'group flex items-center justify-between gap-3 rounded border bg-bg-light px-3 py-2.5 no-underline transition-colors hover:border-primary-3000 hover:bg-bg-3000'
+ }
>
<SlackCardHeader
title="Connect a Slack workspace"
@@ -59,6 +72,7 @@ function ConnectSlackPrompt(): JSX.Element {
* here too.
*/
function TeamChannelCard({ integration }: { integration: IntegrationType }): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const { teamConfig, teamConfigLoading } = useValues(signalTeamConfigLogic)
const { patchTeamConfig } = useActions(signalTeamConfigLogic)
// Local view state: the toggle is on but no channel has been picked yet. A saved
@@ -76,7 +90,7 @@ function TeamChannelCard({ integration }: { integration: IntegrationType }): JSX
}
return (
- <div className="flex flex-col gap-3 rounded border bg-bg-light px-3 py-2.5">
+ <div className={slackCardClassName(redesign)}>
<div className="flex items-start justify-between gap-4">
<SlackCardHeader
title="Notify the whole team"
@@ -117,6 +131,7 @@ function TeamChannelCard({ integration }: { integration: IntegrationType }): JSX
* Backed by the `slack_notification_*` fields on `userAutonomyLogic`.
*/
function PerUserChannelCard({ integrations }: { integrations: IntegrationType[] }): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const { autonomyConfig, autonomyConfigLoading, slackPickersExpanded } = useValues(userAutonomyLogic)
const { updateSlackNotifications, setSlackPickersExpanded } = useActions(userAutonomyLogic)
@@ -172,7 +187,7 @@ function PerUserChannelCard({ integrations }: { integrations: IntegrationType[]
const showPickers = slackPickersExpanded || selectedIntegrationId !== null || !!channel
return (
- <div className="flex flex-col gap-3 rounded border bg-bg-light px-3 py-2.5">
+ <div className={slackCardClassName(redesign)}>
<div className="flex items-start justify-between gap-4">
<SlackCardHeader
title="Notify me directly"
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutAlphaBanner.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutAlphaBanner.tsx
index 113a52ace09d..6ff77762c2fe 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutAlphaBanner.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutAlphaBanner.tsx
@@ -9,13 +9,13 @@ import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
* metadata endpoint. Operator-controlled so a rollout or run-limit notice can change without a
* frontend deploy; nothing renders when the payload carries no message.
*/
-export function ScoutAlphaBanner(): JSX.Element | null {
+export function ScoutAlphaBanner({ className }: { className?: string }): JSX.Element | null {
const { scoutBannerMessage } = useValues(scoutFleetLogic)
if (!scoutBannerMessage) {
return null
}
return (
- <LemonBanner type="info" className="mx-6 mt-4" dismissKey={`signals-scout-banner-${scoutBannerMessage}`}>
+ <LemonBanner type="info" className={className} dismissKey={`signals-scout-banner-${scoutBannerMessage}`}>
{scoutBannerMessage}
</LemonBanner>
)
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
index b9f4929da052..a62f31b880f0 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutCreateModal.tsx
@@ -12,10 +12,12 @@ import {
LemonTextArea,
} from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { teamLogic } from 'scenes/teamLogic'
import type { SignalScoutCreateResponseApi } from 'products/signals/frontend/generated/api.schemas'
+import { SKILL_NAME_MAX_LENGTH } from 'products/skills/frontend/skillConstants'
import {
ScoutCreateInitialValues,
@@ -41,12 +43,19 @@ export interface ScoutCreateModalProps {
}
export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }: ScoutCreateModalProps): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const logicKey = useId()
const formId = `scout-create-form-${logicKey}`
const logicProps: ScoutCreateModalLogicProps = { logicKey, initialValues, onClose, onCreated }
const logic = scoutCreateModalLogic(logicProps)
- const { isScoutCreateFormSubmitting, scoutCreateForm, scoutCreateFormChanged, scoutCreateFormValidationErrors } =
- useValues(logic)
+ const {
+ isScoutCreateFormSubmitting,
+ scoutCreateForm,
+ scoutCreateFormChanged,
+ scoutCreateFormValidationErrors,
+ scoutCreateFormTouches,
+ showScoutCreateFormErrors,
+ } = useValues(logic)
const { resetScoutCreateForm, setScoutCreateDailyTime, setScoutCreateScheduleMode } = useActions(logic)
const { timezone: projectTimezone } = useValues(teamLogic)
const scheduleMode = getScoutScheduleMode(scoutCreateForm.config)
@@ -62,6 +71,11 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
const tagsValidationError = scoutCreateFormValidationErrors.config?.tags?.find(
(error): error is string => typeof error === 'string'
)
+ // Field errors only render after a submit attempt, and the submit button is disabled while the
+ // form has errors, so a name typo would otherwise surface only as the button's tooltip. Show the
+ // name error in the help slot as soon as the field has been left, until the form shows it itself.
+ const touchedNameError =
+ scoutCreateFormTouches.name && !showScoutCreateFormErrors ? scoutCreateFormValidationErrors.name : undefined
const firstError = [
scoutCreateFormValidationErrors.name,
scoutCreateFormValidationErrors.description,
@@ -112,18 +126,37 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
name="name"
label="Name"
help={
- <>
- Scout names start with{' '}
- <span className="font-mono text-[11px]">{SIGNALS_SCOUT_SKILL_PREFIX}</span>.
- </>
+ !redesign ? (
+ <>
+ Scout names start with{' '}
+ <span className="font-mono text-[11px]">{SIGNALS_SCOUT_SKILL_PREFIX}</span>.
+ </>
+ ) : touchedNameError ? (
+ <span className="text-danger">{touchedNameError}</span>
+ ) : (
+ 'Lowercase letters, numbers, and hyphens.'
+ )
}
>
- <LemonInput
- autoFocus
- maxLength={64}
- placeholder="signals-scout-checkout-failures"
- data-attr="scout-create-name"
- />
+ {redesign ? (
+ <LemonInput
+ autoFocus
+ // The prefix is fixed and shown in the field, so the limit is what is left for the typed part.
+ maxLength={SKILL_NAME_MAX_LENGTH - SIGNALS_SCOUT_SKILL_PREFIX.length}
+ prefix={
+ <span className="font-mono text-xs text-muted">{SIGNALS_SCOUT_SKILL_PREFIX}</span>
+ }
+ placeholder="checkout-failures"
+ data-attr="scout-create-name"
+ />
+ ) : (
+ <LemonInput
+ autoFocus
+ maxLength={64}
+ placeholder="signals-scout-checkout-failures"
+ data-attr="scout-create-name"
+ />
+ )}
</LemonField>
<LemonField
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx
new file mode 100644
index 000000000000..28e1a02f25d5
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutRosterCard.tsx
@@ -0,0 +1,114 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import {
+ nextRunAt,
+ SCOUT_GROUP_LABEL,
+ scoutCadenceLabel,
+ ScoutRosterRow,
+ scoutSubtitle,
+} from '../../../utils/scoutGroups'
+import { prettifyScoutSkillName } from '../../../utils/scoutRunsWindow'
+import { inboxCardRowClassName } from '../../cards/inboxCardRowClassName'
+import { ScoutLifecycleBadge } from './ScoutBadges'
+import { ScoutEnabledSwitch } from './ScoutConfigControls'
+import { ScoutNextRunLabel } from './ScoutNextRunLabel'
+import { ScoutRunBoxes } from './ScoutRunBoxes'
+import { ScoutStatusDot } from './ScoutStatusDot'
+
+const SUBTITLE_TONE_CLASS = {
+ danger: 'text-danger',
+ warning: 'text-warning',
+ muted: 'text-secondary',
+} as const
+
+function MetaSeparator(): JSX.Element {
+ return <span aria-hidden>·</span>
+}
+
+/**
+ * One scout in the roster, in the same row shape as the report cards: status dot, name, what it
+ * last checked, and its cadence on the left; the recent-run strip and the on/off switch on the
+ * right. The body links to the scout page. The run boxes and the switch sit outside that link, so
+ * a run box opens its task and the switch flips the scout without opening it.
+ */
+export function ScoutRosterCard({ row }: { row: ScoutRosterRow }): JSX.Element {
+ const { config, group } = row
+ const { rollups, updatingScoutIds, scoutRunsLoadedOnce } = useValues(scoutFleetLogic)
+ const { updateScoutConfig } = useActions(scoutFleetLogic)
+ const { currentTeam } = useValues(teamLogic)
+ const now = new Date()
+ const rollup = rollups.get(config.skill_name)
+ const runs = rollup?.runs ?? []
+ const subtitle = scoutSubtitle(config, rollup, now)
+ // Only enabled scouts have a next run; a paused one would otherwise carry an empty dash.
+ const hasNextRun = nextRunAt(config, currentTeam?.timezone ?? 'UTC', now) !== null
+
+ return (
+ <div className={cn(inboxCardRowClassName(false), !config.enabled && 'opacity-65')}>
+ <Link
+ to={urls.inboxScout(config.skill_name)}
+ className="flex min-w-0 flex-1 items-start gap-3 text-left text-inherit no-underline"
+ data-attr="inbox-scout-card"
+ >
+ <span className="flex h-5 shrink-0 items-center">
+ <ScoutStatusDot group={group} />
+ </span>
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
+ <span className="min-w-0 truncate text-sm font-semibold leading-snug">
+ {prettifyScoutSkillName(config.skill_name)}
+ </span>
+ {config.auto_pause_exempt && group === 'watching' && (
+ <Tooltip title="Exempt from auto-pause, because this scout is supposed to stay quiet">
+ <LemonTag size="small">Quiet by design</LemonTag>
+ </Tooltip>
+ )}
+ <ScoutLifecycleBadge config={config} />
+ </div>
+ {subtitle && (
+ <p className={cn('m-0 line-clamp-1 text-xs leading-snug', SUBTITLE_TONE_CLASS[subtitle.tone])}>
+ {subtitle.text}
+ </p>
+ )}
+ <div className="mt-1 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs leading-none text-tertiary select-none">
+ <span>{SCOUT_GROUP_LABEL[group]}</span>
+ <MetaSeparator />
+ <span>{scoutCadenceLabel(config)}</span>
+ {hasNextRun && (
+ <>
+ <MetaSeparator />
+ <span className="tabular-nums">
+ Next run <ScoutNextRunLabel config={config} />
+ </span>
+ </>
+ )}
+ </div>
+ </div>
+ </Link>
+ <div className="flex shrink-0 items-center justify-between gap-4 @lg:justify-end @lg:self-stretch @lg:border-l @lg:border-primary @lg:pl-3">
+ {/* A fixed strip width on wide rows keeps every row's newest run on one vertical line. */}
+ <div className="flex min-w-0 justify-end @lg:w-52">
+ {runs.length > 0 ? (
+ <ScoutRunBoxes runs={runs} />
+ ) : (
+ // Until the runs request has landed once, an empty rollup means "not
+ // loaded", not "never ran"; the poll retries a failed load on its own.
+ <span className="text-xs text-muted">{scoutRunsLoadedOnce ? 'No runs yet' : '…'}</span>
+ )}
+ </div>
+ <ScoutEnabledSwitch
+ config={config}
+ onUpdate={updateScoutConfig}
+ updating={updatingScoutIds.includes(config.id)}
+ />
+ </div>
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutTagsFilter.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutTagsFilter.tsx
index df7672f368eb..28ae03353b2f 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutTagsFilter.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutTagsFilter.tsx
@@ -8,11 +8,13 @@ export function ScoutTagsFilter({
selected,
onToggle,
onClear,
+ size = 'small',
}: {
options: ScoutTagOption[]
selected: string[]
onToggle: (tag: string) => void
onClear: () => void
+ size?: 'xsmall' | 'small'
}): JSX.Element {
const label = selected.length === 0 ? 'Any tag' : selected.length === 1 ? selected[0] : `${selected.length} tags`
const items: LemonMenuItems = [
@@ -39,12 +41,7 @@ export function ScoutTagsFilter({
return (
<LemonMenu items={items} closeOnClickInside={false} placement="bottom-end">
- <LemonButton
- type="secondary"
- size="xsmall"
- sideIcon={<IconChevronDown />}
- aria-label="Filter scouts by tag"
- >
+ <LemonButton type="secondary" size={size} sideIcon={<IconChevronDown />} aria-label="Filter scouts by tag">
{label}
</LemonButton>
</LemonMenu>
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyState.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyState.tsx
index 8cbfdcdd12b7..e13873fb21a0 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyState.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyState.tsx
@@ -11,15 +11,15 @@ export function ScoutsEmptyState(): JSX.Element {
const { loadScoutConfigs } = useActions(scoutFleetLogic)
return (
- <div className="m-6 flex flex-col items-start gap-2 rounded border border-primary bg-surface-primary px-5 py-5">
- <div className="flex items-center gap-2">
- <IconCompass className="size-[18px] text-accent" />
- <span className="text-sm font-medium text-default">No scouts on this project yet</span>
+ <div className="mx-auto flex max-w-md flex-col items-center gap-2 py-12 text-center">
+ <div className="mb-1 flex h-12 w-12 items-center justify-center rounded-full bg-fill-primary text-secondary">
+ <IconCompass className="text-2xl" />
</div>
- <p className="mb-0 max-w-2xl text-xs leading-snug text-secondary">
+ <h3 className="m-0 text-base font-semibold">No scouts on this project yet</h3>
+ <p className="m-0 text-sm text-tertiary">
Create a scout to investigate a recurring signal or behavior on a schedule.
</p>
- <div className="flex flex-wrap items-center gap-2">
+ <div className="mt-1 flex flex-wrap items-center justify-center gap-2">
<ScoutCreateButton onCreated={() => loadScoutConfigs()} />
<ScoutSuggestButton />
</div>
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyStateLegacy.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyStateLegacy.tsx
new file mode 100644
index 000000000000..e0db0a358245
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsEmptyStateLegacy.tsx
@@ -0,0 +1,30 @@
+import { useActions } from 'kea'
+
+import { IconCompass } from '@posthog/icons'
+
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { ScoutCreateButton } from './ScoutCreateButton'
+import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'
+import { ScoutSuggestButton } from './ScoutSuggestButton'
+
+/** The roster's empty state with the redesign flag off: a bordered card at the top of the tab. */
+export function ScoutsEmptyStateLegacy(): JSX.Element {
+ const { loadScoutConfigs } = useActions(scoutFleetLogic)
+
+ return (
+ <div className="m-6 flex flex-col items-start gap-2 rounded border border-primary bg-surface-primary px-5 py-5">
+ <div className="flex items-center gap-2">
+ <IconCompass className="size-[18px] text-accent" />
+ <span className="text-sm font-medium text-default">No scouts on this project yet</span>
+ </div>
+ <p className="mb-0 max-w-2xl text-xs leading-snug text-secondary">
+ Create a scout to investigate a recurring signal or behavior on a schedule.
+ </p>
+ <div className="flex flex-wrap items-center gap-2">
+ <ScoutCreateButton onCreated={() => loadScoutConfigs()} />
+ <ScoutSuggestButton />
+ </div>
+ <ScoutHelperSkillLinks />
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx
index f89dea828bea..acf235b6906b 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.stories.tsx
@@ -6,9 +6,10 @@ import { mswDecorator } from '~/mocks/browser'
import { mockLargeScoutFleet, mockScoutConfigs, mockScoutRuns } from '../../../__mocks__/scoutConfigs'
import { ScoutsRoster } from './ScoutsRoster'
+import { ScoutsRosterLegacy } from './ScoutsRosterLegacy'
-// The flat roster: one alphabetical table with a sortable Status column. Use this to check the
-// column layout, the status dots, and how a wide fleet reads without lifecycle sections.
+// The roster: one column of scout cards under the search, filter, and sort toolbar. Use this to
+// check the card layout, the status dots, the run strips, and how a wide fleet reads.
const meta: Meta<typeof ScoutsRoster> = {
title: 'Scenes-App/Inbox/ScoutsRoster',
@@ -17,7 +18,7 @@ const meta: Meta<typeof ScoutsRoster> = {
layout: 'fullscreen',
viewMode: 'story',
mockDate: '2026-06-11',
- featureFlags: { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true },
+ featureFlags: { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true, [FEATURE_FLAGS.INBOX_REDESIGN]: true },
testOptions: { waitForLoadersToDisappear: false },
},
decorators: [
@@ -59,12 +60,31 @@ export const LargeFleet: Story = {
],
}
-// Phone width. Cadence and Next run drop out, and the table stops overflowing sideways, so the
-// name, the status, the run strip, and the on/off toggle all stay on screen.
+// The table roster with the redesign flag off. Story parameters replace the meta's, so the
+// meta-level flag is re-listed.
+const LEGACY_FLAGS = { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true, [FEATURE_FLAGS.INBOX_REDESIGN]: false }
+
+export const RosterLegacy: Story = {
+ parameters: { featureFlags: LEGACY_FLAGS },
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:id/signals/scout/configs/': () => [200, mockScoutConfigs],
+ '/api/projects/:id/signals/scout/runs/recent-per-scout/': () => [200, mockScoutRuns(mockScoutConfigs)],
+ },
+ }),
+ ],
+ render: () => <ScoutsRosterLegacy />,
+}
+
+// Phone width with the flag off. Cadence and Next run drop out, and the table stops overflowing
+// sideways, so the name, the status, the run strip, and the on/off toggle all stay on screen.
export const Narrow: Story = {
parameters: {
+ featureFlags: LEGACY_FLAGS,
testOptions: { viewport: { width: 375, height: 900 }, waitForLoadersToDisappear: false },
},
+ render: () => <ScoutsRosterLegacy />,
decorators: [
mswDecorator({
get: {
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx
index 06cc6377aa9c..564c77be29d3 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx
@@ -1,42 +1,32 @@
import { useActions, useValues } from 'kea'
import { useEffect, useRef } from 'react'
-import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
+import { LemonButton, Link } from '@posthog/lemon-ui'
-import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
+import { urls } from 'scenes/urls'
import { captureScoutFleetViewed } from '../../../inboxAnalytics'
import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
import { SCOUT_ROSTER_WINDOW_LABEL, SCOUT_RUNS_PER_SCOUT_LABEL } from '../../../utils/scoutRunsWindow'
+import { CardSkeleton } from '../../cards/CardSkeleton'
import { ScoutAlphaBanner } from './ScoutAlphaBanner'
import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'
import { ScoutsEmptyState } from './ScoutsEmptyState'
-import { ScoutsRosterHeader } from './ScoutsRosterHeader'
-import { ScoutsRosterTable } from './ScoutsRosterTable'
+import { ScoutsRosterFilters } from './ScoutsRosterFilters'
+import { ScoutsRosterList } from './ScoutsRosterList'
+import { ScoutsRosterStats } from './ScoutsRosterStats'
-/**
- * Under this width the roster drops to its compact columns. Sits just above the ~763px the
- * six-column table needs before it starts scrolling sideways, so the switch happens where the wide
- * layout actually stops working rather than at a phone-sized guess. Measured on the roster itself
- * rather than the window, so the tab reads the same inside a narrow embed as it does on a phone.
- */
-const ROSTER_COMPACT_MAX_PX = 768
+// The same centered column as the Reports tab, so the two tabs line up when switching between them.
+const ROSTER_COLUMN_CLASS = '@container mx-auto flex w-full max-w-4xl flex-col gap-4 px-6 py-3'
/**
- * The scout roster: one alphabetical table over the whole troop, with lifecycle as a sortable
- * Status column. Replaces the card list that used to live in the Scout troop modal — the fleet
- * outgrew a 760px portal, and a modal can't host the scout pages it links to.
+ * The scout roster: a toolbar (search, filters, sort on the left; the troop's headline numbers on
+ * the right) over one column of scout cards, in the same layout as the report list. Creating a scout
+ * stays in the scene header, so it is reachable even when the filters narrow the roster to nothing.
*/
export function ScoutsRoster(): JSX.Element {
const { scoutConfigs, scoutConfigsLoading, enabledCount, customScoutCount } = useValues(scoutFleetLogic)
const { loadScoutConfigs, startRunsPolling, stopRunsPolling } = useActions(scoutFleetLogic)
- // One measurement for the whole roster, so the header chrome and the table agree on which
- // layout they're in — two observers could disagree for a frame mid-resize.
- const { ref: widthRef, size } = useResizeBreakpoints(
- { 0: 'compact', [ROSTER_COMPACT_MAX_PX]: 'wide' },
- { initialSize: 'wide' }
- )
- const compact = size === 'compact'
useEffect(() => {
startRunsPolling()
@@ -61,10 +51,8 @@ export function ScoutsRoster(): JSX.Element {
if (scoutConfigsLoading && scoutConfigs === null) {
return (
- <div className="flex flex-col gap-2 p-6">
- <LemonSkeleton className="h-8 w-full rounded" />
- <LemonSkeleton className="h-8 w-full rounded" />
- <LemonSkeleton className="h-8 w-full rounded" />
+ <div className={ROSTER_COLUMN_CLASS}>
+ <CardSkeleton count={3} variant="cards" dashed={false} />
</div>
)
}
@@ -73,33 +61,45 @@ export function ScoutsRoster(): JSX.Element {
// regional rollout gap would otherwise be indistinguishable from "no scouts yet".
if (scoutConfigs === null) {
return (
- <div className="m-6 flex items-center gap-3 rounded border border-danger bg-danger-highlight px-4 py-3.5">
- <span className="flex-1 text-xs text-danger">
- Couldn't load the scout roster. The scout API may be unavailable or this project may not be enrolled
- yet.
- </span>
- <LemonButton type="secondary" size="small" status="danger" onClick={() => loadScoutConfigs()}>
- Retry
- </LemonButton>
+ <div className={ROSTER_COLUMN_CLASS}>
+ <div className="flex items-center gap-3 rounded border border-danger bg-danger-highlight px-4 py-3.5">
+ <span className="flex-1 text-xs text-danger">
+ Couldn't load the scout roster. The scout API may be unavailable or this project may not be
+ enrolled yet.
+ </span>
+ <LemonButton type="secondary" size="small" status="danger" onClick={() => loadScoutConfigs()}>
+ Retry
+ </LemonButton>
+ </div>
</div>
)
}
if (scoutConfigs.length === 0) {
- return <ScoutsEmptyState />
+ return (
+ <div className={ROSTER_COLUMN_CLASS}>
+ <ScoutsEmptyState />
+ </div>
+ )
}
return (
- <div ref={widthRef} className="flex flex-col">
+ <div className={ROSTER_COLUMN_CLASS}>
<ScoutAlphaBanner />
- <ScoutsRosterHeader compact={compact} />
- <ScoutsRosterTable compact={compact} />
- <div className="flex flex-col gap-1 px-6 py-4">
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
+ <ScoutsRosterFilters />
+ <ScoutsRosterStats />
+ </div>
+ <ScoutsRosterList />
+ <div className="flex flex-col gap-1 pt-1">
<span className="text-xs text-muted">
The totals above cover the {SCOUT_ROSTER_WINDOW_LABEL}. Each scout's run strip shows its{' '}
{SCOUT_RUNS_PER_SCOUT_LABEL}, so scouts on different schedules stay comparable. New scouts are
created as <span className="font-mono text-[11px]">signals-scout-*</span> skills in your PostHog
- project.
+ project.{' '}
+ <Link to={urls.inboxRuns()} data-attr="inbox-open-runs">
+ See every recent run
+ </Link>
</span>
<ScoutHelperSkillLinks />
</div>
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFilters.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFilters.tsx
index b07732c5510c..4d08013fd02f 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFilters.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFilters.tsx
@@ -1,55 +1,72 @@
import { useActions, useValues } from 'kea'
-import { LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui'
+import { LemonInput, LemonSelect } from '@posthog/lemon-ui'
-import { cn } from 'lib/utils/css-classes'
-
-import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { ScoutEnabledFilter, ScoutRosterSort, scoutFleetLogic } from '../../../logics/scoutFleetLogic'
import { ScoutTagsFilter } from './ScoutTagsFilter'
-export function ScoutsRosterFilters({ compact }: { compact: boolean }): JSX.Element {
- const { scoutSearch, scoutEnabledFilter, scoutTagOptions, activeScoutTags } = useValues(scoutFleetLogic)
- const { setScoutSearch, setScoutEnabledFilter, setScoutTagFilter } = useActions(scoutFleetLogic)
+const ENABLED_FILTER_OPTIONS: { value: ScoutEnabledFilter; label: string }[] = [
+ { value: 'all', label: 'All scouts' },
+ { value: 'enabled', label: 'Turned on' },
+ { value: 'disabled', label: 'Turned off' },
+]
+
+const SORT_OPTIONS: { value: ScoutRosterSort; label: string }[] = [
+ { value: 'name', label: 'Name' },
+ { value: 'status', label: 'Status' },
+]
+
+/**
+ * What narrows the roster, in the same shape as the report toolbar: search first, then the on/off
+ * filter, the tag filter, and the sort order as dropdown buttons. Filter state lives in
+ * `scoutFleetLogic`, which also fires the filter analytics.
+ */
+export function ScoutsRosterFilters(): JSX.Element {
+ const { scoutSearch, scoutEnabledFilter, scoutRosterSort, scoutTagOptions, activeScoutTags } =
+ useValues(scoutFleetLogic)
+ const { setScoutSearch, setScoutEnabledFilter, setScoutRosterSort, setScoutTagFilter } = useActions(scoutFleetLogic)
return (
- // Compact takes the whole line rather than being pushed right: at phone widths the filters
- // never share a row with the stats anyway, and a right-hugging half-row just wastes it.
- <div className={cn('flex flex-wrap items-center gap-2', compact ? 'w-full' : 'ml-auto')}>
- <LemonSegmentedButton
- size="small"
- value={scoutEnabledFilter}
- onChange={setScoutEnabledFilter}
- options={[
- { value: 'all', label: 'All' },
- { value: 'enabled', label: 'On' },
- { value: 'disabled', label: 'Off' },
- ]}
- />
+ <div className="flex flex-wrap items-center gap-2">
<LemonInput
type="search"
size="small"
placeholder="Search scouts…"
value={scoutSearch}
onChange={setScoutSearch}
- className={compact ? 'min-w-32 flex-1' : 'w-56'}
+ className="w-48"
allowClear
+ data-attr="inbox-scout-search"
+ />
+ <LemonSelect
+ size="small"
+ value={scoutEnabledFilter}
+ onChange={(filter) => filter && setScoutEnabledFilter(filter)}
+ options={ENABLED_FILTER_OPTIONS}
+ data-attr="inbox-scout-filter-enabled"
/>
{scoutTagOptions.length > 0 && (
- <>
- <ScoutTagsFilter
- options={scoutTagOptions}
- selected={activeScoutTags}
- onToggle={(tag) =>
- setScoutTagFilter(
- activeScoutTags.includes(tag)
- ? activeScoutTags.filter((candidate) => candidate !== tag)
- : [...activeScoutTags, tag]
- )
- }
- onClear={() => setScoutTagFilter([])}
- />
- </>
+ <ScoutTagsFilter
+ options={scoutTagOptions}
+ selected={activeScoutTags}
+ onToggle={(tag) =>
+ setScoutTagFilter(
+ activeScoutTags.includes(tag)
+ ? activeScoutTags.filter((candidate) => candidate !== tag)
+ : [...activeScoutTags, tag]
+ )
+ }
+ onClear={() => setScoutTagFilter([])}
+ />
)}
+ <LemonSelect
+ size="small"
+ value={scoutRosterSort}
+ onChange={(sort) => sort && setScoutRosterSort(sort)}
+ options={SORT_OPTIONS}
+ renderButtonContent={(leaf) => `Sort: ${leaf?.label ?? ''}`}
+ data-attr="inbox-scout-sort"
+ />
</div>
)
}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFiltersLegacy.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFiltersLegacy.tsx
new file mode 100644
index 000000000000..21c6d5e84dbe
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterFiltersLegacy.tsx
@@ -0,0 +1,56 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { ScoutTagsFilter } from './ScoutTagsFilter'
+
+export function ScoutsRosterFiltersLegacy({ compact }: { compact: boolean }): JSX.Element {
+ const { scoutSearch, scoutEnabledFilter, scoutTagOptions, activeScoutTags } = useValues(scoutFleetLogic)
+ const { setScoutSearch, setScoutEnabledFilter, setScoutTagFilter } = useActions(scoutFleetLogic)
+
+ return (
+ // Compact takes the whole line rather than being pushed right: at phone widths the filters
+ // never share a row with the stats anyway, and a right-hugging half-row just wastes it.
+ <div className={cn('flex flex-wrap items-center gap-2', compact ? 'w-full' : 'ml-auto')}>
+ <LemonSegmentedButton
+ size="small"
+ value={scoutEnabledFilter}
+ onChange={setScoutEnabledFilter}
+ options={[
+ { value: 'all', label: 'All' },
+ { value: 'enabled', label: 'On' },
+ { value: 'disabled', label: 'Off' },
+ ]}
+ />
+ <LemonInput
+ type="search"
+ size="small"
+ placeholder="Search scouts…"
+ value={scoutSearch}
+ onChange={setScoutSearch}
+ className={compact ? 'min-w-32 flex-1' : 'w-56'}
+ allowClear
+ />
+ {scoutTagOptions.length > 0 && (
+ <>
+ <ScoutTagsFilter
+ size="xsmall"
+ options={scoutTagOptions}
+ selected={activeScoutTags}
+ onToggle={(tag) =>
+ setScoutTagFilter(
+ activeScoutTags.includes(tag)
+ ? activeScoutTags.filter((candidate) => candidate !== tag)
+ : [...activeScoutTags, tag]
+ )
+ }
+ onClear={() => setScoutTagFilter([])}
+ />
+ </>
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterHeader.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterHeader.tsx
index c7f3ad067dd5..c74ffb8e9609 100644
--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterHeader.tsx
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterHeader.tsx
@@ -7,7 +7,7 @@ import { cn } from 'lib/utils/css-classes'
import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
import { scratchpadLogic } from '../../../logics/scratchpadLogic'
import { SCOUT_ROSTER_WINDOW_LABEL } from '../../../utils/scoutRunsWindow'
-import { ScoutsRosterFilters } from './ScoutsRosterFilters'
+import { ScoutsRosterFiltersLegacy } from './ScoutsRosterFiltersLegacy'
function Stat({ value, label, compact = false }: { value: string; label: string; compact?: boolean }): JSX.Element {
return (
@@ -32,7 +32,7 @@ export function ScoutsRosterHeader({ compact }: { compact: boolean }): JSX.Eleme
)}
>
<RosterStats compact={compact} />
- <ScoutsRosterFilters compact={compact} />
+ <ScoutsRosterFiltersLegacy compact={compact} />
</div>
)
}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterLegacy.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterLegacy.tsx
new file mode 100644
index 000000000000..9696a7b5f759
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterLegacy.tsx
@@ -0,0 +1,108 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useRef } from 'react'
+
+import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
+
+import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
+
+import { captureScoutFleetViewed } from '../../../inboxAnalytics'
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { SCOUT_ROSTER_WINDOW_LABEL, SCOUT_RUNS_PER_SCOUT_LABEL } from '../../../utils/scoutRunsWindow'
+import { ScoutAlphaBanner } from './ScoutAlphaBanner'
+import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'
+import { ScoutsEmptyStateLegacy } from './ScoutsEmptyStateLegacy'
+import { ScoutsRosterHeader } from './ScoutsRosterHeader'
+import { ScoutsRosterTable } from './ScoutsRosterTable'
+
+/**
+ * Under this width the roster drops to its compact columns. Sits just above the ~763px the
+ * six-column table needs before it starts scrolling sideways, so the switch happens where the wide
+ * layout actually stops working rather than at a phone-sized guess. Measured on the roster itself
+ * rather than the window, so the tab reads the same inside a narrow embed as it does on a phone.
+ */
+const ROSTER_COMPACT_MAX_PX = 768
+
+/**
+ * The scout roster with the redesign flag off: one alphabetical table over the whole troop, with lifecycle as a sortable
+ * Status column. Replaces the card list that used to live in the Scout troop modal — the fleet
+ * outgrew a 760px portal, and a modal can't host the scout pages it links to.
+ */
+export function ScoutsRosterLegacy(): JSX.Element {
+ const { scoutConfigs, scoutConfigsLoading, enabledCount, customScoutCount } = useValues(scoutFleetLogic)
+ const { loadScoutConfigs, startRunsPolling, stopRunsPolling } = useActions(scoutFleetLogic)
+ // One measurement for the whole roster, so the header chrome and the table agree on which
+ // layout they're in — two observers could disagree for a frame mid-resize.
+ const { ref: widthRef, size } = useResizeBreakpoints(
+ { 0: 'compact', [ROSTER_COMPACT_MAX_PX]: 'wide' },
+ { initialSize: 'wide' }
+ )
+ const compact = size === 'compact'
+
+ useEffect(() => {
+ startRunsPolling()
+ return () => stopRunsPolling()
+ }, [startRunsPolling, stopRunsPolling])
+
+ // Roster shape once per opening, the first time the fleet resolves. A failed load stays `null`
+ // and reports nothing — an unreachable scout API isn't an empty troop.
+ const fleetViewedFiredRef = useRef(false)
+ useEffect(() => {
+ if (scoutConfigs === null || fleetViewedFiredRef.current) {
+ return
+ }
+ fleetViewedFiredRef.current = true
+ captureScoutFleetViewed({
+ scoutCount: scoutConfigs.length,
+ enabledCount,
+ customCount: customScoutCount,
+ dryRunCount: scoutConfigs.filter((config) => !config.emit).length,
+ })
+ }, [scoutConfigs, enabledCount, customScoutCount])
+
+ if (scoutConfigsLoading && scoutConfigs === null) {
+ return (
+ <div className="flex flex-col gap-2 p-6">
+ <LemonSkeleton className="h-8 w-full rounded" />
+ <LemonSkeleton className="h-8 w-full rounded" />
+ <LemonSkeleton className="h-8 w-full rounded" />
+ </div>
+ )
+ }
+
+ // A failed request must not masquerade as an empty troop – a missing scope or
+ // regional rollout gap would otherwise be indistinguishable from "no scouts yet".
+ if (scoutConfigs === null) {
+ return (
+ <div className="m-6 flex items-center gap-3 rounded border border-danger bg-danger-highlight px-4 py-3.5">
+ <span className="flex-1 text-xs text-danger">
+ Couldn't load the scout roster. The scout API may be unavailable or this project may not be enrolled
+ yet.
+ </span>
+ <LemonButton type="secondary" size="small" status="danger" onClick={() => loadScoutConfigs()}>
+ Retry
+ </LemonButton>
+ </div>
+ )
+ }
+
+ if (scoutConfigs.length === 0) {
+ return <ScoutsEmptyStateLegacy />
+ }
+
+ return (
+ <div ref={widthRef} className="flex flex-col">
+ <ScoutAlphaBanner className="mx-6 mt-4" />
+ <ScoutsRosterHeader compact={compact} />
+ <ScoutsRosterTable compact={compact} />
+ <div className="flex flex-col gap-1 px-6 py-4">
+ <span className="text-xs text-muted">
+ The totals above cover the {SCOUT_ROSTER_WINDOW_LABEL}. Each scout's run strip shows its{' '}
+ {SCOUT_RUNS_PER_SCOUT_LABEL}, so scouts on different schedules stay comparable. New scouts are
+ created as <span className="font-mono text-[11px]">signals-scout-*</span> skills in your PostHog
+ project.
+ </span>
+ <ScoutHelperSkillLinks />
+ </div>
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterList.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterList.tsx
new file mode 100644
index 000000000000..1013e2364907
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterList.tsx
@@ -0,0 +1,21 @@
+import { useValues } from 'kea'
+
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { ScoutRosterCard } from './ScoutRosterCard'
+
+/** The filtered, sorted troop as one column of cards, or a one-line notice when nothing matches. */
+export function ScoutsRosterList(): JSX.Element {
+ const { rosterScouts } = useValues(scoutFleetLogic)
+
+ if (rosterScouts.length === 0) {
+ return <p className="m-0 px-1 py-2 text-sm text-tertiary">No scouts match the current filters.</p>
+ }
+
+ return (
+ <div className="flex flex-col gap-1.5">
+ {rosterScouts.map((row) => (
+ <ScoutRosterCard key={row.config.id} row={row} />
+ ))}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx
new file mode 100644
index 000000000000..f3b7d63a240b
--- /dev/null
+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx
@@ -0,0 +1,82 @@
+import { useValues } from 'kea'
+
+import { Tooltip } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { scratchpadLogic } from '../../../logics/scratchpadLogic'
+import { SCOUT_ROSTER_WINDOW_LABEL } from '../../../utils/scoutRunsWindow'
+
+function Stat({
+ value,
+ label,
+ alert = false,
+ tooltip,
+}: {
+ value: string
+ label: string
+ alert?: boolean
+ tooltip?: string
+}): JSX.Element {
+ const stat = (
+ <span
+ className={cn('flex items-baseline gap-1 whitespace-nowrap text-xs', alert ? 'text-danger' : 'text-muted')}
+ >
+ <span className={cn('font-semibold tabular-nums', alert ? 'text-danger' : 'text-default')}>{value}</span>
+ <span>{label}</span>
+ </span>
+ )
+ return tooltip ? (
+ <Tooltip title={tooltip}>
+ <span>{stat}</span>
+ </Tooltip>
+ ) : (
+ stat
+ )
+}
+
+/**
+ * The troop's headline numbers, inline on the toolbar. Output is stated as reports filed rather than
+ * as a run success rate: every run completing tells you nothing crashed, not that the troop is
+ * earning its keep.
+ */
+export function ScoutsRosterStats(): JSX.Element {
+ const { rosterGroupCounts, enabledCount, emittedFindingsSummary, fleetFindingsSummaryLoadedOnce } =
+ useValues(scoutFleetLogic)
+ // Mounted here rather than by the fleet logic, so the 1,000-entry scratchpad read only happens
+ // on the surfaces that show it, not on every inbox tab that mounts the fleet.
+ const { recentlyLearnedCount, entries: scratchpadEntries } = useValues(scratchpadLogic)
+ // A summary that hasn't landed is not zero runs. The number holds a dash until it does; a failed
+ // request keeps the dash rather than claiming a quiet week.
+ const summaryValue = (value: number): string => (fleetFindingsSummaryLoadedOnce ? String(value) : '—')
+
+ return (
+ <div className="ml-auto flex flex-wrap items-center gap-x-3 gap-y-1" data-attr="inbox-scout-stats">
+ {rosterGroupCounts.needs_you > 0 && (
+ <Stat value={String(rosterGroupCounts.needs_you)} label="need you" alert />
+ )}
+ <Stat value={String(enabledCount)} label="on patrol" />
+ <Stat
+ value={summaryValue(emittedFindingsSummary.runCount)}
+ label="runs"
+ tooltip={`Runs your scouts made in the ${SCOUT_ROSTER_WINDOW_LABEL}, quiet ones included.`}
+ />
+ <Stat
+ value={summaryValue(emittedFindingsSummary.authoredReportCount)}
+ label="reports filed"
+ tooltip={`New reports your scouts filed in the ${SCOUT_ROSTER_WINDOW_LABEL}.`}
+ />
+ <Stat
+ value={summaryValue(emittedFindingsSummary.editedReportCount)}
+ label="reports edited"
+ tooltip={`Existing reports your scouts added to in the ${SCOUT_ROSTER_WINDOW_LABEL}.`}
+ />
+ <Stat
+ value={scratchpadEntries === null ? '—' : String(recentlyLearnedCount)}
+ label="learned"
+ tooltip={`Scratchpad entries your scouts wrote or refreshed in the ${SCOUT_ROSTER_WINDOW_LABEL}.`}
+ />
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/AgentRunDetail.tsx b/products/signals/frontend/inbox/components/detail/AgentRunDetail.tsx
index 924e8bce6f00..177544fab8ef 100644
--- a/products/signals/frontend/inbox/components/detail/AgentRunDetail.tsx
+++ b/products/signals/frontend/inbox/components/detail/AgentRunDetail.tsx
@@ -52,7 +52,7 @@ function RunOutputReadyCard({ report }: { report: SignalReport }): JSX.Element {
return (
<Link
- to={urls.inboxReport(isPr ? 'pulls' : 'reports', report.id)}
+ to={urls.inboxReport('reports', report.id)}
className="group flex flex-col gap-2 rounded border border-primary bg-surface-primary px-4 py-3.5 no-underline text-inherit transition-colors duration-150 hover:border-primary hover:bg-surface-secondary"
>
<div className="flex items-center gap-2 flex-wrap">
diff --git a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
index 83f8a88bb67b..b16ed5e9cd67 100644
--- a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
+++ b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
@@ -1,5 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react'
+import { useActions } from 'kea'
import { HttpResponse } from 'msw'
+import { useEffect } from 'react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
import { mswDecorator } from '~/mocks/browser'
@@ -16,10 +20,11 @@ import {
reportTabReports,
runReportsMany,
} from '../../__mocks__/inboxMocks'
-import { SignalReportStatus } from '../../types'
+import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
+import { SignalReport, SignalReportStatus } from '../../types'
import { AgentRunDetail } from './AgentRunDetail'
-import { PullRequestDetail } from './PullRequestDetail'
import { ReportDetail } from './ReportDetail'
+import { ReportDetailLegacy } from './ReportDetailLegacy'
const mixedPrChecks = {
checks: [
@@ -110,7 +115,12 @@ const detailMocks = mswDecorator({
const meta: Meta = {
title: 'Scenes-App/Inbox/Detail',
- parameters: { layout: 'fullscreen', viewMode: 'story', mockDate: '2026-06-11' },
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2026-06-11',
+ featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true },
+ },
decorators: [detailMocks],
}
export default meta
@@ -124,7 +134,7 @@ function Frame({ children }: { children: React.ReactNode }): JSX.Element {
export const Report: Story = {
render: () => (
<Frame>
- <ReportDetail report={reportTabReports[0]} tab="reports" />
+ <ReportDetail report={reportTabReports[0]} />
</Frame>
),
}
@@ -139,7 +149,6 @@ export const ReportMinimal: Story = {
status: SignalReportStatus.CANDIDATE,
signal_count: 1,
})}
- tab="reports"
/>
</Frame>
),
@@ -148,7 +157,7 @@ export const ReportMinimal: Story = {
export const PullRequest: Story = {
render: () => (
<Frame>
- <PullRequestDetail report={pullRequestReports[0]} />
+ <ReportDetail report={pullRequestReports[0]} />
</Frame>
),
}
@@ -156,7 +165,22 @@ export const PullRequest: Story = {
export const PullRequestChecksPassing: Story = {
render: () => (
<Frame>
- <PullRequestDetail report={pullRequestReports[1]} />
+ <ReportDetail report={pullRequestReports[1]} />
+ </Frame>
+ ),
+}
+
+// Opens the "Files changed" tab: the file tree beside the branch diff from `mockBranchDiff()`.
+function FilesChangedTab({ report }: { report: SignalReport }): JSX.Element {
+ const { setDetailTab } = useActions(inboxReportDetailLogic({ reportId: report.id, report }))
+ useEffect(() => setDetailTab('files'), [setDetailTab])
+ return <ReportDetail report={report} />
+}
+
+export const PullRequestFilesChanged: Story = {
+ render: () => (
+ <Frame>
+ <FilesChangedTab report={pullRequestReports[0]} />
</Frame>
),
}
@@ -262,7 +286,27 @@ export const PullRequestInlineReview: Story = {
decorators: [inlineReviewMocks],
render: () => (
<Frame>
- <PullRequestDetail report={pullRequestReports[0]} />
+ <ReportDetail report={pullRequestReports[0]} />
+ </Frame>
+ ),
+}
+
+// The detail pages with the redesign flag off: summary on the left, evidence on the right, and the
+// "Files changed" tab for a report with a PR.
+export const ReportLegacy: Story = {
+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: false } },
+ render: () => (
+ <Frame>
+ <ReportDetailLegacy report={reportTabReports[0]} tab="reports" />
+ </Frame>
+ ),
+}
+
+export const PullRequestLegacy: Story = {
+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: false } },
+ render: () => (
+ <Frame>
+ <ReportDetailLegacy report={pullRequestReports[0]} tab="pulls" />
</Frame>
),
}
diff --git a/products/signals/frontend/inbox/components/detail/InboxDetailHeader.tsx b/products/signals/frontend/inbox/components/detail/InboxDetailHeader.tsx
index 3663b66fe12b..dba41a21b8d9 100644
--- a/products/signals/frontend/inbox/components/detail/InboxDetailHeader.tsx
+++ b/products/signals/frontend/inbox/components/detail/InboxDetailHeader.tsx
@@ -6,7 +6,7 @@ import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { addProjectIdIfMissing } from 'lib/utils/kea-router'
import { urls } from 'scenes/urls'
-import { InboxTabKey, INBOX_TAB_LABEL, SignalReport } from '../../types'
+import { SignalReport } from '../../types'
import { displayConventionalCommitTitle, parseConventionalCommitTitle } from '../../utils/reportPresentation'
import { ConventionalCommitScopeTag } from '../cards/ReportCard'
@@ -15,10 +15,10 @@ import { ConventionalCommitScopeTag } from '../cards/ReportCard'
* copy-link button that copies an absolute deep-link to the run. Report / PR / Not actionable
* details render their own merged header inside `InboxDetailFrame`.
*/
-export function InboxDetailHeader({ report, tab }: { report: SignalReport; tab: InboxTabKey }): JSX.Element {
+export function InboxDetailHeader({ report }: { report: SignalReport }): JSX.Element {
const conventionalTitle = parseConventionalCommitTitle(report.title)
const displayTitle = displayConventionalCommitTitle(report.title, 'Untitled report')
- const reportPath = urls.inboxReport(tab, report.id)
+ const reportPath = urls.inboxReport('reports', report.id)
return (
<div className="shrink-0 border-b border-primary px-6 pt-5 pb-4 flex flex-col gap-3">
@@ -26,10 +26,10 @@ export function InboxDetailHeader({ report, tab }: { report: SignalReport; tab:
type="tertiary"
size="small"
icon={<IconArrowLeft />}
- to={urls.inbox(tab)}
+ to={urls.inbox('reports')}
className="-ml-2 w-fit"
>
- {INBOX_TAB_LABEL[tab]}
+ Inbox
</LemonButton>
<div className="flex items-start justify-between gap-3 min-w-0">
<h1 className="min-w-0 flex-1 m-0 break-words text-2xl font-bold leading-tight tracking-tight">
diff --git a/products/signals/frontend/inbox/components/detail/PullRequestDetail.tsx b/products/signals/frontend/inbox/components/detail/PullRequestDetail.tsx
deleted file mode 100644
index 8fd7bb044d1b..000000000000
--- a/products/signals/frontend/inbox/components/detail/PullRequestDetail.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { SignalReport } from '../../types'
-import { ReportDetail } from './ReportDetail'
-
-/**
- * Pull request detail is now the unified `ReportDetail`, which renders the PR banner +
- * "Open in GitHub" action whenever the report has a shipped implementation PR. Kept as a
- * thin alias for back-compat (e.g. stories / any external imports).
- */
-export function PullRequestDetail({ report }: { report: SignalReport }): JSX.Element {
- return <ReportDetail report={report} tab="pulls" />
-}
diff --git a/products/signals/frontend/inbox/components/detail/PullRequestDiffPanel.tsx b/products/signals/frontend/inbox/components/detail/PullRequestDiffPanel.tsx
index 48fb7156f52e..88a253579bdb 100644
--- a/products/signals/frontend/inbox/components/detail/PullRequestDiffPanel.tsx
+++ b/products/signals/frontend/inbox/components/detail/PullRequestDiffPanel.tsx
@@ -17,8 +17,8 @@ const DIFF_STYLE_OPTIONS = [
]
/**
- * The diff's +/- line counts, shown in the "Files changed" tab label beside the branch so the size of
- * the change reads at a glance even while the tab is collapsed. Renders nothing until the diff loads
+ * The diff's +/- line counts, shown in the "Files changed" section header beside the branch so the size of
+ * the change reads at a glance even while the section is collapsed. Renders nothing until the diff loads
* (or if it's empty). Reads the same `reportDiff` the panel body does — no extra fetch.
*/
export function PullRequestDiffStat({
@@ -33,7 +33,7 @@ export function PullRequestDiffStat({
() => (reportDiff ? summarizeDiff(reportDiff.diff, commit.commit_sha) : null),
[reportDiff, commit.commit_sha]
)
- // Reserve the stat's space while the patch is still loading, so it doesn't pop into the tab label —
+ // Reserve the stat's space while the patch is still loading, so it doesn't pop into the section header —
// but on a load error there's no stat to wait for, so drop it (the panel body shows the error).
if (!reportDiff) {
return reportDiffError ? null : <PullRequestDiffStatSkeleton />
@@ -49,8 +49,8 @@ export function PullRequestDiffStat({
)
}
-/** Mini placeholders for the "Files changed" tab label, shown from the moment we know the report has a
- * PR until the commit artefact (branch) and its diff (size) load — so the tab bar appears immediately
+/** Mini placeholders for the "Files changed" section header, shown from the moment we know the report has a
+ * PR until the commit artefact (branch) and its diff (size) load — so the section appears immediately
* instead of a beat later. */
export function PullRequestDiffStatSkeleton(): JSX.Element {
return <LemonSkeleton className="h-3.5 w-9 rounded" />
@@ -61,7 +61,7 @@ export function PullRequestBranchTagSkeleton(): JSX.Element {
}
/**
- * "Files changed" tab body shown before the commit artefact resolves: a diff skeleton while the branch
+ * "Files changed" section body shown before the commit artefact resolves: a diff skeleton while the branch
* is still loading, or a fallback to GitHub if the artefacts finished loading without a diffable commit.
*/
export function PullRequestDiffPending({ artefactsLoaded }: { artefactsLoaded: boolean }): JSX.Element {
@@ -81,9 +81,8 @@ export function PullRequestDiffPending({ artefactsLoaded }: { artefactsLoaded: b
}
/**
- * The report's branch as a git-branch tag. Rendered in the "Files changed" tab label (so the tab
- * signals there's code behind it, GitHub-style) — inside the LemonTabs active tab it picks up the
- * accent color for free.
+ * The report's branch as a git-branch tag. Rendered in the "Files changed" section header, so the section
+ * signals which branch the diff comes from.
*/
export function PullRequestBranchTag({ commit }: { commit: CommitContent }): JSX.Element {
return (
@@ -97,8 +96,8 @@ export function PullRequestBranchTag({ commit }: { commit: CommitContent }): JSX
}
/**
- * "Files changed" tab body: the report's branch diff against the repository default branch, rendered
- * GitHub-style and read-only. The tab carries the branch tag; this toolbar balances diff stats on the
+ * "Files changed" section body: the report's branch diff against the repository default branch, rendered
+ * GitHub-style and read-only. The section header carries the branch tag; this toolbar balances diff stats on the
* left with the unified/split toggle on the right. The diff itself is loaded by `inboxReportDetailLogic`
* (keyed to the report, cascading off the artefact load) — this component just renders the current
* state, tracking the branch tip as the work moves.
@@ -213,7 +212,7 @@ function DiffToolbarSummary({
const fileLabel = diffSummary.fileCount === 1 ? '1 file changed' : `${diffSummary.fileCount} files changed`
return (
- // The +/- line stat lives in the "Files changed" tab label now, so the toolbar carries just
+ // The +/- line stat lives in the "Files changed" section header, so the toolbar carries just
// the file count and (when present) the inline-thread count.
<div className="flex min-w-0 items-center gap-2 text-sm">
<span className="truncate text-secondary">{fileLabel}</span>
@@ -233,7 +232,6 @@ function DiffToolbarSummary({
title={`Comparing ${commit.repository}@${commit.branch} against the default branch`}
>
{commit.repository}
- <span className="opacity-70"> · vs default branch</span>
</span>
)
}
diff --git a/products/signals/frontend/inbox/components/detail/PullRequestDiffView.tsx b/products/signals/frontend/inbox/components/detail/PullRequestDiffView.tsx
index d3253402e46a..55cfb095c192 100644
--- a/products/signals/frontend/inbox/components/detail/PullRequestDiffView.tsx
+++ b/products/signals/frontend/inbox/components/detail/PullRequestDiffView.tsx
@@ -28,6 +28,24 @@ const CHANGE_META: Record<ChangeTypes, { label: string; icon: ReactNode; classNa
'rename-changed': { label: 'Renamed', icon: <IconArrowRight />, className: 'text-secondary' },
}
+/** Data attribute on each file card, so the file tree can find the cards it follows and scrolls to. */
+export const DIFF_FILE_ATTR = 'data-diff-file'
+
+/** DOM id of a file's card, for `scrollIntoView` from the file tree. Percent-encoded so any path is a valid id. */
+export function diffFileElementId(path: string): string {
+ return `pr-diff-file-${encodeURIComponent(path)}`
+}
+
+/** Color-coded, tooltipped status icon for a changed file, shared by the file headers and the file tree. */
+export function FileChangeIcon({ changeType }: { changeType: ChangeTypes }): JSX.Element {
+ const meta = CHANGE_META[changeType] ?? { label: 'Changed', icon: <IconPencil />, className: 'text-secondary' }
+ return (
+ <Tooltip title={meta.label}>
+ <span className={`flex shrink-0 items-center ${meta.className}`}>{meta.icon}</span>
+ </Tooltip>
+ )
+}
+
// Rough per-row / header heights (px) of Pierre's rendered diff, used only to size the loading
// placeholder so the card doesn't collapse to a bare header while highlighting runs.
const DIFF_ROW_HEIGHT = 20
@@ -116,6 +134,8 @@ function DiffFileCard({ file, children }: { file: FileDiffMetadata; children: Re
return (
<div
+ id={diffFileElementId(file.name)}
+ {...{ [DIFF_FILE_ATTR]: file.name }}
className="relative overflow-hidden rounded-lg border border-primary bg-surface-primary"
style={rendered ? undefined : { minHeight: DIFF_HEADER_HEIGHT + rows * DIFF_ROW_HEIGHT }}
>
@@ -152,7 +172,6 @@ export function summarizeDiff(diff: string, cacheKey?: string): DiffSummary | nu
/** Our own file header (rendered into Pierre's light-DOM header slot): status icon + monospace path + counts. */
function FileDiffHeader({ file }: { file: FileDiffMetadata }): JSX.Element {
- const meta = CHANGE_META[file.type] ?? { label: 'Changed', icon: <IconPencil />, className: 'text-secondary' }
let additions = 0
let deletions = 0
for (const hunk of file.hunks) {
@@ -163,9 +182,7 @@ function FileDiffHeader({ file }: { file: FileDiffMetadata }): JSX.Element {
return (
<div className="flex items-center gap-2 min-w-0 border-b border-primary px-3 py-2">
- <Tooltip title={meta.label}>
- <span className={`flex shrink-0 items-center ${meta.className}`}>{meta.icon}</span>
- </Tooltip>
+ <FileChangeIcon changeType={file.type} />
<span className="truncate font-mono text-xs text-secondary" title={path}>
{path}
</span>
diff --git a/products/signals/frontend/inbox/components/detail/PullRequestFileTree.tsx b/products/signals/frontend/inbox/components/detail/PullRequestFileTree.tsx
new file mode 100644
index 000000000000..ce03fbc8519f
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/PullRequestFileTree.tsx
@@ -0,0 +1,99 @@
+import { useMemo, useState } from 'react'
+
+import { LemonInput } from '@posthog/lemon-ui'
+
+import { LemonTree, TreeDataItem } from 'lib/lemon-ui/LemonTree/LemonTree'
+
+import { buildDiffFileTree, DiffFileSummary, DiffTreeNode } from './diffFileTree'
+import { FileChangeIcon } from './PullRequestDiffView'
+
+function toTreeItems(nodes: DiffTreeNode[]): TreeDataItem[] {
+ return nodes.map((node) =>
+ node.kind === 'folder'
+ ? {
+ id: `folder:${node.path}`,
+ name: node.name,
+ record: { type: 'folder' },
+ children: toTreeItems(node.children),
+ }
+ : {
+ id: node.path,
+ name: node.name,
+ icon: <FileChangeIcon changeType={node.changeType} />,
+ record: {
+ type: 'changed-file',
+ path: node.path,
+ additions: node.additions,
+ deletions: node.deletions,
+ },
+ }
+ )
+}
+
+/**
+ * GitHub-style file tree beside the diff: a path filter, then the changed files grouped by directory,
+ * each with its status icon and line counts. Selecting a file hands its path back to the parent, which
+ * owns the scroll and the highlighted row.
+ */
+export function PullRequestFileTree({
+ files,
+ activePath,
+ onSelectFile,
+}: {
+ files: DiffFileSummary[]
+ /** Path of the file the diff is currently showing; its row renders active. */
+ activePath: string | null
+ onSelectFile: (path: string) => void
+}): JSX.Element {
+ const [query, setQuery] = useState('')
+ const data = useMemo(() => {
+ const needle = query.trim().toLowerCase()
+ const matching = needle ? files.filter((file) => file.path.toLowerCase().includes(needle)) : files
+ return toTreeItems(buildDiffFileTree(matching))
+ }, [files, query])
+
+ return (
+ <div className="flex flex-col gap-2">
+ <LemonInput
+ type="search"
+ size="small"
+ placeholder="Filter files"
+ value={query}
+ onChange={setQuery}
+ data-attr="inbox-pr-file-tree-filter"
+ />
+ {data.length === 0 ? (
+ <p className="m-0 px-2 py-1 text-xs text-tertiary">No files match.</p>
+ ) : (
+ <LemonTree
+ data={data}
+ expandAllFolders
+ isItemActive={(item) => item.id === activePath}
+ onItemClick={(item) => {
+ const path = item?.record?.path
+ if (typeof path === 'string') {
+ onSelectFile(path)
+ }
+ }}
+ renderItem={(item, name) =>
+ item.record?.type === 'changed-file' ? (
+ <span className="flex items-center gap-2 min-w-0" title={item.record.path}>
+ <span className="truncate font-mono text-xs">{name}</span>
+ <span className="ml-auto flex shrink-0 items-center gap-1.5 font-mono text-[0.6875rem] tabular-nums">
+ {item.record.deletions > 0 && (
+ <span className="text-danger">-{item.record.deletions}</span>
+ )}
+ {item.record.additions > 0 && (
+ <span className="text-success">+{item.record.additions}</span>
+ )}
+ </span>
+ </span>
+ ) : (
+ name
+ )
+ }
+ />
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/PullRequestFilesChanged.tsx b/products/signals/frontend/inbox/components/detail/PullRequestFilesChanged.tsx
new file mode 100644
index 000000000000..7e5964bad9e0
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/PullRequestFilesChanged.tsx
@@ -0,0 +1,101 @@
+import { parsePatchFiles } from '@pierre/diffs'
+import { useValues } from 'kea'
+import { useEffect, useMemo, useState } from 'react'
+
+import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
+import { SignalReport } from '../../types'
+import { CommitContent } from './artefactTypes'
+import { DiffFileSummary, summarizeDiffFile } from './diffFileTree'
+import { PullRequestDiffPanel } from './PullRequestDiffPanel'
+import { DIFF_FILE_ATTR, diffFileElementId } from './PullRequestDiffView'
+import { PullRequestFileTree } from './PullRequestFileTree'
+
+function summarizeDiffFiles(diff: string, cacheKey: string): DiffFileSummary[] | null {
+ if (!diff.trim()) {
+ return []
+ }
+ try {
+ return parsePatchFiles(diff, cacheKey)
+ .flatMap((patch) => patch.files)
+ .map(summarizeDiffFile)
+ } catch {
+ return null
+ }
+}
+
+/**
+ * "Files changed" tab body: a sticky file tree beside the stacked per-file diffs. The tree follows the
+ * file at the top of the viewport as the page scrolls, and clicking a row scrolls its diff into view.
+ * The diff itself is `PullRequestDiffPanel`, shared with the legacy tab, so nothing about loading,
+ * inline comments, or the unified/split toggle lives here.
+ */
+export function PullRequestFilesChanged({
+ report,
+ commit,
+}: {
+ report: SignalReport
+ commit: CommitContent
+}): JSX.Element {
+ const { reportDiff } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))
+ const files = useMemo(
+ () => (reportDiff ? summarizeDiffFiles(reportDiff.diff, commit.commit_sha) : null),
+ [reportDiff, commit.commit_sha]
+ )
+ const [activePath, setActivePath] = useState<string | null>(null)
+
+ // Scroll-following is view state only: the row highlight tracks whichever file card crosses the
+ // top third of the viewport. Cards mount asynchronously with the diff, so re-observe when `files` changes.
+ useEffect(() => {
+ if (!files?.length || typeof IntersectionObserver === 'undefined') {
+ return
+ }
+ const cards = Array.from(document.querySelectorAll<HTMLElement>(`[${DIFF_FILE_ATTR}]`))
+ if (cards.length === 0) {
+ return
+ }
+ const visible = new Set<HTMLElement>()
+ const observer = new IntersectionObserver(
+ (entries) => {
+ for (const entry of entries) {
+ if (entry.isIntersecting) {
+ visible.add(entry.target as HTMLElement)
+ } else {
+ visible.delete(entry.target as HTMLElement)
+ }
+ }
+ const first = cards.find((card) => visible.has(card))
+ if (first) {
+ setActivePath(first.getAttribute(DIFF_FILE_ATTR))
+ }
+ },
+ { rootMargin: '0px 0px -66% 0px' }
+ )
+ cards.forEach((card) => observer.observe(card))
+ return () => observer.disconnect()
+ }, [files])
+
+ const selectFile = (path: string): void => {
+ setActivePath(path)
+ const reduceMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
+ document
+ .getElementById(diffFileElementId(path))
+ ?.scrollIntoView({ block: 'start', behavior: reduceMotion ? 'auto' : 'smooth' })
+ }
+
+ return (
+ <div className="flex items-start gap-6">
+ {/* One file needs no tree. The tree also drops below @3xl, where the diff needs the full width. */}
+ {files && files.length > 1 && (
+ <div
+ className="hidden @3xl:block w-72 shrink-0 sticky top-0 max-h-screen overflow-y-auto py-1 pr-2"
+ data-attr="inbox-pr-file-tree"
+ >
+ <PullRequestFileTree files={files} activePath={activePath} onSelectFile={selectFile} />
+ </div>
+ )}
+ <div className="min-w-0 flex-1">
+ <PullRequestDiffPanel report={report} commit={commit} />
+ </div>
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
index 6497d076a24b..c9cec0f98463 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
@@ -1,57 +1,52 @@
-import { BindLogic, useValues } from 'kea'
+import { BindLogic, useActions, useValues } from 'kea'
import { router } from 'kea-router'
-import { ReactNode, useCallback, useState } from 'react'
+import { ReactNode } from 'react'
-import { IconArrowLeft, IconDocument, IconEllipsis, IconExternal, IconPullRequest, IconSearch } from '@posthog/icons'
+import {
+ IconArrowLeft,
+ IconEllipsis,
+ IconExternal,
+ IconSearch,
+ IconSidebarClose,
+ IconSidebarOpen,
+} from '@posthog/icons'
import { LemonButton, LemonTabs, Tooltip } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
-import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { LemonMenu, LemonMenuItem } from 'lib/lemon-ui/LemonMenu'
-import { ScoutLink } from 'lib/signals/ScoutLink'
-import { scoutDisplayName } from 'lib/signals/signalCardSourceLine'
import { addProjectIdIfMissing } from 'lib/utils/kea-router'
import { SignalNode } from 'scenes/debug/signals/types'
import { urls } from 'scenes/urls'
import { captureInboxReportAction } from '../../inboxAnalytics'
+import { inboxDetailLayoutLogic } from '../../logics/inboxDetailLayoutLogic'
import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
import { SignalCard } from '../../SignalCard'
-import { InboxTabKey, INBOX_TAB_LABEL, SignalReport, SignalReportStatus, SignalSourceProduct } from '../../types'
+import { SignalReport, SignalReportStatus } from '../../types'
import {
displayConventionalCommitTitle,
parseConventionalCommitTitle,
parsePrUrlParts,
safeHttpUrl,
} from '../../utils/reportPresentation'
+import { parseReportSummary } from '../../utils/reportSummary'
import { SignalReportActionabilityBadge } from '../badges/SignalReportActionabilityBadge'
import { SignalReportBillingBadge } from '../badges/SignalReportBillingBadge'
import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'
import { isStatusRedundantWithActionability, SignalReportStatusBadge } from '../badges/SignalReportStatusBadge'
-import {
- hasKnownSourceProduct,
- knownSourceProductEntries,
- SourceProductIconRow,
- sourceProductsTooltipTitle,
-} from '../badges/sourceProductIcons'
import { ConventionalCommitScopeTag } from '../cards/ReportCard'
import { CommitContent } from './artefactTypes'
import { DetailSection } from './DetailSection'
import { DiscussReportButton } from './DiscussReportButton'
import { PrChecksSection } from './PrChecksSection'
import { PrCommentsSection } from './PrCommentsSection'
-import {
- PullRequestBranchTag,
- PullRequestBranchTagSkeleton,
- PullRequestDiffPanel,
- PullRequestDiffPending,
- PullRequestDiffStat,
- PullRequestDiffStatSkeleton,
-} from './PullRequestDiffPanel'
+import { PullRequestDiffPending, PullRequestDiffStat, PullRequestDiffStatSkeleton } from './PullRequestDiffPanel'
+import { PullRequestFilesChanged } from './PullRequestFilesChanged'
import { ReportActivitySection } from './ReportActivitySection'
import { ReportChart } from './ReportChart'
import { useReportDetailActions } from './ReportDetailActions'
import { ReportFeedbackFooter } from './ReportFeedbackFooter'
+import { ReportSummaryBody } from './ReportSummaryBody'
import { ReportTasksSection } from './ReportTasksSection'
import { SuggestedReviewersSection } from './SuggestedReviewersSection'
@@ -88,110 +83,6 @@ export function ReportDetailBadges({
const SIGNALS_TOOLTIP =
'Signals are the individual pieces of evidence from your connected sources and scouts that were grouped into this report.'
-/**
- * Single meta line under the title: status/actionability chips, then dot-separated stats
- * (finding count · updated · source stack). `evidenceCount` switches to the live signal count once
- * findings load, so the row reads the same before and after the query resolves.
- */
-function ReportDetailMeta({
- report,
- evidenceCount,
- actionabilityExplanation,
- scoutSkillName,
-}: {
- report: SignalReport
- evidenceCount: number
- actionabilityExplanation?: string | null
- /** Authoring scout's raw skill slug, when scout-authored — its name links to the scout off the "Scout" chip. */
- scoutSkillName?: string | null
-}): JSX.Element {
- const hasSource = hasKnownSourceProduct(report.source_products)
- const showStatus = !isStatusRedundantWithActionability(report.status, report.actionability)
-
- const stats: ReactNode[] = []
- if (evidenceCount > 0) {
- stats.push(
- <Tooltip title={SIGNALS_TOOLTIP}>
- <span className="tabular-nums cursor-help">
- {evidenceCount} signal{evidenceCount === 1 ? '' : 's'}
- </span>
- </Tooltip>
- )
- }
- // Mirrors error tracking's "First seen" / "Last seen": surface both lifecycle moments as distinct facts.
- stats.push(
- <span className="flex items-center gap-1">
- <span>First seen</span>
- <TZLabel time={report.created_at} />
- </span>
- )
- stats.push(
- <span className="flex items-center gap-1">
- <span>Last updated</span>
- <TZLabel time={report.updated_at ?? report.created_at} />
- </span>
- )
- if (hasSource) {
- stats.push(<MetaSourceStack sourceProducts={report.source_products} scoutSkillName={scoutSkillName} />)
- }
-
- return (
- <div className="flex items-center gap-x-2 gap-y-1.5 flex-wrap text-xs text-tertiary leading-none select-none">
- {showStatus && <SignalReportStatusBadge status={report.status} />}
- <SignalReportActionabilityBadge
- actionability={report.actionability}
- explanation={actionabilityExplanation}
- />
- <SignalReportBillingBadge report={report} />
- <span className="flex items-center gap-2 flex-wrap min-w-0">
- {stats.map((node, i) => (
- <span key={i} className="flex items-center gap-2 min-w-0">
- {i > 0 && <span aria-hidden>·</span>}
- {node}
- </span>
- ))}
- </span>
- </div>
- )
-}
-
-/** Source-product icon stack reused inside the detail meta row. */
-function MetaSourceStack({
- sourceProducts,
- scoutSkillName,
-}: {
- sourceProducts?: string[] | null
- scoutSkillName?: string | null
-}): JSX.Element | null {
- const entries = knownSourceProductEntries(sourceProducts)
- const [primary, ...overflow] = entries
- if (!primary) {
- return null
- }
- // Name the authoring scout on a scout-authored report so it's clear at a glance who wrote it,
- // and link the name straight to the scout's detail page. The scout may not sort first among mixed
- // sources, so key off whether any source is a scout rather than just the primary.
- const scoutName = scoutDisplayName(scoutSkillName)
- const showScout = entries.some(({ key }) => key === SignalSourceProduct.SignalsScout) && !!scoutName
- return (
- <Tooltip title={sourceProductsTooltipTitle(entries)}>
- <span className="inline-flex items-center gap-1.5 min-w-0 cursor-help">
- <SourceProductIconRow entries={entries} className="inline-flex items-center gap-1 shrink-0" />
- <span>
- {primary.meta.label}
- {showScout && scoutSkillName ? (
- <>
- {' · '}
- <ScoutLink skillName={scoutSkillName} className="text-tertiary" />
- </>
- ) : null}
- {overflow.length > 0 ? ` + ${overflow.length}` : null}
- </span>
- </span>
- </Tooltip>
- )
-}
-
/** Placeholder finding rows shown while the signals query is in flight, sized to the known count. */
function EvidenceSkeleton({ count }: { count: number }): JSX.Element {
const rows = Math.max(1, Math.min(count, 4))
@@ -210,47 +101,63 @@ function EvidenceSkeleton({ count }: { count: number }): JSX.Element {
)
}
+/** Column classes shared by the frame and its skeleton, so the two can't drift apart. */
+const DETAIL_PAGE_CLASS = '@container w-full max-w-[calc(160ch+5rem)] mx-auto px-6 pb-4 text-sm'
+const DETAIL_CONTAINER_CLASS =
+ 'flex flex-col rounded-lg border border-primary bg-surface-primary @5xl:flex-row @5xl:items-start'
+// The evidence rail: first in the DOM so it leads on wide layouts, ordered after the summary when
+// the columns stack, because reading the summary first is what a narrow screen wants.
+const DETAIL_ASIDE_CLASS =
+ 'order-2 flex w-full min-w-0 flex-col gap-5 border-t border-primary p-5 @5xl:order-none @5xl:w-[26rem] @5xl:shrink-0 @5xl:self-stretch @5xl:border-t-0 @5xl:border-r'
+const DETAIL_MAIN_CLASS = 'order-1 flex min-w-0 flex-1 flex-col px-6 py-5 @5xl:order-none @5xl:px-8'
+// The rail folded away: a strip holding only the control that brings it back, in the same place the
+// hide control sat, so the toggle never jumps across the page.
+const DETAIL_ASIDE_COLLAPSED_CLASS =
+ 'order-2 flex w-full items-start border-t border-primary px-5 py-2 @5xl:order-none @5xl:w-auto @5xl:self-stretch @5xl:border-t-0 @5xl:border-r @5xl:px-2 @5xl:py-5'
+
/**
* Layout-faithful placeholder shown while a report's base record loads on a cold open (deep link
- * with no list row to seed from). Mirrors `InboxDetailFrame`'s header + two-column shape so the
- * page doesn't jump when the real content lands — and so loading reads as "this view, populating"
- * rather than a bare centered spinner.
+ * with no list row to seed from). Mirrors `InboxDetailFrame`'s header row + evidence-first
+ * two-column container so the page doesn't jump when the real content lands — and so loading
+ * reads as "this view, populating" rather than a bare centered spinner.
*/
export function ReportDetailSkeleton(): JSX.Element {
return (
- <div className="@container w-full max-w-[calc(160ch+5rem)] mx-auto px-6 py-5 text-sm" aria-hidden>
- <div className="flex flex-col gap-3.5 mb-6 pb-5 border-b border-primary">
- <div className="h-3.5 w-24 rounded bg-fill-highlight-50 animate-pulse" />
- <div className="flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4">
- <div className="flex items-start gap-3 min-w-0 @2xl:flex-1">
- <div className="size-7 shrink-0 mt-0.5 rounded bg-fill-highlight-100 animate-pulse" />
- <div className="flex flex-col gap-2 min-w-0 flex-1">
- <div className="h-6 w-2/3 rounded bg-fill-highlight-100 animate-pulse" />
- <div className="h-3 w-1/2 rounded bg-fill-highlight-50 animate-pulse" />
- </div>
- </div>
- <div className="flex items-center flex-wrap gap-2 @2xl:shrink-0">
- <div className="h-8 w-24 rounded bg-fill-highlight-50 animate-pulse" />
- <div className="h-8 w-20 rounded bg-fill-highlight-50 animate-pulse" />
- </div>
+ <div className={DETAIL_PAGE_CLASS} aria-hidden>
+ <div className="flex items-center justify-between gap-3 mb-4">
+ <div className="h-8 w-24 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="flex items-center gap-2">
+ <div className="h-8 w-24 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-8 w-20 rounded bg-fill-highlight-50 animate-pulse" />
</div>
</div>
-
- <div className="grid grid-cols-1 @5xl:grid-cols-[minmax(0,80ch)_minmax(22rem,1fr)] gap-5">
- <div className="min-w-0 flex flex-col gap-2.5">
- <div className="h-4 w-28 rounded bg-fill-highlight-100 animate-pulse" />
- <div className="h-3 w-full rounded bg-fill-highlight-50 animate-pulse" />
- <div className="h-3 w-11/12 rounded bg-fill-highlight-50 animate-pulse" />
- <div className="h-3 w-3/4 rounded bg-fill-highlight-50 animate-pulse" />
- </div>
- <div className="flex flex-col min-w-0 gap-5">
+ <div className={DETAIL_CONTAINER_CLASS}>
+ <div className={DETAIL_ASIDE_CLASS}>
{Array.from({ length: 2 }).map((_, i) => (
<div key={i} className="flex flex-col gap-2.5">
<div className="h-4 w-24 rounded bg-fill-highlight-100 animate-pulse" />
- <div className="h-16 w-full rounded border border-primary bg-surface-primary animate-pulse" />
+ <div className="h-16 w-full rounded border border-primary bg-surface-secondary animate-pulse" />
</div>
))}
</div>
+ <div className={DETAIL_MAIN_CLASS}>
+ <div className="flex items-center gap-2.5 mb-4 pb-3 border-b border-primary">
+ <div className="h-3.5 w-28 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-4 w-20 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ <div className="flex items-start gap-3 min-w-0">
+ <div className="size-7 shrink-0 mt-0.5 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="flex flex-col gap-2 min-w-0 flex-1">
+ <div className="h-7 w-2/3 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-3 w-1/2 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ </div>
+ <div className="flex flex-col gap-2.5 mt-6">
+ <div className="h-3 w-full rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-3 w-11/12 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-3 w-3/4 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ </div>
</div>
</div>
)
@@ -258,44 +165,43 @@ export function ReportDetailSkeleton(): JSX.Element {
interface InboxDetailFrameProps {
report: SignalReport
- /** Active inbox tab — drives the back link and the report URL seeded into Discuss. */
- tab: InboxTabKey
- /** Summary section heading icon + title. */
- summary: { icon: ReactNode; title: string }
- /** Content rendered in the main column directly under the Summary (e.g. the PR conversation). */
- summaryFooter?: ReactNode
+ /** Content closing the evidence rail, after Activity (e.g. the PR conversation). */
+ asideFooter?: ReactNode
/** Extra primary action(s) rendered after the shared report actions. */
primaryAction?: ReactNode
- /** Whether to render the Overview / Files changed tab bar. Driven by whether the report has a PR
- * (known immediately), not by whether the diff has loaded — so the tab bar doesn't pop in a beat
- * later and shift the layout. */
+ /** Whether the report column gets the Summary / Files changed tab bar. Driven by whether the report has
+ * a PR (known immediately), not by whether the diff has loaded, so the bar doesn't pop in a beat later
+ * and shift the layout. */
showFilesTab?: boolean
- /** Diff body rendered under the "Files changed" tab (may be a skeleton while the commit artefact loads). */
+ /** Body of the "Files changed" tab (may be a skeleton while the commit artefact loads). */
diffSection?: ReactNode
- /** Branch tag shown in the "Files changed" tab label, so the tab signals there's code behind it. */
- diffBranchTag?: ReactNode
- /** +/- line-count stat shown in the "Files changed" tab label, right of the branch. */
+ /** +/- line-count stat shown in the "Files changed" tab label and the report footer. */
diffStat?: ReactNode
+ /** Note that a pull request with the fix is open, placed under the summary's Solution section. */
+ pullRequestNote?: ReactNode
/** Extra sections (Tasks, Reviewers) – defaults applied by callers. */
children?: ReactNode
}
/**
- * Shared chrome for the Report and Pull request detail bodies. Owns the full page header
- * (title) merged with the badges/meta/actions, then summary on the left
- * and supporting sections (Evidence, Runs, Reviewers) on the right. Mirrors desktop
- * `InboxDetailFrame`. AgentRunDetail keeps its own layout + shell header.
+ * Shared chrome for the Report and Pull request detail bodies. A back link and the actions sit on
+ * one row over a bordered container: the evidence rail on the left (Evidence first, then the PR
+ * checks, reviewers, runs, and activity), and the report summary on the right under its own
+ * "Report summary" header. The summary's title stands alone; the priority, the size of the change, and
+ * the created/updated times head the "Files changed" tab, where a reviewer weighs the change. The
+ * status and actionability chips stay off the page because the inbox section the report came from
+ * already says what they said. The rail can be hidden (a persisted preference) so the report column,
+ * and above all the diff, takes the full width.
+ * AgentRunDetail keeps its own layout.
*/
export function InboxDetailFrame({
report,
- tab,
- summary,
- summaryFooter,
+ asideFooter,
primaryAction,
showFilesTab,
diffSection,
- diffBranchTag,
diffStat,
+ pullRequestNote,
children,
}: InboxDetailFrameProps): JSX.Element {
const { searchParams } = useValues(router)
@@ -304,18 +210,13 @@ export function InboxDetailFrame({
const rawBack = searchParams.back
const backOverride =
typeof rawBack === 'string' && rawBack.startsWith('/') && !rawBack.startsWith('//') ? rawBack : null
+ const backLabel = backOverride ? (backOverride.startsWith(urls.inboxTriage()) ? 'Triage' : 'Back') : 'Inbox'
const logicProps = { reportId: report.id, report }
- const {
- reportSignals,
- reportSignalsLoading,
- priorityExplanation,
- actionabilityExplanation,
- chartPlacements,
- trailingCharts,
- } = useValues(inboxReportDetailLogic(logicProps))
- // GitHub-style PR view: when the report has a PR, the overview and the diff live behind two tabs.
- const [activeDetailTab, setActiveDetailTab] = useState<'overview' | 'files'>('overview')
- const hasDiff = !!showFilesTab
+ const { reportSignals, reportSignalsLoading, priorityExplanation, chartPlacements, trailingCharts, detailTab } =
+ useValues(inboxReportDetailLogic(logicProps))
+ const { setDetailTab } = useActions(inboxReportDetailLogic(logicProps))
+ const { evidenceRailCollapsed } = useValues(inboxDetailLayoutLogic)
+ const { toggleEvidenceRail } = useActions(inboxDetailLayoutLogic)
const signals = reportSignals ?? []
const evidenceCount = reportSignals !== null ? signals.length : report.signal_count
const hasEvidence = evidenceCount > 0
@@ -323,17 +224,6 @@ export function InboxDetailFrame({
const summaryPending =
report.status === SignalReportStatus.IN_PROGRESS || report.status === SignalReportStatus.CANDIDATE
- // Depends on placement alone. `LemonMarkdown` memoizes its anchor component on this callback, so
- // anything else in here — the charts themselves, the report object — would rebuild that component
- // as the report polls and unmount every rendered chart with it.
- const renderChartRef = useCallback(
- (chartId: string, sourceOffset?: number): ReactNode =>
- sourceOffset !== undefined && chartPlacements.inlineByOffset.get(sourceOffset) === chartId ? (
- <ReportChart chartId={chartId} />
- ) : null,
- [chartPlacements]
- )
-
// Reading depth on the report body: which supporting sections a reader actually opened.
const captureSectionToggle = (section: string) => (collapsed: boolean) =>
captureInboxReportAction({
@@ -347,11 +237,19 @@ export function InboxDetailFrame({
const displayTitle = displayConventionalCommitTitle(report.title, 'Untitled report')
// Absolute URL to this report – seeded into the Discuss prompt so the agent can open and read
// the report directly.
- const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport(tab, report.id))}`
+ const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport('reports', report.id))}`
- // Secondary actions as data so the same set renders inline as buttons on wide layouts and as a
- // standard `LemonMenu` on narrow ones; the primary action stays inline either way.
- const reportActions = useReportDetailActions(report)
+ // Create PR is the report's main call to action, so it takes the primary slot (styled like
+ // "Open in GitHub" on PR-bearing reports). The rest render inline as buttons on wide layouts
+ // and as a standard `LemonMenu` on narrow ones.
+ const allReportActions = useReportDetailActions(report)
+ const createPrAction = allReportActions.find((action) => action.key === 'create-pr')
+ // `ReportSummaryBody` renders Create PR under the Solution section, so the header only carries it
+ // when the summary has no Solution section — otherwise an actionable report shows it twice.
+ const summaryHasSolution = parseReportSummary(report.summary).sections.some(
+ (section) => section.kind === 'solution'
+ )
+ const reportActions = allReportActions.filter((action) => action.key !== 'create-pr')
const overflowMenuItems: LemonMenuItem[] = reportActions.map((action) => ({
label: action.label,
icon: action.icon,
@@ -359,200 +257,284 @@ export function InboxDetailFrame({
onClick: action.onClick,
}))
+ const generatedAt = (
+ <span className="flex items-center gap-1 text-xs text-tertiary">
+ Generated <TZLabel time={report.created_at} />
+ </span>
+ )
+
+ // Hiding the rail gives the report column the full width, which is what reading a diff needs. The
+ // Both controls live on the rail: hide in the Evidence header, show in the strip the rail folds to.
+ const onToggleRail = (): void => {
+ toggleEvidenceRail()
+ captureSectionToggle('evidence_rail')(!evidenceRailCollapsed)
+ }
+ const hideRailButton = (
+ <LemonButton
+ size="xsmall"
+ type="tertiary"
+ icon={<IconSidebarClose />}
+ tooltip="Hide evidence to widen the report"
+ aria-label="Hide evidence"
+ onClick={onToggleRail}
+ data-attr="inbox-report-hide-evidence-rail"
+ />
+ )
+ const showRailButton = (
+ <LemonButton
+ size="xsmall"
+ type="tertiary"
+ icon={<IconSidebarOpen />}
+ tooltip="Show evidence"
+ aria-label="Show evidence"
+ onClick={onToggleRail}
+ data-attr="inbox-report-show-evidence-rail"
+ />
+ )
+
+ const titleHeading = (
+ <h1 className="min-w-0 m-0 break-words text-2xl font-bold leading-tight tracking-tight">
+ {conventionalTitle && (
+ <ConventionalCommitScopeTag type={conventionalTitle.type} scope={conventionalTitle.scope} />
+ )}
+ {displayTitle}
+ </h1>
+ )
+
+ // The report body: title, summary, charts, and the rating. On a PR-bearing report it is the
+ // "Summary" tab; otherwise it sits under the "Report summary" header.
+ const summaryColumn = (
+ <div className="flex flex-1 flex-col gap-6">
+ {titleHeading}
+
+ <div>
+ {report.summary ? (
+ <ReportSummaryBody
+ summary={report.summary}
+ chartPlacements={chartPlacements}
+ createPrAction={createPrAction}
+ pullRequestNote={pullRequestNote}
+ />
+ ) : (
+ <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>
+ No summary yet. An agent is still investigating.
+ </p>
+ )}
+ {trailingCharts.length > 0 && (
+ <div className="flex flex-col gap-4 mt-5">
+ {trailingCharts.map((chart) => (
+ <ReportChart key={chart.chart_id} chartId={chart.chart_id} />
+ ))}
+ </div>
+ )}
+ </div>
+ {/* The rating closes out the report body, pinned to the bottom of the column. */}
+ <div className="mt-auto">
+ <ReportFeedbackFooter report={report} align="end" />
+ </div>
+ </div>
+ )
+
+ // Above the diff: what is being reviewed and how big it is. The priority sits here rather than on
+ // the summary because the diff is where a reviewer weighs the change against its urgency.
+ const filesHeader = (
+ <header className="flex flex-col gap-2">
+ <div className="flex items-start gap-3 min-w-0">
+ {report.priority && (
+ <div className="shrink-0 mt-1">
+ <SignalReportPriorityBadge priority={report.priority} explanation={priorityExplanation} />
+ </div>
+ )}
+ {titleHeading}
+ </div>
+ <div className="flex flex-wrap items-center gap-2 text-xs text-tertiary">
+ {diffStat && (
+ <>
+ <span className="flex items-center gap-1.5">
+ <span>Files changed</span>
+ {diffStat}
+ </span>
+ <span aria-hidden>·</span>
+ </>
+ )}
+ <span className="flex items-center gap-1">
+ Created <TZLabel time={report.created_at} />
+ </span>
+ <span aria-hidden>·</span>
+ <span className="flex items-center gap-1">
+ Last updated <TZLabel time={report.updated_at ?? report.created_at} />
+ </span>
+ </div>
+ </header>
+ )
+
// Bound rather than passed as props so a chart can reach the logic by id alone. `ReportChart`
// building the logic itself would have to pass `report` back in, and kea treats that as a props
// change on the mounted instance.
const overviewBody = (
<BindLogic logic={inboxReportDetailLogic} props={logicProps}>
- <div className="grid grid-cols-1 @5xl:grid-cols-[minmax(0,80ch)_minmax(22rem,1fr)] gap-5">
- <div className="min-w-0 flex flex-col gap-5">
- <DetailSection
- icon={summary.icon}
- title={summary.title}
- collapsible
- onToggleCollapsed={captureSectionToggle('summary')}
- >
- {report.summary ? (
- <LemonMarkdown
- className="text-sm text-secondary leading-relaxed break-words [&>*+*]:mt-3 [&_[data-attr=report-chart]]:my-5 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-5 [&_h2]:mt-5 [&_h3]:mt-4"
- disableImages
- renderChartRef={renderChartRef}
+ <div className={DETAIL_CONTAINER_CLASS}>
+ {evidenceRailCollapsed ? (
+ <aside className={DETAIL_ASIDE_COLLAPSED_CLASS}>{showRailButton}</aside>
+ ) : (
+ <aside className={DETAIL_ASIDE_CLASS}>
+ {/* Evidence leads: it is what the summary's claims rest on. */}
+ {hasEvidence && (
+ <DetailSection
+ icon={<IconSearch />}
+ title="Evidence"
+ collapsible
+ onToggleCollapsed={captureSectionToggle('evidence')}
+ rightSlot={
+ <span className="flex items-center gap-1">
+ <Tooltip title={SIGNALS_TOOLTIP}>
+ <span className="text-[0.6875rem] text-tertiary tabular-nums cursor-help">
+ {evidenceCount} signal{evidenceCount === 1 ? '' : 's'}
+ </span>
+ </Tooltip>
+ {hideRailButton}
+ </span>
+ }
>
- {report.summary}
- </LemonMarkdown>
- ) : (
- <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>
- No summary yet. An agent is still investigating.
- </p>
- )}
- {trailingCharts.length > 0 && (
- <div className="flex flex-col gap-4 mt-5">
- {trailingCharts.map((chart) => (
- <ReportChart key={chart.chart_id} chartId={chart.chart_id} />
- ))}
- </div>
+ {reportSignalsLoading && reportSignals === null ? (
+ <EvidenceSkeleton count={evidenceCount} />
+ ) : (
+ <div className="flex flex-col gap-3">
+ {signals.map((signal: SignalNode) => (
+ <SignalCard key={signal.signal_id} signal={signal} />
+ ))}
+ </div>
+ )}
+ </DetailSection>
)}
- </DetailSection>
- {summaryFooter}
- {/* The rating closes out the report body, where the reading ends – ahead of the
- supporting sections, which stack underneath once the layout drops to one column. */}
- <ReportFeedbackFooter report={report} />
- </div>
+ {/* Pull request checks (when present), then reviewers, runs, and activity. */}
+ {children}
+ <SuggestedReviewersSection report={report} />
+ <ReportTasksSection report={report} />
+ <ReportActivitySection report={report} />
+ {asideFooter}
+ </aside>
+ )}
- <div className="flex flex-col min-w-0 gap-5">
- {/* Pull request (when present) first, then reviewers, evidence, runs, and activity. */}
- {children}
- <SuggestedReviewersSection report={report} />
- {hasEvidence && (
- <DetailSection
- icon={<IconSearch />}
- title="Evidence"
- collapsible
- onToggleCollapsed={captureSectionToggle('evidence')}
+ <main className={DETAIL_MAIN_CLASS}>
+ {showFilesTab ? (
+ <LemonTabs
+ activeKey={detailTab}
+ onChange={setDetailTab}
+ // The tab labels carry 12px of padding above the text. Pull the bar up by that
+ // much so the tab text sits where the "Report summary" header sits, level with
+ // the "Evidence" header in the rail, and the gap below the bar stays the same.
+ className="-mt-3"
+ rightSlotClassName="bg-surface-primary"
rightSlot={
- <Tooltip title={SIGNALS_TOOLTIP}>
- <span className="text-[0.6875rem] text-tertiary tabular-nums cursor-help">
- {evidenceCount} signal{evidenceCount === 1 ? '' : 's'}
- </span>
- </Tooltip>
+ <span className="flex items-center gap-2.5">
+ <SignalReportBillingBadge report={report} />
+ {generatedAt}
+ </span>
}
- >
- {reportSignalsLoading && reportSignals === null ? (
- <EvidenceSkeleton count={evidenceCount} />
- ) : (
- <div className="flex flex-col gap-3">
- {signals.map((signal: SignalNode) => (
- <SignalCard key={signal.signal_id} signal={signal} />
- ))}
- </div>
- )}
- </DetailSection>
+ tabs={[
+ { key: 'summary', label: 'Summary', content: summaryColumn },
+ {
+ key: 'files',
+ label: (
+ <span className="flex items-center gap-1.5">
+ <span>Files changed</span>
+ {diffStat}
+ </span>
+ ),
+ // `LemonTabs` renders only the active tab, so the rating row repeats after
+ // the diff: reviewing the code and stopping there must still leave a way
+ // to rate the report. Both rows read the same report-keyed logic.
+ content: (
+ <div className="flex flex-col gap-5">
+ {filesHeader}
+ {diffSection}
+ <ReportFeedbackFooter report={report} align="end" />
+ </div>
+ ),
+ },
+ ]}
+ />
+ ) : (
+ <>
+ <div className="mb-4 flex flex-wrap items-center gap-2.5 border-b border-primary pb-3">
+ <span className="text-sm font-semibold">Report summary</span>
+ <SignalReportBillingBadge report={report} />
+ <span className="flex-1" />
+ {generatedAt}
+ </div>
+ {summaryColumn}
+ </>
)}
- <ReportTasksSection report={report} />
- <ReportActivitySection report={report} />
- </div>
+ </main>
</div>
</BindLogic>
)
return (
- <div className="@container w-full max-w-[calc(160ch+5rem)] mx-auto px-6 py-5 text-sm">
- {/* With a diff present the tab bar owns the full-width divider, so the heading drops its own. */}
- <div className={`flex flex-col gap-3.5 ${hasDiff ? 'mb-4' : 'mb-6 pb-5 border-b border-primary'}`}>
+ <div className={DETAIL_PAGE_CLASS}>
+ <div className="mb-4 flex flex-wrap items-center justify-between gap-2">
<LemonButton
type="tertiary"
size="small"
icon={<IconArrowLeft />}
- to={backOverride ?? urls.inbox(tab)}
- className="-ml-2 w-fit"
+ to={backOverride ?? urls.inbox('reports')}
+ className="-ml-4 w-fit"
+ data-attr="inbox-report-back"
>
- {backOverride ? 'Back' : INBOX_TAB_LABEL[tab]}
+ {backLabel}
</LemonButton>
- <div className="flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4">
- {/* Priority square anchors the title; everything else collapses into the meta line. */}
- <div className="flex items-start gap-3 min-w-0 @2xl:flex-1">
- {report.priority && (
- <div className="shrink-0 mt-0.5">
- <SignalReportPriorityBadge
- priority={report.priority}
- explanation={priorityExplanation}
- />
- </div>
- )}
- <div className="flex flex-col gap-2 min-w-0">
- <h1 className="min-w-0 m-0 break-words text-xl font-bold leading-tight tracking-tight">
- {conventionalTitle && (
- <ConventionalCommitScopeTag
- type={conventionalTitle.type}
- scope={conventionalTitle.scope}
- />
- )}
- {displayTitle}
- </h1>
- <ReportDetailMeta
- report={report}
- evidenceCount={evidenceCount}
- actionabilityExplanation={actionabilityExplanation}
- scoutSkillName={report.scout_name}
- />
- </div>
- </div>
- <div className="flex items-center gap-2 @2xl:shrink-0">
- {primaryAction}
- {/* Discuss is always available and stays inline as its own dropdown button. */}
- <DiscussReportButton report={report} reportUrl={reportUrl} />
- {/* Buttons inline on wide layouts; collapse into a standard LemonMenu kebab below @4xl. */}
- <div className="hidden @4xl:flex items-center gap-2">
- {reportActions.map((action) => (
- <LemonButton
- key={action.key}
- type="secondary"
- size="small"
- icon={action.icon}
- loading={action.loading}
- // A disabled action explains only why it's unavailable — not what it would do.
- tooltip={action.disabledReason ? undefined : action.tooltip}
- disabledReason={action.disabledReason}
- onClick={action.onClick}
- >
- {action.label}
- </LemonButton>
- ))}
- </div>
- {/* A resolved report past its refund window has no secondary actions at all. */}
- {overflowMenuItems.length > 0 && (
- <LemonMenu items={overflowMenuItems} placement="bottom-end">
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconEllipsis />}
- aria-label="More actions"
- className="@4xl:hidden"
- />
- </LemonMenu>
- )}
+ <div className="flex items-center gap-2">
+ {primaryAction}
+ {createPrAction && !summaryHasSolution && (
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={createPrAction.icon}
+ loading={createPrAction.loading}
+ tooltip={createPrAction.disabledReason ? undefined : createPrAction.tooltip}
+ disabledReason={createPrAction.disabledReason}
+ onClick={createPrAction.onClick}
+ >
+ {createPrAction.label}
+ </LemonButton>
+ )}
+ {/* Discuss is always available and stays inline as its own dropdown button. */}
+ <DiscussReportButton report={report} reportUrl={reportUrl} />
+ {/* Buttons inline on wide layouts; collapse into a standard LemonMenu kebab below @4xl. */}
+ <div className="hidden @4xl:flex items-center gap-2">
+ {reportActions.map((action) => (
+ <LemonButton
+ key={action.key}
+ type="secondary"
+ size="small"
+ icon={action.icon}
+ loading={action.loading}
+ // A disabled action explains only why it's unavailable — not what it would do.
+ tooltip={action.disabledReason ? undefined : action.tooltip}
+ disabledReason={action.disabledReason}
+ onClick={action.onClick}
+ >
+ {action.label}
+ </LemonButton>
+ ))}
</div>
+ {/* A resolved report past its refund window has no secondary actions at all. */}
+ {overflowMenuItems.length > 0 && (
+ <LemonMenu items={overflowMenuItems} placement="bottom-end">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconEllipsis />}
+ aria-label="More actions"
+ className="@4xl:hidden"
+ />
+ </LemonMenu>
+ )}
</div>
</div>
- {hasDiff ? (
- <LemonTabs
- activeKey={activeDetailTab}
- onChange={(key) => {
- setActiveDetailTab(key)
- // Reviewing the diff is the deepest engagement a report gets short of acting
- // on it, and it's the one desktop can't see either.
- if (key === 'files') {
- captureInboxReportAction({ report, actionType: 'view_diff', surface: 'detail_pane' })
- }
- }}
- tabs={[
- { key: 'overview', label: 'Overview', content: overviewBody },
- {
- key: 'files',
- label: (
- <span className="flex items-center gap-1.5">
- <span>Files changed</span>
- {diffStat}
- {diffBranchTag}
- </span>
- ),
- // `LemonTabs` renders only the active tab, so the rating row is repeated
- // at the end of the diff – otherwise reviewing a PR's code and stopping
- // there leaves no way to rate the report. Both rows drive the same
- // report-keyed logic, so a rating given on one reads back on the other.
- content: (
- <div className="flex flex-col gap-5">
- {diffSection}
- <ReportFeedbackFooter report={report} />
- </div>
- ),
- },
- ]}
- />
- ) : (
- overviewBody
- )}
+ {overviewBody}
</div>
)
}
@@ -562,65 +544,61 @@ function prFilesUrl(prUrl: string): string {
return prUrl.replace(/\/+$/, '').replace(/(\/files)?$/, '/files')
}
+/** The "Open in GitHub" button, shared by the page header and the summary's pull request note. */
+function OpenPullRequestButton({
+ report,
+ prUrl,
+ prRef,
+}: {
+ report: SignalReport
+ prUrl: string
+ prRef: NonNullable<ReturnType<typeof parsePrUrlParts>>
+}): JSX.Element {
+ return (
+ <LemonButton
+ type="primary"
+ size="small"
+ sideIcon={<IconExternal />}
+ to={prFilesUrl(prUrl)}
+ targetBlank
+ tooltip={`${prRef.repoSlug}#${prRef.number}`}
+ onClick={() => captureInboxReportAction({ report, actionType: 'open_pr', surface: 'detail_pane' })}
+ >
+ Open in GitHub
+ </LemonButton>
+ )
+}
+
/**
* Unified report detail for Pull requests / Reports / Not actionable. The "Open in GitHub" action
* surfaces only when the report has a shipped implementation PR; otherwise it reads as a plain
- * report. When the report has a "Commit pushed" artefact, a GitHub-style "Files changed" tab renders
- * the branch's diff against the default branch alongside the overview. Runs keep their own `AgentRunDetail`.
+ * report. Runs keep their own `AgentRunDetail`.
*/
-export function ReportDetail({ report, tab }: { report: SignalReport; tab: InboxTabKey }): JSX.Element {
+export function ReportDetail({ report }: { report: SignalReport }): JSX.Element {
const { latestCommitArtefact, reportArtefacts } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))
const prUrl = safeHttpUrl(report.implementation_pr_url)
const prRef = prUrl ? parsePrUrlParts(prUrl) : null
const hasPr = !!(prRef && prUrl)
- // The report's branch to diff comes from the latest "Commit pushed" artefact; only offer the diff
- // tab when that artefact carries the repo + branch the diff endpoint needs.
+ // The branch to diff comes from the latest "Commit pushed" artefact; the diff needs the repo + branch
+ // it carries. A PR-bearing report gets the tab bar right away off `hasPr` (immediate) rather than the
+ // artefact (a beat later), with skeletons in the tab label and body until the artefact loads.
const commit = latestCommitArtefact ? (latestCommitArtefact.content as CommitContent) : null
const canDiff = !!(commit?.repository && commit?.branch)
- // A PR-bearing report always gets the tab bar right away — driven by `hasPr` (immediate) rather than
- // the diff artefact (a beat later), so the tabs don't pop in and shift the layout. While the commit
- // artefact is still loading, the tab label and body show skeletons.
const artefactsLoaded = reportArtefacts !== null
return (
<InboxDetailFrame
report={report}
- tab={tab}
- summary={{ icon: hasPr ? <IconPullRequest /> : <IconDocument />, title: 'Summary' }}
- primaryAction={
- hasPr ? (
- <LemonButton
- type="primary"
- size="small"
- sideIcon={<IconExternal />}
- to={prFilesUrl(prUrl)}
- targetBlank
- tooltip={`${prRef.repoSlug}#${prRef.number}`}
- onClick={() =>
- captureInboxReportAction({ report, actionType: 'open_pr', surface: 'detail_pane' })
- }
- >
- Open in GitHub
- </LemonButton>
- ) : undefined
- }
showFilesTab={hasPr || canDiff}
diffSection={
canDiff && commit ? (
- <PullRequestDiffPanel report={report} commit={commit} />
+ <PullRequestFilesChanged report={report} commit={commit} />
) : hasPr ? (
<PullRequestDiffPending artefactsLoaded={artefactsLoaded} />
) : undefined
}
- diffBranchTag={
- canDiff && commit ? (
- <PullRequestBranchTag commit={commit} />
- ) : hasPr && !artefactsLoaded ? (
- <PullRequestBranchTagSkeleton />
- ) : undefined
- }
diffStat={
canDiff && commit ? (
<PullRequestDiffStat report={report} commit={commit} />
@@ -628,9 +606,25 @@ export function ReportDetail({ report, tab }: { report: SignalReport; tab: Inbox
<PullRequestDiffStatSkeleton />
) : undefined
}
- // The PR conversation sits under the Summary as primary content; CI checks stay in the
- // sidebar. Both drop themselves when there's nothing to show.
- summaryFooter={hasPr ? <PrCommentsSection report={report} /> : undefined}
+ primaryAction={
+ prRef && prUrl ? <OpenPullRequestButton report={report} prUrl={prUrl} prRef={prRef} /> : undefined
+ }
+ pullRequestNote={
+ prRef && prUrl ? (
+ <div className="flex flex-wrap items-center gap-3" data-attr="inbox-report-solution-pr-note">
+ <span className="text-sm text-secondary">
+ A pull request with this fix is open:{' '}
+ <span className="font-mono">
+ {prRef.repoSlug}#{prRef.number}
+ </span>
+ </span>
+ <OpenPullRequestButton report={report} prUrl={prUrl} prRef={prRef} />
+ </div>
+ ) : undefined
+ }
+ // The PR conversation closes the evidence rail, under Activity; CI checks sit higher in
+ // the same rail. Both drop themselves when there's nothing to show.
+ asideFooter={hasPr ? <PrCommentsSection report={report} /> : undefined}
>
{hasPr && <PrChecksSection report={report} />}
</InboxDetailFrame>
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx b/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
index 38945c912476..83dabd2f7438 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
@@ -13,7 +13,7 @@ import { inboxSceneLogic } from '../../inboxSceneLogic'
import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'
import { inboxBulkActionsLogic } from '../../logics/inboxBulkActionsLogic'
import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
-import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from '../../logics/reportListLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from '../../logics/reportListLogic'
import { ACTIONABLE_ACTIONABILITY_VALUES, SignalReport, SignalReportStatus } from '../../types'
import { useReportArchive } from '../cards/useReportArchive'
import { useReportRefund } from '../cards/useReportRefund'
@@ -38,7 +38,7 @@ export interface ReportDetailAction {
* Should the Create PR action be offered? Mirrors desktop `canCreateImplementationPr` /
* the server-side autostart rules: only when ready & actionable, or blocked on user input.
*/
-function canCreateImplementationPr(report: SignalReport): boolean {
+export function canCreateImplementationPr(report: SignalReport): boolean {
if (report.implementation_pr_url) {
return false
}
@@ -122,11 +122,11 @@ export function useReportDetailActions(report: SignalReport): ReportDetailAction
}
const onRestoreClick = async (): Promise<void> => {
- // Prefer the mounted Archived list logic so it optimistically drops the row and fixes its
- // count + tab badge synchronously (it also fires the API call + toast). Navigate straight back.
+ // Prefer the mounted Resolved list logic so it optimistically drops the row and fixes its
+ // count + view badge synchronously (it also fires the API call + toast). Navigate straight back.
const archivedList = reportListLogic.findMounted({
- tabKey: 'archived',
- listParams: INBOX_FLAT_TAB_LIST_PARAMS.archived,
+ sectionKey: 'resolved',
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS.resolved,
})
if (archivedList) {
// The list logic fires the `restore` analytics; just drive navigation here.
@@ -134,7 +134,7 @@ export function useReportDetailActions(report: SignalReport): ReportDetailAction
router.actions.push(urls.inbox(activeTab))
return
}
- // Fallback for a deep-linked detail with no mounted Archived list (e.g. cold load).
+ // Fallback for a deep-linked detail with no mounted Resolved list (e.g. cold load).
setIsRestoring(true)
try {
await api.signalReports.setState(report.id, { state: 'potential' })
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx
new file mode 100644
index 000000000000..c35ec7010e8c
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx
@@ -0,0 +1,608 @@
+import { BindLogic, useValues } from 'kea'
+import { router } from 'kea-router'
+import { ReactNode, useCallback, useState } from 'react'
+
+import { IconArrowLeft, IconDocument, IconEllipsis, IconExternal, IconPullRequest, IconSearch } from '@posthog/icons'
+import { LemonButton, LemonTabs, Tooltip } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+import { LemonMenu, LemonMenuItem } from 'lib/lemon-ui/LemonMenu'
+import { ScoutLink } from 'lib/signals/ScoutLink'
+import { scoutDisplayName } from 'lib/signals/signalCardSourceLine'
+import { addProjectIdIfMissing } from 'lib/utils/kea-router'
+import { SignalNode } from 'scenes/debug/signals/types'
+import { urls } from 'scenes/urls'
+
+import { captureInboxReportAction } from '../../inboxAnalytics'
+import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
+import { SignalCard } from '../../SignalCard'
+import { InboxTabKey, INBOX_TAB_LABEL, SignalReport, SignalReportStatus, SignalSourceProduct } from '../../types'
+import {
+ displayConventionalCommitTitle,
+ parseConventionalCommitTitle,
+ parsePrUrlParts,
+ safeHttpUrl,
+} from '../../utils/reportPresentation'
+import { SignalReportActionabilityBadge } from '../badges/SignalReportActionabilityBadge'
+import { SignalReportBillingBadge } from '../badges/SignalReportBillingBadge'
+import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'
+import { isStatusRedundantWithActionability, SignalReportStatusBadge } from '../badges/SignalReportStatusBadge'
+import {
+ hasKnownSourceProduct,
+ knownSourceProductEntries,
+ SourceProductIconRow,
+ sourceProductsTooltipTitle,
+} from '../badges/sourceProductIcons'
+import { ConventionalCommitScopeTag } from '../cards/ReportCard'
+import { CommitContent } from './artefactTypes'
+import { DetailSection } from './DetailSection'
+import { DiscussReportButton } from './DiscussReportButton'
+import { PrChecksSection } from './PrChecksSection'
+import { PrCommentsSection } from './PrCommentsSection'
+import {
+ PullRequestBranchTag,
+ PullRequestBranchTagSkeleton,
+ PullRequestDiffPanel,
+ PullRequestDiffPending,
+ PullRequestDiffStat,
+ PullRequestDiffStatSkeleton,
+} from './PullRequestDiffPanel'
+import { ReportActivitySection } from './ReportActivitySection'
+import { ReportChart } from './ReportChart'
+import { useReportDetailActions } from './ReportDetailActions'
+import { ReportFeedbackFooter } from './ReportFeedbackFooter'
+import { ReportTasksSection } from './ReportTasksSection'
+import { SuggestedReviewersSection } from './SuggestedReviewersSection'
+
+const SIGNALS_TOOLTIP =
+ 'Signals are the individual pieces of evidence from your connected sources and scouts that were grouped into this report.'
+
+/**
+ * Single meta line under the title: status/actionability chips, then dot-separated stats
+ * (finding count · updated · source stack). `evidenceCount` switches to the live signal count once
+ * findings load, so the row reads the same before and after the query resolves.
+ */
+function ReportDetailMeta({
+ report,
+ evidenceCount,
+ actionabilityExplanation,
+ scoutSkillName,
+}: {
+ report: SignalReport
+ evidenceCount: number
+ actionabilityExplanation?: string | null
+ /** Authoring scout's raw skill slug, when scout-authored — its name links to the scout off the "Scout" chip. */
+ scoutSkillName?: string | null
+}): JSX.Element {
+ const hasSource = hasKnownSourceProduct(report.source_products)
+ const showStatus = !isStatusRedundantWithActionability(report.status, report.actionability)
+
+ const stats: ReactNode[] = []
+ if (evidenceCount > 0) {
+ stats.push(
+ <Tooltip title={SIGNALS_TOOLTIP}>
+ <span className="tabular-nums cursor-help">
+ {evidenceCount} signal{evidenceCount === 1 ? '' : 's'}
+ </span>
+ </Tooltip>
+ )
+ }
+ // Mirrors error tracking's "First seen" / "Last seen": surface both lifecycle moments as distinct facts.
+ stats.push(
+ <span className="flex items-center gap-1">
+ <span>First seen</span>
+ <TZLabel time={report.created_at} />
+ </span>
+ )
+ stats.push(
+ <span className="flex items-center gap-1">
+ <span>Last updated</span>
+ <TZLabel time={report.updated_at ?? report.created_at} />
+ </span>
+ )
+ if (hasSource) {
+ stats.push(<MetaSourceStack sourceProducts={report.source_products} scoutSkillName={scoutSkillName} />)
+ }
+
+ return (
+ <div className="flex items-center gap-x-2 gap-y-1.5 flex-wrap text-xs text-tertiary leading-none select-none">
+ {showStatus && <SignalReportStatusBadge status={report.status} />}
+ <SignalReportActionabilityBadge
+ actionability={report.actionability}
+ explanation={actionabilityExplanation}
+ />
+ <SignalReportBillingBadge report={report} />
+ <span className="flex items-center gap-2 flex-wrap min-w-0">
+ {stats.map((node, i) => (
+ <span key={i} className="flex items-center gap-2 min-w-0">
+ {i > 0 && <span aria-hidden>·</span>}
+ {node}
+ </span>
+ ))}
+ </span>
+ </div>
+ )
+}
+
+/** Source-product icon stack reused inside the detail meta row. */
+function MetaSourceStack({
+ sourceProducts,
+ scoutSkillName,
+}: {
+ sourceProducts?: string[] | null
+ scoutSkillName?: string | null
+}): JSX.Element | null {
+ const entries = knownSourceProductEntries(sourceProducts)
+ const [primary, ...overflow] = entries
+ if (!primary) {
+ return null
+ }
+ // Name the authoring scout on a scout-authored report so it's clear at a glance who wrote it,
+ // and link the name straight to the scout's detail page. The scout may not sort first among mixed
+ // sources, so key off whether any source is a scout rather than just the primary.
+ const scoutName = scoutDisplayName(scoutSkillName)
+ const showScout = entries.some(({ key }) => key === SignalSourceProduct.SignalsScout) && !!scoutName
+ return (
+ <Tooltip title={sourceProductsTooltipTitle(entries)}>
+ <span className="inline-flex items-center gap-1.5 min-w-0 cursor-help">
+ <SourceProductIconRow entries={entries} className="inline-flex items-center gap-1 shrink-0" />
+ <span>
+ {primary.meta.label}
+ {showScout && scoutSkillName ? (
+ <>
+ {' · '}
+ <ScoutLink skillName={scoutSkillName} className="text-tertiary" />
+ </>
+ ) : null}
+ {overflow.length > 0 ? ` + ${overflow.length}` : null}
+ </span>
+ </span>
+ </Tooltip>
+ )
+}
+
+/** Placeholder finding rows shown while the signals query is in flight, sized to the known count. */
+function EvidenceSkeleton({ count }: { count: number }): JSX.Element {
+ const rows = Math.max(1, Math.min(count, 4))
+ return (
+ <div className="flex flex-col gap-3" aria-hidden>
+ {Array.from({ length: rows }).map((_, i) => (
+ <div
+ key={i}
+ className="flex flex-col gap-2 rounded border border-primary bg-surface-primary px-3 py-2.5"
+ >
+ <div className="h-3 w-1/3 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-2.5 w-4/5 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ ))}
+ </div>
+ )
+}
+
+/**
+ * Layout-faithful placeholder shown while a report's base record loads on a cold open (deep link
+ * with no list row to seed from). Mirrors `InboxDetailFrame`'s header + two-column shape so the
+ * page doesn't jump when the real content lands — and so loading reads as "this view, populating"
+ * rather than a bare centered spinner.
+ */
+export function ReportDetailSkeletonLegacy(): JSX.Element {
+ return (
+ <div className="@container w-full max-w-[calc(160ch+5rem)] mx-auto px-6 py-5 text-sm" aria-hidden>
+ <div className="flex flex-col gap-3.5 mb-6 pb-5 border-b border-primary">
+ <div className="h-3.5 w-24 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4">
+ <div className="flex items-start gap-3 min-w-0 @2xl:flex-1">
+ <div className="size-7 shrink-0 mt-0.5 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="flex flex-col gap-2 min-w-0 flex-1">
+ <div className="h-6 w-2/3 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-3 w-1/2 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ </div>
+ <div className="flex items-center flex-wrap gap-2 @2xl:shrink-0">
+ <div className="h-8 w-24 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-8 w-20 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ </div>
+ </div>
+
+ <div className="grid grid-cols-1 @5xl:grid-cols-[minmax(0,80ch)_minmax(22rem,1fr)] gap-5">
+ <div className="min-w-0 flex flex-col gap-2.5">
+ <div className="h-4 w-28 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-3 w-full rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-3 w-11/12 rounded bg-fill-highlight-50 animate-pulse" />
+ <div className="h-3 w-3/4 rounded bg-fill-highlight-50 animate-pulse" />
+ </div>
+ <div className="flex flex-col min-w-0 gap-5">
+ {Array.from({ length: 2 }).map((_, i) => (
+ <div key={i} className="flex flex-col gap-2.5">
+ <div className="h-4 w-24 rounded bg-fill-highlight-100 animate-pulse" />
+ <div className="h-16 w-full rounded border border-primary bg-surface-primary animate-pulse" />
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+interface InboxDetailFrameProps {
+ report: SignalReport
+ /** Active inbox tab — drives the back link and the report URL seeded into Discuss. */
+ tab: InboxTabKey
+ /** Summary section heading icon + title. */
+ summary: { icon: ReactNode; title: string }
+ /** Content rendered in the main column directly under the Summary (e.g. the PR conversation). */
+ summaryFooter?: ReactNode
+ /** Extra primary action(s) rendered after the shared report actions. */
+ primaryAction?: ReactNode
+ /** Whether to render the Overview / Files changed tab bar. Driven by whether the report has a PR
+ * (known immediately), not by whether the diff has loaded — so the tab bar doesn't pop in a beat
+ * later and shift the layout. */
+ showFilesTab?: boolean
+ /** Diff body rendered under the "Files changed" tab (may be a skeleton while the commit artefact loads). */
+ diffSection?: ReactNode
+ /** Branch tag shown in the "Files changed" tab label, so the tab signals there's code behind it. */
+ diffBranchTag?: ReactNode
+ /** +/- line-count stat shown in the "Files changed" tab label, right of the branch. */
+ diffStat?: ReactNode
+ /** Extra sections (Tasks, Reviewers) – defaults applied by callers. */
+ children?: ReactNode
+}
+
+/**
+ * Shared chrome for the Report and Pull request detail bodies. Owns the full page header
+ * (title) merged with the badges/meta/actions, then summary on the left
+ * and supporting sections (Evidence, Runs, Reviewers) on the right. Mirrors desktop
+ * `InboxDetailFrame`. AgentRunDetail keeps its own layout + shell header.
+ */
+function InboxDetailFrameLegacy({
+ report,
+ tab,
+ summary,
+ summaryFooter,
+ primaryAction,
+ showFilesTab,
+ diffSection,
+ diffBranchTag,
+ diffStat,
+ children,
+}: InboxDetailFrameProps): JSX.Element {
+ const { searchParams } = useValues(router)
+ // A `?back=` internal path (set by surfaces embedding inbox cards, e.g. the customer analytics
+ // feed) redirects the back button there instead of the inbox list tab.
+ const rawBack = searchParams.back
+ const backOverride =
+ typeof rawBack === 'string' && rawBack.startsWith('/') && !rawBack.startsWith('//') ? rawBack : null
+ const logicProps = { reportId: report.id, report }
+ const {
+ reportSignals,
+ reportSignalsLoading,
+ priorityExplanation,
+ actionabilityExplanation,
+ chartPlacements,
+ trailingCharts,
+ } = useValues(inboxReportDetailLogic(logicProps))
+ // GitHub-style PR view: when the report has a PR, the overview and the diff live behind two tabs.
+ const [activeDetailTab, setActiveDetailTab] = useState<'overview' | 'files'>('overview')
+ const hasDiff = !!showFilesTab
+ const signals = reportSignals ?? []
+ const evidenceCount = reportSignals !== null ? signals.length : report.signal_count
+ const hasEvidence = evidenceCount > 0
+
+ const summaryPending =
+ report.status === SignalReportStatus.IN_PROGRESS || report.status === SignalReportStatus.CANDIDATE
+
+ // Depends on placement alone. `LemonMarkdown` memoizes its anchor component on this callback, so
+ // anything else in here — the charts themselves, the report object — would rebuild that component
+ // as the report polls and unmount every rendered chart with it.
+ const renderChartRef = useCallback(
+ (chartId: string, sourceOffset?: number): ReactNode =>
+ sourceOffset !== undefined && chartPlacements.inlineByOffset.get(sourceOffset) === chartId ? (
+ <ReportChart chartId={chartId} />
+ ) : null,
+ [chartPlacements]
+ )
+
+ // Reading depth on the report body: which supporting sections a reader actually opened.
+ const captureSectionToggle = (section: string) => (collapsed: boolean) =>
+ captureInboxReportAction({
+ report,
+ actionType: collapsed ? 'collapse_section' : 'expand_section',
+ surface: 'detail_pane',
+ extra: { section },
+ })
+
+ const conventionalTitle = parseConventionalCommitTitle(report.title)
+ const displayTitle = displayConventionalCommitTitle(report.title, 'Untitled report')
+ // Absolute URL to this report – seeded into the Discuss prompt so the agent can open and read
+ // the report directly.
+ const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport(tab, report.id))}`
+
+ // Secondary actions as data so the same set renders inline as buttons on wide layouts and as a
+ // standard `LemonMenu` on narrow ones; the primary action stays inline either way.
+ const reportActions = useReportDetailActions(report)
+ const overflowMenuItems: LemonMenuItem[] = reportActions.map((action) => ({
+ label: action.label,
+ icon: action.icon,
+ disabledReason: action.loading ? 'Working…' : action.disabledReason,
+ onClick: action.onClick,
+ }))
+
+ // Bound rather than passed as props so a chart can reach the logic by id alone. `ReportChart`
+ // building the logic itself would have to pass `report` back in, and kea treats that as a props
+ // change on the mounted instance.
+ const overviewBody = (
+ <BindLogic logic={inboxReportDetailLogic} props={logicProps}>
+ <div className="grid grid-cols-1 @5xl:grid-cols-[minmax(0,80ch)_minmax(22rem,1fr)] gap-5">
+ <div className="min-w-0 flex flex-col gap-5">
+ <DetailSection
+ icon={summary.icon}
+ title={summary.title}
+ collapsible
+ onToggleCollapsed={captureSectionToggle('summary')}
+ >
+ {report.summary ? (
+ <LemonMarkdown
+ className="text-sm text-secondary leading-relaxed break-words [&>*+*]:mt-3 [&_[data-attr=report-chart]]:my-5 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-5 [&_h2]:mt-5 [&_h3]:mt-4"
+ disableImages
+ renderChartRef={renderChartRef}
+ >
+ {report.summary}
+ </LemonMarkdown>
+ ) : (
+ <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>
+ No summary yet. An agent is still investigating.
+ </p>
+ )}
+ {trailingCharts.length > 0 && (
+ <div className="flex flex-col gap-4 mt-5">
+ {trailingCharts.map((chart) => (
+ <ReportChart key={chart.chart_id} chartId={chart.chart_id} />
+ ))}
+ </div>
+ )}
+ </DetailSection>
+ {summaryFooter}
+ {/* The rating closes out the report body, where the reading ends – ahead of the
+ supporting sections, which stack underneath once the layout drops to one column. */}
+ <ReportFeedbackFooter report={report} />
+ </div>
+
+ <div className="flex flex-col min-w-0 gap-5">
+ {/* Pull request (when present) first, then reviewers, evidence, runs, and activity. */}
+ {children}
+ <SuggestedReviewersSection report={report} />
+ {hasEvidence && (
+ <DetailSection
+ icon={<IconSearch />}
+ title="Evidence"
+ collapsible
+ onToggleCollapsed={captureSectionToggle('evidence')}
+ rightSlot={
+ <Tooltip title={SIGNALS_TOOLTIP}>
+ <span className="text-[0.6875rem] text-tertiary tabular-nums cursor-help">
+ {evidenceCount} signal{evidenceCount === 1 ? '' : 's'}
+ </span>
+ </Tooltip>
+ }
+ >
+ {reportSignalsLoading && reportSignals === null ? (
+ <EvidenceSkeleton count={evidenceCount} />
+ ) : (
+ <div className="flex flex-col gap-3">
+ {signals.map((signal: SignalNode) => (
+ <SignalCard key={signal.signal_id} signal={signal} />
+ ))}
+ </div>
+ )}
+ </DetailSection>
+ )}
+ <ReportTasksSection report={report} />
+ <ReportActivitySection report={report} />
+ </div>
+ </div>
+ </BindLogic>
+ )
+
+ return (
+ <div className="@container w-full max-w-[calc(160ch+5rem)] mx-auto px-6 py-5 text-sm">
+ {/* With a diff present the tab bar owns the full-width divider, so the heading drops its own. */}
+ <div className={`flex flex-col gap-3.5 ${hasDiff ? 'mb-4' : 'mb-6 pb-5 border-b border-primary'}`}>
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<IconArrowLeft />}
+ to={backOverride ?? urls.inbox(tab)}
+ className="-ml-2 w-fit"
+ >
+ {backOverride ? 'Back' : INBOX_TAB_LABEL[tab]}
+ </LemonButton>
+ <div className="flex flex-col gap-3 @2xl:flex-row @2xl:items-start @2xl:justify-between @2xl:gap-4">
+ {/* Priority square anchors the title; everything else collapses into the meta line. */}
+ <div className="flex items-start gap-3 min-w-0 @2xl:flex-1">
+ {report.priority && (
+ <div className="shrink-0 mt-0.5">
+ <SignalReportPriorityBadge
+ priority={report.priority}
+ explanation={priorityExplanation}
+ />
+ </div>
+ )}
+ <div className="flex flex-col gap-2 min-w-0">
+ <h1 className="min-w-0 m-0 break-words text-xl font-bold leading-tight tracking-tight">
+ {conventionalTitle && (
+ <ConventionalCommitScopeTag
+ type={conventionalTitle.type}
+ scope={conventionalTitle.scope}
+ />
+ )}
+ {displayTitle}
+ </h1>
+ <ReportDetailMeta
+ report={report}
+ evidenceCount={evidenceCount}
+ actionabilityExplanation={actionabilityExplanation}
+ scoutSkillName={report.scout_name}
+ />
+ </div>
+ </div>
+ <div className="flex items-center gap-2 @2xl:shrink-0">
+ {primaryAction}
+ {/* Discuss is always available and stays inline as its own dropdown button. */}
+ <DiscussReportButton report={report} reportUrl={reportUrl} />
+ {/* Buttons inline on wide layouts; collapse into a standard LemonMenu kebab below @4xl. */}
+ <div className="hidden @4xl:flex items-center gap-2">
+ {reportActions.map((action) => (
+ <LemonButton
+ key={action.key}
+ type="secondary"
+ size="small"
+ icon={action.icon}
+ loading={action.loading}
+ // A disabled action explains only why it's unavailable — not what it would do.
+ tooltip={action.disabledReason ? undefined : action.tooltip}
+ disabledReason={action.disabledReason}
+ onClick={action.onClick}
+ >
+ {action.label}
+ </LemonButton>
+ ))}
+ </div>
+ {/* A resolved report past its refund window has no secondary actions at all. */}
+ {overflowMenuItems.length > 0 && (
+ <LemonMenu items={overflowMenuItems} placement="bottom-end">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconEllipsis />}
+ aria-label="More actions"
+ className="@4xl:hidden"
+ />
+ </LemonMenu>
+ )}
+ </div>
+ </div>
+ </div>
+
+ {hasDiff ? (
+ <LemonTabs
+ activeKey={activeDetailTab}
+ onChange={(key) => {
+ setActiveDetailTab(key)
+ // Reviewing the diff is the deepest engagement a report gets short of acting
+ // on it, and it's the one desktop can't see either.
+ if (key === 'files') {
+ captureInboxReportAction({ report, actionType: 'view_diff', surface: 'detail_pane' })
+ }
+ }}
+ tabs={[
+ { key: 'overview', label: 'Overview', content: overviewBody },
+ {
+ key: 'files',
+ label: (
+ <span className="flex items-center gap-1.5">
+ <span>Files changed</span>
+ {diffStat}
+ {diffBranchTag}
+ </span>
+ ),
+ // `LemonTabs` renders only the active tab, so the rating row is repeated
+ // at the end of the diff – otherwise reviewing a PR's code and stopping
+ // there leaves no way to rate the report. Both rows drive the same
+ // report-keyed logic, so a rating given on one reads back on the other.
+ content: (
+ <div className="flex flex-col gap-5">
+ {diffSection}
+ <ReportFeedbackFooter report={report} />
+ </div>
+ ),
+ },
+ ]}
+ />
+ ) : (
+ overviewBody
+ )}
+ </div>
+ )
+}
+
+/** Point a PR URL at its diff/files tab, without double-appending if it's already there. */
+function prFilesUrl(prUrl: string): string {
+ return prUrl.replace(/\/+$/, '').replace(/(\/files)?$/, '/files')
+}
+
+/**
+ * The report detail with the redesign flag off. Unified for Pull requests / Reports / Not actionable. The "Open in GitHub" action
+ * surfaces only when the report has a shipped implementation PR; otherwise it reads as a plain
+ * report. When the report has a "Commit pushed" artefact, a GitHub-style "Files changed" tab renders
+ * the branch's diff against the default branch alongside the overview. Runs keep their own `AgentRunDetail`.
+ */
+export function ReportDetailLegacy({ report, tab }: { report: SignalReport; tab: InboxTabKey }): JSX.Element {
+ const { latestCommitArtefact, reportArtefacts } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))
+
+ const prUrl = safeHttpUrl(report.implementation_pr_url)
+ const prRef = prUrl ? parsePrUrlParts(prUrl) : null
+ const hasPr = !!(prRef && prUrl)
+
+ // The report's branch to diff comes from the latest "Commit pushed" artefact; only offer the diff
+ // tab when that artefact carries the repo + branch the diff endpoint needs.
+ const commit = latestCommitArtefact ? (latestCommitArtefact.content as CommitContent) : null
+ const canDiff = !!(commit?.repository && commit?.branch)
+ // A PR-bearing report always gets the tab bar right away — driven by `hasPr` (immediate) rather than
+ // the diff artefact (a beat later), so the tabs don't pop in and shift the layout. While the commit
+ // artefact is still loading, the tab label and body show skeletons.
+ const artefactsLoaded = reportArtefacts !== null
+
+ return (
+ <InboxDetailFrameLegacy
+ report={report}
+ tab={tab}
+ summary={{ icon: hasPr ? <IconPullRequest /> : <IconDocument />, title: 'Summary' }}
+ primaryAction={
+ hasPr ? (
+ <LemonButton
+ type="primary"
+ size="small"
+ sideIcon={<IconExternal />}
+ to={prFilesUrl(prUrl)}
+ targetBlank
+ tooltip={`${prRef.repoSlug}#${prRef.number}`}
+ onClick={() =>
+ captureInboxReportAction({ report, actionType: 'open_pr', surface: 'detail_pane' })
+ }
+ >
+ Open in GitHub
+ </LemonButton>
+ ) : undefined
+ }
+ showFilesTab={hasPr || canDiff}
+ diffSection={
+ canDiff && commit ? (
+ <PullRequestDiffPanel report={report} commit={commit} />
+ ) : hasPr ? (
+ <PullRequestDiffPending artefactsLoaded={artefactsLoaded} />
+ ) : undefined
+ }
+ diffBranchTag={
+ canDiff && commit ? (
+ <PullRequestBranchTag commit={commit} />
+ ) : hasPr && !artefactsLoaded ? (
+ <PullRequestBranchTagSkeleton />
+ ) : undefined
+ }
+ diffStat={
+ canDiff && commit ? (
+ <PullRequestDiffStat report={report} commit={commit} />
+ ) : hasPr && !artefactsLoaded ? (
+ <PullRequestDiffStatSkeleton />
+ ) : undefined
+ }
+ // The PR conversation sits under the Summary as primary content; CI checks stay in the
+ // sidebar. Both drop themselves when there's nothing to show.
+ summaryFooter={hasPr ? <PrCommentsSection report={report} /> : undefined}
+ >
+ {hasPr && <PrChecksSection report={report} />}
+ </InboxDetailFrameLegacy>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
index fed293350952..94bdfc356542 100644
--- a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
@@ -20,7 +20,14 @@ const FEEDBACK_NOTE_MAX_LENGTH = 4000
* once it's recorded does an optional note appear, so the note can never gate the rating, and
* ignoring it leaves the flow exactly as it was.
*/
-export function ReportFeedbackFooter({ report }: { report: SignalReport }): JSX.Element {
+export function ReportFeedbackFooter({
+ report,
+ align = 'start',
+}: {
+ report: SignalReport
+ /** `end` pins the row to the right edge, for the redesign's summary column. */
+ align?: 'start' | 'end'
+}): JSX.Element {
const logic = inboxReportDetailLogic({ reportId: report.id, report })
const { feedbackSentiment, feedbackNoteOpen, feedbackNoteDraft, feedbackNoteSent, feedbackNoteSubmitting } =
useValues(logic)
@@ -41,7 +48,7 @@ export function ReportFeedbackFooter({ report }: { report: SignalReport }): JSX.
}
return (
- <div className="flex flex-col gap-2 pt-1">
+ <div className={align === 'end' ? 'flex flex-col items-end gap-2 pt-1' : 'flex flex-col gap-2 pt-1'}>
{/* `select-none` stays on the rating row: on the wrapper it would also cover the note
textarea, where it blocks selecting text to edit or copy a draft. */}
<div className="flex items-center gap-2 flex-wrap text-xs text-tertiary select-none">
diff --git a/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx
new file mode 100644
index 000000000000..f63090b34f0e
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx
@@ -0,0 +1,119 @@
+import { ReactNode, useCallback, useMemo } from 'react'
+
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+
+import { ChartPlacements } from '../../utils/chartPlacement'
+import { parseReportSummary } from '../../utils/reportSummary'
+import { ReportChart } from './ReportChart'
+import { ReportDetailAction } from './ReportDetailActions'
+
+const PROSE_CLASS =
+ 'text-[15px] text-secondary leading-relaxed break-words [&>*+*]:mt-3.5 [&_[data-attr=report-chart]]:my-5 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-8 [&_h1]:text-lg [&_h2]:mt-8 [&_h2]:text-lg [&_h3]:mt-6 [&_h3]:text-base'
+
+interface SummaryMarkdownProps {
+ markdown: string
+ /** Where `markdown` starts in the full summary; chart placements are keyed on the full summary. */
+ sourceOffset: number
+ chartPlacements: ChartPlacements
+ className?: string
+}
+
+/** One slice of the summary. Owns its chart-ref callback so `LemonMarkdown` keeps its anchor component. */
+function SummaryMarkdown({ markdown, sourceOffset, chartPlacements, className }: SummaryMarkdownProps): JSX.Element {
+ // Depends on placement alone. `LemonMarkdown` memoizes its anchor component on this callback, so
+ // anything else in here would rebuild that component as the report polls and unmount every chart.
+ const renderChartRef = useCallback(
+ (chartId: string, offset?: number): ReactNode =>
+ offset !== undefined && chartPlacements.inlineByOffset.get(sourceOffset + offset) === chartId ? (
+ <ReportChart chartId={chartId} />
+ ) : null,
+ [chartPlacements, sourceOffset]
+ )
+ return (
+ <LemonMarkdown className={className ?? PROSE_CLASS} disableImages renderChartRef={renderChartRef}>
+ {markdown}
+ </LemonMarkdown>
+ )
+}
+
+interface ReportSummaryBodyProps {
+ summary: string
+ chartPlacements: ChartPlacements
+ /** The Create PR action, rendered under the Solution section when the report offers it. */
+ createPrAction?: ReportDetailAction
+ /**
+ * Says a pull request with the fix is open and links to it. Rendered under the Solution section, or after
+ * the body when the summary has no sections, so a report never hides that its fix already shipped.
+ */
+ pullRequestNote?: ReactNode
+}
+
+/**
+ * The report summary as sections: the lead sentence, then Problem, Impact, and Solution under their
+ * own headings. A summary without headings renders as one block of prose.
+ */
+export function ReportSummaryBody({
+ summary,
+ chartPlacements,
+ createPrAction,
+ pullRequestNote,
+}: ReportSummaryBodyProps): JSX.Element {
+ const parsed = useMemo(() => parseReportSummary(summary), [summary])
+ const hasSolutionSection = parsed.sections.some((section) => section.kind === 'solution')
+
+ if (parsed.sections.length === 0) {
+ return (
+ <div className="flex flex-col gap-6">
+ <SummaryMarkdown
+ markdown={parsed.lead}
+ sourceOffset={parsed.leadOffset}
+ chartPlacements={chartPlacements}
+ />
+ {pullRequestNote}
+ </div>
+ )
+ }
+
+ return (
+ <div className="flex flex-col gap-6">
+ {parsed.lead && (
+ <SummaryMarkdown
+ markdown={parsed.lead}
+ sourceOffset={parsed.leadOffset}
+ chartPlacements={chartPlacements}
+ className="text-base text-primary leading-relaxed break-words [&>*+*]:mt-3.5"
+ />
+ )}
+ {parsed.sections.map((section) => (
+ <section key={`${section.kind}-${section.bodyOffset}`} className="flex flex-col gap-2">
+ <h2 className="m-0 text-lg font-semibold">{section.heading}</h2>
+ <SummaryMarkdown
+ markdown={section.body}
+ sourceOffset={section.bodyOffset}
+ chartPlacements={chartPlacements}
+ />
+ {section.kind === 'solution' && pullRequestNote && <div className="mt-2">{pullRequestNote}</div>}
+ {section.kind === 'solution' && createPrAction && (
+ <div className="mt-2">
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={createPrAction.icon}
+ loading={createPrAction.loading}
+ tooltip={createPrAction.disabledReason ? undefined : createPrAction.tooltip}
+ disabledReason={createPrAction.disabledReason}
+ onClick={createPrAction.onClick}
+ data-attr="inbox-report-solution-create-pr"
+ >
+ {createPrAction.label}
+ </LemonButton>
+ </div>
+ )}
+ </section>
+ ))}
+ {!hasSolutionSection && pullRequestNote}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/diffFileTree.test.ts b/products/signals/frontend/inbox/components/detail/diffFileTree.test.ts
new file mode 100644
index 000000000000..ecf1509b4009
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/diffFileTree.test.ts
@@ -0,0 +1,37 @@
+import { buildDiffFileTree, DiffFileSummary, DiffTreeNode } from './diffFileTree'
+
+const file = (path: string): DiffFileSummary => ({ path, changeType: 'change', additions: 1, deletions: 0 })
+
+/** `folder/` for folders, the bare name for files, nested as `name(children)`. */
+function outline(nodes: DiffTreeNode[]): string {
+ return nodes
+ .map((node) => (node.kind === 'folder' ? `${node.name}/(${outline(node.children)})` : node.name))
+ .join(' ')
+}
+
+describe('buildDiffFileTree', () => {
+ test.each([
+ {
+ name: 'collapses a chain of single-child folders into one row',
+ paths: ['frontend/src/scenes/invites/inviteLogic.ts', 'frontend/src/scenes/invites/InviteRow.tsx'],
+ expected: 'frontend/src/scenes/invites/(inviteLogic.ts InviteRow.tsx)',
+ },
+ {
+ name: 'stops collapsing where a folder holds files of its own',
+ paths: ['posthog/api/organization_invite.py', 'posthog/api/test/test_organization_invite.py'],
+ expected: 'posthog/api/(test/(test_organization_invite.py) organization_invite.py)',
+ },
+ {
+ name: 'keeps sibling folders apart and lists folders before root files',
+ paths: ['b/two.py', 'README.md', 'a/one.py'],
+ expected: 'a/(one.py) b/(two.py) README.md',
+ },
+ ])('$name', ({ paths, expected }) => {
+ expect(outline(buildDiffFileTree(paths.map(file)))).toBe(expected)
+ })
+
+ it('keeps the full directory path on a collapsed folder', () => {
+ const [folder] = buildDiffFileTree([file('frontend/src/scenes/invites/inviteLogic.ts')])
+ expect(folder).toMatchObject({ kind: 'folder', path: 'frontend/src/scenes/invites' })
+ })
+})
diff --git a/products/signals/frontend/inbox/components/detail/diffFileTree.ts b/products/signals/frontend/inbox/components/detail/diffFileTree.ts
new file mode 100644
index 000000000000..909d941ce714
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/diffFileTree.ts
@@ -0,0 +1,91 @@
+import { type ChangeTypes, type FileDiffMetadata } from '@pierre/diffs'
+
+/** One changed file, reduced to what the file tree and its rows need. */
+export interface DiffFileSummary {
+ path: string
+ changeType: ChangeTypes
+ additions: number
+ deletions: number
+}
+
+export interface DiffTreeFile extends DiffFileSummary {
+ kind: 'file'
+ name: string
+}
+
+export interface DiffTreeFolder {
+ kind: 'folder'
+ /** Full directory path, so it stays a stable id when the display name is a joined chain. */
+ path: string
+ /** Display name: one segment, or a `a/b/c` chain when the folders in between hold nothing else. */
+ name: string
+ children: DiffTreeNode[]
+}
+
+export type DiffTreeNode = DiffTreeFile | DiffTreeFolder
+
+export function summarizeDiffFile(file: FileDiffMetadata): DiffFileSummary {
+ let additions = 0
+ let deletions = 0
+ for (const hunk of file.hunks) {
+ additions += hunk.additionLines
+ deletions += hunk.deletionLines
+ }
+ return { path: file.name, changeType: file.type, additions, deletions }
+}
+
+interface MutableFolder {
+ path: string
+ name: string
+ folders: Map<string, MutableFolder>
+ files: DiffTreeFile[]
+}
+
+function insertFile(root: MutableFolder, file: DiffFileSummary): void {
+ const segments = file.path.split('/')
+ const name = segments.pop() ?? file.path
+ let folder = root
+ for (const segment of segments) {
+ let child = folder.folders.get(segment)
+ if (!child) {
+ child = {
+ path: folder.path ? `${folder.path}/${segment}` : segment,
+ name: segment,
+ folders: new Map(),
+ files: [],
+ }
+ folder.folders.set(segment, child)
+ }
+ folder = child
+ }
+ folder.files.push({ kind: 'file', name, ...file })
+}
+
+const byName = (a: { name: string }, b: { name: string }): number => a.name.localeCompare(b.name)
+
+/**
+ * Folders first, then files, each alphabetical. A folder whose only content is one folder collapses
+ * into it (`frontend/src/scenes/invites`), the way GitHub's file tree does, so a deep path costs one
+ * row instead of four.
+ */
+function finalizeFolder(folder: MutableFolder): DiffTreeNode[] {
+ const folders = [...folder.folders.values()].sort(byName).map((child): DiffTreeFolder => {
+ let current = child
+ while (current.files.length === 0 && current.folders.size === 1) {
+ const [only] = current.folders.values()
+ current = { ...only, name: `${current.name}/${only.name}` }
+ }
+ return { kind: 'folder', path: current.path, name: current.name, children: finalizeFolder(current) }
+ })
+ const files = [...folder.files].sort(byName)
+ return [...folders, ...files]
+}
+
+/** Nested folder/file tree for a diff's changed files, ready to render. */
+export function buildDiffFileTree(files: DiffFileSummary[]): DiffTreeNode[] {
+ const root: MutableFolder = { path: '', name: '', folders: new Map(), files: [] }
+ for (const file of files) {
+ insertFile(root, file)
+ }
+ return finalizeFolder(root)
+}
diff --git a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
index 337fd0a1b541..75c9064b9a78 100644
--- a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
+++ b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
@@ -65,7 +65,13 @@ const REPORT_SAMPLE: Omit<SignalReport, 'created_at' | 'updated_at'> = {
* "Example" tag labels it at a glance, and a single click surface on top plays the meep flair while
* a tooltip explains that real work lands here once the setup command runs.
*/
-function PreviewCard({ report, tabKey }: { report: SignalReport; tabKey: 'pulls' | 'reports' }): JSX.Element {
+function PreviewCard({
+ report,
+ sectionKey,
+}: {
+ report: SignalReport
+ sectionKey: 'monitoring' | 'needs-decision'
+}): JSX.Element {
return (
// `@container` so ReportCard's `@lg:` row layout resolves against the preview width (it has no
// inbox-list container here). `role="presentation"` – the whole thing is decorative.
@@ -74,7 +80,7 @@ function PreviewCard({ report, tabKey }: { report: SignalReport; tabKey: 'pulls'
sample report id (which 404s) out of reach – nobody can click or tab into it – on top
of the `pointer-events-none` and overlay below. */}
<div aria-hidden className="pointer-events-none">
- <ReportCard report={report} tabKey={tabKey} preview />
+ <ReportCard report={report} sectionKey={sectionKey} preview />
</div>
{/* Always-visible label so the sample reads as a sample, not live work. Sits on the top
@@ -99,10 +105,20 @@ function PreviewCard({ report, tabKey }: { report: SignalReport; tabKey: 'pulls'
export function PullRequestPreview(): JSX.Element {
const landed = landedHoursAgo(2)
- return <PreviewCard report={{ ...PULL_REQUEST_SAMPLE, created_at: landed, updated_at: landed }} tabKey="pulls" />
+ return (
+ <PreviewCard
+ report={{ ...PULL_REQUEST_SAMPLE, created_at: landed, updated_at: landed }}
+ sectionKey="monitoring"
+ />
+ )
}
export function ReportPreview(): JSX.Element {
const landed = landedHoursAgo(4)
- return <PreviewCard report={{ ...REPORT_SAMPLE, created_at: landed, updated_at: landed }} tabKey="reports" />
+ return (
+ <PreviewCard
+ report={{ ...REPORT_SAMPLE, created_at: landed, updated_at: landed }}
+ sectionKey="needs-decision"
+ />
+ )
}
diff --git a/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx b/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx
new file mode 100644
index 000000000000..63b36a1eea24
--- /dev/null
+++ b/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx
@@ -0,0 +1,156 @@
+import { useValues } from 'kea'
+import { useEffect, useRef } from 'react'
+
+import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
+
+import { captureInboxPanelViewed } from '../../inboxAnalytics'
+import { inboxSceneLogic } from '../../inboxSceneLogic'
+import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'
+import { InboxTabKey, SignalRun } from '../../types'
+import { CardSkeleton } from '../cards/CardSkeleton'
+import { ScoutsRosterLegacy } from '../config/scouts/ScoutsRosterLegacy'
+import { InboxOnboardingTakeover } from '../onboarding/InboxOnboarding'
+import { InboxWelcomeRedesign } from '../onboarding/InboxWelcomeRedesign'
+import { ArchivedTab } from '../tabs/ArchivedTab'
+import { NotActionableTab } from '../tabs/NotActionableTab'
+import { PullRequestsTab } from '../tabs/PullRequestsTab'
+import { ReportsTabLegacy } from '../tabs/ReportsTabLegacy'
+import { RunsTab } from '../tabs/RunsTab'
+import { AgentSetupColumn } from './AgentSetupColumn'
+import { InboxScopeSelect } from './InboxScopeSelect'
+import { InboxTabBarLegacy } from './InboxTabBarLegacy'
+
+/** Min scene-container width at which the setup rail fits beside the list. */
+const SETUP_RAIL_MIN_PX = 1024
+
+/** Tabs that show the centered report list (scope chrome in the header). Runs/Configuration are special. */
+function isReportListTab(tab: InboxTabKey): boolean {
+ return tab === 'pulls' || tab === 'reports' || tab === 'not-actionable' || tab === 'archived'
+}
+
+function ActiveTabBody({
+ tab,
+ signalRuns,
+ signalRunsLoading,
+}: {
+ tab: InboxTabKey
+ signalRuns: SignalRun[]
+ signalRunsLoading: boolean
+}): JSX.Element | null {
+ switch (tab) {
+ case 'pulls':
+ return <PullRequestsTab />
+ case 'reports':
+ return <ReportsTabLegacy />
+ case 'not-actionable':
+ return <NotActionableTab />
+ case 'archived':
+ return <ArchivedTab />
+ case 'scouts':
+ return <ScoutsRosterLegacy />
+ case 'runs':
+ return <RunsTab runs={signalRuns} loading={signalRunsLoading} />
+ case 'config':
+ return <AgentSetupColumn layout="stacked" />
+ // The redesign's Settings tab is redirected to Configuration before it can become active.
+ case 'settings':
+ return null
+ }
+}
+
+/**
+ * The inbox list view with the redesign flag off: a tab bar + scope select over the active tab's
+ * body, with the agent-setup widgets to the right as a rail when the scene is wide enough
+ * (≥ ~72rem). Below that width the rail is dropped and the widgets live in a Configuration tab
+ * instead. Each flat report tab (Pull requests / Reports / Not actionable) owns its own filtered
+ * request, count, search/filter chrome, and pagination via the keyed `reportListLogic`. Runs is
+ * project-wide and chrome-less.
+ */
+export function InboxListViewLegacy(): JSX.Element {
+ const { activeTab, signalRuns, signalRunsLoading } = useValues(inboxSceneLogic)
+ const { onboardingMode, isWelcomeRedesign } = useValues(inboxOnboardingLogic)
+ const { ref: widthRef, size } = useResizeBreakpoints(
+ { 0: 'narrow', [SETUP_RAIL_MIN_PX]: 'wide' },
+ { initialSize: 'wide' }
+ )
+ const wide = size === 'wide'
+ // Self-driving isn't set up and the inbox is empty: the inbox becomes a single locked "Welcome"
+ // tab (the other tabs are visible but disabled) whose body is the onboarding card. The setup rail
+ // is dropped too, so the onboarding is the whole story – just run the one command.
+ const onboarding = onboardingMode === 'takeover'
+ // The takeover verdict is still settling: commit to neither UI. Rendering the tab bar or the
+ // rail here is what caused the normal inbox to flash in and get replaced by the welcome page.
+ const pending = onboardingMode === 'pending'
+ // The Scouts tab is a full-width table, and the rail's own scout widget just links here — so
+ // the rail would be both redundant and the reason the table has nowhere to breathe.
+ const showRail = wide && !onboarding && !pending && activeTab !== 'scouts'
+ // The rail and the Configuration tab are mutually exclusive – never leave 'config' active
+ // (e.g. via a deep link) while the rail shows, or the rail and a config body would both appear.
+ const effectiveTab = showRail && activeTab === 'config' ? 'pulls' : activeTab
+
+ // Runs and Configuration don't render `InboxReportList`, so `Inbox viewed` never fires for them.
+ // Same once-per-visit guard as the report list: hold Runs until its load settles so the count is real.
+ const panelViewFiredRef = useRef<string | null>(null)
+ useEffect(() => {
+ if (effectiveTab !== 'runs' && effectiveTab !== 'config') {
+ panelViewFiredRef.current = null
+ return
+ }
+ if (effectiveTab === 'runs' && signalRunsLoading) {
+ return
+ }
+ if (panelViewFiredRef.current === effectiveTab) {
+ return
+ }
+ panelViewFiredRef.current = effectiveTab
+ captureInboxPanelViewed({
+ panel: effectiveTab,
+ itemCount: effectiveTab === 'runs' ? signalRuns.length : null,
+ })
+ }, [effectiveTab, signalRunsLoading, signalRuns.length])
+
+ return (
+ <div ref={widthRef} className="flex min-h-0 flex-1">
+ <div className="flex flex-col min-h-0 flex-1 min-w-0">
+ {/* pl-5 (20px) aligns the first tab label with the SceneTitleSection description above;
+ pr-6 matches the report list's px-6 so the scope select shares the list's right edge. */}
+ {/* The redesigned welcome (experiment test arm) is a full-pane page with no tab
+ row at all; control keeps the locked "Welcome" tab over the disabled real tabs. */}
+ {!isWelcomeRedesign && !pending && (
+ <div className="flex items-end justify-between gap-2 border-b border-primary pl-5 pr-6 shrink-0">
+ <InboxTabBarLegacy showConfigTab={!wide} onboarding={onboarding} />
+ {!onboarding && isReportListTab(effectiveTab) && (
+ <div className="pb-1.5">
+ <InboxScopeSelect />
+ </div>
+ )}
+ </div>
+ )}
+ <div className="flex-1 overflow-auto min-h-0">
+ {pending ? (
+ <div className="mx-auto max-w-4xl px-6 py-4">
+ <CardSkeleton count={4} variant="cards" />
+ </div>
+ ) : onboarding ? (
+ isWelcomeRedesign ? (
+ <InboxWelcomeRedesign />
+ ) : (
+ <InboxOnboardingTakeover />
+ )
+ ) : (
+ <ActiveTabBody
+ tab={effectiveTab}
+ signalRuns={signalRuns}
+ signalRunsLoading={signalRunsLoading}
+ />
+ )}
+ </div>
+ </div>
+ {showRail && (
+ <aside className="shrink-0 w-80 overflow-auto min-h-0 border-l border-primary">
+ <AgentSetupColumn layout="rail" />
+ </aside>
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx b/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx
new file mode 100644
index 000000000000..4757d1489110
--- /dev/null
+++ b/products/signals/frontend/inbox/components/shell/InboxReportFilters.tsx
@@ -0,0 +1,79 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonSelect } from '@posthog/lemon-ui'
+
+import {
+ INBOX_PRIORITY_OPTIONS,
+ INBOX_SORT_OPTIONS,
+ inboxPriorityFilterLabel,
+ inboxSortOptionKey,
+ PRIORITY_ACCENT,
+ PRIORITY_MEANING,
+} from '../../filterOptions'
+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'
+import { SignalReportPriority } from '../../types'
+
+const ALL_PRIORITIES = null
+
+const PRIORITY_SELECT_OPTIONS = [
+ { value: ALL_PRIORITIES, label: 'All priorities' },
+ ...INBOX_PRIORITY_OPTIONS.map((priority) => ({
+ value: priority,
+ label: `${priority} · ${PRIORITY_MEANING[priority].label}`,
+ icon: (
+ <span
+ className="size-2 rounded-full"
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ backgroundColor: PRIORITY_ACCENT[priority] }}
+ />
+ ),
+ })),
+]
+
+// No icons: the trigger reads out the active option, and an icon there would crowd the label the
+// order is already stated in.
+const SORT_SELECT_OPTIONS = INBOX_SORT_OPTIONS.map((option) => ({
+ value: inboxSortOptionKey(option.field, option.direction),
+ label: option.label,
+}))
+
+/**
+ * What narrows the report list: priority, then sort order. There is no status filter, because the
+ * sections below are the status split. Filter state is persisted via `inboxFiltersLogic`, and every
+ * section reloads on change.
+ *
+ * Reviewer scope is deliberately not here. It sits with triage mode on the other side of the row,
+ * because it picks whose inbox this is rather than narrowing the one you are looking at.
+ */
+export function InboxReportFilters(): JSX.Element {
+ const { sortField, sortDirection, priorityFilter } = useValues(inboxFiltersLogic)
+ const { setSort, setPriorityFilter } = useActions(inboxFiltersLogic)
+
+ return (
+ <div className="flex flex-wrap items-center gap-2">
+ <LemonSelect
+ size="small"
+ value={priorityFilter.length === 1 ? priorityFilter[0] : ALL_PRIORITIES}
+ onChange={(priority) => setPriorityFilter(priority ? [priority as SignalReportPriority] : [])}
+ options={PRIORITY_SELECT_OPTIONS}
+ // A shared link can carry several priorities, which no single option represents.
+ // Read the selection out of the filter itself so the button never understates it.
+ renderButtonContent={() => inboxPriorityFilterLabel(priorityFilter)}
+ data-attr="inbox-filter-priority"
+ />
+ <LemonSelect
+ size="small"
+ value={inboxSortOptionKey(sortField, sortDirection)}
+ onChange={(key) => {
+ const option = INBOX_SORT_OPTIONS.find((o) => inboxSortOptionKey(o.field, o.direction) === key)
+ if (option) {
+ setSort(option.field, option.direction)
+ }
+ }}
+ options={SORT_SELECT_OPTIONS}
+ renderButtonContent={(leaf) => `Sort: ${leaf?.label ?? ''}`}
+ data-attr="inbox-sort"
+ />
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/shell/InboxTabBar.tsx b/products/signals/frontend/inbox/components/shell/InboxTabBar.tsx
index 039d11064fb8..5601e238364f 100644
--- a/products/signals/frontend/inbox/components/shell/InboxTabBar.tsx
+++ b/products/signals/frontend/inbox/components/shell/InboxTabBar.tsx
@@ -1,46 +1,12 @@
-import { useMountedLogic, useValues } from 'kea'
+import { useValues } from 'kea'
import { router } from 'kea-router'
-import { LemonSkeleton, LemonTabs, LemonTag } from '@posthog/lemon-ui'
+import { LemonTabs } from '@posthog/lemon-ui'
import { urls } from 'scenes/urls'
import { inboxSceneLogic } from '../../inboxSceneLogic'
-import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from '../../logics/reportListLogic'
-import {
- INBOX_FLAT_LIST_TAB_KEYS,
- INBOX_STAFF_ONLY_TAB_KEYS,
- INBOX_TAB_KEYS,
- INBOX_TAB_LABEL,
- INBOX_TAB_TAG,
- InboxFlatListTabKey,
- InboxTabKey,
-} from '../../types'
-
-function isFlatListTabKey(tab: InboxTabKey): tab is InboxFlatListTabKey {
- return (INBOX_FLAT_LIST_TAB_KEYS as readonly string[]).includes(tab)
-}
-
-function isStaffOnlyTabKey(tab: InboxTabKey): boolean {
- return (INBOX_STAFF_ONLY_TAB_KEYS as string[]).includes(tab)
-}
-
-/**
- * Count chip for a flat report tab. Mounts that tab's `reportListLogic` so its `count`
- * (a cheap `limit=1` request) is available for the badge before the tab is ever opened.
- * The active tab shares the same keyed instance, so no double-fetch.
- */
-function FlatTabCount({ tabKey }: { tabKey: InboxFlatListTabKey }): JSX.Element {
- const logic = reportListLogic({ tabKey, listParams: INBOX_FLAT_TAB_LIST_PARAMS[tabKey] })
- useMountedLogic(logic)
- const { count, countLoading } = useValues(logic)
- // Skeleton only while the request is genuinely in flight; on failure `count` stays null,
- // so fall back to the number (0) rather than a permanent skeleton.
- if (count === null && countLoading) {
- return <LemonSkeleton className="h-3 w-3 rounded" />
- }
- return <span className="text-xs text-muted tabular-nums">{count ?? 0}</span>
-}
+import { INBOX_TAB_KEYS, INBOX_TAB_LABEL, InboxTabKey } from '../../types'
/** Synthetic key for the onboarding "Welcome" tab – presentational only, never routed to. */
const WELCOME_TAB_KEY = 'welcome'
@@ -48,56 +14,32 @@ const WELCOME_TAB_KEY = 'welcome'
type InboxTabBarKey = InboxTabKey | typeof WELCOME_TAB_KEY
/**
- * Tab bar: Pull requests / Reports / Runs (everyone) + Not actionable (staff-only, with a
- * "Staff" tag). Each flat report tab shows its own server-computed count. The Configuration tab is only
- * shown when `showConfigTab` is set – i.e. when the scene is too narrow for the setup rail; on wide
- * viewports the rail replaces it.
+ * Page tab bar: Reports / Scouts / Settings. The report sections (Review and merge / Needs a PR /
+ * Resolved) live inside the Reports tab, so no counts sit here.
*
* In `onboarding` mode (self-driving not set up, empty inbox) a locked "Welcome" tab is shown and
* selected, while the real tabs stay visible but disabled – the user can see what's coming, but the
- * inbox only opens up once self-driving is set up. Code review is the exception: it works without
- * self-driving, so its tab stays clickable.
+ * inbox only opens up once self-driving is set up.
*/
-export function InboxTabBar({
- showConfigTab,
- onboarding,
-}: {
- showConfigTab?: boolean
- onboarding?: boolean
-}): JSX.Element {
- const { activeTab, isStaff } = useValues(inboxSceneLogic)
-
- const visibleTabKeys = INBOX_TAB_KEYS.filter(
- (key) => (key !== 'config' || showConfigTab) && (!isStaffOnlyTabKey(key) || isStaff)
- )
+export function InboxTabBar({ onboarding }: { onboarding?: boolean }): JSX.Element {
+ const { activeTab } = useValues(inboxSceneLogic)
- const realTabs = visibleTabKeys.map((key) => ({
- key,
- label: (
- <span className="flex items-center gap-1.5">
- <span>{INBOX_TAB_LABEL[key]}</span>
- {isFlatListTabKey(key) && <FlatTabCount tabKey={key} />}
- {INBOX_TAB_TAG[key] && (
- <LemonTag type={INBOX_TAB_TAG[key] === 'Alpha' ? 'warning' : 'completion'} size="small">
- {INBOX_TAB_TAG[key]}
- </LemonTag>
- )}
- </span>
- ),
+ const realTabs = INBOX_TAB_KEYS.map((key) => ({
+ key: key as InboxTabBarKey,
+ label: INBOX_TAB_LABEL[key],
disabledReason: onboarding ? 'Set up self-driving to open your inbox' : undefined,
content: <></>,
}))
const tabs = onboarding
- ? [{ key: WELCOME_TAB_KEY as InboxTabBarKey, label: <span>Welcome</span>, content: <></> }, ...realTabs]
+ ? [{ key: WELCOME_TAB_KEY as InboxTabBarKey, label: 'Welcome', content: <></> }, ...realTabs]
: realTabs
return (
<LemonTabs<InboxTabBarKey>
activeKey={onboarding ? WELCOME_TAB_KEY : activeTab}
- // min-w-0 lets the tab bar shrink inside the header flex row so its own overflow-x scroll
- // engages on narrow/mobile widths – otherwise it grows to fit every tab and the last ones
- // (e.g. Configuration) overflow off-screen with no way to reach them.
+ // min-w-0 lets the tab bar shrink inside the header row so its own overflow-x scroll
+ // engages on narrow/mobile widths instead of the last tabs overflowing off-screen.
className="min-w-0"
// Hide LemonTabs' own bottom border + margin so the single full-width border lives on the
// scene header row; the active-tab slider then sits directly on that one border.
@@ -108,6 +50,7 @@ export function InboxTabBar({
}
}}
tabs={tabs}
+ data-attr="inbox-tabs"
/>
)
}
diff --git a/products/signals/frontend/inbox/components/shell/InboxTabBarLegacy.tsx b/products/signals/frontend/inbox/components/shell/InboxTabBarLegacy.tsx
new file mode 100644
index 000000000000..a0cab4f6bcdd
--- /dev/null
+++ b/products/signals/frontend/inbox/components/shell/InboxTabBarLegacy.tsx
@@ -0,0 +1,115 @@
+import { useMountedLogic, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { LemonSkeleton, LemonTabs, LemonTag } from '@posthog/lemon-ui'
+
+import { urls } from 'scenes/urls'
+
+import { inboxSceneLogic } from '../../inboxSceneLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from '../../logics/reportListLogic'
+import {
+ INBOX_FLAT_LIST_TAB_KEYS,
+ INBOX_LEGACY_TAB_SECTION,
+ INBOX_STAFF_ONLY_TAB_KEYS,
+ INBOX_LEGACY_TAB_KEYS,
+ INBOX_TAB_LABEL,
+ INBOX_TAB_TAG,
+ InboxFlatListTabKey,
+ InboxTabKey,
+} from '../../types'
+
+function isFlatListTabKey(tab: InboxTabKey): tab is InboxFlatListTabKey {
+ return (INBOX_FLAT_LIST_TAB_KEYS as readonly string[]).includes(tab)
+}
+
+function isStaffOnlyTabKey(tab: InboxTabKey): boolean {
+ return (INBOX_STAFF_ONLY_TAB_KEYS as string[]).includes(tab)
+}
+
+/**
+ * Count chip for a flat report tab. Mounts that tab's `reportListLogic` so its `count`
+ * (a cheap `limit=1` request) is available for the badge before the tab is ever opened.
+ * The active tab shares the same keyed instance, so no double-fetch.
+ */
+function FlatTabCount({ tabKey }: { tabKey: InboxFlatListTabKey }): JSX.Element {
+ const sectionKey = INBOX_LEGACY_TAB_SECTION[tabKey]
+ const logic = reportListLogic({ sectionKey, listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey] })
+ useMountedLogic(logic)
+ const { count, countLoading } = useValues(logic)
+ // Skeleton only while the request is genuinely in flight; on failure `count` stays null,
+ // so fall back to the number (0) rather than a permanent skeleton.
+ if (count === null && countLoading) {
+ return <LemonSkeleton className="h-3 w-3 rounded" />
+ }
+ return <span className="text-xs text-muted tabular-nums">{count ?? 0}</span>
+}
+
+/** Synthetic key for the onboarding "Welcome" tab – presentational only, never routed to. */
+const WELCOME_TAB_KEY = 'welcome'
+
+type InboxTabBarKey = InboxTabKey | typeof WELCOME_TAB_KEY
+
+/**
+ * Tab bar with the redesign flag off: Pull requests / Reports / Runs (everyone) + Not actionable (staff-only, with a
+ * "Staff" tag). Each flat report tab shows its own server-computed count. The Configuration tab is only
+ * shown when `showConfigTab` is set – i.e. when the scene is too narrow for the setup rail; on wide
+ * viewports the rail replaces it.
+ *
+ * In `onboarding` mode (self-driving not set up, empty inbox) a locked "Welcome" tab is shown and
+ * selected, while the real tabs stay visible but disabled – the user can see what's coming, but the
+ * inbox only opens up once self-driving is set up. Code review is the exception: it works without
+ * self-driving, so its tab stays clickable.
+ */
+export function InboxTabBarLegacy({
+ showConfigTab,
+ onboarding,
+}: {
+ showConfigTab?: boolean
+ onboarding?: boolean
+}): JSX.Element {
+ const { activeTab, isStaff } = useValues(inboxSceneLogic)
+
+ const visibleTabKeys = INBOX_LEGACY_TAB_KEYS.filter(
+ (key) => (key !== 'config' || showConfigTab) && (!isStaffOnlyTabKey(key) || isStaff)
+ )
+
+ const realTabs = visibleTabKeys.map((key) => ({
+ key,
+ label: (
+ <span className="flex items-center gap-1.5">
+ <span>{INBOX_TAB_LABEL[key]}</span>
+ {isFlatListTabKey(key) && <FlatTabCount tabKey={key} />}
+ {INBOX_TAB_TAG[key] && (
+ <LemonTag type={INBOX_TAB_TAG[key] === 'Alpha' ? 'warning' : 'completion'} size="small">
+ {INBOX_TAB_TAG[key]}
+ </LemonTag>
+ )}
+ </span>
+ ),
+ disabledReason: onboarding ? 'Set up self-driving to open your inbox' : undefined,
+ content: <></>,
+ }))
+
+ const tabs = onboarding
+ ? [{ key: WELCOME_TAB_KEY as InboxTabBarKey, label: <span>Welcome</span>, content: <></> }, ...realTabs]
+ : realTabs
+
+ return (
+ <LemonTabs<InboxTabBarKey>
+ activeKey={onboarding ? WELCOME_TAB_KEY : activeTab}
+ // min-w-0 lets the tab bar shrink inside the header flex row so its own overflow-x scroll
+ // engages on narrow/mobile widths – otherwise it grows to fit every tab and the last ones
+ // (e.g. Configuration) overflow off-screen with no way to reach them.
+ className="min-w-0"
+ // Hide LemonTabs' own bottom border + margin so the single full-width border lives on the
+ // scene header row; the active-tab slider then sits directly on that one border.
+ barClassName="before:hidden mb-0"
+ onChange={(key) => {
+ if (key !== WELCOME_TAB_KEY) {
+ router.actions.push(urls.inbox(key))
+ }
+ }}
+ tabs={tabs}
+ />
+ )
+}
diff --git a/products/signals/frontend/inbox/components/shell/InboxUsageWidget.tsx b/products/signals/frontend/inbox/components/shell/InboxUsageWidget.tsx
index dda2e5487173..798e0bec2cfc 100644
--- a/products/signals/frontend/inbox/components/shell/InboxUsageWidget.tsx
+++ b/products/signals/frontend/inbox/components/shell/InboxUsageWidget.tsx
@@ -4,6 +4,7 @@ import { Form } from 'kea-forms'
import { LemonButton, LemonInput, LemonModal, LemonSkeleton, LemonTag, Tooltip } from '@posthog/lemon-ui'
import { BillingUpgradeCTA } from 'lib/components/BillingUpgradeCTA'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { currencyFormatter } from 'scenes/billing/billing-utils'
import { billingProductLogic } from 'scenes/billing/billingProductLogic'
@@ -21,7 +22,12 @@ const FILL_CLASS: Record<InboxUsageStatus, string> = {
limit: 'bg-danger',
}
-const CARD_CLASS = 'flex flex-col gap-2 rounded border border-primary bg-surface-primary px-2.5 py-2'
+// The Usage settings section is already a card; the legacy setup rail needs the widget to frame itself.
+function cardClassName(redesign: boolean): string {
+ return redesign
+ ? 'flex flex-col gap-2'
+ : 'flex flex-col gap-2 rounded border border-primary bg-surface-primary px-2.5 py-2'
+}
/** A single status-coloured fill over a neutral track. Width is runtime-derived, hence inline. */
function UsageBar({ percentage, status }: { percentage: number; status: InboxUsageStatus }): JSX.Element {
@@ -37,8 +43,9 @@ function UsageBar({ percentage, status }: { percentage: number; status: InboxUsa
}
function UsageCardSkeleton(): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
return (
- <div className={CARD_CLASS}>
+ <div className={cardClassName(redesign)}>
<LemonSkeleton className="h-3 w-24" />
<LemonSkeleton className="h-2 w-full" />
<div className="flex items-center justify-between">
@@ -139,6 +146,7 @@ function EditLimitModal(): JSX.Element {
* autonomy throttles in SelfDrivingSection, so a self-imposed cap never reads as a plan limit.
*/
export function InboxUsageWidget(): JSX.Element | null {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const {
product,
isLoading,
@@ -169,7 +177,7 @@ export function InboxUsageWidget(): JSX.Element | null {
// Only org admins/owners can change billing (canAccessBilling) — others get a read-only view with a hint.
return (
<>
- <div className={CARD_CLASS}>
+ <div className={cardClassName(redesign)}>
<div className="flex items-center justify-between gap-1.5">
<span className="text-[13px] font-semibold text-default">Pull requests</span>
{!isSubscribed ? (
diff --git a/products/signals/frontend/inbox/components/shell/InstallationSetupSection.tsx b/products/signals/frontend/inbox/components/shell/InstallationSetupSection.tsx
index d9eaac6a2d14..69ca7968055c 100644
--- a/products/signals/frontend/inbox/components/shell/InstallationSetupSection.tsx
+++ b/products/signals/frontend/inbox/components/shell/InstallationSetupSection.tsx
@@ -1,18 +1,21 @@
import { useValues } from 'kea'
import { useMountedLogic } from 'kea'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'
+import { SettingsSection } from '../tabs/SettingsSection'
import { InstallationCard } from './InstallationCard'
import { SetupSection } from './SetupSection'
/**
- * The "Installation" block of the inbox setup column, present only while a wizard run is in flight.
+ * The "Installation" block of the Settings tab, present only while a wizard run is in flight.
* Renders its own section wrapper so the heading disappears with the run.
*/
export function InstallationSetupSection(): JSX.Element | null {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
// The detector's cheap poll is what tells us a run exists at all; mounting it here means the
- // rail doesn't depend on the FAB being rendered to find the run.
+ // tab doesn't depend on the FAB being rendered to find the run.
useMountedLogic(wizardActiveSessionDetectorLogic)
const { shouldStream, activeWorkflowId } = useValues(wizardActiveSessionDetectorLogic)
@@ -20,9 +23,16 @@ export function InstallationSetupSection(): JSX.Element | null {
return null
}
+ if (!redesign) {
+ return (
+ <SetupSection title="Installation">
+ <InstallationCard workflowId={activeWorkflowId} />
+ </SetupSection>
+ )
+ }
return (
- <SetupSection title="Installation">
+ <SettingsSection title="Installation" description="The setup agent is still running in your repository.">
<InstallationCard workflowId={activeWorkflowId} />
- </SetupSection>
+ </SettingsSection>
)
}
diff --git a/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
index 60c8f05fffc4..7a330ac73d9a 100644
--- a/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/ConversationsTicketSignalCard.tsx
@@ -1,12 +1,20 @@
-import { IconChevronRight, IconComment, IconGithub, IconLetter } from '@posthog/icons'
+import { useState } from 'react'
+
+import { IconChevronRight, IconComment, IconGithub, IconImage, IconLetter } from '@posthog/icons'
import { Link } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconMicrosoftTeams, IconSlack } from 'lib/lemon-ui/icons'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { LemonTag, type LemonTagType } from 'lib/lemon-ui/LemonTag'
+import { isTrustedPostHogUrl } from 'lib/utils/trustedUrl'
import { urls } from 'scenes/urls'
-import type { ConversationsTicketSignalExtraApi } from 'products/signals/frontend/generated/api.schemas'
+import type {
+ ConversationsTicketImageApi,
+ ConversationsTicketSignalExtraApi,
+} from 'products/signals/frontend/generated/api.schemas'
+import { safeHttpUrl } from 'products/signals/frontend/inbox/utils/reportPresentation'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardEntry, SignalCardProps } from './types'
@@ -79,9 +87,55 @@ export function conversationsChannelIcon(source: string): JSX.Element | null {
}
}
+/** How many attachment thumbnails to show before pointing at the ticket for the rest. */
+const IMAGE_PREVIEW_COUNT = 4
+
+/**
+ * One attachment thumbnail that opens the full image. Only an image PostHog serves loads inline: the
+ * URL comes from ticket rich content, which is not origin-validated, and an inline `<img>` makes every
+ * viewer's browser fetch it on render. Any other host is a click-to-open tile that loads nothing.
+ * Drops out when the image can no longer be fetched.
+ */
+function TicketImageThumbnail({ image }: { image: ConversationsTicketImageApi }): JSX.Element | null {
+ const [failed, setFailed] = useState(false)
+ const trusted = isTrustedPostHogUrl(image.url)
+ const href = trusted ? image.url : safeHttpUrl(image.url)
+ if (failed || !href) {
+ return null
+ }
+ const label = image.author ? `Attachment from ${image.author}` : 'Ticket attachment'
+ return (
+ <li>
+ <Link
+ to={href}
+ target="_blank"
+ className="flex items-center justify-center size-16 rounded border overflow-hidden bg-surface-secondary"
+ title={image.author ? `Attached by ${image.author}` : undefined}
+ aria-label={trusted ? undefined : label}
+ >
+ {trusted ? (
+ <img
+ src={href}
+ alt={label}
+ className="size-full object-cover"
+ loading="lazy"
+ onError={() => setFailed(true)}
+ />
+ ) : (
+ <IconImage className="text-xl text-secondary" />
+ )}
+ </Link>
+ </li>
+ )
+}
+
export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const extra = signal.extra as Record<string, unknown> & ConversationsTicketSignalExtraApi
const channelIcon = conversationsChannelIcon(extra.channel_source)
+ // Attachment thumbnails are part of the redesign's evidence rail.
+ const images = redesign && Array.isArray(extra.images) ? extra.images : []
+ const ticketUrl = urls.supportTicketDetail(extra.ticket_number)
return (
<SignalCardShell signal={signal} label={extra.email_subject ?? undefined}>
@@ -90,6 +144,20 @@ export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.
{signal.content}
</LemonMarkdown>
)}
+ {images.length > 0 && (
+ <ul className="flex flex-wrap items-center gap-1.5 mb-2">
+ {images.slice(0, IMAGE_PREVIEW_COUNT).map((image, index) => (
+ <TicketImageThumbnail key={`${image.url}-${index}`} image={image} />
+ ))}
+ {images.length > IMAGE_PREVIEW_COUNT && (
+ <li>
+ <Link to={ticketUrl} className="text-xs font-medium">
+ +{images.length - IMAGE_PREVIEW_COUNT} more
+ </Link>
+ </li>
+ )}
+ </ul>
+ )}
<div className="flex items-center gap-2 flex-wrap text-xs text-tertiary">
<span className="font-mono font-medium">#{extra.ticket_number}</span>
<LemonTag size="small" type={conversationsStatusTagType(extra.status)}>
@@ -112,10 +180,7 @@ export function ConversationsTicketSignalCard({ signal }: SignalCardProps): JSX.
</div>
<div className="flex items-center mt-2">
<span className="flex-1" />
- <Link
- to={urls.supportTicketDetail(extra.ticket_number)}
- className="flex items-center gap-1 text-xs font-medium"
- >
+ <Link to={ticketUrl} className="flex items-center gap-1 text-xs font-medium">
Open ticket
<IconChevronRight />
</Link>
diff --git a/products/signals/frontend/inbox/components/signalCards/GenericSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/GenericSignalCard.tsx
index f6af69a59318..1e699f388d5e 100644
--- a/products/signals/frontend/inbox/components/signalCards/GenericSignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/GenericSignalCard.tsx
@@ -1,9 +1,21 @@
+import { IconExternal } from '@posthog/icons'
+import { Link } from '@posthog/lemon-ui'
+
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+import { genericSignalLink } from '../../utils/signalLinks'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardProps } from './types'
+/**
+ * Fallback card for a source without a dedicated renderer, or a payload that doesn't satisfy its
+ * renderer's guard. Under the redesign it still links out to the underlying object whenever the
+ * signal identifies it.
+ */
export function GenericSignalCard({ signal }: SignalCardProps): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
+ const link = redesign ? genericSignalLink(signal) : null
return (
<SignalCardShell signal={signal}>
{signal.content && (
@@ -11,6 +23,18 @@ export function GenericSignalCard({ signal }: SignalCardProps): JSX.Element {
{signal.content}
</LemonMarkdown>
)}
+ {link && (
+ <div className="flex items-center mt-2">
+ <span className="flex-1" />
+ <Link
+ to={link.to}
+ target={link.external ? '_blank' : undefined}
+ className="flex items-center gap-1 text-xs font-medium shrink-0"
+ >
+ {link.label} <IconExternal className="size-3" />
+ </Link>
+ </div>
+ )}
</SignalCardShell>
)
}
diff --git a/products/signals/frontend/inbox/components/signalCards/RecordingPreview.tsx b/products/signals/frontend/inbox/components/signalCards/RecordingPreview.tsx
new file mode 100644
index 000000000000..28247e47a6f9
--- /dev/null
+++ b/products/signals/frontend/inbox/components/signalCards/RecordingPreview.tsx
@@ -0,0 +1,97 @@
+import clsx from 'clsx'
+import { useActions, useValues } from 'kea'
+import { useEffect, useState } from 'react'
+
+import { IconPlay } from '@posthog/icons'
+import { Spinner } from '@posthog/lemon-ui'
+
+import { sessionRecordingInfoLogic } from 'lib/components/ViewRecordingButton/sessionRecordingInfoLogic'
+import { RecordingPlayerType, useRecordingButton } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
+import { Dayjs } from 'lib/dayjs'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { getExportsContentRetrieveUrl } from '~/generated/core/api'
+
+interface RecordingPreviewProps {
+ sessionId: string
+ /** Instant the player seeks to when the frame is clicked. */
+ seekTime?: Dayjs
+ /** Exported screenshot of that moment, shown as the frame's background while it can be fetched. */
+ exportedAssetId?: number | null
+ alt: string
+}
+
+/**
+ * 16:9 preview frame for a moment in a recording. The whole frame is the play affordance: clicking
+ * it opens the recording in the player modal at `seekTime`. Disables itself, instead of opening an
+ * empty player, when the recording wasn't captured or has expired.
+ */
+export function RecordingPreview({ sessionId, seekTime, exportedAssetId, alt }: RecordingPreviewProps): JSX.Element {
+ const { currentTeamId } = useValues(teamLogic)
+ const [thumbnailFailed, setThumbnailFailed] = useState(false)
+
+ const thumbnailSrc =
+ currentTeamId !== null && exportedAssetId != null && !thumbnailFailed
+ ? getExportsContentRetrieveUrl(String(currentTeamId), exportedAssetId)
+ : undefined
+
+ const { checkRecordingInfo } = useActions(sessionRecordingInfoLogic)
+ const { getRecordingExists, isRecordingExistsLoading } = useValues(sessionRecordingInfoLogic)
+ useEffect(() => {
+ checkRecordingInfo(sessionId)
+ }, [sessionId, checkRecordingInfo])
+ const hasRecording = getRecordingExists(sessionId)
+ const recordingCheckLoading = isRecordingExistsLoading(sessionId)
+
+ const { onClick: openRecording, disabledReason } = useRecordingButton({
+ sessionId,
+ timestamp: seekTime,
+ openPlayerIn: RecordingPlayerType.Modal,
+ hasRecording,
+ })
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={openRecording}
+ disabled={!!disabledReason || recordingCheckLoading}
+ title={typeof disabledReason === 'string' ? disabledReason : undefined}
+ aria-label="Play recording"
+ data-attr="inbox-signal-recording-preview"
+ className="group relative w-full aspect-video rounded overflow-hidden border bg-surface-secondary mb-2 cursor-pointer disabled:cursor-default disabled:opacity-70"
+ >
+ {thumbnailSrc && (
+ // Defer this full-frame screenshot: the evidence rail opens expanded and can hold
+ // one preview per replay signal, so eager loading fetches frames never scrolled to.
+ <img
+ src={thumbnailSrc}
+ alt={alt}
+ className="absolute inset-0 size-full object-cover"
+ loading="lazy"
+ decoding="async"
+ onError={() => setThumbnailFailed(true)}
+ />
+ )}
+ <div
+ className={clsx(
+ 'absolute inset-0 flex items-center justify-center transition-colors motion-reduce:transition-none',
+ thumbnailSrc ? 'bg-black/20 group-hover:bg-black/30' : 'group-hover:bg-fill-highlight-100'
+ )}
+ >
+ {recordingCheckLoading ? (
+ <Spinner className={clsx('text-2xl', thumbnailSrc ? 'text-white' : 'text-tertiary')} />
+ ) : (
+ <IconPlay
+ className={clsx('size-10 drop-shadow', thumbnailSrc ? 'text-white' : 'text-tertiary')}
+ aria-hidden
+ />
+ )}
+ </div>
+ </button>
+ {hasRecording === false && (
+ <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
+ )}
+ </>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/signalCards/ScannerFindingSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/ScannerFindingSignalCard.tsx
index 526bd3a8a199..d295f9d93f79 100644
--- a/products/signals/frontend/inbox/components/signalCards/ScannerFindingSignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/ScannerFindingSignalCard.tsx
@@ -1,22 +1,13 @@
-import clsx from 'clsx'
-import { useActions, useValues } from 'kea'
-import { useEffect, useState } from 'react'
+import { LemonTag } from '@posthog/lemon-ui'
-import { IconPlay } from '@posthog/icons'
-import { LemonTag, Spinner } from '@posthog/lemon-ui'
-
-import { sessionRecordingInfoLogic } from 'lib/components/ViewRecordingButton/sessionRecordingInfoLogic'
-import { RecordingPlayerType, useRecordingButton } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
import { Dayjs, dayjs } from 'lib/dayjs'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { colonDelimitedDuration, humanFriendlyDuration } from 'lib/utils/durations'
import { identifierToHuman } from 'lib/utils/strings'
-import { teamLogic } from 'scenes/teamLogic'
-
-import { getExportsContentRetrieveUrl } from '~/generated/core/api'
import type { ReplayVisionScannerFindingSignalExtraApi } from 'products/signals/frontend/generated/api.schemas'
+import { RecordingPreview } from './RecordingPreview'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardEntry, SignalCardProps } from './types'
@@ -44,35 +35,8 @@ function findingSeekTime(recordingStartTime: string | null | undefined, offsetSe
/** Live card for a replay-vision scanner finding: thumbnail preview and a play affordance that seeks to the observation. */
export function ScannerFindingSignalCard({ signal }: SignalCardProps): JSX.Element {
- const { currentTeamId } = useValues(teamLogic)
- const [thumbnailFailed, setThumbnailFailed] = useState(false)
-
const extra = signal.extra as Record<string, unknown> & ReplayVisionScannerFindingSignalExtraApi
- const hasThumbnail = currentTeamId !== null && !thumbnailFailed
- const thumbnailSrc = hasThumbnail
- ? getExportsContentRetrieveUrl(String(currentTeamId), extra.exported_asset_id)
- : undefined
-
- const findingSeek = findingSeekTime(extra.recording_start_time, extra.start_time)
-
- // Batch-check the recording so the play affordance disables (rather than opening an empty player)
- // when the recording wasn't captured or has expired.
- const { checkRecordingInfo } = useActions(sessionRecordingInfoLogic)
- const { getRecordingExists, isRecordingExistsLoading } = useValues(sessionRecordingInfoLogic)
- useEffect(() => {
- checkRecordingInfo(extra.session_id)
- }, [extra.session_id, checkRecordingInfo])
- const hasRecording = getRecordingExists(extra.session_id)
- const recordingCheckLoading = isRecordingExistsLoading(extra.session_id)
-
- const { onClick: openRecording, disabledReason } = useRecordingButton({
- sessionId: extra.session_id,
- timestamp: findingSeek,
- openPlayerIn: RecordingPlayerType.Modal,
- hasRecording,
- })
-
const confidencePct = Math.round(extra.confidence * 100)
const activeDuration =
@@ -102,42 +66,12 @@ export function ScannerFindingSignalCard({ signal }: SignalCardProps): JSX.Eleme
</LemonMarkdown>
)}
- {/* The 16:9 preview frame is itself the play affordance — clicking it opens the recording at the finding. */}
- <button
- type="button"
- onClick={openRecording}
- disabled={!!disabledReason || recordingCheckLoading}
- title={typeof disabledReason === 'string' ? disabledReason : undefined}
- aria-label="Play recording"
- className="group relative w-full aspect-video rounded overflow-hidden border bg-surface-secondary mb-2 cursor-pointer disabled:cursor-default disabled:opacity-70"
- >
- {thumbnailSrc && (
- <img
- src={thumbnailSrc}
- alt={`Recording preview for ${extra.scanner_name}`}
- className="absolute inset-0 size-full object-cover"
- onError={() => setThumbnailFailed(true)}
- />
- )}
- <div
- className={clsx(
- 'absolute inset-0 flex items-center justify-center transition-colors',
- thumbnailSrc ? 'bg-black/20 group-hover:bg-black/30' : 'group-hover:bg-fill-highlight-100'
- )}
- >
- {recordingCheckLoading ? (
- <Spinner className={clsx('text-2xl', thumbnailSrc ? 'text-white' : 'text-tertiary')} />
- ) : (
- <IconPlay
- className={clsx('size-10 drop-shadow', thumbnailSrc ? 'text-white' : 'text-tertiary')}
- aria-hidden
- />
- )}
- </div>
- </button>
- {hasRecording === false && (
- <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
- )}
+ <RecordingPreview
+ sessionId={extra.session_id}
+ seekTime={findingSeekTime(extra.recording_start_time, extra.start_time)}
+ exportedAssetId={extra.exported_asset_id}
+ alt={`Recording preview for ${extra.scanner_name}`}
+ />
{/* Dot-separated meta line: affected user, finding window, active/total duration. */}
<div className="flex items-center gap-1.5 flex-wrap text-xs text-tertiary">
diff --git a/products/signals/frontend/inbox/components/signalCards/SessionReplaySignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/SessionReplaySignalCard.tsx
index 1f0d34b46f91..35ceeb24c43e 100644
--- a/products/signals/frontend/inbox/components/signalCards/SessionReplaySignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/SessionReplaySignalCard.tsx
@@ -8,6 +8,7 @@ import type { LemonTagType } from '@posthog/lemon-ui'
import { sessionRecordingInfoLogic } from 'lib/components/ViewRecordingButton/sessionRecordingInfoLogic'
import ViewRecordingButton, { RecordingPlayerType } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
import { Dayjs, dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { humanFriendlyDuration, reverseColonDelimitedDuration } from 'lib/utils/durations'
@@ -16,6 +17,7 @@ import type {
SessionProblemSignalExtraApi,
} from 'products/signals/frontend/generated/api.schemas'
+import { RecordingPreview } from './RecordingPreview'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardEntry, SignalCardProps } from './types'
@@ -104,6 +106,7 @@ function TimelineRow({
/** Live card for a session-replay problem segment: a replay link-out and an event timeline. */
export function SessionReplaySignalCard({ signal }: SignalCardProps): JSX.Element {
+ const redesign = useFeatureFlag('INBOX_REDESIGN')
const [showAllEvents, setShowAllEvents] = useState(false)
const extra = signal.extra as Record<string, unknown> & SessionProblemSignalExtraApi
@@ -127,8 +130,10 @@ export function SessionReplaySignalCard({ signal }: SignalCardProps): JSX.Elemen
<SignalCardShell
signal={signal}
label={extra.segment_title}
+ // Under the redesign the evidence card header carries only the segment title, to match
+ // the chip-free report header above it.
rightSlot={
- problemTag ? (
+ !redesign && problemTag ? (
<LemonTag type={problemTag.type} size="small" className="shrink-0">
{problemTag.label}
</LemonTag>
@@ -141,20 +146,33 @@ export function SessionReplaySignalCard({ signal }: SignalCardProps): JSX.Elemen
</LemonMarkdown>
)}
- {/* Opens the recording at the segment in the player modal; disables when it wasn't captured. */}
- <ViewRecordingButton
- sessionId={extra.session_id}
- timestamp={segmentSeekTime}
- openPlayerIn={RecordingPlayerType.Modal}
- checkRecordingExists
- label="View replay"
- type="secondary"
- size="small"
- className="mb-2"
- loading={recordingExistsLoading}
- />
- {recordingExists === false && (
- <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
+ {/* Both open the recording at the segment in the player modal and disable when it wasn't
+ captured. Under the redesign the screenshot frame is used when the emitter exported
+ one, since it shows what the user saw without opening the player. */}
+ {redesign && typeof extra.exported_asset_id === 'number' ? (
+ <RecordingPreview
+ sessionId={extra.session_id}
+ seekTime={segmentSeekTime}
+ exportedAssetId={extra.exported_asset_id}
+ alt={`Recording preview for ${extra.segment_title}`}
+ />
+ ) : (
+ <>
+ <ViewRecordingButton
+ sessionId={extra.session_id}
+ timestamp={segmentSeekTime}
+ openPlayerIn={RecordingPlayerType.Modal}
+ checkRecordingExists
+ label="View replay"
+ type="secondary"
+ size="small"
+ className="mb-2"
+ loading={recordingExistsLoading}
+ />
+ {recordingExists === false && (
+ <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
+ )}
+ </>
)}
{/* Dot-separated meta line: affected user, segment window, active/total duration. */}
diff --git a/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx
new file mode 100644
index 000000000000..e9028c6a7b85
--- /dev/null
+++ b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx
@@ -0,0 +1,212 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { HttpResponse } from 'msw'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import type { SignalNode } from 'scenes/debug/signals/types'
+
+import { mswDecorator } from '~/mocks/browser'
+
+import { SignalCard } from '../../SignalCard'
+
+const BASE_DATE = '2026-06-10T09:30:00Z'
+
+// Tiny generated screenshots so the preview frames and attachment thumbnails have something to show.
+const RECORDING_PREVIEW_PNG =
+ 'iVBORw0KGgoAAAANSUhEUgAAAUAAAAC0CAIAAABqhmJGAAADVElEQVR42u3dsW7TUBQG4N+oVCgvEIrUAbFELB0RE0IsbH3WbCwVYkIdWVAX1AGJwMiAQ+IhbCxIUYOT1Pf6+9ZKbU/dX+de39in2Ww2Acr0wJ8ABBgQYECAYSROtnytvWyO9ntM5u6lgQ4MAgwUv4Quws3nT/2/yez5Ra3fHx0YEGBAgIG/mi2fhXaMBDowIMDATktoQAcGBBgQYKjJSbf+XXoND08fuZD4LHSp2l8/XUgsoQEBBgQYEGAQYECAAQEGBBgEGMgwP4m1+Pb1fn+5syfnrhDowCDAgAADAgwIMMTzwOX48X1RTS3Tx2dqrLjGvgGu9RTn6bNZBVXcfrlRY/U1WkKDPTAgwEDcxNqX648fjvODXrx8pUY16sCAAIMAAwIMxPPAqeOehBrVqAODAAMCDAgwIMAgwECGf4zkra6gAwMCDAgwCDAgwIAAgwADAgzE88BJfJIEvJUy+34XvhrVOBzNerUsvQN33cqFxB4YEGBAgAEBhoz0JlYp3MQijpFGwvR6NZZSowDH9Ho11n2abQ8McRMLEGDAHjgmu6txHFPUdGCwhAY8DxzPA4MODDpwTHZXoxp1YECAAQEGAQZiPjCgA4MAAwIMCDAgwCDAgAADAgzE88CgAwMCDHigPya7qzGGm5W2BzbcDEtoQIAB84FjPjDowCDAQBwjDYLp9WospUYBjun1aqz7NNsSGuyBAQEG7IFjsrsaRzJFzfPAYAkNCDAgwBA3sWKyuxrVqAMDAgyYDww6MCDAgACDAAMCDAgwIMAgwIAAAwIMCDDE44Twj/ay2de3mm79UlvIH2Qy3+jAgA6cxPT6A5tK1RGvxegC3GcOjRqHs3QsaCtx0MthCQ1xFxoQYECAQYCBOEYaFtPr7/cY6f3Vu/r+qV6/edvnX67PbeoxngObXn9QbdjhWvQ8JbaEBntgQIABe+CY7B7T63VgQAeG3PHEBR0YBBiwhI7J7mpEgCFHfyNXSnh1gSU02AMDAgwIMAgwIMCAAANxDkzlxvY2eR0YBBiwhCY+1YgODAIMWEIT94Hz3+++3vLy+jre760Dgw4cE9PVqMbyNOvVsvQaum7lQmIJDQgwIMCAAIMAAwIMCDAgwCDAgAADAgwCDAgwcHB/AE6//T5WJpdMAAAAAElFTkSuQmCC'
+const ATTACHMENT_PNG =
+ 'iVBORw0KGgoAAAANSUhEUgAAAPAAAACgCAIAAAC9uXYyAAAC5klEQVR42u3cvWoUYRQG4HckinegEQyIRYKNpVgFsbHLtaazEbESSxvZLUIggtmUKWLcnWK9gVnIhsnsN988TxlIcpx9czzzd5r1eh2oxSOHAIEGgYaHt9f51YOTeb+/5uL00LFGhwaBxshRjtmvn9t+y9Gbt+X/HHRoEGgEGqrRdN76dtkOHRpK7dCgQ4NAg0DDJnvt6l9pNT1+8tQHQyW3vpP8vbn2wWDkAIFGoEGgQaBBoBFoEGjISG6sXP75/aC/df/FS4ceHRoEGoEGgQZP293L1eKyzMKePd9X6gClbh3o8q9CvHp9VFpJ52czpQ5WqpEDMzSYoYf04/u3Hn/au/fHSh1XqTo0Rg4QaBBomPbTdgOfcChVhwaBBoEGgUagIWO7yuGdP3RoEGgQaBBoBBoEGgQa4mk7qOWdwm3fbldqZaVu0qyWt6V16LZd6jSYoUGgEWgY2Qy9W2ZoYvtorPSM7aOjvWxnpWdsHzVD46QQzNCxfVSpto+CQIOn7dChwUlh7MlUqg4NAg0Cjd12oEODQINAI9Ag0CDQINAQT9uhQ4NAg8dHY6WnUmP7KBg5iN12sdsOHRoEGmL7qJWesX3U9tFY6RnbR8EMDWboWOmpVE/bgZEDgQaBBieFVnoqVYcGu+0wQ4NAg0CDQCPQINAg0CDQINAINAg0xNN29OTgZH7fb22SRdcX5zv851ycHto+OvFSm5r+Pns5UKMM9FabR6oudVFToHs5VkaOGvTyn/UIBycnhcRVDhBoiMt2sX00073KselY2T6ayaz07D6d+vrlc8mf3YePn+5+oGwfxQwNZujYPpqprPTUoUGgwa1vcufLCDo06NCxJ9NpnECTyp+DyyDPBho5MEODQINAg0Aj0CDQENehiZfJdWjQoeOWnhkaBBqMHOzspO38bNa5caHAd+ltH1XqJErdpFktb0urqW2Xui9maBBoBBoEGgQaBBqBBoEGgQaBBoFGoGHs/gP0Uf5WkRgQ5wAAAABJRU5ErkJggg=='
+
+function pngResponse(base64: string): Response {
+ return new HttpResponse(
+ Uint8Array.from(atob(base64), (char) => char.charCodeAt(0)),
+ {
+ headers: { 'Content-Type': 'image/png' },
+ }
+ )
+}
+
+function makeSignal(
+ overrides: Omit<Partial<SignalNode>, 'extra'> & {
+ source_product: SignalNode['source_product']
+ extra: Record<string, unknown>
+ }
+): SignalNode {
+ return {
+ signal_id: `sig-${overrides.source_product}`,
+ content: 'The user retried the upload three times before leaving the page.',
+ source_type: 'issue',
+ source_id: 'src-1',
+ weight: 0.8,
+ timestamp: BASE_DATE,
+ ...overrides,
+ extra: overrides.extra as unknown as SignalNode['extra'],
+ }
+}
+
+const sessionProblemExtra: Record<string, unknown> = {
+ session_id: 'sess-1',
+ segment_title: 'Upload retry loop',
+ start_time: '01:12',
+ end_time: '02:40',
+ problem_type: 'failure',
+ distinct_id: 'user-8f3a1c2d9e',
+ session_start_time: '2026-06-11T09:00:00Z',
+ session_duration: 412,
+ session_active_seconds: 180,
+ exported_asset_id: 101,
+ event_history: [
+ {
+ event: '$pageview',
+ timestamp: '01:12',
+ current_url: 'https://app.example.com/files',
+ event_type: 'pageview',
+ },
+ { event: '$autocapture', timestamp: '01:20', interaction_text: 'Upload', event_type: 'click' },
+ {
+ event: '$exception',
+ timestamp: '01:31',
+ interaction_text: 'Request failed with 413',
+ event_type: 'exception',
+ },
+ { event: '$autocapture', timestamp: '02:38', interaction_text: 'Upload', event_type: 'click' },
+ ],
+}
+
+const sessionProblem = makeSignal({
+ source_product: 'session_replay',
+ source_type: 'session_problem',
+ source_id: 'sess-1',
+ content: 'Three attempts to upload a 40 MB PDF failed with a 413, then the user abandoned the folder.',
+ extra: sessionProblemExtra,
+})
+
+const sessionProblemWithoutScreenshot = makeSignal({
+ ...sessionProblem,
+ signal_id: 'sig-session-plain',
+ extra: { ...sessionProblemExtra, exported_asset_id: null },
+})
+
+const scannerFinding = makeSignal({
+ source_product: 'replay_vision',
+ source_type: 'scanner_finding',
+ source_id: 'obs-1',
+ content: 'The share dialog opened with no close control and the user pressed Escape four times.',
+ extra: {
+ scanner_id: 'scanner-1',
+ scanner_name: 'Dead-end modal',
+ scanner_type: 'ux',
+ observation_id: 'obs-1',
+ session_id: 'sess-2',
+ confidence: 0.82,
+ problem_type: 'dead_end',
+ start_time: 72,
+ end_time: 90,
+ url: 'https://app.example.com/files/shared',
+ exported_asset_id: 102,
+ distinct_id: 'user-2b7d4e6f1a',
+ recording_start_time: '2026-06-11T08:40:00Z',
+ recording_duration: 600,
+ recording_active_seconds: 240,
+ },
+})
+
+const conversationsTicket = makeSignal({
+ source_product: 'conversations',
+ source_type: 'ticket',
+ source_id: 'ticket-4821',
+ content: 'Customer reports the upload progress bar reaches 100% but the file never appears in the folder.',
+ extra: {
+ ticket_number: 4821,
+ channel_source: 'email',
+ channel_detail: null,
+ status: 'open',
+ priority: 'high',
+ created_at: BASE_DATE,
+ email_subject: 'Upload stuck at 100%',
+ images: [
+ { url: '/api/projects/997/exports/103/content/', author: 'Sam' },
+ { url: '/api/projects/997/exports/104/content/', author: 'Sam' },
+ ],
+ },
+})
+
+// An error tracking payload with no fingerprint fails that card's guard, so it falls back to the
+// generic card, which still links the issue from the source id.
+const genericWithEntityLink = makeSignal({
+ source_product: 'error_tracking',
+ source_type: 'issue_created',
+ source_id: 'issue-1',
+ content: 'TypeError: cannot read properties of undefined (reading "size") in startUpload.',
+ extra: {},
+})
+
+const genericWithExternalLink = makeSignal({
+ source_product: 'jira',
+ source_id: 'HB-12',
+ content: 'Tracked as a bug by the platform team.',
+ extra: { url: 'https://example.atlassian.net/browse/HB-12' },
+})
+
+const genericWithoutLink = makeSignal({
+ source_product: 'jira',
+ source_id: 'HB-13',
+ content: 'Mentioned in the sprint retro notes.',
+ extra: {},
+})
+
+const meta: Meta = {
+ title: 'Scenes-App/Inbox/Signal cards',
+ parameters: {
+ layout: 'padded',
+ viewMode: 'story',
+ mockDate: '2026-06-11',
+ // The evidence links and previews are part of the redesign.
+ featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true },
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:id/exports/:exportId/content/': (req) =>
+ pngResponse(
+ ['103', '104'].includes(String(req.params.exportId)) ? ATTACHMENT_PNG : RECORDING_PREVIEW_PNG
+ ),
+ },
+ post: {
+ '/api/environments/:id/session_recordings/batch_check_exists': () => [
+ 200,
+ { results: { 'sess-1': true, 'sess-2': true } },
+ ],
+ '/api/projects/:id/session_recordings/batch_check_exists': () => [
+ 200,
+ { results: { 'sess-1': true, 'sess-2': true } },
+ ],
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj
+
+/** Same width as the evidence rail in the report detail, where these cards render. */
+function Rail({ signals }: { signals: SignalNode[] }): JSX.Element {
+ return (
+ <div className="flex flex-col gap-3 w-[26rem]">
+ {signals.map((signal) => (
+ <SignalCard key={signal.signal_id} signal={signal} />
+ ))}
+ </div>
+ )
+}
+
+export const RecordingPreviews: Story = {
+ render: () => <Rail signals={[sessionProblem, scannerFinding, sessionProblemWithoutScreenshot]} />,
+}
+
+export const TicketAttachments: Story = {
+ render: () => <Rail signals={[conversationsTicket]} />,
+}
+
+export const GenericFallbacks: Story = {
+ render: () => <Rail signals={[genericWithEntityLink, genericWithExternalLink, genericWithoutLink]} />,
+}
diff --git a/products/signals/frontend/inbox/components/signalCards/SignalsScoutSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/SignalsScoutSignalCard.tsx
index 60bf89562312..7c480aea4106 100644
--- a/products/signals/frontend/inbox/components/signalCards/SignalsScoutSignalCard.tsx
+++ b/products/signals/frontend/inbox/components/signalCards/SignalsScoutSignalCard.tsx
@@ -7,6 +7,7 @@ import { LemonButton, LemonTag, Link } from '@posthog/lemon-ui'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { LemonProgress } from 'lib/lemon-ui/LemonProgress/LemonProgress'
import { humanFriendlyDetailedTime } from 'lib/utils/datetime'
+import { identifierToHuman } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
import type {
@@ -14,19 +15,15 @@ import type {
SignalsScoutSignalExtraApi,
} from 'products/signals/frontend/generated/api.schemas'
-import { INBOX_SOURCE_OPTIONS } from '../../filterOptions'
+import { signalEntityUrl } from '../../utils/signalLinks'
import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'
+import { getSourceProductMeta } from '../badges/sourceProductIcons'
import { SignalCardShell } from './SignalCardShell'
import type { SignalCardEntry, SignalCardProps } from './types'
/** How many evidence rows to show before collapsing the rest behind a toggle. */
const EVIDENCE_PREVIEW_COUNT = 3
-/** O(1) source-product → {label, icon} lookup, built once from the shared filter options. */
-const SOURCE_BY_VALUE: Record<string, { label: string; icon: JSX.Element }> = Object.fromEntries(
- INBOX_SOURCE_OPTIONS.map((o) => [o.value, { label: o.label, icon: o.icon }])
-)
-
/** Narrows a raw `extra` payload to the live Signals scout shape. */
export function isSignalsScoutExtra(value: unknown): value is Record<string, unknown> & SignalsScoutSignalExtraApi {
if (typeof value !== 'object' || value === null) {
@@ -36,36 +33,19 @@ export function isSignalsScoutExtra(value: unknown): value is Record<string, unk
return Array.isArray(extra.evidence) && typeof extra.skill_name === 'string' && typeof extra.confidence === 'number'
}
-/**
- * Builds a deep link into the product an evidence entry came from, or null when no link applies.
- * Entity-keyed products need an `entityId`; `logs` is entity-less; unknown products get no link.
- */
-export function scoutEvidenceUrl(sourceProduct: string, entityId?: string): string | null {
- switch (sourceProduct) {
- case 'error_tracking':
- return entityId ? urls.errorTrackingIssue(entityId) : null
- case 'session_replay':
- return entityId ? urls.replaySingle(entityId) : null
- case 'llm_analytics':
- return entityId ? urls.aiObservabilityTrace(entityId) : null
- case 'logs':
- return urls.logs()
- default:
- return null
- }
-}
-
/** A single evidence row: source icon + eyebrow, the summary, and an optional deep link. */
function EvidenceRow({ entry }: { entry: SignalsScoutEvidenceEntryApi }): JSX.Element {
- const meta = SOURCE_BY_VALUE[entry.source_product]
- const url = scoutEvidenceUrl(entry.source_product, entry.entity_id ?? undefined)
+ const meta = getSourceProductMeta(entry.source_product)
+ const url = signalEntityUrl(entry.source_product, entry.entity_id)
return (
<li className="flex items-start gap-2 py-0.5">
<span className="inline-flex shrink-0 items-center text-tertiary mt-0.5" aria-hidden>
- {meta ? meta.icon : <IconList />}
+ {meta ? <meta.Icon className={meta.colorClass} /> : <IconList />}
</span>
<div className="flex-1 min-w-0">
- <div className="text-xs font-medium text-tertiary">{meta?.label ?? entry.source_product}</div>
+ <div className="text-xs font-medium text-tertiary">
+ {meta?.label ?? identifierToHuman(entry.source_product)}
+ </div>
<div className="text-sm text-primary">{entry.summary}</div>
</div>
{url && (
diff --git a/products/signals/frontend/inbox/components/tabs/ArchivedTab.tsx b/products/signals/frontend/inbox/components/tabs/ArchivedTab.tsx
index 81ebf38e8858..ad4a3ba5c3f6 100644
--- a/products/signals/frontend/inbox/components/tabs/ArchivedTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/ArchivedTab.tsx
@@ -1,6 +1,5 @@
import { IconArchive } from '@posthog/icons'
-import { INBOX_FLAT_TAB_LIST_PARAMS } from '../../logics/reportListLogic'
import { ReportCard } from '../cards/ReportCard'
import { InboxReportList } from '../InboxReportList'
@@ -13,7 +12,6 @@ export function ArchivedTab(): JSX.Element {
return (
<InboxReportList
tabKey="archived"
- listParams={INBOX_FLAT_TAB_LIST_PARAMS.archived}
Card={ReportCard}
emptyState={{
icon: <IconArchive className="text-2xl" />,
diff --git a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
index ec2eefd54d05..8811158540e0 100644
--- a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
+++ b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
@@ -1,17 +1,25 @@
import type { Decorator, Meta, StoryObj } from '@storybook/react'
+import { useMountedLogic } from 'kea'
+import { router } from 'kea-router'
+import { useEffect } from 'react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
import { pullRequestReports, reportTabReports } from '../../__mocks__/inboxMocks'
-import { SignalReport, SignalRun } from '../../types'
+import { inboxSceneLogic } from '../../inboxSceneLogic'
+import { DEFAULT_OPEN_SECTIONS, inboxReportSectionsLogic } from '../../logics/inboxReportSectionsLogic'
+import { INBOX_REPORT_SECTION_KEYS, SignalReport, SignalRun } from '../../types'
import { PullRequestsTab } from './PullRequestsTab'
import { ReportsTab } from './ReportsTab'
+import { ReportsTabLegacy } from './ReportsTabLegacy'
import { RunsTab } from './RunsTab'
-// Stories for the inbox tab bodies. The flat report tabs (Reports / Pull requests) load via
-// `reportListLogic`, so they get an mswDecorator that mocks the reports list endpoint; the
-// Runs tab is prop-driven and receives mock runs directly. Use these to polish list density
-// and the scout/signal run-card design.
+// Stories for the inbox tab bodies. The Reports tab loads each section via `reportListLogic`, so it
+// gets an mswDecorator that mocks the reports list endpoint; the Runs panel is prop-driven and
+// receives mock runs directly. Use these to polish section density and the run-card design.
const SAMPLE_RUNS: SignalRun[] = [
{
@@ -40,7 +48,7 @@ const SAMPLE_RUNS: SignalRun[] = [
},
]
-// Mocks the shared reports list endpoint so the logic-driven flat tabs render the given set.
+// Mocks the shared reports list endpoint so the logic-driven views render the given set.
function reportsListDecorator(reports: SignalReport[]): Decorator {
return mswDecorator({
get: {
@@ -48,16 +56,39 @@ function reportsListDecorator(reports: SignalReport[]): Decorator {
200,
{ results: reports, count: reports.length, next: null, previous: null },
],
+ '/api/projects/:id/signals/reports/available_reviewers': () => [200, []],
+ '/api/projects/:id/signals/scout/configs': () => [200, []],
},
})
}
+// One mocked endpoint feeds every section, so each renders the same rows — enough to judge the
+// section rhythm, which is what these stories are for.
+function ReportsTabStory({ expandAll = false }: { expandAll?: boolean }): JSX.Element {
+ useMountedLogic(inboxSceneLogic)
+ const sectionsLogic = useMountedLogic(inboxReportSectionsLogic)
+ useEffect(() => {
+ router.actions.push(urls.inbox('reports'))
+ if (expandAll) {
+ INBOX_REPORT_SECTION_KEYS.filter((key) => !DEFAULT_OPEN_SECTIONS[key]).forEach((key) =>
+ sectionsLogic.actions.toggleSection(key)
+ )
+ }
+ }, [expandAll, sectionsLogic])
+ return (
+ <div className="bg-primary min-h-screen">
+ <ReportsTab />
+ </div>
+ )
+}
+
const meta: Meta = {
title: 'Scenes-App/Inbox/Tabs',
parameters: {
layout: 'fullscreen',
viewMode: 'story',
mockDate: '2026-06-11',
+ featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: true },
testOptions: { waitForLoadersToDisappear: false },
},
}
@@ -65,62 +96,65 @@ export default meta
type Story = StoryObj
+// The default arrangement: Needs a PR and Review and merge open, Resolved collapsed.
export const Reports: Story = {
decorators: [reportsListDecorator(reportTabReports)],
- render: () => (
- <div className="bg-primary min-h-screen">
- <ReportsTab />
- </div>
- ),
+ render: () => <ReportsTabStory />,
}
+// Every section open, including the ones that start collapsed.
+export const ReportsAllSectionsExpanded: Story = {
+ decorators: [reportsListDecorator(pullRequestReports)],
+ render: () => <ReportsTabStory expandAll />,
+}
+
+// Nothing anywhere: the whole-list empty state rather than a per-section one.
export const ReportsEmpty: Story = {
decorators: [reportsListDecorator([])],
- render: () => (
- <div className="bg-primary min-h-screen">
- <ReportsTab />
- </div>
- ),
+ render: () => <ReportsTabStory />,
}
-export const PullRequests: Story = {
- decorators: [reportsListDecorator(pullRequestReports)],
+export const Runs: Story = {
render: () => (
<div className="bg-primary min-h-screen">
- <PullRequestsTab />
+ <RunsTab runs={SAMPLE_RUNS} loading={false} />
</div>
),
}
-export const PullRequestsEmpty: Story = {
- decorators: [reportsListDecorator([])],
+export const RunsLoading: Story = {
render: () => (
<div className="bg-primary min-h-screen">
- <PullRequestsTab />
+ <RunsTab runs={[]} loading />
</div>
),
}
-export const Runs: Story = {
+export const RunsEmpty: Story = {
render: () => (
<div className="bg-primary min-h-screen">
- <RunsTab runs={SAMPLE_RUNS} loading={false} />
+ <RunsTab runs={[]} loading={false} />
</div>
),
}
-export const RunsLoading: Story = {
+// The flat tabs with the redesign flag off: one list per tab under the search and filter bar.
+export const ReportsLegacy: Story = {
+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: false } },
+ decorators: [reportsListDecorator(reportTabReports)],
render: () => (
<div className="bg-primary min-h-screen">
- <RunsTab runs={[]} loading />
+ <ReportsTabLegacy />
</div>
),
}
-export const RunsEmpty: Story = {
+export const PullRequestsLegacy: Story = {
+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_REDESIGN]: false } },
+ decorators: [reportsListDecorator(pullRequestReports)],
render: () => (
<div className="bg-primary min-h-screen">
- <RunsTab runs={[]} loading={false} />
+ <PullRequestsTab />
</div>
),
}
diff --git a/products/signals/frontend/inbox/components/tabs/NotActionableTab.tsx b/products/signals/frontend/inbox/components/tabs/NotActionableTab.tsx
index dba93f3f8988..6f917a1e2ec2 100644
--- a/products/signals/frontend/inbox/components/tabs/NotActionableTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/NotActionableTab.tsx
@@ -1,6 +1,5 @@
import { IconInfo } from '@posthog/icons'
-import { INBOX_FLAT_TAB_LIST_PARAMS } from '../../logics/reportListLogic'
import { ReportCard } from '../cards/ReportCard'
import { InboxReportList } from '../InboxReportList'
@@ -13,7 +12,6 @@ export function NotActionableTab(): JSX.Element {
return (
<InboxReportList
tabKey="not-actionable"
- listParams={INBOX_FLAT_TAB_LIST_PARAMS['not-actionable']}
Card={ReportCard}
emptyState={{
icon: <IconInfo className="text-2xl" />,
diff --git a/products/signals/frontend/inbox/components/tabs/PullRequestsTab.tsx b/products/signals/frontend/inbox/components/tabs/PullRequestsTab.tsx
index 393bb0ae44e2..0cce7b8cafea 100644
--- a/products/signals/frontend/inbox/components/tabs/PullRequestsTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/PullRequestsTab.tsx
@@ -5,7 +5,6 @@ import { IconPullRequest } from '@posthog/icons'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { INBOX_FLAT_TAB_LIST_PARAMS } from '../../logics/reportListLogic'
import { ReportCard } from '../cards/ReportCard'
import { InboxWaitingForWork } from '../emptyState/InboxWaitingForWork'
import { InboxReportList } from '../InboxReportList'
@@ -18,7 +17,6 @@ export function PullRequestsTab(): JSX.Element {
return (
<InboxReportList
tabKey="pulls"
- listParams={INBOX_FLAT_TAB_LIST_PARAMS.pulls}
Card={ReportCard}
emptyState={
showWaitingForWork
diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx
new file mode 100644
index 000000000000..749bb9f123d2
--- /dev/null
+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.test.tsx
@@ -0,0 +1,125 @@
+import { MOCK_DEFAULT_USER } from 'lib/api.mock'
+
+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen, waitFor } from '@testing-library/react'
+import posthog from 'posthog-js'
+
+import { userLogic } from 'scenes/userLogic'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { INBOX_EVENTS } from '../../inboxAnalytics'
+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'
+import { INBOX_SCOPE_ENTIRE_PROJECT } from '../../types'
+import { ReportsTab } from './ReportsTab'
+
+jest.mock('posthog-js')
+// The sections, filters, and bulk bar each pull in their own endpoints; this is about what the tab
+// reports for the list as a whole.
+jest.mock('../InboxReportSection', () => ({
+ InboxReportSection: ({ sectionKey }: { sectionKey: string }) => <div data-attr={`section-${sectionKey}`} />,
+}))
+jest.mock('../shell/InboxReportFilters', () => ({ InboxReportFilters: () => null }))
+jest.mock('../shell/InboxBulkSelectionBar', () => ({ InboxBulkSelectionBar: () => null }))
+jest.mock('../SelfDrivingInstallingHint', () => ({ SelfDrivingInstallingHint: () => null }))
+
+interface SectionCountStub {
+ match: (params: URLSearchParams) => boolean
+ count: number
+}
+
+// One count per section's fixed filter, so the summed total is unambiguous.
+const COUNT_BY_FILTER: SectionCountStub[] = [
+ { match: (p) => p.get('has_implementation_pr') === 'true', count: 4 },
+ { match: (p) => p.get('has_implementation_pr') === 'false', count: 7 },
+ { match: (p) => (p.get('status') ?? '').includes('suppressed'), count: 2 },
+]
+
+// Only `ready` + `not_actionable` reports: the pipeline's actionability judgment leaves the status
+// alone, so nothing lands in the three counted sections.
+const ONLY_NOT_ACTIONABLE: SectionCountStub[] = [
+ { match: (p) => p.get('actionability') === 'not_actionable' && !p.has('has_implementation_pr'), count: 3 },
+]
+
+function mockReportCounts(stubs: SectionCountStub[]): void {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ '/api/projects/:team_id/signals/reports/': ({ request }) => {
+ const params = new URL(request.url).searchParams
+ const count = stubs.find((c) => c.match(params))?.count ?? 0
+ return [200, { count, next: null, previous: null, results: [] }]
+ },
+ },
+ })
+}
+
+describe('ReportsTab', () => {
+ beforeEach(() => {
+ ;(posthog.capture as jest.Mock).mockClear()
+ mockReportCounts(COUNT_BY_FILTER)
+ initKeaTests()
+ })
+
+ afterEach(cleanup)
+
+ // `Inbox viewed` fires once every count has settled, so it doubles as "the empty verdict is in".
+ async function waitForCountsToSettle(): Promise<void> {
+ await waitFor(() => {
+ const viewed = (posthog.capture as jest.Mock).mock.calls.filter(([event]) => event === INBOX_EVENTS.VIEWED)
+ expect(viewed).toHaveLength(1)
+ })
+ }
+
+ // The sections all render at once, so the naive wiring fires one `Inbox viewed` per section and
+ // triples every visit in the activation funnel.
+ it('fires Inbox viewed once for the whole list', async () => {
+ render(<ReportsTab />)
+
+ await waitFor(() => {
+ const viewed = (posthog.capture as jest.Mock).mock.calls.filter(([event]) => event === INBOX_EVENTS.VIEWED)
+ expect(viewed).toHaveLength(1)
+ // Needs a PR + Review and merge + Resolved. Not actionable is staff-only triage.
+ expect(viewed[0][1]).toMatchObject({ tab: 'reports', total_count: 13, is_empty: false })
+ })
+ })
+
+ // The empty verdict used to be taken over the three counted sections only, so a staff user on a
+ // project whose reports were all judged not actionable was told "nothing yet" while the section
+ // built to review them was never mounted.
+ it.each([
+ { name: 'staff sees Not actionable when it is the only section with reports', isStaff: true, empty: false },
+ { name: 'non-staff sees the empty state for the same project', isStaff: false, empty: true },
+ ])('$name', async ({ isStaff, empty }) => {
+ mockReportCounts(ONLY_NOT_ACTIONABLE)
+ userLogic.actions.loadUserSuccess({ ...MOCK_DEFAULT_USER, is_staff: isStaff })
+ inboxFiltersLogic.mount()
+ inboxFiltersLogic.actions.setScope(INBOX_SCOPE_ENTIRE_PROJECT)
+
+ render(<ReportsTab />)
+ await waitForCountsToSettle()
+
+ expect(screen.queryByText('Nothing in your inbox yet') !== null).toBe(empty)
+ expect(document.querySelector('[data-attr="section-not-actionable"]') !== null).toBe(!empty)
+ })
+
+ // "Nothing yet" claims the project has no reports. A search or scope that matches nothing must
+ // not make that claim, or the user loses the filter bar's own per-section feedback.
+ it.each([
+ { name: 'a search that matches nothing', setUp: () => inboxFiltersLogic.actions.setSearchQuery('zzz') },
+ { name: 'the For-you scope', setUp: () => inboxFiltersLogic.actions.setScope('for-you') },
+ ])('keeps the sections when $name is active', async ({ setUp }) => {
+ mockReportCounts([])
+ inboxFiltersLogic.mount()
+ setUp()
+
+ render(<ReportsTab />)
+ await waitForCountsToSettle()
+
+ expect(document.querySelector('[data-attr="section-needs-decision"]')).not.toBeNull()
+ expect(screen.queryByText('Nothing in your inbox yet')).toBeNull()
+ })
+})
diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
index 02ff18be3141..14171819d730 100644
--- a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
@@ -1,27 +1,240 @@
+import { useValues } from 'kea'
+import { JSX, useEffect, useRef } from 'react'
+
import { IconNotebook } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { urls } from 'scenes/urls'
-import { INBOX_FLAT_TAB_LIST_PARAMS } from '../../logics/reportListLogic'
-import { ReportCard } from '../cards/ReportCard'
-import { InboxReportList } from '../InboxReportList'
+import { captureInboxViewed } from '../../inboxAnalytics'
+import { inboxSceneLogic } from '../../inboxSceneLogic'
+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from '../../logics/reportListLogic'
+import {
+ INBOX_REPORT_SECTION_KEYS,
+ INBOX_SCOPE_ENTIRE_PROJECT,
+ INBOX_STAFF_ONLY_REPORT_SECTION_KEYS,
+ InboxReportSectionKey,
+ SignalReport,
+} from '../../types'
+import { InboxWaitingForWork } from '../emptyState/InboxWaitingForWork'
+import { InboxReportSection } from '../InboxReportSection'
import { SelfDrivingInstallingHint } from '../SelfDrivingInstallingHint'
+import { InboxBulkSelectionBar } from '../shell/InboxBulkSelectionBar'
+import { InboxReportFilters } from '../shell/InboxReportFilters'
+import { InboxScopeSelect } from '../shell/InboxScopeSelect'
+
+/**
+ * The sections that make up "the inbox" for the `Inbox viewed` event. Not actionable is left out: it
+ * is a staff triage surface, and counting it would report a non-empty inbox on a project that has
+ * surfaced nothing worth acting on. The empty-state verdict is a separate question, answered over
+ * the sections the current user can actually see.
+ */
+const COUNTED_SECTION_KEYS = ['needs-decision', 'monitoring', 'resolved'] as const
+
+type CountedSectionKey = (typeof COUNTED_SECTION_KEYS)[number]
+
+interface SectionListState {
+ count: number | null
+ countLoading: boolean
+ visibleReports: SignalReport[]
+}
+
+/**
+ * Every section's header count and rendered rows, keyed by section. All four logics are mounted
+ * regardless of who is looking, so the hooks never change shape when the staff flag resolves;
+ * callers decide which sections matter to them.
+ *
+ * Read one value at a time rather than spreading what `useValues` returns: it hands back a proxy
+ * whose properties are subscribing getters, and spreading it yields an empty object — silently, and
+ * with a type that still claims every value is there.
+ */
+function useSectionStates(): Record<InboxReportSectionKey, SectionListState> {
+ const needsDecisionProps = {
+ sectionKey: 'needs-decision' as const,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],
+ }
+ const monitoringProps = {
+ sectionKey: 'monitoring' as const,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS.monitoring,
+ }
+ const resolvedProps = { sectionKey: 'resolved' as const, listParams: INBOX_REPORT_SECTION_LIST_PARAMS.resolved }
+ const notActionableProps = {
+ sectionKey: 'not-actionable' as const,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['not-actionable'],
+ }
+
+ const {
+ count: needsDecisionCount,
+ countLoading: needsDecisionCountLoading,
+ visibleReports: needsDecisionReports,
+ } = useValues(reportListLogic(needsDecisionProps))
+ const {
+ count: monitoringCount,
+ countLoading: monitoringCountLoading,
+ visibleReports: monitoringReports,
+ } = useValues(reportListLogic(monitoringProps))
+ const {
+ count: resolvedCount,
+ countLoading: resolvedCountLoading,
+ visibleReports: resolvedReports,
+ } = useValues(reportListLogic(resolvedProps))
+ const {
+ count: notActionableCount,
+ countLoading: notActionableCountLoading,
+ visibleReports: notActionableReports,
+ } = useValues(reportListLogic(notActionableProps))
+
+ return {
+ 'needs-decision': {
+ count: needsDecisionCount,
+ countLoading: needsDecisionCountLoading,
+ visibleReports: needsDecisionReports,
+ },
+ monitoring: {
+ count: monitoringCount,
+ countLoading: monitoringCountLoading,
+ visibleReports: monitoringReports,
+ },
+ resolved: {
+ count: resolvedCount,
+ countLoading: resolvedCountLoading,
+ visibleReports: resolvedReports,
+ },
+ 'not-actionable': {
+ count: notActionableCount,
+ countLoading: notActionableCountLoading,
+ visibleReports: notActionableReports,
+ },
+ }
+}
+
+/**
+ * `Inbox viewed`, fired once per Reports mount as soon as every counted section's header count has
+ * settled. One event per visit, as before the sections replaced the view tabs — but the reader now
+ * sees every section at once, so it carries the whole list rather than one view's slice.
+ */
+function useInboxViewedEvent(sections: Record<CountedSectionKey, SectionListState>): void {
+ const { hasActiveFilters, sourceProductFilter, priorityFilter, scope } = useValues(inboxFiltersLogic)
+ // The list stays mounted (hidden) while a report/scout detail is open, so gate the view event on
+ // the list actually being the visible surface — otherwise a deep-link to a report fires a phantom
+ // `Inbox viewed` and then suppresses the real one when the user navigates back to the list.
+ const { selectedReportId, selectedScoutSkillName, isScratchpadOpen, isFindingsOpen, isRunsOpen, isTriageOpen } =
+ useValues(inboxSceneLogic)
+ const listVisible =
+ !selectedReportId &&
+ !selectedScoutSkillName &&
+ !isScratchpadOpen &&
+ !isFindingsOpen &&
+ !isRunsOpen &&
+ !isTriageOpen
+ // A count is settled once its request is no longer in flight: loaded, refreshed, or failed
+ // (count stays null). Waiting on the loading flags rather than non-null values means a scope or
+ // filter refresh in progress doesn't fire the event with the previous query's counts.
+ const settled = COUNTED_SECTION_KEYS.every((key) => !sections[key].countLoading)
+ const firedRef = useRef(false)
+
+ useEffect(() => {
+ if (!listVisible || !settled || firedRef.current) {
+ return
+ }
+ firedRef.current = true
+ captureInboxViewed({
+ // pinned: `tab` names the inbox page tab. Before the sections landed it named the report
+ // view, which is no longer a surface of its own.
+ tab: 'reports',
+ reports: COUNTED_SECTION_KEYS.flatMap((key) => sections[key].visibleReports),
+ totalCount: COUNTED_SECTION_KEYS.reduce((sum, key) => sum + (sections[key].count ?? 0), 0),
+ pullsTabCount: sections.monitoring.count,
+ reportsTabCount: sections['needs-decision'].count,
+ hasActiveFilters,
+ sourceProductFilter,
+ priorityFilter,
+ scope,
+ })
+ }, [listVisible, settled, sections, hasActiveFilters, sourceProductFilter, priorityFilter, scope])
+}
+
+/** Nothing has reached the inbox yet — the whole list is empty, not just one section. */
+function ReportsEmptyState(): JSX.Element {
+ const { featureFlags } = useValues(featureFlagLogic)
+ if (featureFlags[FEATURE_FLAGS.INBOX_SELF_DRIVING_EMPTY_STATE] === 'empty-state') {
+ return <InboxWaitingForWork />
+ }
+ return (
+ <div className="mx-auto flex max-w-md flex-col items-center gap-2 py-12 text-center">
+ <div className="mb-1 flex h-12 w-12 items-center justify-center rounded-full bg-fill-primary text-secondary">
+ <IconNotebook className="text-2xl" />
+ </div>
+ <h3 className="m-0 text-base font-semibold">Nothing in your inbox yet</h3>
+ <p className="m-0 text-sm text-tertiary">
+ Agents file what they find here: reports waiting on a pull request, pull requests for you to review, and
+ the work already resolved.
+ </p>
+ <SelfDrivingInstallingHint>
+ Reports will start arriving as soon as live data comes in.
+ </SelfDrivingInstallingHint>
+ </div>
+ )
+}
+
+/**
+ * The Reports tab: one toolbar over a single column of collapsible sections (Needs a PR / Review and
+ * merge / Resolved, plus Not actionable for staff). Each section owns its own filtered request,
+ * count, and paging via the keyed `reportListLogic`, while the toolbar, reviewer scope, and bulk
+ * selection are shared across all of them.
+ */
export function ReportsTab(): JSX.Element {
+ const { isStaff } = useValues(inboxSceneLogic)
+ const { hasActiveFilters, scope } = useValues(inboxFiltersLogic)
+ const sections = useSectionStates()
+ useInboxViewedEvent(sections)
+
+ const visibleSections: InboxReportSectionKey[] = INBOX_REPORT_SECTION_KEYS.filter(
+ (key) => isStaff || !INBOX_STAFF_ONLY_REPORT_SECTION_KEYS.includes(key)
+ )
+ // "Nothing yet" is a claim about the whole project, so it only holds with no filters and the
+ // project-wide scope; a narrowed view that matches nothing shows the sections with their own
+ // per-section copy instead. The verdict is over the sections this user can see, so staff still
+ // reach Not actionable when it is the only section with reports. Hold the sections until every
+ // count has answered, so a slow first load never flashes the "nothing yet" screen at a full inbox.
+ const unfilteredView = !hasActiveFilters && scope === INBOX_SCOPE_ENTIRE_PROJECT
+ const countsSettled = visibleSections.every((key) => sections[key].count !== null)
+ const inboxIsEmpty = unfilteredView && countsSettled && visibleSections.every((key) => sections[key].count === 0)
+
return (
- <InboxReportList
- tabKey="reports"
- listParams={INBOX_FLAT_TAB_LIST_PARAMS.reports}
- Card={ReportCard}
- emptyState={{
- icon: <IconNotebook className="text-2xl" />,
- title: 'No reports yet',
- description:
- "Reports are what agents surface when there's something worth your judgment but no clean code change to draft.",
- extra: (
- <SelfDrivingInstallingHint>
- Reports will start arriving as soon as live data comes in.
- </SelfDrivingInstallingHint>
- ),
- }}
- />
+ <div className="mx-auto flex w-full max-w-4xl flex-col gap-4 px-6 py-3">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
+ <InboxReportFilters />
+ <div className="ml-auto flex shrink-0 items-center gap-2">
+ <LemonButton
+ type="primary"
+ size="small"
+ to={urls.inboxTriage()}
+ sideIcon={<KeyboardShortcut t />}
+ tooltip="Go through the reports that need a pull request one at a time"
+ data-attr="inbox-triage-mode"
+ >
+ Triage mode
+ </LemonButton>
+ <InboxScopeSelect />
+ </div>
+ </div>
+ <InboxBulkSelectionBar />
+
+ {inboxIsEmpty ? (
+ <ReportsEmptyState />
+ ) : (
+ <div className="@container flex flex-col gap-5">
+ {visibleSections.map((sectionKey) => (
+ <InboxReportSection key={sectionKey} sectionKey={sectionKey} />
+ ))}
+ </div>
+ )}
+ </div>
)
}
diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTabLegacy.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTabLegacy.tsx
new file mode 100644
index 000000000000..71b052024d5b
--- /dev/null
+++ b/products/signals/frontend/inbox/components/tabs/ReportsTabLegacy.tsx
@@ -0,0 +1,25 @@
+import { IconNotebook } from '@posthog/icons'
+
+import { ReportCard } from '../cards/ReportCard'
+import { InboxReportList } from '../InboxReportList'
+import { SelfDrivingInstallingHint } from '../SelfDrivingInstallingHint'
+
+export function ReportsTabLegacy(): JSX.Element {
+ return (
+ <InboxReportList
+ tabKey="reports"
+ Card={ReportCard}
+ emptyState={{
+ icon: <IconNotebook className="text-2xl" />,
+ title: 'No reports yet',
+ description:
+ "Reports are what agents surface when there's something worth your judgment but no clean code change to draft.",
+ extra: (
+ <SelfDrivingInstallingHint>
+ Reports will start arriving as soon as live data comes in.
+ </SelfDrivingInstallingHint>
+ ),
+ }}
+ />
+ )
+}
diff --git a/products/signals/frontend/inbox/components/tabs/RunsTab.tsx b/products/signals/frontend/inbox/components/tabs/RunsTab.tsx
index 879349c4ff98..b77ce55ea016 100644
--- a/products/signals/frontend/inbox/components/tabs/RunsTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/RunsTab.tsx
@@ -6,7 +6,7 @@ import { isRunLive, RunStatusIndicator } from '../cards/runStatusVariant'
import { SignalRunCard } from '../cards/SignalRunCard'
/**
- * Runs tab: the project's scout and signals-pipeline tasks, split into what's happening now ("Live")
+ * Runs panel: the project's scout and signals-pipeline tasks, split into what's happening now ("Live")
* and what's already finished ("Past"). Each row links out to the standalone Tasks scene.
* `inboxSceneLogic` merges the two sources newest-first, so each section stays newest-first too. A
* skeleton covers the first load so the empty state doesn't flash before any data has been fetched.
diff --git a/products/signals/frontend/inbox/components/tabs/SettingsSection.tsx b/products/signals/frontend/inbox/components/tabs/SettingsSection.tsx
new file mode 100644
index 000000000000..31c9f615ecd7
--- /dev/null
+++ b/products/signals/frontend/inbox/components/tabs/SettingsSection.tsx
@@ -0,0 +1,26 @@
+import { ReactNode } from 'react'
+
+/**
+ * One block of the Settings tab: heading, one-line context, and the section's controls, together on
+ * a bordered card. The card is the only frame on the page — controls inside it separate with rules
+ * rather than nesting further boxes.
+ */
+export function SettingsSection({
+ title,
+ description,
+ children,
+}: {
+ title: string
+ description?: string
+ children: ReactNode
+}): JSX.Element {
+ return (
+ <section className="flex flex-col gap-3 rounded border border-primary bg-surface-primary p-4">
+ <div className="flex flex-col gap-0.5">
+ <h3 className="m-0 text-sm font-semibold text-default">{title}</h3>
+ {description && <p className="m-0 max-w-2xl text-xs leading-snug text-secondary">{description}</p>}
+ </div>
+ {children}
+ </section>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/tabs/SettingsTab.tsx b/products/signals/frontend/inbox/components/tabs/SettingsTab.tsx
new file mode 100644
index 000000000000..7edeaec2c404
--- /dev/null
+++ b/products/signals/frontend/inbox/components/tabs/SettingsTab.tsx
@@ -0,0 +1,63 @@
+import { useMountedLogic, useValues } from 'kea'
+
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { GithubIntegration } from 'scenes/integrations/components/GithubIntegration'
+import { urls } from 'scenes/urls'
+
+import { inboxUsageLogic } from '../../logics/inboxUsageLogic'
+import { signalSourcesLogic } from '../../signalSourcesLogic'
+import { SelfDrivingSection } from '../config/SelfDrivingSection'
+import { SignalSourcesPanel } from '../config/SignalSourcesPanel'
+import { SlackNotificationsSection } from '../config/SlackNotificationsSection'
+import { InboxUsageWidget } from '../shell/InboxUsageWidget'
+import { InstallationSetupSection } from '../shell/InstallationSetupSection'
+import { SettingsSection } from './SettingsSection'
+
+/**
+ * The Settings tab: every agent-setup control on one page, in the order a new team works through
+ * them. Signal sources and autonomy are edited most, so they lead; the connections and the usage
+ * meter follow.
+ */
+export function SettingsTab(): JSX.Element {
+ useMountedLogic(integrationsLogic)
+ useMountedLogic(signalSourcesLogic)
+ // The usage widget renders nothing without the billing product, so the section title
+ // must hide with it rather than sit over an empty area.
+ const { product: inboxUsageProduct, isLoading: inboxUsageLoading } = useValues(inboxUsageLogic)
+
+ return (
+ <div className="mx-auto flex w-full max-w-4xl flex-col gap-8 px-6 py-6">
+ <InstallationSetupSection />
+ <SettingsSection
+ title="Signal sources"
+ description="Each source watches for signals, and spins up an agent to look into them."
+ >
+ <SignalSourcesPanel />
+ </SettingsSection>
+ <SettingsSection
+ title="Autonomy"
+ description="How much agents do on their own: opening pull requests, and how many reports arrive each day."
+ >
+ <SelfDrivingSection />
+ </SettingsSection>
+ <SettingsSection
+ title="Code access"
+ description="Connect GitHub so agents can read repositories and open pull requests."
+ >
+ {/* The OAuth round trip returns to `next`; land back on this tab so the result is in view. */}
+ <GithubIntegration next={urls.inbox('settings')} connectSurface="signals_agent_setup" />
+ </SettingsSection>
+ <SettingsSection
+ title="Notifications"
+ description="Post reports to a Slack channel, and get pinged when you're a suggested reviewer."
+ >
+ <SlackNotificationsSection />
+ </SettingsSection>
+ {(inboxUsageProduct != null || inboxUsageLoading) && (
+ <SettingsSection title="Usage" description="Pull requests agents opened this billing period.">
+ <InboxUsageWidget />
+ </SettingsSection>
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/triage/InboxTriageView.test.ts b/products/signals/frontend/inbox/components/triage/InboxTriageView.test.ts
new file mode 100644
index 000000000000..1628d6f141a3
--- /dev/null
+++ b/products/signals/frontend/inbox/components/triage/InboxTriageView.test.ts
@@ -0,0 +1,33 @@
+import { TriageEnterIntent, triageEnterIntent } from './InboxTriageView'
+
+describe('triageEnterIntent', () => {
+ const button = (): HTMLElement => document.createElement('button')
+ const link = (): HTMLElement => document.createElement('a')
+ const plain = (): HTMLElement => document.createElement('div')
+ const buttonInDialog = (): HTMLElement => {
+ const dialog = document.createElement('div')
+ dialog.className = 'LemonModal'
+ const child = document.createElement('button')
+ dialog.append(child)
+ return child
+ }
+
+ it.each<[string, () => HTMLElement | null, boolean, TriageEnterIntent]>([
+ // The regression this guards: Command/Ctrl+Enter must open the report even when a
+ // just-clicked control (e.g. the "Read summary" toggle) still holds focus.
+ ['a focused button with a modifier opens the report', button, true, 'open'],
+ // Plain Enter on a focused button still activates the button, not the card toggle.
+ ['a focused button without a modifier is passed through', button, false, 'passthrough'],
+ // A focused link keeps its own Enter (activate it, or open in a new tab with the modifier).
+ ['a focused link with a modifier is passed through', link, true, 'passthrough'],
+ ['a focused link without a modifier is passed through', link, false, 'passthrough'],
+ // A key inside a dialog belongs to the dialog, even with a modifier held.
+ ['a control inside a dialog is passed through', buttonInDialog, true, 'passthrough'],
+ // Away from any control, the modifier opens the report and plain Enter toggles the card.
+ ['a modifier away from any control opens the report', plain, true, 'open'],
+ ['plain Enter away from any control toggles the card', plain, false, 'toggle'],
+ ['no focused element still toggles on plain Enter', () => null, false, 'toggle'],
+ ])('%s', (_name, makeTarget, hasModifier, expected) => {
+ expect(triageEnterIntent(makeTarget(), hasModifier)).toBe(expected)
+ })
+})
diff --git a/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx
new file mode 100644
index 000000000000..ebaecebdcfe7
--- /dev/null
+++ b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx
@@ -0,0 +1,390 @@
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import { useEffect, useRef } from 'react'
+
+import { IconArchive, IconArrowLeft, IconPullRequest } from '@posthog/icons'
+import { LemonButton, LemonSkeleton, Link, Tooltip } from '@posthog/lemon-ui'
+
+import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'
+import { TZLabel } from 'lib/components/TZLabel'
+import { HotkeyInterface, useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
+import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+import { cn } from 'lib/utils/css-classes'
+import { urls } from 'scenes/urls'
+
+import { captureInboxPanelViewed } from '../../inboxAnalytics'
+import { inboxTriageLogic } from '../../logics/inboxTriageLogic'
+import { SignalReport } from '../../types'
+import {
+ deriveHeadline,
+ displayConventionalCommitTitle,
+ parseConventionalCommitTitle,
+} from '../../utils/reportPresentation'
+import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'
+import { ConventionalCommitScopeTag, InboxCardSourceMeta } from '../cards/ReportCard'
+
+/**
+ * Wrap a hotkey so it stays quiet while a dialog (the archive form) is up. The hotkey listener sits
+ * on `window`, and a modal's buttons are not inputs, so without this pressing the archive key on the
+ * archive dialog's own button would stack a second dialog.
+ */
+function outsideDialogs(action: () => void): HotkeyInterface['action'] {
+ return (event) => {
+ if ((event.target as Element | null)?.closest?.('.LemonModal')) {
+ return
+ }
+ action()
+ }
+}
+
+export type TriageEnterIntent = 'passthrough' | 'open' | 'toggle'
+
+/**
+ * What the Enter chord does in triage, from the focused element and whether a modifier is held.
+ * Command/Ctrl+Enter opens the report from anywhere in the view — even when a just-clicked control
+ * still holds focus — so the modifier is checked before the plain-button guard. A focused link keeps
+ * its own Enter (activate it, or open in a new tab with the modifier), a key inside a dialog belongs
+ * to the dialog, and plain Enter on a focused button activates it rather than toggling the card.
+ */
+export function triageEnterIntent(target: HTMLElement | null, hasModifier: boolean): TriageEnterIntent {
+ if (target?.closest('a, .LemonModal')) {
+ return 'passthrough'
+ }
+ if (hasModifier) {
+ return 'open'
+ }
+ if (target?.closest('button')) {
+ return 'passthrough'
+ }
+ return 'toggle'
+}
+
+function PeekStrip({
+ report,
+ shortcut,
+ onClick,
+ dataAttr,
+}: {
+ report: SignalReport
+ shortcut: JSX.Element
+ onClick: () => void
+ dataAttr: string
+}): JSX.Element {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ data-attr={dataAttr}
+ className="flex w-full max-w-2xl flex-none items-center gap-3 overflow-hidden rounded border border-primary bg-surface-primary px-4 py-1.5 opacity-50 transition-opacity hover:opacity-100 motion-reduce:transition-none"
+ >
+ {shortcut}
+ <span className="truncate text-xs text-secondary">
+ {displayConventionalCommitTitle(report.title, 'Untitled report')}
+ </span>
+ </button>
+ )
+}
+
+function HintBarItem({ shortcut, label }: { shortcut: JSX.Element; label: string }): JSX.Element {
+ return (
+ <span className="flex items-center gap-1.5">
+ {shortcut}
+ <span>{label}</span>
+ </span>
+ )
+}
+
+function TriageCard({ report, expanded }: { report: SignalReport; expanded: boolean }): JSX.Element {
+ const { canCreatePr, isCreatingPr, aiConsentDisabledReason, currentReportUrl } = useValues(inboxTriageLogic)
+ const { archiveCurrent, createPrForCurrent, openCurrent, toggleExpanded } = useActions(inboxTriageLogic)
+
+ const conventionalTitle = parseConventionalCommitTitle(report.title)
+ const title = displayConventionalCommitTitle(report.title, 'Untitled report')
+ const headline = deriveHeadline(report.summary)
+
+ return (
+ <article
+ key={report.id}
+ className="flex max-h-full w-full max-w-3xl min-h-0 flex-col overflow-hidden rounded-lg border border-primary bg-surface-primary shadow-sm"
+ data-attr="inbox-triage-card"
+ >
+ <div className="flex flex-none items-center px-6 pt-4">
+ <InboxCardSourceMeta sourceProducts={report.source_products} scoutSkillName={report.scout_name} />
+ </div>
+
+ <div className="flex flex-none items-center gap-3 px-6 pt-3">
+ {report.priority && (
+ <div className="shrink-0">
+ <SignalReportPriorityBadge priority={report.priority} />
+ </div>
+ )}
+ <h1
+ className={cn(
+ 'm-0 min-w-0 break-words font-bold leading-tight tracking-tight',
+ expanded ? 'text-base' : 'text-xl'
+ )}
+ >
+ {conventionalTitle && (
+ <ConventionalCommitScopeTag type={conventionalTitle.type} scope={conventionalTitle.scope} />
+ )}
+ {title}
+ </h1>
+ </div>
+
+ {!expanded ? (
+ <>
+ <p className="m-0 flex-none px-6 pt-3 text-sm leading-relaxed text-secondary">
+ {headline ?? (
+ <span className="italic text-tertiary">No summary yet. Still collecting context.</span>
+ )}
+ </p>
+ <div className="flex flex-none flex-wrap items-center gap-x-2 gap-y-1 px-6 pt-3 pb-4 text-xs text-tertiary">
+ {report.signal_count > 0 && (
+ <>
+ <span className="tabular-nums">
+ {report.signal_count} signal{report.signal_count === 1 ? '' : 's'}
+ </span>
+ <span aria-hidden>·</span>
+ </>
+ )}
+ <span className="flex items-center gap-1">
+ First seen <TZLabel time={report.created_at} />
+ </span>
+ <span aria-hidden>·</span>
+ <span className="flex items-center gap-1">
+ Last updated <TZLabel time={report.updated_at ?? report.created_at} />
+ </span>
+ </div>
+ </>
+ ) : (
+ <div className="mt-3 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto border-t border-primary px-6 py-5">
+ {report.summary ? (
+ <LemonMarkdown
+ className="text-sm text-secondary leading-relaxed break-words [&>*+*]:mt-3 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-5 [&_h2]:mt-5 [&_h3]:mt-4"
+ disableImages
+ // Charts need the report page's placement logic; here their references
+ // drop out and the full report link below carries the reader to them.
+ renderChartRef={() => null}
+ >
+ {report.summary}
+ </LemonMarkdown>
+ ) : (
+ <p className="m-0 text-sm italic text-tertiary">
+ No summary yet. An agent is still investigating.
+ </p>
+ )}
+ <div className="flex items-center gap-2">
+ <Link
+ to={currentReportUrl ?? undefined}
+ className="text-xs"
+ data-attr="inbox-triage-full-report"
+ >
+ Full report
+ </Link>
+ <KeyboardShortcut command enter className="text-accent" />
+ </div>
+ </div>
+ )}
+
+ <div className="flex flex-none flex-wrap items-center gap-2 border-t border-primary px-4 py-2">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconArchive />}
+ onClick={archiveCurrent}
+ sideIcon={<KeyboardShortcut a />}
+ data-attr="inbox-triage-archive"
+ >
+ Archive
+ </LemonButton>
+ {canCreatePr && (
+ <LemonButton
+ type="primary"
+ size="small"
+ icon={<IconPullRequest />}
+ onClick={createPrForCurrent}
+ loading={isCreatingPr}
+ disabledReason={aiConsentDisabledReason ?? undefined}
+ sideIcon={<KeyboardShortcut c />}
+ data-attr="inbox-triage-create-pr"
+ >
+ Create PR
+ </LemonButton>
+ )}
+ <div className="flex-1" />
+ <LemonButton
+ type="tertiary"
+ size="small"
+ onClick={openCurrent}
+ sideIcon={<KeyboardShortcut o />}
+ data-attr="inbox-triage-open-report"
+ >
+ Open report
+ </LemonButton>
+ <LemonButton
+ type="tertiary"
+ size="small"
+ onClick={toggleExpanded}
+ sideIcon={<KeyboardShortcut enter />}
+ data-attr="inbox-triage-toggle-summary"
+ >
+ {expanded ? 'Collapse' : 'Read summary'}
+ </LemonButton>
+ </div>
+ </article>
+ )
+}
+
+/**
+ * Triage mode, at `/inbox/reports/triage`: the Needs-a-decision queue one report at a time, with the
+ * previous and next reports peeking above and below. Every action has a key, and the hint bar at the
+ * bottom lists them.
+ */
+export function InboxTriageView(): JSX.Element {
+ const {
+ reports,
+ isLoaded,
+ isRestoringPosition,
+ reportsLoadFailed,
+ currentReport,
+ previousReport,
+ nextReport,
+ expanded,
+ counter,
+ } = useValues(inboxTriageLogic)
+ const { navigate, toggleExpanded, setExpanded, archiveCurrent, createPrForCurrent, openCurrent, ensureLoaded } =
+ useActions(inboxTriageLogic)
+
+ useKeyboardHotkeys(
+ {
+ j: { action: outsideDialogs(() => navigate(1)) },
+ arrowdown: { action: outsideDialogs(() => navigate(1)) },
+ k: { action: outsideDialogs(() => navigate(-1)) },
+ arrowup: { action: outsideDialogs(() => navigate(-1)) },
+ enter: {
+ action: (event) => {
+ const intent = triageEnterIntent(event.target as HTMLElement | null, event.metaKey || event.ctrlKey)
+ if (intent === 'passthrough') {
+ return
+ }
+ event.preventDefault()
+ if (intent === 'open') {
+ openCurrent()
+ } else {
+ toggleExpanded()
+ }
+ },
+ willHandleEvent: true,
+ },
+ e: { action: outsideDialogs(() => toggleExpanded()) },
+ o: { action: outsideDialogs(() => openCurrent()) },
+ a: { action: outsideDialogs(() => archiveCurrent()) },
+ c: { action: outsideDialogs(() => createPrForCurrent()) },
+ escape: {
+ // Escape peels back one layer: the expanded summary, then triage mode itself.
+ action: outsideDialogs(() => {
+ if (expanded) {
+ setExpanded(false)
+ } else {
+ router.actions.push(urls.inbox('reports'))
+ }
+ }),
+ },
+ },
+ [expanded, navigate, toggleExpanded, setExpanded, archiveCurrent, createPrForCurrent, openCurrent]
+ )
+
+ // Once per open, when the queue has settled, so the panel shows up next to the other
+ // list-replacing surfaces with how much there was to triage.
+ const viewedFiredRef = useRef(false)
+ useEffect(() => {
+ if (isLoaded && !viewedFiredRef.current) {
+ viewedFiredRef.current = true
+ captureInboxPanelViewed({ panel: 'triage', itemCount: reports.length })
+ }
+ }, [isLoaded, reports.length])
+
+ return (
+ // The card is centered in whatever height the scene gives; the 70vh floor keeps it centered
+ // on a page that doesn't stretch its scene (Storybook, an embedded frame) instead of
+ // collapsing to the top.
+ <div className="-mt-2 flex min-h-[70vh] flex-1 flex-col overflow-hidden">
+ <div className="flex items-center justify-between gap-2 px-4">
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<IconArrowLeft />}
+ to={urls.inbox('reports')}
+ className="-ml-2"
+ data-attr="inbox-triage-back"
+ >
+ Reports
+ </LemonButton>
+ <Tooltip title="Your place in the reports that need a pull request">
+ <span className="text-xs text-tertiary tabular-nums">{counter}</span>
+ </Tooltip>
+ </div>
+
+ <main className="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 py-4">
+ {!isLoaded && reportsLoadFailed ? (
+ // The first load failed: kea loaders keep the response null, so `isLoaded` never
+ // flips and the skeleton would otherwise spin forever. Offer a retry instead.
+ <div className="flex flex-col items-center gap-2 text-center">
+ <h3 className="m-0 text-base font-semibold">Couldn't load your reports.</h3>
+ <LemonButton
+ type="secondary"
+ size="small"
+ onClick={() => ensureLoaded()}
+ data-attr="inbox-triage-retry"
+ >
+ Retry
+ </LemonButton>
+ </div>
+ ) : !isLoaded || isRestoringPosition ? (
+ <div className="flex w-full max-w-3xl flex-col gap-3" aria-hidden>
+ <LemonSkeleton className="h-8 w-full max-w-2xl self-center rounded" />
+ <LemonSkeleton className="h-48 w-full rounded-lg" />
+ <LemonSkeleton className="h-8 w-full max-w-2xl self-center rounded" />
+ </div>
+ ) : !currentReport ? (
+ <div className="flex flex-col items-center gap-2 text-center">
+ <h3 className="m-0 text-base font-semibold">Inbox zero. Nice.</h3>
+ <p className="m-0 text-sm text-tertiary">
+ Nothing needs a decision right now. The hedgehogs are still out sniffing for more.
+ </p>
+ <LemonButton type="secondary" size="small" to={urls.inbox('reports')}>
+ Back to reports
+ </LemonButton>
+ </div>
+ ) : (
+ <>
+ {previousReport && (
+ <PeekStrip
+ report={previousReport}
+ shortcut={<KeyboardShortcut arrowup />}
+ onClick={() => navigate(-1)}
+ dataAttr="inbox-triage-peek-previous"
+ />
+ )}
+ <TriageCard report={currentReport} expanded={expanded} />
+ {nextReport && (
+ <PeekStrip
+ report={nextReport}
+ shortcut={<KeyboardShortcut arrowdown />}
+ onClick={() => navigate(1)}
+ dataAttr="inbox-triage-peek-next"
+ />
+ )}
+ </>
+ )}
+ </main>
+
+ <footer className="flex flex-none flex-wrap items-center justify-center gap-x-4 gap-y-1 border-t border-primary px-4 py-1.5 text-xxs text-tertiary">
+ <HintBarItem shortcut={<KeyboardShortcut arrowdown />} label="next" />
+ <HintBarItem shortcut={<KeyboardShortcut arrowup />} label="previous" />
+ <HintBarItem shortcut={<KeyboardShortcut command enter />} label="open report" />
+ <HintBarItem shortcut={<KeyboardShortcut escape />} label="back" />
+ </footer>
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/useReportImpressions.ts b/products/signals/frontend/inbox/components/useReportImpressions.ts
new file mode 100644
index 000000000000..73b0ca4c762b
--- /dev/null
+++ b/products/signals/frontend/inbox/components/useReportImpressions.ts
@@ -0,0 +1,70 @@
+import { useValues } from 'kea'
+import { useEffect, useRef } from 'react'
+
+import { captureInboxReportsImpressed } from '../inboxAnalytics'
+import { inboxSceneLogic } from '../inboxSceneLogic'
+import { reportListLogic } from '../logics/reportListLogic'
+import { InboxReportSectionKey } from '../types'
+
+/**
+ * Impression log for ranking-model training: record each report the first time it is actually on
+ * screen in this section, with its rank at that moment. A collapsed section impresses nothing.
+ * Deduped per section mount so re-renders and detail-pane round-trips don't refire.
+ */
+export function useReportImpressions(sectionKey: InboxReportSectionKey, isOpen: boolean): void {
+ const { visibleReports, totalCount, isLoaded, loadedQueryKey, loadedContext } = useValues(reportListLogic)
+ // The list stays mounted (hidden) while a report/scout detail is open, so gate impressions on the
+ // list actually being the visible surface.
+ const { selectedReportId, selectedScoutSkillName, isScratchpadOpen, isFindingsOpen, isRunsOpen, isTriageOpen } =
+ useValues(inboxSceneLogic)
+ const listVisible =
+ !selectedReportId &&
+ !selectedScoutSkillName &&
+ !isScratchpadOpen &&
+ !isFindingsOpen &&
+ !isRunsOpen &&
+ !isTriageOpen
+
+ const impressedIdsRef = useRef(new Set<string>())
+ // Dedupe is per query: a sort/search/filter/scope change is a new ranking context, so a report
+ // re-shown under the new query must impress again (at its new rank) for its later open/action
+ // events to have a matching impression.
+ const impressionQueryKeyRef = useRef('')
+ useEffect(() => {
+ // totalCount, loadedQueryKey, and loadedContext come from the same response as the rows (not
+ // the live filter state or the separately-loaded header count), so impressions can't be
+ // stamped with a stale total or with scope/filter context the user switched to after the
+ // request went out, and rows from the previous query are never attributed to the new one
+ // while its refetch is still in flight.
+ if (
+ !isOpen ||
+ !listVisible ||
+ !isLoaded ||
+ totalCount === null ||
+ loadedQueryKey === null ||
+ loadedContext === null
+ ) {
+ return
+ }
+ if (loadedQueryKey !== impressionQueryKeyRef.current) {
+ impressionQueryKeyRef.current = loadedQueryKey
+ impressedIdsRef.current = new Set<string>()
+ }
+ const fresh = visibleReports
+ .map((report, index) => ({ report, rank: index + 1 }))
+ .filter(({ report }) => !impressedIdsRef.current.has(report.id))
+ if (fresh.length === 0) {
+ return
+ }
+ fresh.forEach(({ report }) => impressedIdsRef.current.add(report.id))
+ captureInboxReportsImpressed({
+ tab: sectionKey,
+ reports: fresh.map(({ report }) => report),
+ ranks: fresh.map(({ rank }) => rank),
+ listSize: visibleReports.length,
+ totalCount,
+ hasActiveFilters: loadedContext.hasActiveFilters,
+ scope: loadedContext.scope,
+ })
+ }, [isOpen, listVisible, isLoaded, totalCount, visibleReports, sectionKey, loadedQueryKey, loadedContext])
+}
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index 308065c9b342..d97e2c993a8b 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -3,7 +3,13 @@ import type { CaptureOptions } from 'posthog-js'
import { dayjs } from 'lib/dayjs'
-import { SignalReport, SignalReportActionability, SignalReportPriority, SignalRunKind } from './types'
+import {
+ InboxReportSectionKey,
+ SignalReport,
+ SignalReportActionability,
+ SignalReportPriority,
+ SignalRunKind,
+} from './types'
/**
* Inbox telemetry. Mirrors the desktop "Code" app's inbox analytics (event names + property
@@ -24,6 +30,7 @@ export const INBOX_EVENTS = {
QUERY_CHANGED: 'Inbox query changed',
REPORTS_IMPRESSED: 'Inbox reports impressed',
REPORT_OPENED: 'Inbox report opened',
+ SECTION_TOGGLED: 'Inbox section toggled',
REPORT_CLOSED: 'Inbox report closed',
REPORT_SCROLLED: 'Inbox report scrolled',
REPORT_ACTION: 'Inbox report action',
@@ -49,10 +56,10 @@ export const INBOX_EVENTS = {
type InboxEvent = (typeof INBOX_EVENTS)[keyof typeof INBOX_EVENTS]
/** Action surface an `Inbox report action` fired from. */
-export type InboxReportActionSurface = 'detail_pane' | 'detail_footer' | 'list_row' | 'bulk_bar'
+export type InboxReportActionSurface = 'detail_pane' | 'detail_footer' | 'list_row' | 'bulk_bar' | 'triage_mode'
-/** How a report detail was opened. */
-export type InboxReportOpenMethod = 'click' | 'deeplink' | 'unknown'
+/** How a report detail was opened. `triage` is the open-report shortcut in triage mode. */
+export type InboxReportOpenMethod = 'click' | 'deeplink' | 'triage' | 'unknown'
/**
* How a report detail was closed. `page_unload` is a tab close or hard page navigation: the scene
@@ -66,7 +73,8 @@ export type InboxReportFeedbackSentiment = 'positive' | 'negative'
/**
* Report actions cloud actually emits. Names match the desktop enum one-for-one (so the
* `action_type` breakdown reads the same across clients), plus cloud-only `restore` (Archive tab),
- * `view_diff`, and the section expand/collapse pair (desktop splits those per section instead).
+ * `view_diff`, `show_more` (a list section widening its window), and the section expand/collapse
+ * pair (desktop splits those per section instead).
* Desktop-only variants we don't fire yet are intentionally omitted.
*/
export type InboxReportActionType =
@@ -77,6 +85,7 @@ export type InboxReportActionType =
| 'refund'
| 'open_pr'
| 'view_diff'
+ | 'show_more'
| 'expand_section'
| 'collapse_section'
| 'add_suggested_reviewer'
@@ -113,8 +122,11 @@ export function discussQuestionProperties(params: {
*/
export type InboxReportActionOutcome = 'success' | 'failure' | 'blocked' | 'limited'
-/** Panels that replace the report list and so never fire `Inbox viewed`. */
-export type InboxPanelName = 'runs' | 'config' | 'scratchpad' | 'findings'
+/**
+ * Panels that replace the report list and so never fire `Inbox viewed`. `config` is the Settings
+ * tab; the value predates the rename and stays so the panel breakdown reads continuously.
+ */
+export type InboxPanelName = 'runs' | 'config' | 'scratchpad' | 'findings' | 'triage'
/** Which control moved the report list to a new query. `url` is a shared/deep link being applied. */
export type InboxQueryChange = 'scope' | 'sort' | 'source_product' | 'scout' | 'priority' | 'search' | 'clear' | 'url'
@@ -172,6 +184,7 @@ interface BaseReportProperties {
report_age_hours: number
priority: SignalReportPriority | null
actionability: SignalReportActionability | null
+ has_pr: boolean
}
/**
@@ -186,6 +199,7 @@ function baseReportProperties(report: SignalReport): BaseReportProperties {
report_age_hours: reportAgeHours(report),
priority: report.priority ?? null,
actionability: report.actionability ?? null,
+ has_pr: !!report.implementation_pr_url,
}
}
@@ -338,12 +352,18 @@ export function captureInboxReportsImpressed(params: {
})
}
+/**
+ * `section` is the Reports list section the row was opened from, so "opened from Resolved" and
+ * "opened from Needs decision" are one breakdown. Null when the report isn't in a loaded list
+ * (a cold deep-link), in which case `rank` and `list_size` are null too.
+ */
export function captureInboxReportOpened(params: {
report: SignalReport
openMethod: InboxReportOpenMethod
previousReportId: string | null
rank: number | null
listSize: number | null
+ section: InboxReportSectionKey | null
}): void {
captureInboxEvent(INBOX_EVENTS.REPORT_OPENED, {
...baseReportProperties(params.report),
@@ -353,6 +373,19 @@ export function captureInboxReportOpened(params: {
previous_report_id: params.previousReportId,
rank: params.rank,
list_size: params.listSize,
+ section: params.section,
+ })
+}
+
+/**
+ * A Reports list section was expanded or collapsed. Resolved and Not actionable start collapsed,
+ * so without this a reader who scrolls down to the resolved work is invisible until a card in it
+ * impresses. Cloud-only: the desktop app has no collapsible sections.
+ */
+export function captureInboxSectionToggled(params: { section: InboxReportSectionKey; isOpen: boolean }): void {
+ captureInboxEvent(INBOX_EVENTS.SECTION_TOGGLED, {
+ section: params.section,
+ is_open: params.isOpen,
})
}
@@ -407,7 +440,7 @@ export function captureInboxReportAction(params: {
}): void {
const base = params.report
? baseReportProperties(params.report)
- : { report_id: null, report_age_hours: 0, priority: null, actionability: null }
+ : { report_id: null, report_age_hours: 0, priority: null, actionability: null, has_pr: false }
captureInboxEvent(INBOX_EVENTS.REPORT_ACTION, {
...base,
action_type: params.actionType,
@@ -535,9 +568,9 @@ export function captureInboxReportActionCompleted(params: {
}
/**
- * A surface that replaces the report list (Runs, Configuration, and the two scout panels). None of
- * them render `InboxReportList`, so without this they're invisible — `Inbox viewed` only ever fires
- * for the flat report tabs.
+ * A surface that replaces the report list (Runs, Settings, triage mode, and the two scout panels).
+ * None of them render the Reports sections, so without this they're invisible — `Inbox viewed` only
+ * ever fires for the report views.
*/
export function captureInboxPanelViewed(params: { panel: InboxPanelName; itemCount?: number | null }): void {
captureInboxEvent(INBOX_EVENTS.PANEL_VIEWED, {
diff --git a/products/signals/frontend/inbox/inboxSceneLogic.test.ts b/products/signals/frontend/inbox/inboxSceneLogic.test.ts
index 912395df1528..d8a2b384e2ca 100644
--- a/products/signals/frontend/inbox/inboxSceneLogic.test.ts
+++ b/products/signals/frontend/inbox/inboxSceneLogic.test.ts
@@ -1,7 +1,18 @@
+import { combineUrl, router } from 'kea-router'
+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */
+import { expectLogic } from 'kea-test-utils'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { urls } from 'scenes/urls'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
import { OriginProduct, Task, TaskRun, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'
import { RuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'
-import { mergeSignalRuns } from './inboxSceneLogic'
+import { inboxSceneLogic, mergeSignalRuns } from './inboxSceneLogic'
import { SignalScoutRunSummary } from './types'
function scoutRun(overrides: Partial<SignalScoutRunSummary> = {}): SignalScoutRunSummary {
@@ -93,3 +104,173 @@ describe('mergeSignalRuns', () => {
expect(row).toMatchObject({ status: 'in_progress', created_at: '2026-06-11T12:00:00Z' })
})
})
+
+// Slack links, bookmarks, and other products carry `/inbox/<tab>` segments from either layout, so
+// each layout has to land the other's segments on its own surface instead of dropping them.
+describe('inboxSceneLogic routing', () => {
+ let logic: ReturnType<typeof inboxSceneLogic.build>
+
+ beforeEach(() => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ '/api/projects/:team_id/signals/reports/': { results: [], count: 0, next: null, previous: null },
+ '/api/projects/:team_id/signals/source_configs/': { results: [] },
+ '/api/projects/:team_id/signals/scout/configs/': [],
+ },
+ })
+ initKeaTests()
+ featureFlagLogic.mount()
+ })
+
+ afterEach(() => logic?.unmount())
+
+ function mountWithRedesign(enabled: boolean): void {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: enabled,
+ })
+ logic = inboxSceneLogic()
+ logic.mount()
+ }
+
+ it.each<[string, string, string]>([
+ ['/inbox/pulls', urls.inbox('reports'), 'reports'],
+ ['/inbox/archived', urls.inbox('reports'), 'reports'],
+ ['/inbox/config', urls.inbox('settings'), 'settings'],
+ ['/inbox/runs', urls.inboxRuns(), 'scouts'],
+ ['/inbox/pulls/report-1', urls.inboxReport('reports', 'report-1'), 'reports'],
+ ])('under the redesign %s lands on %s', (path, expectedPath, expectedTab) => {
+ mountWithRedesign(true)
+ router.actions.push(path)
+ expect(router.values.location.pathname.endsWith(expectedPath)).toBe(true)
+ expect(logic.values.activeTab).toBe(expectedTab)
+ })
+
+ it.each<[string, string, string]>([
+ ['/inbox/settings', urls.inbox('config'), 'config'],
+ ['/inbox/scouts/runs', urls.inbox('runs'), 'runs'],
+ ['/inbox/reports/triage', urls.inbox('reports'), 'reports'],
+ ['/inbox/pulls', urls.inbox('pulls'), 'pulls'],
+ ['/inbox/pulls/report-1', urls.inboxReport('pulls', 'report-1'), 'pulls'],
+ ])('with the flag off %s lands on %s', (path, expectedPath, expectedTab) => {
+ mountWithRedesign(false)
+ router.actions.push(path)
+ expect(router.values.location.pathname.endsWith(expectedPath)).toBe(true)
+ expect(logic.values.activeTab).toBe(expectedTab)
+ })
+
+ it.each([
+ [true, 'reports'],
+ [false, 'pulls'],
+ ])('with the redesign flag %p a bare /inbox lands on the %s tab', (enabled, expectedTab) => {
+ mountWithRedesign(enabled)
+ router.actions.push(urls.inbox())
+ expect(logic.values.activeTab).toBe(expectedTab)
+ })
+
+ // A flag that flips mid-session leaves the URL addressed to the other layout. The current URL is
+ // routed again for the new layout, so its surface opens rather than a tab body that renders nothing.
+ it.each<[boolean, string, string, string]>([
+ [false, '/inbox/runs', urls.inboxRuns(), 'scouts'],
+ [true, '/inbox/settings', urls.inbox('config'), 'config'],
+ ])('a mid-session flag flip (from redesign=%p) re-routes %s to %s', (initial, path, expectedPath, expectedTab) => {
+ mountWithRedesign(initial)
+ router.actions.push(path)
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: !initial,
+ })
+ expect(router.values.location.pathname.endsWith(expectedPath)).toBe(true)
+ expect(logic.values.activeTab).toBe(expectedTab)
+ })
+
+ function mountBeforeFlagsResolve(persistedRedesign: boolean): void {
+ // `featureFlags` persists through kea-localstorage, so a cold load routes against the value the
+ // last visit stored until PostHog answers. Seed that value and leave `receivedFeatureFlags` false.
+ window.localStorage.setItem(
+ 'lib.logic.featureFlagLogic.featureFlags',
+ JSON.stringify({ [FEATURE_FLAGS.INBOX_REDESIGN]: persistedRedesign })
+ )
+ initKeaTests()
+ featureFlagLogic.mount()
+ logic = inboxSceneLogic()
+ logic.mount()
+ }
+
+ // On a cold load the route handlers run before PostHog returns flags. A layout redirect issued then
+ // would erase the surface the URL names, so the URL is held and routed again once flags land.
+ it.each<[string, boolean, string, (values: typeof logic.values) => boolean]>([
+ ['/inbox/reports/triage', true, urls.inboxTriage(), (values) => values.isTriageOpen],
+ ['/inbox/scouts/runs', true, urls.inboxRuns(), (values) => values.isRunsOpen],
+ ['/inbox/pulls', true, urls.inbox('reports'), (values) => values.activeTab === 'reports'],
+ ['/inbox/settings', false, urls.inbox('config'), (values) => values.activeTab === 'config'],
+ ])('before flags resolve %s is held, then routed for redesign=%p to %s', (path, redesign, expectedPath, opened) => {
+ mountBeforeFlagsResolve(!redesign)
+ router.actions.push(path)
+ expect(router.values.location.pathname.endsWith(path)).toBe(true)
+ expect(opened(logic.values)).toBe(false)
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: redesign,
+ })
+ expect(router.values.location.pathname.endsWith(expectedPath)).toBe(true)
+ expect(opened(logic.values)).toBe(true)
+ })
+
+ // A held report deep-link still opens the report under the persisted layout, so the page is not
+ // empty while flags load; the replay only settles the tab once the layout is known.
+ it('before flags resolve /inbox/pulls/<id> opens the report and lands on Reports once the redesign resolves', () => {
+ mountBeforeFlagsResolve(true)
+ router.actions.push('/inbox/pulls/report-1')
+ expect(logic.values.selectedReportId).toBe('report-1')
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,
+ })
+ expect(router.values.location.pathname.endsWith(urls.inboxReport('reports', 'report-1'))).toBe(true)
+ expect(logic.values.selectedReportId).toBe('report-1')
+ expect(logic.values.activeTab).toBe('reports')
+ })
+
+ // The triage card's "Full report" link opens the report by URL (with a triage `back`), not through
+ // `openCurrent`, so the open-method must be recovered from that `back` or triage opens split between
+ // the `triage` and `click` analytics values.
+ it.each<[string, boolean, string]>([
+ ['a triage back link records the triage open method', true, 'triage'],
+ ['a plain report deep-link is not attributed to triage', false, 'deeplink'],
+ ])('%s', async (_name, withTriageBack, expectedMethod) => {
+ mountWithRedesign(true)
+ const url = withTriageBack
+ ? combineUrl(urls.inboxReport('reports', 'r1'), {
+ back: combineUrl(urls.inboxTriage(), { report: 'r1', at: 0 }).url,
+ }).url
+ : urls.inboxReport('reports', 'r1')
+
+ let openMethod: string | undefined
+ await expectLogic(logic, () => router.actions.push(url)).toDispatchActions([
+ (action: any) => {
+ if (action.type !== logic.actionTypes.setSelectedReportId) {
+ return false
+ }
+ openMethod = action.payload.openMethod
+ return true
+ },
+ ])
+ expect(openMethod).toBe(expectedMethod)
+ })
+
+ it('stops the runs poll when opening another surface closes the panel', () => {
+ // Opening a report flips `isRunsOpen` false through a mutual-exclusion reducer, not
+ // `setRunsOpen(false)`, so the poll teardown cannot hang off the `setRunsOpen` listener alone
+ // or it leaks two requests every few seconds for the rest of the visit.
+ mountWithRedesign(true)
+ const clearSpy = jest.spyOn(global, 'clearInterval')
+
+ logic.actions.setRunsOpen(true)
+ const clearedBeforeReport = clearSpy.mock.calls.length
+
+ logic.actions.setSelectedReportId('report-1')
+
+ expect(logic.values.isRunsOpen).toBe(false)
+ expect(clearSpy.mock.calls.length).toBeGreaterThan(clearedBeforeReport)
+
+ clearSpy.mockRestore()
+ })
+})
diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.ts
index ef8611129bfb..ab14a4df9d5a 100644
--- a/products/signals/frontend/inbox/inboxSceneLogic.ts
+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts
@@ -1,12 +1,16 @@
import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
+import { subscriptions } from 'kea-subscriptions'
import type { CaptureOptions } from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
import api from 'lib/api'
import { ApiError } from 'lib/api-error'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { reconcileById } from 'lib/utils/objects'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
@@ -28,23 +32,26 @@ import {
InboxReportOpenMethod,
} from './inboxAnalytics'
import { inboxFiltersLogic } from './logics/inboxFiltersLogic'
-import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from './logics/reportListLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './logics/reportListLogic'
import type { ScoutCreateInitialValues } from './logics/scoutCreateModalLogic'
import { scratchpadLogic } from './logics/scratchpadLogic'
import { signalSourcesLogic } from './signalSourcesLogic'
import {
- InboxFlatListTabKey,
+ INBOX_LEGACY_TAB_KEYS,
INBOX_STAFF_ONLY_TAB_KEYS,
INBOX_TAB_KEYS,
+ InboxReportSectionKey,
InboxTabKey,
SignalReport,
SignalRun,
SignalScoutRunStatus,
SignalScoutRunSummary,
} from './types'
+import { isInboxRedesignEnabled } from './utils/inboxRedesign'
+import { inboxTabRedirectPath } from './utils/inboxReportUrls'
import { decodeScoutCreateTemplate } from './utils/scoutTemplateDeepLink'
-// Newest-first scout runs to pull for the Runs tab. The scout-runs endpoint caps at 100 server-side.
+// Newest-first scout runs to pull for the Runs panel. The scout-runs endpoint caps at 100 server-side.
const SCOUT_RUNS_LIMIT = 100
// Signal-pipeline tasks to pull. Bounded symmetrically with the scout side (the tasks endpoint caps
@@ -70,7 +77,7 @@ function consumeScoutTemplateHash(
}
}
-// How often the Runs tab refetches while it's open, so live runs update in place.
+// How often the Runs panel refetches while it's open, so live runs update in place.
const RUNS_POLL_INTERVAL_MS = 5000
// `TaskRunStatus` and `SignalScoutRunStatus` enumerate the same run states. This `Record` keyed on the
@@ -86,7 +93,7 @@ const TASK_RUN_STATUS_TO_SCOUT_STATUS: Record<TaskRunStatus, SignalScoutRunStatu
}
/**
- * Merge the Runs tab's two sources — scout runs and signal-pipeline tasks — into one newest-first
+ * Merge the Runs panel's two sources — scout runs and signal-pipeline tasks — into one newest-first
* `SignalRun[]`. Pure (no I/O) so the merge/sort/normalize contract is unit-testable directly.
* Scout runs without a backing `task_id` are dropped (they can't deep-link to a task); signal rows
* fall back to the task's own timestamp / a null status when no run exists yet.
@@ -127,8 +134,10 @@ export function mergeSignalRuns(scoutRuns: SignalScoutRunSummary[], signalTasks:
)
}
-function isInboxTabKey(value: string | undefined): value is InboxTabKey {
- return value !== undefined && (INBOX_TAB_KEYS as string[]).includes(value)
+/** Whether a URL segment is one of the current layout's page tabs. */
+function isInboxTabKey(value: string | undefined, redesign: boolean): value is InboxTabKey {
+ const tabKeys = (redesign ? INBOX_TAB_KEYS : INBOX_LEGACY_TAB_KEYS) as string[]
+ return value !== undefined && tabKeys.includes(value)
}
function isStaffOnlyTab(tab: string | undefined): boolean {
@@ -136,7 +145,7 @@ function isStaffOnlyTab(tab: string | undefined): boolean {
}
/**
- * Find a report already loaded in one of the mounted per-tab lists, so opening it can render the
+ * Find a report already loaded in one of the mounted per-view lists, so opening it can render the
* detail instantly from the list row instead of waiting on a fresh
* `GET`. The background fetch still runs to converge on the authoritative record.
*/
@@ -151,8 +160,11 @@ function clearScratchpadSearch(): void {
}
function findLoadedReport(id: string): SignalReport | null {
- for (const tabKey of Object.keys(INBOX_FLAT_TAB_LIST_PARAMS) as InboxFlatListTabKey[]) {
- const mounted = reportListLogic.findMounted({ tabKey, listParams: INBOX_FLAT_TAB_LIST_PARAMS[tabKey] })
+ for (const sectionKey of Object.keys(INBOX_REPORT_SECTION_LIST_PARAMS) as InboxReportSectionKey[]) {
+ const mounted = reportListLogic.findMounted({
+ sectionKey,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey],
+ })
const found = mounted?.values.reports.find((r: SignalReport) => r.id === id)
if (found) {
return found
@@ -163,26 +175,34 @@ function findLoadedReport(id: string): SignalReport | null {
/**
* Position (1-based) and size of the report's list, for `Inbox report opened`. Searches the mounted
- * flat-tab lists for the report. Null when the report isn't in a loaded list (e.g. a cold deep-link).
+ * per-section lists for the report. Null when the report isn't in a loaded list (e.g. a cold deep-link).
*/
-function findReportRank(id: string): { rank: number | null; listSize: number | null } {
- for (const tabKey of Object.keys(INBOX_FLAT_TAB_LIST_PARAMS) as InboxFlatListTabKey[]) {
- const mounted = reportListLogic.findMounted({ tabKey, listParams: INBOX_FLAT_TAB_LIST_PARAMS[tabKey] })
+function findReportRank(id: string): {
+ rank: number | null
+ listSize: number | null
+ section: InboxReportSectionKey | null
+} {
+ for (const sectionKey of Object.keys(INBOX_REPORT_SECTION_LIST_PARAMS) as InboxReportSectionKey[]) {
+ const mounted = reportListLogic.findMounted({
+ sectionKey,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey],
+ })
const reports = mounted?.values.reports
if (!reports) {
continue
}
const idx = reports.findIndex((r: SignalReport) => r.id === id)
if (idx >= 0) {
- return { rank: idx + 1, listSize: reports.length }
+ return { rank: idx + 1, listSize: reports.length, section: sectionKey }
}
}
- return { rank: null, listSize: null }
+ return { rank: null, listSize: null, section: null }
}
/**
- * The URL for whichever full-width inbox surface is open, or the list otherwise. The four (report,
- * scout detail, scratchpad, findings) are mutually exclusive, so a fixed priority order resolves them.
+ * The URL for whichever full-width inbox surface is open, or the list otherwise. The surfaces
+ * (report, scout detail, scratchpad, findings, runs, triage) are mutually exclusive, so a fixed
+ * priority order resolves them.
*/
function inboxSurfaceUrl(values: {
selectedReportId: string | null
@@ -191,9 +211,14 @@ function inboxSurfaceUrl(values: {
selectedScoutFindingId: string | null
isScratchpadOpen: boolean
isFindingsOpen: boolean
+ isRunsOpen: boolean
+ isTriageOpen: boolean
+ isRedesign: boolean
}): string {
if (values.selectedReportId) {
- return urls.inboxReport(values.activeTab, values.selectedReportId)
+ // Under the redesign every report lives in the one Reports list; the legacy layout keeps the
+ // report under the tab that listed it, so its back control returns there.
+ return urls.inboxReport(values.isRedesign ? 'reports' : values.activeTab, values.selectedReportId)
}
if (values.selectedScoutSkillName) {
return urls.inboxScout(values.selectedScoutSkillName, values.selectedScoutFindingId ?? undefined)
@@ -204,6 +229,12 @@ function inboxSurfaceUrl(values: {
if (values.isFindingsOpen) {
return urls.inboxFindings()
}
+ if (values.isRunsOpen) {
+ return urls.inboxRuns()
+ }
+ if (values.isTriageOpen) {
+ return urls.inboxTriage()
+ }
return urls.inbox(values.activeTab)
}
@@ -233,14 +264,34 @@ function flushOpenReport(
cache.openTracking = undefined
}
+/**
+ * Run the current inbox URL through `urlToAction` again. A `replace` to the unchanged URL still
+ * dispatches `locationChanged`, and the scene logic treats an unchanged scene and params as no
+ * navigation, so only the route handlers run.
+ */
+function replayInboxLocation(): void {
+ const { pathname, search, hash } = router.values.location
+ const path = removeProjectIdIfPresent(pathname)
+ if (path !== urls.inbox() && !path.startsWith(`${urls.inbox()}/`)) {
+ return
+ }
+ router.actions.replace(pathname + search + hash)
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ receivedFeatureFlags: boolean // featureFlagLogic
user: UserType | null // userLogic
activeTab: InboxTabKey
+ activeTabState: InboxTabKey | null
breadcrumbs: Breadcrumb[]
isFindingsOpen: boolean
+ isRedesign: boolean
+ isRunsOpen: boolean
isScratchpadOpen: boolean
isStaff: boolean
+ isTriageOpen: boolean
scoutTemplateDraft: ScoutCreateInitialValues | null
selectedReport: SignalReport | null
selectedReportId: string | null
@@ -257,6 +308,13 @@ export interface inboxSceneLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxSceneLogicActions {
+ setFeatureFlags: (
+ flags: string[],
+ variants: Record<string, boolean | string>
+ ) => {
+ flags: string[]
+ variants: Record<string, boolean | string>
+ } // featureFlagLogic
loadSourceConfigs: () => any // signalSourcesLogic
loadRuns: (_payload: void) => void
loadRunsFailure: (
@@ -306,6 +364,9 @@ export interface inboxSceneLogicActions {
setFindingsOpen: (open: boolean) => {
open: boolean
}
+ setRunsOpen: (open: boolean) => {
+ open: boolean
+ }
setScoutTemplateDraft: (draft: ScoutCreateInitialValues | null) => {
draft: ScoutCreateInitialValues | null
}
@@ -326,11 +387,16 @@ export interface inboxSceneLogicActions {
findingId: string | null
skillName: string | null
}
+ setTriageOpen: (open: boolean) => {
+ open: boolean
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxSceneLogicMeta {
__keaTypeGenInternalSelectorTypes: {
+ isRedesign: (featureFlags: FeatureFlagsSet) => boolean
+ activeTab: (activeTabState: InboxTabKey | null, isRedesign: boolean) => InboxTabKey
isStaff: (user: UserType | null) => boolean
signalRuns: (signalRunsResponse: SignalRun[] | null) => SignalRun[]
signalRunsLoading: (signalRunsResponse: SignalRun[] | null, signalRunsResponseLoading: boolean) => boolean
@@ -347,9 +413,10 @@ export type inboxSceneLogicType = MakeLogicType<
>
/**
- * Inbox scene orchestrator. Owns the active tab, the selected report (loaded by id),
- * the project-wide Runs list, and session-analysis. The per-tab report
- * lists + their counts live in the keyed `reportListLogic` (one instance per flat tab).
+ * Inbox scene orchestrator. Owns the active page tab (Reports / Scouts / Settings), the active
+ * Reports view, the selected report (loaded by id), the full-width surfaces that replace the list
+ * (scout detail, scratchpad, findings, runs, triage mode), and the project-wide runs list. The
+ * per-view report lists + their counts live in the keyed `reportListLogic` (one instance per view).
*/
export const inboxSceneLogic = kea<inboxSceneLogicType>([
path(['scenes', 'inbox', 'inboxSceneLogic']),
@@ -358,8 +425,8 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
// Mount inboxFiltersLogic with the scene so its URL sync (shareable filter params) applies on
// deep-link load, before the filter bar / list have rendered.
logic: [inboxFiltersLogic],
- values: [userLogic, ['user']],
- actions: [signalSourcesLogic, ['loadSourceConfigs']],
+ values: [userLogic, ['user'], featureFlagLogic, ['featureFlags', 'receivedFeatureFlags']],
+ actions: [signalSourcesLogic, ['loadSourceConfigs'], featureFlagLogic, ['setFeatureFlags']],
})),
actions({
@@ -384,6 +451,10 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
// Cross-fleet findings surface: full-width browse/search/filter of every finding the troop
// emitted recently, mutually exclusive with the other full-width views.
setFindingsOpen: (open: boolean) => ({ open }),
+ // Runs surface: the project-wide scout + signal-pipeline runs list, reached from the roster.
+ setRunsOpen: (open: boolean) => ({ open }),
+ // Triage mode: the Needs-a-decision queue one report at a time, driven from the keyboard.
+ setTriageOpen: (open: boolean) => ({ open }),
// The detail pane was scrolled. The logic fires `Inbox report scrolled` once per open; the
// component reports the raw scroll.
reportDetailScrolled: true,
@@ -392,10 +463,10 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
}),
loaders(({ values }) => ({
- // Runs tab: a newest-first list of scout + signals-pipeline runs, composed from two existing
+ // Runs panel: a newest-first list of scout + signals-pipeline runs, composed from two existing
// endpoints, scout runs (clean `skill_name`) and signal-pipeline tasks (whose title is the
// originating report's title). Merged client-side; there is no unified backend "runs" resource
- // by design. Both endpoints are team-scoped and readable by any member, so the tab is public.
+ // by design. Both endpoints are team-scoped and readable by any member, so the panel is public.
signalRunsResponse: [
null as SignalRun[] | null,
{
@@ -412,7 +483,7 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
])
breakpoint()
// Degrade gracefully: surface whichever source resolved, matching the inbox's other
- // fan-out loaders (scoutDetailLogic) so one source's outage doesn't blank the tab.
+ // fan-out loaders (scoutDetailLogic) so one source's outage doesn't blank the panel.
// Only fail the load if both sources rejected.
if (scoutResult.status === 'rejected' && signalResult.status === 'rejected') {
throw scoutResult.reason
@@ -433,7 +504,7 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
},
],
// The selected report's base record, loaded by id so detail works regardless of which
- // tab/list it came from (and on direct deep-link).
+ // view/list it came from (and on direct deep-link).
selectedReportResponse: [
null as SignalReport | null,
{
@@ -473,8 +544,9 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
setSelectedReportId: (_, { id }) => id,
},
],
- activeTab: [
- 'pulls' as InboxTabKey,
+ // Null until a route sets a tab; `activeTab` fills in the layout's landing tab.
+ activeTabState: [
+ null as InboxTabKey | null,
{
setActiveTab: (_, { tab }) => tab,
},
@@ -489,20 +561,45 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
false,
{
setScratchpadOpen: (_, { open }) => open,
- // Opening a report, a scout, or the findings view closes the memory view.
+ // Opening any other full-width surface closes the memory view.
setSelectedReportId: (state, { id }) => (id ? false : state),
setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),
setFindingsOpen: (state, { open }) => (open ? false : state),
+ setRunsOpen: (state, { open }) => (open ? false : state),
+ setTriageOpen: (state, { open }) => (open ? false : state),
},
],
isFindingsOpen: [
false,
{
setFindingsOpen: (_, { open }) => open,
- // Opening a report, a scout, or the memory view closes the findings view.
setSelectedReportId: (state, { id }) => (id ? false : state),
setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),
setScratchpadOpen: (state, { open }) => (open ? false : state),
+ setRunsOpen: (state, { open }) => (open ? false : state),
+ setTriageOpen: (state, { open }) => (open ? false : state),
+ },
+ ],
+ isRunsOpen: [
+ false,
+ {
+ setRunsOpen: (_, { open }) => open,
+ setSelectedReportId: (state, { id }) => (id ? false : state),
+ setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),
+ setScratchpadOpen: (state, { open }) => (open ? false : state),
+ setFindingsOpen: (state, { open }) => (open ? false : state),
+ setTriageOpen: (state, { open }) => (open ? false : state),
+ },
+ ],
+ isTriageOpen: [
+ false,
+ {
+ setTriageOpen: (_, { open }) => open,
+ setSelectedReportId: (state, { id }) => (id ? false : state),
+ setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),
+ setScratchpadOpen: (state, { open }) => (open ? false : state),
+ setFindingsOpen: (state, { open }) => (open ? false : state),
+ setRunsOpen: (state, { open }) => (open ? false : state),
},
],
scoutTemplateDraft: [
@@ -522,6 +619,24 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
}),
selectors({
+ isRedesign: [
+ (s) => [s.featureFlags],
+ (featureFlags: FeatureFlagsSet): boolean => isInboxRedesignEnabled(featureFlags),
+ ],
+ // The landing tab differs per layout (Reports under the redesign, Pull requests with the
+ // flag off), and a bare `/inbox` keeps whichever tab was already active. A tab set under one
+ // layout can outlive a mid-session flag flip (async flag resolution, or a bookmarked URL of
+ // the other layout). Fall back to the layout's landing tab when the active tab is not one of
+ // this layout's tabs, so the body never renders a tab the active layout has no panel for.
+ activeTab: [
+ (s) => [s.activeTabState, s.isRedesign],
+ (activeTabState: InboxTabKey | null, isRedesign: boolean): InboxTabKey =>
+ activeTabState && isInboxTabKey(activeTabState, isRedesign)
+ ? activeTabState
+ : isRedesign
+ ? 'reports'
+ : 'pulls',
+ ],
breadcrumbs: [
() => [],
(): Breadcrumb[] => [
@@ -540,8 +655,8 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
(s) => [s.signalRunsResponse],
(signalRunsResponse: SignalRun[] | null): SignalRun[] => signalRunsResponse ?? [],
],
- // True only while the first load is in flight (response still null), so the Runs tab shows a
- // skeleton instead of the empty state before any data lands. A refetch on tab re-open keeps the
+ // True only while the first load is in flight (response still null), so the Runs panel shows a
+ // skeleton instead of the empty state before any data lands. A refetch on re-open keeps the
// already-loaded list visible rather than flashing the skeleton.
signalRunsLoading: [
(s) => [s.signalRunsResponse, s.signalRunsResponseLoading],
@@ -558,12 +673,25 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
],
}),
- listeners(({ actions, values, cache }) => ({
+ listeners(({ actions, values, cache, selectors }) => ({
+ setFeatureFlags: (_, __, ___, previousState) => {
+ // Routes handled before PostHog answered ran against the flag the last visit persisted,
+ // and held their layout redirects (see `urlToAction`). Route the current URL again once
+ // the layout is known, and again on a mid-session flip, so the surface the URL names
+ // opens under the layout that renders.
+ const wasResolved = featureFlagLogic.selectors.receivedFeatureFlags(previousState)
+ if (wasResolved && selectors.isRedesign(previousState) === values.isRedesign) {
+ return
+ }
+ replayInboxLocation()
+ },
setActiveTab: ({ tab }) => {
- // While the Runs tab is open, refetch on a slow poll so live runs update in place. The
- // keyed disposable replaces any prior poll and is torn down on tab switch / unmount, and
- // kea-disposables pauses it while the browser tab is hidden. The refetch is silent (the
- // skeleton only shows before the first load), so it swaps the list without flicker.
+ // With the flag off the runs list is a tab, so its slow poll follows the tab. Under the
+ // redesign it is a panel and `setRunsOpen` owns the poll; it must not be touched here,
+ // because opening that panel also moves the tab to Scouts.
+ if (values.isRedesign) {
+ return
+ }
if (tab === 'runs') {
actions.loadRuns()
cache.disposables.add(() => {
@@ -574,6 +702,52 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
cache.disposables.dispose('runsPoll')
}
},
+ setRunsOpen: ({ open }) => {
+ // While the Runs panel is open, refetch on a slow poll so live runs update in place. The
+ // keyed disposable replaces any prior poll and is torn down on close / unmount, and
+ // kea-disposables pauses it while the browser tab is hidden. The refetch is silent (the
+ // skeleton only shows before the first load), so it swaps the list without flicker.
+ if (!open) {
+ // The `isRunsOpen` subscription owns poll teardown, so it also catches the closes that
+ // flip the panel shut through a mutual-exclusion reducer without dispatching
+ // `setRunsOpen(false)` (a report, scout, triage, scratchpad, or findings opening).
+ return
+ }
+ actions.loadRuns()
+ cache.disposables.add(() => {
+ const interval = setInterval(() => actions.loadRuns(), RUNS_POLL_INTERVAL_MS)
+ return () => clearInterval(interval)
+ }, 'runsPoll')
+ // Close the open report/scout through their own actions so report dwell-time
+ // bookkeeping runs (clearing the id in a reducer would skip the close tracking).
+ clearScratchpadSearch()
+ if (values.selectedReportId !== null) {
+ actions.setSelectedReportId(null)
+ }
+ if (values.selectedScoutSkillName !== null) {
+ actions.setSelectedScoutSkillName(null)
+ }
+ // The runs list is reached from the roster, so its Back control returns to the Scouts tab.
+ if (values.activeTab !== 'scouts') {
+ actions.setActiveTab('scouts')
+ }
+ },
+ setTriageOpen: ({ open }) => {
+ if (!open) {
+ return
+ }
+ clearScratchpadSearch()
+ if (values.selectedReportId !== null) {
+ actions.setSelectedReportId(null)
+ }
+ if (values.selectedScoutSkillName !== null) {
+ actions.setSelectedScoutSkillName(null)
+ }
+ // Triage mode triages the Reports tab's queue, so leaving it lands back on Reports.
+ if (values.activeTab !== 'reports') {
+ actions.setActiveTab('reports')
+ }
+ },
setSelectedReportId: ({ id, openMethod }) => {
// Close the previously open report (if any) before opening/clearing. `next_report` when
// switching straight to another report, `deselected` when returning to the list.
@@ -601,6 +775,12 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
if (values.selectedScoutSkillName !== null) {
actions.setSelectedScoutSkillName(null)
}
+ // Under the redesign a report page is a Reports-tab surface even when reached from a
+ // scout page, so its back button returns to the report list. With the flag off the
+ // report stays under the tab that listed it.
+ if (values.isRedesign && values.activeTab !== 'reports') {
+ actions.setActiveTab('reports')
+ }
// Reuse the list row if we already have it (instant render), then refresh from the server.
actions.seedSelectedReport(findLoadedReport(id))
actions.loadSelectedReport({ id })
@@ -614,13 +794,14 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
if (!report || values.selectedReportId !== report.id || cache.openTracking?.report.id === report.id) {
return
}
- const { rank, listSize } = findReportRank(report.id)
+ const { rank, listSize, section } = findReportRank(report.id)
captureInboxReportOpened({
report,
openMethod: (cache.pendingOpenMethod as InboxReportOpenMethod | undefined) ?? 'unknown',
previousReportId: cache.previousReportId ?? null,
rank,
listSize,
+ section,
})
cache.openTracking = { report, openedAt: Date.now(), scrolled: false }
cache.pendingOpenMethod = undefined
@@ -712,7 +893,7 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
{ pauseOnPageHidden: false }
)
},
- // The Runs list loads lazily when its tab opens (via the `setActiveTab` listener). There is no
+ // The Runs list loads lazily when its panel opens (via the `setRunsOpen` listener). There is no
// mount pre-fetch, so an inbox visit that never opens Runs doesn't pay for its two requests.
beforeUnmount: () => {
// Flush dwell time for a report still open when the scene unmounts (navigated away).
@@ -720,6 +901,19 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
},
})),
+ // The Runs poll (added in the `setRunsOpen` listener) has to stop the moment the panel closes,
+ // however it closes. Opening any other full-width surface flips `isRunsOpen` false through a
+ // mutual-exclusion reducer rather than dispatching `setRunsOpen(false)`, so this one subscription
+ // is the single teardown path that runs for every close — otherwise the poll leaks two requests
+ // every 5s for the rest of the visit.
+ subscriptions(({ cache }) => ({
+ isRunsOpen: (open: boolean) => {
+ if (!open) {
+ cache.disposables.dispose('runsPoll')
+ }
+ },
+ })),
+
actionToUrl(({ values }) => ({
// Each action resolves to whichever full-width view is left open (or the list), so clearing one
// because another opened honors that surface's URL rather than bouncing to the list — and a
@@ -730,9 +924,13 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
router.values.hashParams,
{ replace: false },
],
- setSelectedReportId: () => [
+ setSelectedReportId: ({ openMethod }) => [
inboxSurfaceUrl(values),
- router.values.searchParams,
+ // Opened from triage mode: the report page's back control returns to the spot in the
+ // queue, which the triage URL carries at this moment.
+ openMethod === 'triage'
+ ? { back: removeProjectIdIfPresent(router.values.location.pathname) + router.values.location.search }
+ : router.values.searchParams,
router.values.hashParams,
{ replace: false },
],
@@ -754,22 +952,22 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
router.values.hashParams,
{ replace: false },
],
+ setRunsOpen: () => [
+ inboxSurfaceUrl(values),
+ router.values.searchParams,
+ router.values.hashParams,
+ { replace: false },
+ ],
+ setTriageOpen: () => [
+ inboxSurfaceUrl(values),
+ router.values.searchParams,
+ router.values.hashParams,
+ { replace: false },
+ ],
})),
- urlToAction(({ actions, values, cache }) => ({
- [urls.inboxScratchpad()]: () => {
- if (!values.isScratchpadOpen) {
- actions.setScratchpadOpen(true)
- }
- },
- [urls.inboxFindings()]: () => {
- if (!values.isFindingsOpen) {
- actions.setFindingsOpen(true)
- }
- },
- [urls.inbox()]: (_, __, hashParams) => {
- cache.inboxListVisited = true
- consumeScoutTemplateHash(actions, hashParams)
+ urlToAction(({ actions, values, cache }) => {
+ const closeAllSurfaces = (): void => {
if (values.selectedReportId !== null) {
actions.setSelectedReportId(null)
}
@@ -782,84 +980,167 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
if (values.isFindingsOpen) {
actions.setFindingsOpen(false)
}
- },
- [urls.inbox(':tab')]: ({ tab }: { tab?: string }, _, hashParams) => {
- // A bare report deep-link `/inbox/<reportId>` redirected to report form. Mark the list as
- // visited only when we're actually staying on a list view — otherwise the redirected report
- // would be misclassified as an in-app click instead of a deep-link.
- if (tab && !isInboxTabKey(tab) && tab !== 'scouts') {
- router.actions.replace(
- urls.inboxReport('reports', tab),
- router.values.searchParams,
- router.values.hashParams
- )
- return
- }
- cache.inboxListVisited = true
- consumeScoutTemplateHash(actions, hashParams)
- // Staff-only tabs (Not actionable): bounce non-staff to the default tab.
- if (isStaffOnlyTab(tab) && userLogic.values.user != null && !values.isStaff) {
- actions.setActiveTab('pulls')
- return
- }
- if (isInboxTabKey(tab) && values.activeTab !== tab) {
- actions.setActiveTab(tab)
+ if (values.isRunsOpen) {
+ actions.setRunsOpen(false)
}
- if (values.selectedReportId !== null) {
- actions.setSelectedReportId(null)
- }
- if (values.selectedScoutSkillName !== null) {
- actions.setSelectedScoutSkillName(null)
- }
- if (values.isScratchpadOpen) {
- actions.setScratchpadOpen(false)
- }
- if (values.isFindingsOpen) {
- actions.setFindingsOpen(false)
- }
- },
- [urls.inboxScout(':skillName')]: ({ skillName }: { skillName?: string }) => {
- // `/inbox/scouts/scratchpad` and `/inbox/scouts/findings` also match this pattern; their own
- // handlers own those paths (no real scout skill_name collides — they're `signals-scout-*`).
- if (skillName === 'scratchpad' || skillName === 'findings') {
- return
- }
- const name = skillName ?? null
- // Also reset the finding when landing on the bare scout URL after a finding deep-link.
- if (values.selectedScoutSkillName !== name || values.selectedScoutFindingId !== null) {
- actions.setSelectedScoutSkillName(name)
- }
- },
- [urls.inboxScout(':skillName', ':findingId')]: ({
- skillName,
- findingId,
- }: {
- skillName?: string
- findingId?: string
- }) => {
- const name = skillName ?? null
- const finding = findingId ?? null
- if (values.selectedScoutSkillName !== name || values.selectedScoutFindingId !== finding) {
- actions.setSelectedScoutSkillName(name, finding)
- }
- },
- [urls.inboxReport(':tab', ':reportId')]: ({ tab, reportId }: { tab?: string; reportId?: string }) => {
- // This pattern also matches `/inbox/scouts/<skillName>`; the scout handler owns that path.
- if (tab === 'scouts') {
- return
- }
- if (isStaffOnlyTab(tab) && userLogic.values.user != null && !values.isStaff) {
- actions.setActiveTab('pulls')
- return
+ if (values.isTriageOpen) {
+ actions.setTriageOpen(false)
}
- if (isInboxTabKey(tab) && values.activeTab !== tab) {
- actions.setActiveTab(tab)
- }
- const id = reportId ?? null
- if (values.selectedReportId !== id) {
- // First route to a report before any list URL was seen → cold deep-link; otherwise an in-app click.
- actions.setSelectedReportId(id, id ? (cache.inboxListVisited ? 'click' : 'deeplink') : 'unknown')
+ }
+ // A layout redirect rewrites the URL for the layout the flag names. On a cold load the
+ // handlers run before PostHog answers, against the flag the last visit persisted, and a
+ // redirect issued then would erase the surface the URL names before the `setFeatureFlags`
+ // listener can route it again. Hold the URL until flags land; that listener replays it.
+ const redirectForLayout = (
+ path: string,
+ searchParams: Record<string, any>,
+ hashParams: Record<string, any>
+ ): boolean => {
+ if (!values.receivedFeatureFlags) {
+ return false
}
- },
- })),
+ router.actions.replace(path, searchParams, hashParams)
+ return true
+ }
+ return {
+ [urls.inboxScratchpad()]: () => {
+ if (!values.isScratchpadOpen) {
+ actions.setScratchpadOpen(true)
+ }
+ },
+ [urls.inboxFindings()]: () => {
+ if (!values.isFindingsOpen) {
+ actions.setFindingsOpen(true)
+ }
+ },
+ [urls.inboxRuns()]: (_, searchParams, hashParams) => {
+ // With the flag off the runs list is still the Runs tab.
+ if (!values.isRedesign) {
+ redirectForLayout(urls.inbox('runs'), searchParams, hashParams)
+ return
+ }
+ if (!values.isRunsOpen) {
+ actions.setRunsOpen(true)
+ }
+ },
+ [urls.inboxTriage()]: (_, searchParams, hashParams) => {
+ // Triage mode only exists under the redesign; the queue it walks is the Reports tab.
+ if (!values.isRedesign) {
+ redirectForLayout(urls.inbox('reports'), searchParams, hashParams)
+ return
+ }
+ cache.inboxListVisited = true
+ if (!values.isTriageOpen) {
+ actions.setTriageOpen(true)
+ }
+ },
+ [urls.inbox()]: (_, __, hashParams) => {
+ cache.inboxListVisited = true
+ consumeScoutTemplateHash(actions, hashParams)
+ closeAllSurfaces()
+ },
+ [urls.inbox(':tab')]: ({ tab }: { tab?: string }, searchParams, hashParams) => {
+ // Tab segments from the other inbox layout still arrive from Slack messages, bookmarks,
+ // and a flag that flipped between visits: send them to the surface that replaced them.
+ const redirectPath = inboxTabRedirectPath(tab, values.isRedesign)
+ if (redirectPath) {
+ redirectForLayout(redirectPath, searchParams, hashParams)
+ return
+ }
+ // A bare report deep-link `/inbox/<reportId>` is redirected to report form. Mark the list
+ // as visited only when we're actually staying on a list view — otherwise the redirected
+ // report would be misclassified as an in-app click instead of a deep-link.
+ if (tab && !isInboxTabKey(tab, values.isRedesign)) {
+ router.actions.replace(urls.inboxReport('reports', tab), searchParams, hashParams)
+ return
+ }
+ cache.inboxListVisited = true
+ consumeScoutTemplateHash(actions, hashParams)
+ // Staff-only tabs (Not actionable): bounce non-staff to the default tab. Under the
+ // redesign that list is a section the Reports tab hides from non-staff instead.
+ if (!values.isRedesign && isStaffOnlyTab(tab) && userLogic.values.user != null && !values.isStaff) {
+ actions.setActiveTab('pulls')
+ return
+ }
+ if (isInboxTabKey(tab, values.isRedesign) && values.activeTab !== tab) {
+ actions.setActiveTab(tab)
+ }
+ closeAllSurfaces()
+ },
+ [urls.inboxScout(':skillName')]: ({ skillName }: { skillName?: string }) => {
+ // `/inbox/scouts/scratchpad`, `/inbox/scouts/findings`, and `/inbox/scouts/runs` also match
+ // this pattern; their own handlers own those paths (no real scout skill_name collides —
+ // they're `signals-scout-*`).
+ if (skillName === 'scratchpad' || skillName === 'findings' || skillName === 'runs') {
+ return
+ }
+ const name = skillName ?? null
+ // Also reset the finding when landing on the bare scout URL after a finding deep-link.
+ if (values.selectedScoutSkillName !== name || values.selectedScoutFindingId !== null) {
+ actions.setSelectedScoutSkillName(name)
+ }
+ },
+ [urls.inboxScout(':skillName', ':findingId')]: ({
+ skillName,
+ findingId,
+ }: {
+ skillName?: string
+ findingId?: string
+ }) => {
+ const name = skillName ?? null
+ const finding = findingId ?? null
+ if (values.selectedScoutSkillName !== name || values.selectedScoutFindingId !== finding) {
+ actions.setSelectedScoutSkillName(name, finding)
+ }
+ },
+ [urls.inboxReport(':tab', ':reportId')]: (
+ { tab, reportId }: { tab?: string; reportId?: string },
+ searchParams,
+ hashParams
+ ) => {
+ // This pattern also matches `/inbox/scouts/<skillName>` and `/inbox/reports/triage`;
+ // their own handlers own those paths.
+ if (tab === 'scouts' || (tab === 'reports' && reportId === 'triage')) {
+ return
+ }
+ if (!reportId) {
+ return
+ }
+ if (values.isRedesign) {
+ // `/inbox/pulls/<id>` and friends: the same report, now addressed through the one
+ // Reports list that replaced those tabs. While the redirect is held, open the
+ // report under this layout rather than leave the page empty until flags land.
+ if (
+ tab !== 'reports' &&
+ redirectForLayout(urls.inboxReport('reports', reportId), searchParams, hashParams)
+ ) {
+ return
+ }
+ if (values.activeTab !== 'reports') {
+ actions.setActiveTab('reports')
+ }
+ } else {
+ if (isStaffOnlyTab(tab) && userLogic.values.user != null && !values.isStaff) {
+ actions.setActiveTab('pulls')
+ return
+ }
+ if (isInboxTabKey(tab, false) && values.activeTab !== tab) {
+ actions.setActiveTab(tab)
+ }
+ }
+ if (values.selectedReportId !== reportId) {
+ // A `back` pointing at triage means the open came from the triage card's "Full
+ // report" link, which navigates by URL rather than through `openCurrent`; attribute
+ // it to triage so the metric isn't split with plain list clicks. Otherwise: a first
+ // route before any list URL was seen is a cold deep-link, else an in-app click.
+ const fromTriage =
+ typeof searchParams.back === 'string' && searchParams.back.startsWith(urls.inboxTriage())
+ actions.setSelectedReportId(
+ reportId,
+ fromTriage ? 'triage' : cache.inboxListVisited ? 'click' : 'deeplink'
+ )
+ }
+ },
+ }
+ }),
])
diff --git a/products/signals/frontend/inbox/logics/inboxDetailLayoutLogic.ts b/products/signals/frontend/inbox/logics/inboxDetailLayoutLogic.ts
new file mode 100644
index 000000000000..2aebd5cda029
--- /dev/null
+++ b/products/signals/frontend/inbox/logics/inboxDetailLayoutLogic.ts
@@ -0,0 +1,39 @@
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
+
+/** localStorage key for the evidence rail preference on the report detail (see `evidenceRailCollapsed`). */
+export const INBOX_DETAIL_RAIL_STORAGE_KEY = 'inbox-detail-evidence-rail-collapsed'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxDetailLayoutLogicValues {
+ evidenceRailCollapsed: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxDetailLayoutLogicActions {
+ toggleEvidenceRail: () => { value: true }
+}
+
+export type inboxDetailLayoutLogicType = MakeLogicType<inboxDetailLayoutLogicValues, inboxDetailLayoutLogicActions>
+
+/**
+ * Whether the report detail hides its evidence rail so the report column takes the full width.
+ * One preference for every report rather than per-report state: a reviewer who hides the rail to
+ * read diffs wants it hidden on the next report too.
+ */
+export const inboxDetailLayoutLogic = kea<inboxDetailLayoutLogicType>([
+ path(['scenes', 'inbox', 'logics', 'inboxDetailLayoutLogic']),
+
+ actions({
+ toggleEvidenceRail: true,
+ }),
+
+ reducers({
+ evidenceRailCollapsed: [
+ false as boolean,
+ { persist: true, storageKey: INBOX_DETAIL_RAIL_STORAGE_KEY },
+ {
+ toggleEvidenceRail: (state) => !state,
+ },
+ ],
+ }),
+])
diff --git a/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts b/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts
index 4844310ca76f..eec0dba24db2 100644
--- a/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts
@@ -1,14 +1,25 @@
-import { MakeLogicType, actions, afterMount, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
import api from 'lib/api'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { isUUIDLike } from 'lib/utils/guards'
import { urls } from 'scenes/urls'
import { INBOX_PRIORITY_OPTIONS, INBOX_SORT_OPTIONS, INBOX_SOURCE_OPTIONS } from '../filterOptions'
import { captureInboxQueryChanged, InboxQueryChange } from '../inboxAnalytics'
-import { INBOX_SCOPE_FOR_YOU, INBOX_TAB_KEYS, InboxScope, SignalReportPriority } from '../types'
+import {
+ INBOX_LEGACY_TAB_KEYS,
+ INBOX_PRIMARY_REPORT_SECTION_KEY,
+ INBOX_REPORT_SECTION_KEYS,
+ INBOX_SCOPE_FOR_YOU,
+ INBOX_TAB_KEYS,
+ InboxScope,
+ SignalReportPriority,
+} from '../types'
+import { isInboxRedesignEnabled } from '../utils/inboxRedesign'
/** A teammate who can be scoped to / suggested as a reviewer. Matches the `available_reviewers` API row. */
export interface InboxReviewerOption {
@@ -97,15 +108,25 @@ export function parseFilterSearchParams(searchParams: Record<string, any>): Inbo
}
/**
- * The inbox tab in the current URL, or null off a tab route (the scout panels, or a bare `/inbox`).
- * Read from the router rather than connected from `inboxSceneLogic`, which already connects this
- * logic — the reverse edge would be a cycle.
+ * The list the filters apply to, for the `tab` analytics property: the Reports view from the URL's
+ * `?view=` (the landing view when absent), another page tab's key, or null off a tab route (the
+ * scout panels, or a bare `/inbox`). With the redesign flag off every tab is its own list, so the
+ * tab segment is the answer as it stands. Read from the router rather than connected from
+ * `inboxSceneLogic`, which already connects this logic — the reverse edge would be a cycle.
*/
-function currentInboxTab(): string | null {
+function currentInboxTab(redesign: boolean): string | null {
const segments = router.values.location.pathname.split('/').filter(Boolean)
const inboxIndex = segments.indexOf('inbox')
const candidate = inboxIndex === -1 ? undefined : segments[inboxIndex + 1]
- return candidate && (INBOX_TAB_KEYS as string[]).includes(candidate) ? candidate : null
+ const tabKeys = (redesign ? INBOX_TAB_KEYS : INBOX_LEGACY_TAB_KEYS) as string[]
+ if (!candidate || !tabKeys.includes(candidate)) {
+ return null
+ }
+ if (!redesign || candidate !== 'reports') {
+ return candidate
+ }
+ const view = router.values.searchParams.view
+ return (INBOX_REPORT_SECTION_KEYS as readonly string[]).includes(view) ? view : INBOX_PRIMARY_REPORT_SECTION_KEY
}
function sameSet(a: string[], b: string[]): boolean {
@@ -174,10 +195,12 @@ export function buildSignalReportListOrdering(field: InboxSortField, direction:
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxFiltersLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
availableReviewers: InboxReviewerOption[]
availableReviewersLoading: boolean
hasActiveFilters: boolean
hasUserChosenScope: boolean
+ isRedesign: boolean
priorityFilter: SignalReportPriority[]
scope: InboxScope
scoutFilter: string[]
@@ -233,6 +256,9 @@ export interface inboxFiltersLogicActions {
setFilters: (filters: InboxFilterState) => {
filters: InboxFilterState
}
+ setPriorityFilter: (priorities: SignalReportPriority[]) => {
+ priorities: SignalReportPriority[]
+ }
setScope: (scope: InboxScope) => {
scope: InboxScope
}
@@ -266,6 +292,7 @@ export interface inboxFiltersLogicMeta {
scoutFilter: string[],
priorityFilter: SignalReportPriority[]
) => boolean
+ isRedesign: (featureFlags: FeatureFlagsSet) => boolean
}
}
@@ -294,6 +321,10 @@ export type inboxFiltersLogicType = MakeLogicType<
export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
path(['scenes', 'inbox', 'logics', 'inboxFiltersLogic']),
+ connect(() => ({
+ values: [featureFlagLogic, ['featureFlags']],
+ })),
+
actions({
setScope: (scope: InboxScope) => ({ scope }),
// Auto-select a default scope (e.g. Entire project when the user has no assigned reports)
@@ -305,6 +336,9 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
toggleScout: (scout: string) => ({ scout }),
clearScoutFilter: true,
togglePriority: (priority: SignalReportPriority) => ({ priority }),
+ // Replace the whole selection. The priority control is a single select, but the state
+ // stays a list so a shared link carrying several priorities still filters by all of them.
+ setPriorityFilter: (priorities: SignalReportPriority[]) => ({ priorities }),
// Atomically apply a full filter set. Used when hydrating from a shared URL so the whole view
// is restored in one action — one list refresh, no fan-out race between partial states.
setFilters: (filters: InboxFilterState) => ({ filters }),
@@ -332,7 +366,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
const captureQueryChange = (change: InboxQueryChange): void =>
captureInboxQueryChanged({
change,
- tab: currentInboxTab(),
+ tab: currentInboxTab(values.isRedesign),
scope: values.scope,
sortField: values.sortField,
sortDirection: values.sortDirection,
@@ -356,6 +390,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
toggleScout: () => captureQueryChange('scout'),
clearScoutFilter: () => captureQueryChange('scout'),
togglePriority: () => captureQueryChange('priority'),
+ setPriorityFilter: () => captureQueryChange('priority'),
clearFilters: () => captureQueryChange('clear'),
setFilters: () => captureQueryChange('url'),
// The search box fires per keystroke; settle first so a typed phrase is one event.
@@ -442,6 +477,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
{
togglePriority: (state, { priority }) =>
state.includes(priority) ? state.filter((p) => p !== priority) : [...state, priority],
+ setPriorityFilter: (_, { priorities }) => priorities,
setFilters: (_, { filters }) => filters.priorityFilter,
clearFilters: () => [],
},
@@ -464,6 +500,10 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
scoutFilter.length > 0 ||
priorityFilter.length > 0,
],
+ isRedesign: [
+ (s) => [s.featureFlags],
+ (featureFlags: FeatureFlagsSet): boolean => isInboxRedesignEnabled(featureFlags),
+ ],
}),
actionToUrl(({ values }) => {
@@ -479,6 +519,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
toggleScout: toUrl,
clearScoutFilter: toUrl,
togglePriority: toUrl,
+ setPriorityFilter: toUrl,
setSearchQuery: toUrl,
clearFilters: toUrl,
}
@@ -523,6 +564,8 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([
[urls.inbox(':tab')]: applyFromUrl,
[urls.inboxScratchpad()]: applyFromUrl,
[urls.inboxFindings()]: applyFromUrl,
+ [urls.inboxRuns()]: applyFromUrl,
+ [urls.inboxTriage()]: applyFromUrl,
[urls.inboxScout(':skillName')]: applyFromUrl,
[urls.inboxScout(':skillName', ':findingId')]: applyFromUrl,
[urls.inboxReport(':tab', ':reportId')]: applyFromUrl,
diff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts
index dd218fd735c3..e7dd58721372 100644
--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts
@@ -18,7 +18,7 @@ import {
} from '../inboxAnalytics'
import { signalSourcesLogic } from '../signalSourcesLogic'
import { INBOX_CONFIG_TAB_KEY, type SignalSourceConfig } from '../types'
-import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from './reportListLogic'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './reportListLogic'
import { scoutFleetLogic } from './scoutFleetLogic'
// Spread for the mount-time wizard check. Short enough that a user arriving from onboarding gets
@@ -423,12 +423,15 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([
['sourceConfigs', 'sourceConfigsLoading', 'enabledSourcesCount', 'hasEmittingScanner'],
scoutFleetLogic,
['scoutConfigs', 'scoutConfigsLoading', 'enabledCount as enabledScoutsCount'],
- // Mount the pulls + reports count loaders directly (cheap limit=1 each) so we know
- // whether there's existing work even during a takeover, when the tab bar that usually
- // mounts these isn't rendered. Same keyed instances the tab bar uses – no double-fetch.
- reportListLogic({ tabKey: 'pulls', listParams: INBOX_FLAT_TAB_LIST_PARAMS.pulls }),
+ // Mount the monitoring + needs-decision count loaders directly (cheap limit=1 each) so we
+ // know whether there's existing work even during a takeover, when the view switcher that
+ // usually mounts these isn't rendered. Same keyed instances it uses – no double-fetch.
+ reportListLogic({ sectionKey: 'monitoring', listParams: INBOX_REPORT_SECTION_LIST_PARAMS.monitoring }),
['count as pullsCount', 'countLoading as pullsCountLoading'],
- reportListLogic({ tabKey: 'reports', listParams: INBOX_FLAT_TAB_LIST_PARAMS.reports }),
+ reportListLogic({
+ sectionKey: 'needs-decision',
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],
+ }),
['count as reportsCount', 'countLoading as reportsCountLoading'],
// Already mounted app-wide by the sync widget; connecting here just reads its verdict.
wizardActiveSessionDetectorLogic,
@@ -445,9 +448,12 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([
['loadSourceConfigs'],
scoutFleetLogic,
['loadScoutConfigs'],
- reportListLogic({ tabKey: 'pulls', listParams: INBOX_FLAT_TAB_LIST_PARAMS.pulls }),
+ reportListLogic({ sectionKey: 'monitoring', listParams: INBOX_REPORT_SECTION_LIST_PARAMS.monitoring }),
['loadCount as loadPullsCount'],
- reportListLogic({ tabKey: 'reports', listParams: INBOX_FLAT_TAB_LIST_PARAMS.reports }),
+ reportListLogic({
+ sectionKey: 'needs-decision',
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],
+ }),
['loadCount as loadReportsCount'],
],
})),
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
index 11f087df4276..27828cb25b0f 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
@@ -57,6 +57,7 @@ import {
CurrentReviewerUser,
} from '../components/detail/reviewerDisplay'
import {
+ captureInboxReportAction,
captureInboxReportFeedback,
captureInboxReportFeedbackNote,
InboxReportFeedbackSentiment,
@@ -86,6 +87,9 @@ const IMPLEMENTATION_SLOT_RELEASING_STATUSES: TaskRunStatus[] = [TaskRunStatus.F
// limit the kickoff flow already uses to find the repo-selection artefact.
const ARTEFACT_FETCH_LIMIT = 1000
+/** The report column's tabs on a PR-bearing report: the summary, or the branch diff. */
+export type ReportDetailTab = 'summary' | 'files'
+
export interface InboxReportDetailLogicProps {
reportId: string
/** The selected report, fed in by the shell so task polling can stop once it reaches a terminal status. */
@@ -238,6 +242,7 @@ export interface inboxReportDetailLogicValues {
chartPlacements: ChartPlacements
chartsById: Map<string, ReportChartApi>
currentUserGithubLogin: string | null
+ detailTab: ReportDetailTab
diffArtefactId: string | null
displayReviewers: EnrichedReviewer[] | null
draftThread: DraftThread | null
@@ -464,6 +469,9 @@ export interface inboxReportDetailLogicActions {
searchAvailableReviewers: (query: string) => {
query: string
}
+ setDetailTab: (tab: ReportDetailTab) => {
+ tab: ReportDetailTab
+ }
setEditingCommentId: (commentId: string | null) => {
commentId: string | null
}
@@ -606,6 +614,8 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
searchAvailableReviewers: (query: string) => ({ query }),
// Which linked task's run log the detail view shows; null falls back to `primaryTask`.
setSelectedTaskId: (taskId: string | null) => ({ taskId }),
+ // Summary or Files changed in the report column (PR-bearing reports only).
+ setDetailTab: (tab: ReportDetailTab) => ({ tab }),
// Inline-expand a linked task's run log within the report detail's Runs section.
toggleExpandedTask: (taskId: string) => ({ taskId }),
// Thumbs feedback at the end of the report body. Recorded server-side as a report action
@@ -794,6 +804,14 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
setReport: () => [],
},
],
+ // Which tab the report column shows. The logic is keyed by report id, so each report keeps its
+ // own tab while open and a freshly opened report starts on the summary.
+ detailTab: [
+ 'summary' as ReportDetailTab,
+ {
+ setDetailTab: (_, { tab }) => tab,
+ },
+ ],
// The thumbs rating this reader gave the open report, so the row can read the choice back.
// The logic is keyed by report id, so each report keeps its own rating for as long as it's open.
feedbackSentiment: [
@@ -1168,6 +1186,12 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
}),
listeners(({ actions, values, props }) => ({
+ setDetailTab: ({ tab }) => {
+ // Reviewing the diff is the deepest engagement a report gets short of acting on it.
+ if (tab === 'files' && values.report) {
+ captureInboxReportAction({ report: values.report, actionType: 'view_diff', surface: 'detail_pane' })
+ }
+ },
rateReport: ({ sentiment }) => {
if (!values.report) {
return
diff --git a/products/signals/frontend/inbox/logics/inboxReportSectionsLogic.ts b/products/signals/frontend/inbox/logics/inboxReportSectionsLogic.ts
new file mode 100644
index 000000000000..1fba0303b0d5
--- /dev/null
+++ b/products/signals/frontend/inbox/logics/inboxReportSectionsLogic.ts
@@ -0,0 +1,92 @@
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
+
+import { captureInboxSectionToggled } from '../inboxAnalytics'
+import { INBOX_REPORT_SECTION_KEYS, InboxReportSectionKey } from '../types'
+
+/** localStorage key for the per-user collapsed/expanded sections (see `sectionOverrides`). */
+export const INBOX_OPEN_SECTIONS_STORAGE_KEY = 'inbox-open-report-sections'
+
+/**
+ * How a section starts before the user has collapsed or expanded it. The two sections that carry
+ * work to do open; the two that are a record of work already judged stay out of the way.
+ */
+export const DEFAULT_OPEN_SECTIONS: Record<InboxReportSectionKey, boolean> = {
+ monitoring: true,
+ 'needs-decision': true,
+ resolved: false,
+ 'not-actionable': false,
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxReportSectionsLogicValues {
+ openSections: Record<InboxReportSectionKey, boolean>
+ sectionOverrides: Record<string, boolean>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxReportSectionsLogicActions {
+ toggleSection: (section: InboxReportSectionKey) => {
+ section: 'monitoring' | 'needs-decision' | 'not-actionable' | 'resolved'
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxReportSectionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ openSections: (sectionOverrides: Record<string, boolean>) => Record<InboxReportSectionKey, boolean>
+ }
+}
+
+export type inboxReportSectionsLogicType = MakeLogicType<
+ inboxReportSectionsLogicValues,
+ inboxReportSectionsLogicActions,
+ Record<string, any>,
+ inboxReportSectionsLogicMeta
+>
+
+/**
+ * Which Reports sections are expanded. Persisted, so a user who collapses Monitoring finds it
+ * collapsed on their next visit.
+ *
+ * Only sections the user has actually toggled are stored. Everything else reads through to
+ * `DEFAULT_OPEN_SECTIONS`, so a changed default reaches every user who never expressed a
+ * preference, and a section added later starts at its own default rather than at `false`.
+ */
+export const inboxReportSectionsLogic = kea<inboxReportSectionsLogicType>([
+ path(['scenes', 'inbox', 'logics', 'inboxReportSectionsLogic']),
+
+ actions({
+ toggleSection: (section: InboxReportSectionKey) => ({ section }),
+ }),
+
+ reducers({
+ sectionOverrides: [
+ {} as Record<string, boolean>,
+ { persist: true, storageKey: INBOX_OPEN_SECTIONS_STORAGE_KEY },
+ {
+ toggleSection: (state, { section }) => ({
+ ...state,
+ [section]: !(state[section] ?? DEFAULT_OPEN_SECTIONS[section]),
+ }),
+ },
+ ],
+ }),
+
+ listeners(({ values }) => ({
+ // Listeners run after reducers, so `openSections` already holds the new state.
+ toggleSection: ({ section }) => captureInboxSectionToggled({ section, isOpen: values.openSections[section] }),
+ })),
+
+ selectors({
+ openSections: [
+ (s) => [s.sectionOverrides],
+ (sectionOverrides: Record<string, boolean>): Record<InboxReportSectionKey, boolean> =>
+ Object.fromEntries(
+ INBOX_REPORT_SECTION_KEYS.map((section) => [
+ section,
+ sectionOverrides[section] ?? DEFAULT_OPEN_SECTIONS[section],
+ ])
+ ) as Record<InboxReportSectionKey, boolean>,
+ ],
+ }),
+])
diff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts
new file mode 100644
index 000000000000..636e0c0d2540
--- /dev/null
+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts
@@ -0,0 +1,186 @@
+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */
+import { router } from 'kea-router'
+import { expectLogic } from 'kea-test-utils'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { urls } from 'scenes/urls'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { SignalReport, SignalReportStatus } from '../types'
+import { inboxTriageLogic } from './inboxTriageLogic'
+
+const REPORTS_URL = '/api/projects/:team_id/signals/reports/'
+// Matches the list logic's server page size, so a spot past it needs a second page.
+const PAGE_SIZE = 50
+
+function makeReport(id: string): SignalReport {
+ return {
+ id,
+ title: `Report ${id}`,
+ summary: 'summary',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ priority: 'P2',
+ source_products: ['error_tracking'],
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ } satisfies SignalReport
+}
+
+const FIRST_PAGE = Array.from({ length: PAGE_SIZE }, (_, i) => makeReport(`r-${i}`))
+const SECOND_PAGE = Array.from({ length: 10 }, (_, i) => makeReport(`r-${PAGE_SIZE + i}`))
+
+describe('inboxTriageLogic', () => {
+ let requestedOffsets: (string | null)[]
+ let logic: ReturnType<typeof inboxTriageLogic.build>
+
+ beforeEach(() => {
+ requestedOffsets = []
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ [REPORTS_URL]: ({ request }) => {
+ const { searchParams } = new URL(request.url)
+ const offset = searchParams.get('offset')
+ if (searchParams.get('limit') !== '1') {
+ requestedOffsets.push(offset)
+ }
+ const firstPage = offset === '0' || offset === null
+ return [
+ 200,
+ {
+ count: FIRST_PAGE.length + SECOND_PAGE.length,
+ next: firstPage
+ ? `http://localhost/api/projects/997/signals/reports/?offset=${PAGE_SIZE}`
+ : null,
+ previous: null,
+ results: firstPage ? FIRST_PAGE : SECOND_PAGE,
+ },
+ ]
+ },
+ },
+ })
+ initKeaTests()
+ // Triage mode is a redesign surface: with the flag off the scene redirects its URL to the list.
+ featureFlagLogic.mount()
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: true,
+ })
+ })
+
+ afterEach(() => logic?.unmount())
+
+ async function mountAt(searchParams: Record<string, unknown>): Promise<void> {
+ router.actions.push(urls.inboxTriage(), searchParams)
+ logic = inboxTriageLogic()
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ }
+
+ it.each([
+ {
+ name: 'lands on the report the URL names',
+ searchParams: { report: 'r-7', at: 7 },
+ expectedId: 'r-7',
+ expectedOffsets: ['0'],
+ },
+ {
+ name: 'prefers the report over a stale index when rows above it were archived',
+ searchParams: { report: 'r-7', at: 9 },
+ expectedId: 'r-7',
+ expectedOffsets: ['0'],
+ },
+ {
+ name: 'falls back to the index when the report is no longer in the queue',
+ searchParams: { report: 'gone', at: 3 },
+ expectedId: 'r-3',
+ expectedOffsets: ['0'],
+ },
+ {
+ name: 'pages forward until a spot past the first page is loaded',
+ searchParams: { report: `r-${PAGE_SIZE + 5}`, at: PAGE_SIZE + 5 },
+ expectedId: `r-${PAGE_SIZE + 5}`,
+ expectedOffsets: ['0', String(PAGE_SIZE)],
+ },
+ ])('$name', async ({ searchParams, expectedId, expectedOffsets }) => {
+ await mountAt(searchParams)
+
+ expect(logic.values.currentReport?.id).toBe(expectedId)
+ expect(logic.values.isRestoringPosition).toBe(false)
+ expect(requestedOffsets).toEqual(expectedOffsets)
+ })
+
+ // Restoring to a spot past the first page means paging forward; if that page request fails, the
+ // view must stop waiting and show the nearest loaded report instead of skeletons forever.
+ it('stops restoring and shows the nearest loaded report when the next page fails', async () => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ [REPORTS_URL]: ({ request }) => {
+ const { searchParams } = new URL(request.url)
+ if (searchParams.get('limit') === '1') {
+ return [
+ 200,
+ { count: FIRST_PAGE.length + SECOND_PAGE.length, next: null, previous: null, results: [] },
+ ]
+ }
+ const offset = searchParams.get('offset')
+ if (offset === '0' || offset === null) {
+ return [
+ 200,
+ {
+ count: FIRST_PAGE.length + SECOND_PAGE.length,
+ next: `http://localhost/api/projects/997/signals/reports/?offset=${PAGE_SIZE}`,
+ previous: null,
+ results: FIRST_PAGE,
+ },
+ ]
+ }
+ return [500, {}]
+ },
+ },
+ })
+
+ await mountAt({ report: `r-${PAGE_SIZE + 5}`, at: PAGE_SIZE + 5 })
+
+ // The remembered spot's page never arrived, so the view falls back to the last loaded report
+ // rather than staying on the restoring skeleton.
+ expect(logic.values.isRestoringPosition).toBe(false)
+ expect(logic.values.currentReport?.id).toBe(`r-${PAGE_SIZE - 1}`)
+ })
+
+ // A failed first load leaves the response null, so `isLoaded` never flips; the view keys the
+ // retry off `reportsLoadFailed` instead of skeletoning forever.
+ it('flags a failed initial load instead of loading forever', async () => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ [REPORTS_URL]: () => [500, {}],
+ },
+ })
+
+ await mountAt({})
+
+ expect(logic.values.isLoaded).toBe(false)
+ expect(logic.values.reportsLoadFailed).toBe(true)
+ })
+
+ it('keeps the URL on the current spot and hands it to the report page as the way back', async () => {
+ await mountAt({})
+ logic.actions.navigate(1)
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(router.values.location.pathname.endsWith(urls.inboxTriage())).toBe(true)
+ expect(router.values.searchParams).toEqual({ report: 'r-1', at: 1 })
+ expect(logic.values.currentReportUrl).toBe(
+ `/inbox/reports/r-1?back=${encodeURIComponent('/inbox/reports/triage?report=r-1&at=1')}`
+ )
+ })
+})
diff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.ts
new file mode 100644
index 000000000000..6f7cf5d785b2
--- /dev/null
+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.ts
@@ -0,0 +1,421 @@
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'
+
+import { urls } from 'scenes/urls'
+
+import { canCreateImplementationPr } from '../components/detail/ReportDetailActions'
+import { openDismissReportDialog } from '../components/shell/DismissReportDialog'
+import { captureInboxReportAction } from '../inboxAnalytics'
+import { inboxSceneLogic } from '../inboxSceneLogic'
+import { inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
+import { INBOX_PRIMARY_REPORT_SECTION_KEY, InboxReportSectionKey, SignalReport } from '../types'
+import { displayConventionalCommitTitle } from '../utils/reportPresentation'
+import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './reportListLogic'
+
+/**
+ * Triage mode triages the Needs-a-PR queue, sharing that section's loaded pages, filters, and
+ * scope. It walks every loaded report, not just the rows the section has expanded to show.
+ */
+export const TRIAGE_SECTION_KEY: InboxReportSectionKey = INBOX_PRIMARY_REPORT_SECTION_KEY
+
+const TRIAGE_LIST_PROPS = {
+ sectionKey: TRIAGE_SECTION_KEY,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS[TRIAGE_SECTION_KEY],
+}
+
+// How many reports before the end of the loaded page the next page is fetched, so stepping
+// forward never lands on a "loading" gap.
+const PREFETCH_THRESHOLD = 3
+
+function clampIndex(index: number, length: number): number {
+ return Math.max(0, Math.min(index, length - 1))
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxTriageLogicValues {
+ aiConsentDisabledReason: string | null // inboxTaskKickoffLogic
+ isCreatingPr: boolean // inboxTaskKickoffLogic
+ hasMore: boolean // reportListLogic
+ isLoaded: boolean // reportListLogic
+ reports: SignalReport[] // reportListLogic
+ reportsLoadFailed: boolean // reportListLogic
+ reportsResponseLoading: boolean // reportListLogic
+ canCreatePr: boolean
+ counter: string
+ currentIndex: number
+ currentReport: SignalReport | null
+ currentReportUrl: string | null
+ expanded: boolean
+ isRestoringPosition: boolean
+ nextReport: SignalReport | null
+ previousReport: SignalReport | null
+ requestedIndex: number
+ requestedReportId: string | null
+ requestedReportIndex: number
+ restoreFailed: boolean
+ returnUrl: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxTriageLogicActions {
+ setSelectedReportId: (
+ id: string | null,
+ openMethod?: import('../inboxAnalytics').InboxReportOpenMethod | undefined
+ ) => {
+ id: string | null
+ openMethod: import('../inboxAnalytics').InboxReportOpenMethod
+ } // inboxSceneLogic
+ createPrFromReport: (report: SignalReport) => {
+ report: SignalReport
+ } // inboxTaskKickoffLogic
+ archiveReport: (
+ reportId: string,
+ reason:
+ | 'already_fixed'
+ | 'analysis_wrong'
+ | 'other'
+ | 'report_unclear'
+ | 'wontfix_intentional'
+ | 'wontfix_irrelevant',
+ note: string
+ ) => {
+ note: string
+ reason:
+ | 'already_fixed'
+ | 'analysis_wrong'
+ | 'other'
+ | 'report_unclear'
+ | 'wontfix_intentional'
+ | 'wontfix_irrelevant'
+ reportId: string
+ } // reportListLogic
+ ensureLoaded: () => {
+ value: true
+ } // reportListLogic
+ loadMore: () => {
+ value: true
+ } // reportListLogic
+ loadMoreReportsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // reportListLogic
+ loadMoreReportsSuccess: (
+ reportsResponse: import('./reportListLogic').ReportListResponse,
+ payload?: any
+ ) => {
+ payload?: any
+ reportsResponse: import('./reportListLogic').ReportListResponse
+ } // reportListLogic
+ loadReportsSuccess: (
+ reportsResponse: import('./reportListLogic').ReportListResponse,
+ payload?: any
+ ) => {
+ payload?: any
+ reportsResponse: import('./reportListLogic').ReportListResponse
+ } // reportListLogic
+ removeReport: (reportId: string) => {
+ reportId: string
+ } // reportListLogic
+ archiveCurrent: () => {
+ value: true
+ }
+ createPrForCurrent: () => {
+ value: true
+ }
+ focusReport: (
+ reportId: string | null,
+ index: number
+ ) => {
+ index: number
+ reportId: string | null
+ }
+ navigate: (delta: number) => {
+ delta: number
+ }
+ openCurrent: () => {
+ value: true
+ }
+ setExpanded: (expanded: boolean) => {
+ expanded: boolean
+ }
+ setIndex: (index: number) => {
+ index: number
+ }
+ toggleExpanded: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface inboxTriageLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ requestedReportIndex: (requestedReportId: string | null, reports: SignalReport[]) => number
+ currentIndex: (requestedReportIndex: number, requestedIndex: number, reports: SignalReport[]) => number
+ isRestoringPosition: (
+ requestedReportIndex: number,
+ requestedIndex: number,
+ reports: SignalReport[],
+ hasMore: boolean,
+ restoreFailed: boolean
+ ) => boolean
+ currentReport: (reports: SignalReport[], currentIndex: number) => SignalReport | null
+ previousReport: (reports: SignalReport[], currentIndex: number) => SignalReport | null
+ nextReport: (reports: SignalReport[], currentIndex: number) => SignalReport | null
+ counter: (reports: SignalReport[], currentIndex: number, hasMore: boolean) => string
+ canCreatePr: (currentReport: SignalReport | null) => boolean
+ returnUrl: (currentReport: SignalReport | null, currentIndex: number) => string
+ currentReportUrl: (currentReport: SignalReport | null, returnUrl: string) => string | null
+ }
+}
+
+export type inboxTriageLogicType = MakeLogicType<
+ inboxTriageLogicValues,
+ inboxTriageLogicActions,
+ Record<string, any>,
+ inboxTriageLogicMeta
+>
+
+/**
+ * Triage mode: one report at a time from the Needs-a-decision queue, driven from the keyboard. The
+ * queue is the landing view's own `reportListLogic` (same pages, filters, and reviewer scope), so
+ * archiving here drops the row from the list too and the next report slides into place.
+ */
+export const inboxTriageLogic = kea<inboxTriageLogicType>([
+ path(['scenes', 'inbox', 'logics', 'inboxTriageLogic']),
+
+ connect(() => ({
+ values: [
+ reportListLogic(TRIAGE_LIST_PROPS),
+ ['reports', 'hasMore', 'isLoaded', 'reportsResponseLoading', 'reportsLoadFailed'],
+ inboxTaskKickoffLogic,
+ ['isCreatingPr', 'aiConsentDisabledReason'],
+ ],
+ actions: [
+ reportListLogic(TRIAGE_LIST_PROPS),
+ [
+ 'ensureLoaded',
+ 'loadMore',
+ 'archiveReport',
+ 'removeReport',
+ 'loadReportsSuccess',
+ 'loadMoreReportsSuccess',
+ 'loadMoreReportsFailure',
+ ],
+ inboxTaskKickoffLogic,
+ ['createPrFromReport'],
+ inboxSceneLogic,
+ ['setSelectedReportId'],
+ ],
+ })),
+
+ actions({
+ navigate: (delta: number) => ({ delta }),
+ setIndex: (index: number) => ({ index }),
+ // Restore a spot carried in the triage URL: the report the user was on, and where it sat.
+ focusReport: (reportId: string | null, index: number) => ({ reportId, index }),
+ toggleExpanded: true,
+ setExpanded: (expanded: boolean) => ({ expanded }),
+ archiveCurrent: true,
+ createPrForCurrent: true,
+ openCurrent: true,
+ }),
+
+ reducers({
+ // The index the user asked for. It can point past the end once archiving shrinks the list,
+ // so `currentIndex` clamps it against what is loaded rather than trusting it directly.
+ requestedIndex: [
+ 0,
+ {
+ setIndex: (_, { index }) => index,
+ focusReport: (_, { index }) => index,
+ },
+ ],
+ // The report the URL says the user is on. It wins over the index while it is still in the
+ // queue, so rows archived above it don't shift the user onto a different report.
+ requestedReportId: [
+ null as string | null,
+ {
+ focusReport: (_, { reportId }) => reportId,
+ setIndex: () => null,
+ },
+ ],
+ expanded: [
+ false,
+ {
+ toggleExpanded: (state) => !state,
+ setExpanded: (_, { expanded }) => expanded,
+ },
+ ],
+ // A page load toward the remembered spot failed. kea loaders leave `reports`/`hasMore`
+ // unchanged on failure, so `isRestoringPosition` would otherwise stay true forever and hold the
+ // view on a skeleton with nothing left to load. Stop restoring (fall back to the nearest loaded
+ // report); reset when a new spot is requested or a page lands so a later retry can resume.
+ restoreFailed: [
+ false,
+ {
+ focusReport: () => false,
+ loadReportsSuccess: () => false,
+ loadMoreReportsSuccess: () => false,
+ loadMoreReportsFailure: () => true,
+ },
+ ],
+ }),
+
+ selectors({
+ requestedReportIndex: [
+ (s) => [s.requestedReportId, s.reports],
+ (requestedReportId: string | null, reports: SignalReport[]): number =>
+ requestedReportId ? reports.findIndex((report) => report.id === requestedReportId) : -1,
+ ],
+ currentIndex: [
+ (s) => [s.requestedReportIndex, s.requestedIndex, s.reports],
+ (requestedReportIndex: number, requestedIndex: number, reports: SignalReport[]): number =>
+ requestedReportIndex >= 0 ? requestedReportIndex : clampIndex(requestedIndex, reports.length),
+ ],
+ // The remembered spot sits past the loaded pages while more exist: the view waits instead of
+ // flashing whichever report happens to be last on the loaded page.
+ isRestoringPosition: [
+ (s) => [s.requestedReportIndex, s.requestedIndex, s.reports, s.hasMore, s.restoreFailed],
+ (
+ requestedReportIndex: number,
+ requestedIndex: number,
+ reports: SignalReport[],
+ hasMore: boolean,
+ restoreFailed: boolean
+ ): boolean => requestedReportIndex < 0 && requestedIndex >= reports.length && hasMore && !restoreFailed,
+ ],
+ currentReport: [
+ (s) => [s.reports, s.currentIndex],
+ (reports: SignalReport[], currentIndex: number): SignalReport | null => reports[currentIndex] ?? null,
+ ],
+ previousReport: [
+ (s) => [s.reports, s.currentIndex],
+ (reports: SignalReport[], currentIndex: number): SignalReport | null =>
+ currentIndex > 0 ? (reports[currentIndex - 1] ?? null) : null,
+ ],
+ nextReport: [
+ (s) => [s.reports, s.currentIndex],
+ (reports: SignalReport[], currentIndex: number): SignalReport | null => reports[currentIndex + 1] ?? null,
+ ],
+ // "3 / 12", or "3 / 12+" while more pages are still on the server.
+ counter: [
+ (s) => [s.reports, s.currentIndex, s.hasMore],
+ (reports: SignalReport[], currentIndex: number, hasMore: boolean): string =>
+ reports.length === 0 ? '0 / 0' : `${currentIndex + 1} / ${reports.length}${hasMore ? '+' : ''}`,
+ ],
+ canCreatePr: [
+ (s) => [s.currentReport],
+ (currentReport: SignalReport | null): boolean =>
+ currentReport !== null && canCreateImplementationPr(currentReport),
+ ],
+ // The triage URL for the current spot; what a report opened from here returns to.
+ returnUrl: [
+ (s) => [s.currentReport, s.currentIndex],
+ (currentReport: SignalReport | null, currentIndex: number): string =>
+ currentReport
+ ? combineUrl(urls.inboxTriage(), { report: currentReport.id, at: currentIndex }).url
+ : urls.inboxTriage(),
+ ],
+ currentReportUrl: [
+ (s) => [s.currentReport, s.returnUrl],
+ (currentReport: SignalReport | null, returnUrl: string): string | null =>
+ currentReport
+ ? combineUrl(urls.inboxReport('reports', currentReport.id), { back: returnUrl }).url
+ : null,
+ ],
+ }),
+
+ listeners(({ actions, values }) => {
+ // Keep paging until the remembered spot is loaded (or the queue runs out).
+ const loadTowardRequestedSpot = (): void => {
+ if (values.isRestoringPosition && !values.reportsResponseLoading) {
+ actions.loadMore()
+ }
+ }
+ return {
+ loadReportsSuccess: loadTowardRequestedSpot,
+ loadMoreReportsSuccess: loadTowardRequestedSpot,
+ navigate: ({ delta }) => {
+ actions.setIndex(clampIndex(values.currentIndex + delta, values.reports.length))
+ if (
+ values.hasMore &&
+ !values.reportsResponseLoading &&
+ values.currentIndex >= values.reports.length - PREFETCH_THRESHOLD
+ ) {
+ actions.loadMore()
+ }
+ },
+ archiveCurrent: () => {
+ const report = values.currentReport
+ if (!report) {
+ return
+ }
+ openDismissReportDialog({
+ reportTitle: displayConventionalCommitTitle(report.title, 'Untitled report'),
+ onConfirm: ({ reason, note }) => {
+ // The structured reason plus the user's note, matching the list-card archive
+ // path so the dismiss analytics read the same from every surface.
+ captureInboxReportAction({
+ report,
+ actionType: 'dismiss',
+ surface: 'triage_mode',
+ extra: { dismissal_reason: reason, ...(note ? { dismissal_note: note } : {}) },
+ })
+ // The list logic drops the row optimistically, so the next report takes this index.
+ actions.archiveReport(report.id, reason, note)
+ },
+ })
+ },
+ createPrForCurrent: () => {
+ const report = values.currentReport
+ if (!report || !values.canCreatePr || values.isCreatingPr || values.aiConsentDisabledReason) {
+ return
+ }
+ captureInboxReportAction({ report, actionType: 'create_pr', surface: 'triage_mode' })
+ actions.createPrFromReport(report)
+ },
+ openCurrent: () => {
+ const report = values.currentReport
+ if (report) {
+ actions.setSelectedReportId(report.id, 'triage')
+ }
+ },
+ }
+ }),
+
+ // The URL follows the current spot (replaced, not pushed, so the browser's back button leaves
+ // triage in one step). Archiving moves the spot too, once the row is gone from the list.
+ actionToUrl(({ values }) => {
+ const positionUrl = (): [string, Record<string, unknown>, Record<string, unknown>, { replace: boolean }] => {
+ // Other params (the list scope, for one) stay; only the spot is rewritten.
+ const { report: _report, at: _at, ...rest } = router.values.searchParams
+ return [
+ urls.inboxTriage(),
+ values.currentReport ? { ...rest, report: values.currentReport.id, at: values.currentIndex } : rest,
+ router.values.hashParams,
+ { replace: true },
+ ]
+ }
+ return {
+ setIndex: positionUrl,
+ removeReport: positionUrl,
+ }
+ }),
+
+ urlToAction(({ actions }) => ({
+ [urls.inboxTriage()]: (_, searchParams) => {
+ const reportId = typeof searchParams.report === 'string' ? searchParams.report : null
+ const at = Number(searchParams.at)
+ if (reportId !== null || Number.isFinite(at)) {
+ actions.focusReport(reportId, Number.isFinite(at) ? Math.max(0, Math.floor(at)) : 0)
+ }
+ },
+ })),
+
+ afterMount(({ actions }) => {
+ actions.ensureLoaded()
+ }),
+])
diff --git a/products/signals/frontend/inbox/logics/reportListLogic.test.ts b/products/signals/frontend/inbox/logics/reportListLogic.test.ts
index 266b00f4262b..293f2ac343e9 100644
--- a/products/signals/frontend/inbox/logics/reportListLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/reportListLogic.test.ts
@@ -1,33 +1,191 @@
-import { INBOX_SCOPE_ENTIRE_PROJECT, INBOX_SCOPE_FOR_YOU, InboxFlatListTabKey, InboxScope } from '../types'
-import { shouldDefaultToEntireProject } from './reportListLogic'
-
-describe('shouldDefaultToEntireProject', () => {
- const base = {
- tabKey: 'pulls' as InboxFlatListTabKey,
- scope: INBOX_SCOPE_FOR_YOU as InboxScope,
- hasUserChosenScope: false,
- hasResolvedUser: true,
- count: 0 as number | null,
- }
-
- it('switches to Entire project when a fresh user has zero assigned PRs', () => {
- expect(shouldDefaultToEntireProject(base)).toBe(true)
+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */
+import { expectLogic } from 'kea-test-utils'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import {
+ INBOX_SCOPE_ENTIRE_PROJECT,
+ INBOX_SCOPE_FOR_YOU,
+ InboxReportSectionKey,
+ InboxScope,
+ SignalReport,
+ SignalReportStatus,
+} from '../types'
+import {
+ INBOX_REPORT_SECTION_LIST_PARAMS,
+ reportListLogic,
+ SECTION_PAGE_SIZE,
+ shouldDefaultToEntireProject,
+} from './reportListLogic'
+
+const REPORTS_URL = '/api/projects/:team_id/signals/reports/'
+
+function makeReport(id: string): SignalReport {
+ return {
+ id,
+ title: `Report ${id}`,
+ summary: 'summary',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ priority: 'P2',
+ source_products: ['error_tracking'],
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ } satisfies SignalReport
+}
+
+describe('reportListLogic', () => {
+ describe('shouldDefaultToEntireProject', () => {
+ const base = {
+ sectionKey: 'needs-decision' as InboxReportSectionKey,
+ primarySectionKey: 'needs-decision' as InboxReportSectionKey,
+ scope: INBOX_SCOPE_FOR_YOU as InboxScope,
+ hasUserChosenScope: false,
+ hasResolvedUser: true,
+ count: 0 as number | null,
+ }
+
+ it('switches to Entire project when a fresh user has zero assigned reports', () => {
+ expect(shouldDefaultToEntireProject(base)).toBe(true)
+ })
+
+ // With the redesign flag off the Pull requests list is the primary section instead.
+ it('keys the switch on whichever section the layout treats as primary', () => {
+ const legacy = { ...base, primarySectionKey: 'monitoring' as InboxReportSectionKey }
+ expect(shouldDefaultToEntireProject({ ...legacy, sectionKey: 'monitoring' })).toBe(true)
+ expect(shouldDefaultToEntireProject({ ...legacy, sectionKey: 'needs-decision' })).toBe(false)
+ })
+
+ it.each<[string, Partial<typeof base>]>([
+ // The user has reports assigned – keep them on For you.
+ ['user has assigned reports', { count: 3 }],
+ // The user deliberately picked a scope – never override it, even with zero reports.
+ ['user chose their scope', { hasUserChosenScope: true }],
+ // Only the primary section (Needs a PR) drives the default.
+ ['not the primary section', { sectionKey: 'monitoring' as InboxReportSectionKey }],
+ // Already off For you – nothing to default.
+ ['already entire project', { scope: INBOX_SCOPE_ENTIRE_PROJECT as InboxScope }],
+ // Count for For-you scope is only meaningful once the user's uuid has resolved.
+ ['user not resolved yet', { hasResolvedUser: false }],
+ // Count request in flight / failed (null) is not treated as "zero".
+ ['count not loaded', { count: null }],
+ ])('stays put when %s', (_label, override) => {
+ expect(shouldDefaultToEntireProject({ ...base, ...override })).toBe(false)
+ })
})
- it.each<[string, Partial<typeof base>]>([
- // The user has PRs assigned – keep them on For you.
- ['user has assigned PRs', { count: 3 }],
- // The user deliberately picked a scope – never override it, even with zero PRs.
- ['user chose their scope', { hasUserChosenScope: true }],
- // Only the Pull requests tab (their assigned PRs) drives the default.
- ['not the pulls tab', { tabKey: 'reports' as InboxFlatListTabKey }],
- // Already off For you – nothing to default.
- ['already entire project', { scope: INBOX_SCOPE_ENTIRE_PROJECT as InboxScope }],
- // Count for For-you scope is only meaningful once the user's uuid has resolved.
- ['user not resolved yet', { hasResolvedUser: false }],
- // Count request in flight / failed (null) is not treated as "zero".
- ['count not loaded', { count: null }],
- ])('stays put when %s', (_label, override) => {
- expect(shouldDefaultToEntireProject({ ...base, ...override })).toBe(false)
+ // A section shows a short window over a much larger server page, so "Show more" has two jobs
+ // that are easy to get wrong in opposite directions: widening the window, and reaching for the
+ // next server page only once the window has outrun the rows already in hand.
+ describe('section paging window', () => {
+ // Two full sections' worth on the first page, so the first press is served from memory.
+ const FIRST_PAGE = Array.from({ length: SECTION_PAGE_SIZE * 2 }, (_, i) => makeReport(`page-1-${i}`))
+ const SECOND_PAGE = [makeReport('page-2-0')]
+ let requestedOffsets: (string | null)[]
+ let logic: ReturnType<typeof reportListLogic.build>
+
+ beforeEach(async () => {
+ requestedOffsets = []
+ useMocks({
+ get: {
+ // Reviewer scope loads alongside the list; an empty map keeps it out of the way.
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ [REPORTS_URL]: ({ request }) => {
+ const { searchParams } = new URL(request.url)
+ const offset = searchParams.get('offset')
+ // The header count fires a separate count-only request; not a page.
+ if (searchParams.get('limit') !== '1') {
+ requestedOffsets.push(offset)
+ }
+ const firstPage = offset === '0' || offset === null
+ return [
+ 200,
+ {
+ count: FIRST_PAGE.length + SECOND_PAGE.length,
+ // A non-null `next` is what tells the section there are more pages.
+ next: firstPage ? 'http://localhost/api/projects/997/signals/reports/?offset=50' : null,
+ previous: null,
+ results: firstPage ? FIRST_PAGE : SECOND_PAGE,
+ },
+ ]
+ },
+ },
+ })
+ initKeaTests()
+ logic = reportListLogic({
+ sectionKey: 'needs-decision',
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],
+ })
+ logic.mount()
+ logic.actions.ensureLoaded()
+ await expectLogic(logic).toFinishAllListeners()
+ })
+
+ afterEach(() => logic.unmount())
+
+ it('shows one section-worth of the loaded page', () => {
+ expect(logic.values.visibleReports).toHaveLength(SECTION_PAGE_SIZE)
+ expect(logic.values.hiddenReportCount).toBe(FIRST_PAGE.length + SECOND_PAGE.length - SECTION_PAGE_SIZE)
+ })
+
+ it('widens the window from rows already loaded, without a new request', async () => {
+ logic.actions.showMore()
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.visibleReports).toHaveLength(SECTION_PAGE_SIZE * 2)
+ expect(requestedOffsets).toEqual(['0'])
+ })
+
+ it('fetches the next page once the window outruns the loaded rows', async () => {
+ logic.actions.showMore()
+ await expectLogic(logic).toFinishAllListeners()
+ logic.actions.showMore()
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(requestedOffsets).toEqual(['0', String(FIRST_PAGE.length)])
+ expect(logic.values.reports).toHaveLength(FIRST_PAGE.length + SECOND_PAGE.length)
+ })
+
+ // "Show more" widens the window past the loaded rows before the next page lands, so a failed
+ // next-page request leaves the window ahead of the loaded rows. The hidden count must track
+ // the rows on screen, not the window size — otherwise it hits zero and unmounts the only
+ // control that can retry, stranding the unfetched rows.
+ it('keeps Show more after a failed next-page request so the rows stay reachable', async () => {
+ useMocks({
+ get: {
+ [REPORTS_URL]: ({ request }) => {
+ const offset = new URL(request.url).searchParams.get('offset')
+ return offset && offset !== '0'
+ ? [500, {}]
+ : [
+ 200,
+ {
+ count: FIRST_PAGE.length + SECOND_PAGE.length,
+ next: 'http://localhost/api/projects/997/signals/reports/?offset=50',
+ previous: null,
+ results: FIRST_PAGE,
+ },
+ ]
+ },
+ },
+ })
+ // First press is served from memory; the second outruns the loaded rows and the
+ // next-page fetch fails.
+ logic.actions.showMore()
+ await expectLogic(logic).toFinishAllListeners()
+ logic.actions.showMore()
+ await expectLogic(logic).toFinishAllListeners()
+
+ // The second page never arrived, so the loaded rows are unchanged...
+ expect(logic.values.reports).toHaveLength(FIRST_PAGE.length)
+ expect(logic.values.visibleReports).toHaveLength(FIRST_PAGE.length)
+ // ...but the section still knows one report is held back and offers to fetch it again.
+ expect(logic.values.hiddenReportCount).toBe(SECOND_PAGE.length)
+ })
})
})
diff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.ts
index 1125faa2e53a..13dccffab062 100644
--- a/products/signals/frontend/inbox/logics/reportListLogic.ts
+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts
@@ -4,6 +4,8 @@ import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
import api, { CountedPaginatedResponse } from 'lib/api'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { userLogic } from 'scenes/userLogic'
import type { UserType } from '~/types'
@@ -11,21 +13,33 @@ import type { UserType } from '~/types'
import { captureInboxReportAction } from '../inboxAnalytics'
import {
ACTIONABLE_ACTIONABILITY_VALUES,
+ INBOX_LEGACY_PRIMARY_REPORT_SECTION_KEY,
+ INBOX_PRIMARY_REPORT_SECTION_KEY,
INBOX_SCOPE_ENTIRE_PROJECT,
INBOX_SCOPE_FOR_YOU,
- InboxFlatListTabKey,
+ InboxReportSectionKey,
InboxScope,
SignalReport,
} from '../types'
import type { SignalReportPriority } from '../types'
import { DismissalReasonValue } from '../utils/dismissalReasons'
+import { isInboxRedesignEnabled } from '../utils/inboxRedesign'
import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'
import { buildSignalReportListOrdering, inboxFiltersLogic } from './inboxFiltersLogic'
import type { InboxFilterState, InboxSortDirection, InboxSortField } from './inboxFiltersLogic'
const PAGE_SIZE = 50
-/** Fixed, tab-defining server filter (e.g. `{ has_implementation_pr: 'true' }`). */
+/**
+ * How many rows a section shows before "Show more". Sections stack in one column, so each one has
+ * to stay short enough that the sections below it are still reachable without scrolling past a
+ * whole list. Well under the server `PAGE_SIZE`, so the first few "Show more" presses are free.
+ */
+// Annotated rather than inferred: kea-typegen reads a bare `= 5` as the literal type `5` and
+// types the reducer it defaults as `5`, which then rejects the widened value.
+export const SECTION_PAGE_SIZE: number = 5
+
+/** Fixed, section-defining server filter (e.g. `{ has_implementation_pr: 'true' }`). */
export type ReportListParams = Record<string, string>
/** A list response stamped with the query params and display context that produced it (see the loader). */
@@ -35,26 +49,28 @@ export type ReportListResponse = CountedPaginatedResponse<SignalReport> & {
}
export interface ReportListLogicProps {
- tabKey: InboxFlatListTabKey
- /** The tab's fixed server filter. User-driven chrome (search/sort/source/priority/scope) is layered on top. */
+ sectionKey: InboxReportSectionKey
+ /** The section's fixed server filter. User-driven chrome (search/sort/source/priority/scope) layers on top. */
listParams: ReportListParams
}
/**
- * The fixed server filter per flat tab – the single source of truth shared by the tab
- * bodies, the count chips, and the scene. Mirrors the backend filters confirmed in the plan.
+ * The fixed server filter per report section – the single source of truth shared by the section
+ * bodies, the header counts, and the scene.
*/
-export const INBOX_FLAT_TAB_LIST_PARAMS: Record<InboxFlatListTabKey, ReportListParams> = {
- pulls: { has_implementation_pr: 'true', status: 'ready' },
- reports: {
+export const INBOX_REPORT_SECTION_LIST_PARAMS: Record<InboxReportSectionKey, ReportListParams> = {
+ // An implementation PR is open, waiting to be reviewed and merged.
+ monitoring: { has_implementation_pr: 'true', status: 'ready' },
+ // Researched and actionable, but no PR has been opened for it yet.
+ 'needs-decision': {
has_implementation_pr: 'false',
status: 'ready,pending_input',
actionability: ACTIONABLE_ACTIONABILITY_VALUES.join(','),
},
+ // Terminal reports: ones resolved by a merged implementation PR (not restorable) and ones
+ // the user archived (suppressed, restorable).
+ resolved: { status: 'suppressed,resolved' },
'not-actionable': { actionability: 'not_actionable' },
- // Archive = terminal reports: ones the user dismissed (suppressed, restorable) and ones
- // resolved by a merged implementation PR (terminal, not restorable).
- archived: { status: 'suppressed,resolved' },
}
function teammateUuidFromScope(scope: string): string | undefined {
@@ -81,20 +97,21 @@ function requestContextFromValues(values: {
/**
* Whether to auto-switch the reviewer scope to Entire project on first load. True only for the
- * Pull requests tab when the user is still on the (default) For-you scope, hasn't chosen a scope
- * themselves, has resolved to a real user, and has zero PRs suggested to them — so a user with
- * nothing assigned doesn't land on an empty view. Pure so the branching is unit-testable without
- * mounting the logic.
+ * primary section (Needs a PR under the redesign, the Pull requests list with the flag off) when
+ * the user is still on the (default) For-you scope, hasn't chosen a scope themselves, has resolved
+ * to a real user, and has zero reports suggested to them — so a user with nothing assigned doesn't
+ * land on an empty inbox. Pure so the branching is unit-testable without mounting the logic.
*/
export function shouldDefaultToEntireProject(input: {
- tabKey: InboxFlatListTabKey
+ sectionKey: InboxReportSectionKey
+ primarySectionKey: InboxReportSectionKey
scope: InboxScope
hasUserChosenScope: boolean
hasResolvedUser: boolean
count: number | null
}): boolean {
return (
- input.tabKey === 'pulls' &&
+ input.sectionKey === input.primarySectionKey &&
input.scope === INBOX_SCOPE_FOR_YOU &&
!input.hasUserChosenScope &&
input.hasResolvedUser &&
@@ -104,6 +121,7 @@ export function shouldDefaultToEntireProject(input: {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface reportListLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
hasUserChosenScope: boolean // inboxFiltersLogic
priorityFilter: SignalReportPriority[] // inboxFiltersLogic
scope: InboxScope // inboxFiltersLogic
@@ -116,6 +134,7 @@ export interface reportListLogicValues {
count: number | null
countLoading: boolean
hasMore: boolean
+ hiddenReportCount: number
isLoaded: boolean
listApiParams: any
loadedContext: {
@@ -123,10 +142,14 @@ export interface reportListLogicValues {
scope: InboxScope
} | null
loadedQueryKey: string | null
+ primarySectionKey: InboxReportSectionKey
reports: SignalReport[]
+ reportsLoadFailed: boolean
reportsResponse: ReportListResponse | null
reportsResponseLoading: boolean
totalCount: number | null
+ visibleCount: number
+ visibleReports: SignalReport[]
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -140,6 +163,9 @@ export interface reportListLogicActions {
setFilters: (filters: InboxFilterState) => {
filters: InboxFilterState
} // inboxFiltersLogic
+ setPriorityFilter: (priorities: SignalReportPriority[]) => {
+ priorities: SignalReportPriority[]
+ } // inboxFiltersLogic
setScope: (scope: InboxScope) => {
scope: InboxScope
} // inboxFiltersLogic
@@ -237,12 +263,16 @@ export interface reportListLogicActions {
restoreReport: (reportId: string) => {
reportId: string
}
+ showMore: () => {
+ value: true
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface reportListLogicMeta {
- key: 'archived' | 'not-actionable' | 'pulls' | 'reports'
+ key: 'monitoring' | 'needs-decision' | 'not-actionable' | 'resolved'
__keaTypeGenInternalSelectorTypes: {
+ primarySectionKey: (featureFlags: FeatureFlagsSet) => InboxReportSectionKey
listApiParams: (
searchQuery: string,
sortField: InboxSortField,
@@ -255,6 +285,8 @@ export interface reportListLogicMeta {
arg: any
) => any
reports: (reportsResponse: ReportListResponse | null) => SignalReport[]
+ visibleReports: (reports: SignalReport[], visibleCount: number) => SignalReport[]
+ hiddenReportCount: (totalCount: number | null, count: number | null, visibleReports: SignalReport[]) => number
hasMore: (reportsResponse: ReportListResponse | null) => boolean
isLoaded: (reportsResponse: ReportListResponse | null) => boolean
totalCount: (reportsResponse: ReportListResponse | null) => number | null
@@ -274,18 +306,19 @@ export type reportListLogicType = MakeLogicType<
>
/**
- * Keyed per-tab report list. Mounted once per flat tab (pulls / reports / not-actionable),
- * each with its own fixed `listParams`, so every tab is its own filtered request with its
- * own accurate `count` and its own pagination. The shared user chrome (search, sort, source,
- * priority, reviewer scope) is connected from `inboxFiltersLogic` and applied on top.
+ * Keyed per-section report list. Mounted once per Reports section (Review and merge / Needs a PR /
+ * Resolved / Not actionable), each with its own fixed `listParams`, so every section is its own
+ * filtered request with its own accurate `count` and its own pagination. The shared user chrome
+ * (search, sort, source, priority, reviewer scope) is connected from `inboxFiltersLogic` and applied
+ * on top, so one filter row drives all four.
*
- * `count` loads on mount (cheap `limit=1`) so the tab badge is correct before the contents
- * are fetched. The list itself loads lazily (`ensureLoaded`) only when the tab is rendered.
+ * `count` loads on mount (cheap `limit=1`) so a section header is correct even while collapsed. The
+ * rows load lazily (`ensureLoaded`) only once the section is expanded.
*/
export const reportListLogic = kea<reportListLogicType>([
- path((tabKey) => ['scenes', 'inbox', 'logics', 'reportListLogic', tabKey]),
+ path((sectionKey) => ['scenes', 'inbox', 'logics', 'reportListLogic', sectionKey]),
props({} as ReportListLogicProps),
- key((props) => props.tabKey),
+ key((props) => props.sectionKey),
connect(() => ({
values: [
@@ -302,6 +335,8 @@ export const reportListLogic = kea<reportListLogicType>([
],
userLogic,
['user'],
+ featureFlagLogic,
+ ['featureFlags'],
],
actions: [
inboxFiltersLogic,
@@ -311,6 +346,7 @@ export const reportListLogic = kea<reportListLogicType>([
'toggleSourceProduct',
'toggleScout',
'togglePriority',
+ 'setPriorityFilter',
'setScope',
'applyDefaultScope',
'setFilters',
@@ -326,10 +362,11 @@ export const reportListLogic = kea<reportListLogicType>([
restoreReport: (reportId: string) => ({ reportId }),
removeReport: (reportId: string) => ({ reportId }),
refresh: true,
+ showMore: true,
}),
loaders(({ values }) => ({
- // Cheap count-only request (limit=1) – populates the tab badge before contents load.
+ // Cheap count-only request (limit=1) – populates the section header before its rows load.
count: [
null as number | null,
{
@@ -386,10 +423,40 @@ export const reportListLogic = kea<reportListLogicType>([
count: {
removeReport: (state) => (state != null ? Math.max(0, state - 1) : state),
},
+ // The first-page load failed. Kea loaders keep `reportsResponse` null on failure, so
+ // `isLoaded` stays false and the section would otherwise show a skeleton forever. Reset when a
+ // load starts or lands, so a retry clears the error. Keyed on the first-page loader only — a
+ // failed `loadMoreReports` keeps the loaded rows, so it must not flag the whole section.
+ reportsLoadFailed: [
+ false,
+ {
+ loadReports: () => false,
+ loadReportsSuccess: () => false,
+ loadReportsFailure: () => true,
+ },
+ ],
+ // How many of the loaded rows this section renders. Reset whenever the list is re-fetched
+ // from the top (first load, refresh, any filter change), so a new query starts short again.
+ visibleCount: [
+ SECTION_PAGE_SIZE,
+ {
+ showMore: (state) => state + SECTION_PAGE_SIZE,
+ loadReports: () => SECTION_PAGE_SIZE,
+ },
+ ],
}),
selectors({
- // The tab's fixed filter merged with the user-driven chrome + reviewer scope (server-side).
+ // The section whose For-you count decides the default scope: Needs a PR under the redesign,
+ // the Pull requests list with the flag off (see `shouldDefaultToEntireProject`).
+ primarySectionKey: [
+ (s) => [s.featureFlags],
+ (featureFlags: FeatureFlagsSet): InboxReportSectionKey =>
+ isInboxRedesignEnabled(featureFlags)
+ ? INBOX_PRIMARY_REPORT_SECTION_KEY
+ : INBOX_LEGACY_PRIMARY_REPORT_SECTION_KEY,
+ ],
+ // The section's fixed filter merged with the user-driven chrome + reviewer scope (server-side).
listApiParams: [
(s) => [
s.searchQuery,
@@ -430,6 +497,26 @@ export const reportListLogic = kea<reportListLogicType>([
(s) => [s.reportsResponse],
(reportsResponse: ReportListResponse | null): SignalReport[] => reportsResponse?.results ?? [],
],
+ // The rows the section actually renders.
+ visibleReports: [
+ (s) => [s.reports, s.visibleCount],
+ (reports: SignalReport[], visibleCount: number): SignalReport[] => reports.slice(0, visibleCount),
+ ],
+ /**
+ * How many matching reports this section is holding back — what "Show more" promises. Reads
+ * the loaded response's own total first so it can't disagree with the rows on screen; the
+ * separately-loaded header count is the fallback while the first page is still in flight.
+ * Subtract the rows actually on screen (`visibleReports.length`), not the window size
+ * (`visibleCount`): "Show more" widens the window past the loaded rows before the next page
+ * lands, so a page still in flight or one that failed to load leaves `visibleCount` ahead of
+ * `reports.length`. Using the window size there would drive this to 0 and unmount the button,
+ * stranding the unloaded rows with no way to retry.
+ */
+ hiddenReportCount: [
+ (s) => [s.totalCount, s.count, s.visibleReports],
+ (totalCount: number | null, count: number | null, visibleReports: SignalReport[]): number =>
+ Math.max(0, (totalCount ?? count ?? 0) - visibleReports.length),
+ ],
hasMore: [
(s) => [s.reportsResponse],
(reportsResponse: ReportListResponse | null): boolean =>
@@ -464,14 +551,15 @@ export const reportListLogic = kea<reportListLogicType>([
}),
listeners(({ actions, values, props }) => ({
- // First For-you count for the Pull requests tab: if the user has no PRs suggested to them,
- // default to Entire project so they don't land on an empty view. Only when they haven't
+ // First For-you count for the primary section: if the user has no reports suggested to
+ // them, default to Entire project so they don't land on an empty inbox. Only when they haven't
// picked a scope themselves, and only once the user's uuid has resolved (so the count is
// genuinely theirs, not an unfiltered project-wide count).
loadCountSuccess: () => {
if (
shouldDefaultToEntireProject({
- tabKey: props.tabKey,
+ sectionKey: props.sectionKey,
+ primarySectionKey: values.primarySectionKey,
scope: values.scope,
hasUserChosenScope: values.hasUserChosenScope,
hasResolvedUser: !!values.user?.uuid,
@@ -491,13 +579,26 @@ export const reportListLogic = kea<reportListLogicType>([
actions.loadMoreReports()
}
},
+ // The reducer has already widened the window. Only reach for another server page when the
+ // window now extends past the rows in hand.
+ showMore: () => {
+ // The reducer already widened the window, so `hidden_count` is what is still held back.
+ captureInboxReportAction({
+ actionType: 'show_more',
+ surface: 'list_row',
+ extra: { section: props.sectionKey, hidden_count: values.hiddenReportCount },
+ })
+ if (values.visibleCount > values.reports.length) {
+ actions.loadMore()
+ }
+ },
refresh: () => {
actions.loadCount()
if (values.isLoaded) {
actions.loadReports()
}
},
- // User-driven filter/scope changes re-fetch the count always, and the contents if this tab is loaded.
+ // User-driven filter/scope changes re-fetch the count always, and the rows if this section is loaded.
setSearchQuery: async (_, breakpoint) => {
await breakpoint(300)
actions.refresh()
@@ -506,6 +607,7 @@ export const reportListLogic = kea<reportListLogicType>([
toggleSourceProduct: () => actions.refresh(),
toggleScout: () => actions.refresh(),
togglePriority: () => actions.refresh(),
+ setPriorityFilter: () => actions.refresh(),
setScope: () => actions.refresh(),
applyDefaultScope: () => actions.refresh(),
setFilters: () => actions.refresh(),
@@ -530,7 +632,7 @@ export const reportListLogic = kea<reportListLogicType>([
}
},
// Restore a suppressed report back to the inbox (transition to `potential`). Optimistically
- // drops it from the Archived list; the report re-enters the pipeline and resurfaces elsewhere.
+ // drops it from Resolved; the report re-enters the pipeline and resurfaces elsewhere.
restoreReport: async ({ reportId }) => {
const report = values.reports.find((r) => r.id === reportId)
actions.removeReport(reportId)
@@ -540,18 +642,18 @@ export const reportListLogic = kea<reportListLogicType>([
captureInboxReportAction({ report, actionType: 'restore', surface: 'list_row' })
lemonToast.success('Report restored to inbox')
// Restore maps through restore_target_status server-side, so a report suppressed while
- // resolved returns to `resolved` and still belongs in this tab. Reconcile against the
- // server rather than trusting the optimistic removal, which over-drops those rows.
+ // resolved returns to `resolved` and still belongs in this section. Reconcile against
+ // the server rather than trusting the optimistic removal, which over-drops those rows.
actions.refresh()
} catch (error: any) {
lemonToast.error(error?.detail || error?.message || 'Failed to restore report')
actions.refresh()
}
},
- // Bulk archive happens in the singleton; refresh this tab once it lands.
+ // Bulk archive happens in the singleton; refresh this section once it lands.
[inboxBulkActionsLogic.actionTypes.bulkDismissSuccess]: () => actions.refresh(),
- // A single report archived elsewhere (e.g. the detail pane) – reconcile this tab against
- // the server so the report leaves Reports/Pull requests and joins Archived, counts included.
+ // A single report archived elsewhere (e.g. the detail pane) – reconcile this section against
+ // the server so the report leaves its section and joins Resolved, counts included.
[inboxBulkActionsLogic.actionTypes.reportArchived]: () => actions.refresh(),
})),
diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
index e2350e069bd8..941efd0b1978 100644
--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts
@@ -3,6 +3,8 @@ import { MOCK_TEAM_ID } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
import { ApiError } from 'lib/api-error'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { initKeaTests } from '~/test/init'
@@ -53,6 +55,13 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {
},
}
+const setRedesignFlag = (enabled: boolean): void => {
+ featureFlagLogic.mount()
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_REDESIGN], {
+ [FEATURE_FLAGS.INBOX_REDESIGN]: enabled,
+ })
+}
+
describe('scoutCreateModalLogic', () => {
let logic: ReturnType<typeof scoutCreateModalLogic.build>
let onClose: jest.MockedFunction<() => void>
@@ -60,6 +69,8 @@ describe('scoutCreateModalLogic', () => {
beforeEach(() => {
initKeaTests()
+ // The prefix-in-the-field form is part of the inbox redesign; the legacy contract is pinned below.
+ setRedesignFlag(true)
mockSignalsScoutCreate.mockReset()
onClose = jest.fn()
onCreated = jest.fn()
@@ -96,7 +107,7 @@ describe('scoutCreateModalLogic', () => {
logic.mount()
expect(logic.values.scoutCreateForm).toEqual({
- name: 'signals-scout-checkout-failures',
+ name: 'checkout-failures',
description: 'Investigates recurring checkout failures.',
body: 'Inspect checkout failure signals and report meaningful regressions.',
dailyTime: '09:00',
@@ -241,8 +252,90 @@ describe('scoutCreateModalLogic', () => {
expect(logic.values.scoutCreateFormManualErrors).toEqual({
name: 'A scout with this name already exists with different instructions.',
})
- expect(logic.values.scoutCreateForm).toMatchObject(initialValues)
+ expect(logic.values.scoutCreateForm).toMatchObject({ ...initialValues, name: 'checkout-failures' })
expect(onCreated).not.toHaveBeenCalled()
expect(onClose).not.toHaveBeenCalled()
})
+
+ it.each([
+ ['', 'Name is required'],
+ ['checkout failures', 'Name cannot contain spaces. Use hyphens between words.'],
+ ['Checkout', 'Lowercase letters, numbers, and hyphens only'],
+ ['checkout-failures', undefined],
+ ['signals-scout-checkout-failures', undefined],
+ ])('validates the typed name %p', async (name, expectedError) => {
+ logic = scoutCreateModalLogic({ logicKey: `name-${name}`, onClose, onCreated })
+ logic.mount()
+
+ logic.actions.setScoutCreateFormValue('name', name)
+
+ await expectLogic(logic).toMatchValues({
+ scoutCreateFormValidationErrors: expect.objectContaining({ name: expectedError }),
+ })
+ })
+
+ it('adds the prefix once, whether or not it was typed', async () => {
+ mockSignalsScoutCreate.mockResolvedValue(CREATED_SCOUT)
+ logic = scoutCreateModalLogic({
+ logicKey: 'pasted-prefix',
+ initialValues: {
+ description: 'Investigates recurring checkout failures.',
+ body: 'Inspect checkout failure signals and report meaningful regressions.',
+ },
+ onClose,
+ onCreated,
+ })
+ logic.mount()
+
+ logic.actions.setScoutCreateFormValue('name', ' signals-scout-checkout-failures ')
+ await expectLogic(logic, () => logic.actions.submitScoutCreateForm()).toFinishAllListeners()
+
+ expect(mockSignalsScoutCreate).toHaveBeenCalledWith(
+ String(MOCK_TEAM_ID),
+ expect.objectContaining({ name: 'signals-scout-checkout-failures' })
+ )
+ })
+
+ // With the redesign flag off the field holds the whole skill name, so the prefix must be typed.
+ describe('with the redesign flag off', () => {
+ beforeEach(() => setRedesignFlag(false))
+
+ it.each([
+ ['checkout-failures', 'Name must start with signals-scout-'],
+ ['signals-scout-checkout-failures', undefined],
+ ])('validates the full name %p', async (name, expectedError) => {
+ logic = scoutCreateModalLogic({ logicKey: `legacy-name-${name}`, onClose, onCreated })
+ logic.mount()
+
+ expect(logic.values.scoutCreateForm.name).toBe('signals-scout-')
+ logic.actions.setScoutCreateFormValue('name', name)
+
+ await expectLogic(logic).toMatchValues({
+ scoutCreateFormValidationErrors: expect.objectContaining({ name: expectedError }),
+ })
+ })
+
+ it('keeps a prefilled full name and submits it unchanged', async () => {
+ mockSignalsScoutCreate.mockResolvedValue(CREATED_SCOUT)
+ logic = scoutCreateModalLogic({
+ logicKey: 'legacy-prefilled',
+ initialValues: {
+ name: 'signals-scout-checkout-failures',
+ description: 'Investigates recurring checkout failures.',
+ body: 'Inspect checkout failure signals and report meaningful regressions.',
+ },
+ onClose,
+ onCreated,
+ })
+ logic.mount()
+
+ expect(logic.values.scoutCreateForm.name).toBe('signals-scout-checkout-failures')
+ await expectLogic(logic, () => logic.actions.submitScoutCreateForm()).toFinishAllListeners()
+
+ expect(mockSignalsScoutCreate).toHaveBeenCalledWith(
+ String(MOCK_TEAM_ID),
+ expect.objectContaining({ name: 'signals-scout-checkout-failures' })
+ )
+ })
+ })
})
diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
index 0c271f891c1c..9c408288c3f4 100644
--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts
@@ -5,6 +5,8 @@ import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from
import { lemonToast } from '@posthog/lemon-ui'
import { ApiError } from 'lib/api-error'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { teamLogic } from 'scenes/teamLogic'
import { signalsScoutCreate } from 'products/signals/frontend/generated/api'
@@ -15,12 +17,14 @@ import type {
} from 'products/signals/frontend/generated/api.schemas'
import { SKILL_DESCRIPTION_MAX_LENGTH, validateSkillName } from 'products/skills/frontend/skillConstants'
+import { isInboxRedesignEnabled } from '../utils/inboxRedesign'
import {
dailyCronToTime,
DEFAULT_SCOUT_DAILY_TIME,
SCOUT_CUSTOM_CRON_SCHEDULE_MODE,
SCOUT_DAILY_AT_SCHEDULE_MODE,
SIGNALS_SCOUT_SKILL_PREFIX,
+ stripScoutPrefix,
timeToDailyCron,
} from '../utils/scoutRunsWindow'
import { MAX_SCOUT_TAG_LENGTH, MAX_SCOUT_TAGS, normalizeScoutTag } from '../utils/scoutTags'
@@ -50,7 +54,7 @@ export interface ScoutCreateModalLogicProps {
}
export const DEFAULT_SCOUT_CREATE_FORM_VALUES: ScoutCreateFormValues = {
- name: SIGNALS_SCOUT_SKILL_PREFIX,
+ name: '',
description: '',
body: '',
dailyTime: DEFAULT_SCOUT_DAILY_TIME,
@@ -64,7 +68,15 @@ export const DEFAULT_SCOUT_CREATE_FORM_VALUES: ScoutCreateFormValues = {
},
}
-export function getScoutCreateFormValues(initialValues?: ScoutCreateInitialValues): ScoutCreateFormValues {
+/**
+ * Under the redesign the form holds the part after `signals-scout-` and the input shows the prefix;
+ * callers (deep links, templates) may pass a full skill name. With the flag off the form holds the
+ * whole skill name, prefix included, as it always did.
+ */
+export function getScoutCreateFormValues(
+ initialValues: ScoutCreateInitialValues | undefined,
+ redesign: boolean
+): ScoutCreateFormValues {
const config = {
...DEFAULT_SCOUT_CREATE_FORM_VALUES.config,
...initialValues?.config,
@@ -72,25 +84,48 @@ export function getScoutCreateFormValues(initialValues?: ScoutCreateInitialValue
return {
...DEFAULT_SCOUT_CREATE_FORM_VALUES,
...initialValues,
+ name: redesign
+ ? stripScoutPrefix((initialValues?.name ?? '').trim())
+ : (initialValues?.name ?? SIGNALS_SCOUT_SKILL_PREFIX),
config,
dailyTime: dailyCronToTime(config.run_cron_schedule) ?? DEFAULT_SCOUT_DAILY_TIME,
}
}
+/**
+ * The skill name a form entry produces: the fixed prefix plus what was typed. A pasted full name
+ * (`signals-scout-foo`) is not doubled up.
+ */
+export function scoutSkillNameFromInput(name: string): string {
+ return `${SIGNALS_SCOUT_SKILL_PREFIX}${stripScoutPrefix(name.trim())}`
+}
+
function isValidScoutDailyTime(dailyTime: string): boolean {
return /^(?:[01]\d|2[0-3]):[0-5]\d$/.test(dailyTime)
}
-function scoutNameError(name: string): string | undefined {
- const normalizedName = name.trim()
- const validationError = validateSkillName(normalizedName)
- if (validationError) {
- return validationError
+function scoutNameError(name: string, redesign: boolean): string | undefined {
+ if (!redesign) {
+ const normalizedName = name.trim()
+ const validationError = validateSkillName(normalizedName)
+ if (validationError) {
+ return validationError
+ }
+ if (!normalizedName.startsWith(SIGNALS_SCOUT_SKILL_PREFIX)) {
+ return `Name must start with ${SIGNALS_SCOUT_SKILL_PREFIX}`
+ }
+ return undefined
}
- if (!normalizedName.startsWith(SIGNALS_SCOUT_SKILL_PREFIX)) {
- return `Name must start with ${SIGNALS_SCOUT_SKILL_PREFIX}`
+ const bareName = stripScoutPrefix(name.trim())
+ if (!bareName) {
+ return 'Name is required'
}
- return undefined
+ // The shared skill-name rule rejects spaces too, but as "lowercase letters, numbers, and hyphens
+ // only", which does not tell someone who typed "checkout failures" what to change.
+ if (/\s/.test(bareName)) {
+ return 'Name cannot contain spaces. Use hyphens between words.'
+ }
+ return validateSkillName(`${SIGNALS_SCOUT_SKILL_PREFIX}${bareName}`)
}
function scoutTagsError(tags: string[]): string | undefined {
@@ -105,6 +140,7 @@ function scoutTagsError(tags: string[]): string | undefined {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface scoutCreateModalLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
currentTeamId: number | null // teamLogic
isScoutCreateFormSubmitting: boolean
isScoutCreateFormValid: boolean
@@ -182,7 +218,7 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
props({} as ScoutCreateModalLogicProps),
key((logicProps) => logicProps.logicKey),
connect(() => ({
- values: [teamLogic, ['currentTeamId']],
+ values: [teamLogic, ['currentTeamId'], featureFlagLogic, ['featureFlags']],
})),
actions({
setScoutCreateScheduleMode: (scheduleMode: string) => ({ scheduleMode }),
@@ -190,7 +226,7 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
}),
forms(({ props: logicProps, actions, values }) => ({
scoutCreateForm: {
- defaults: getScoutCreateFormValues(logicProps.initialValues),
+ defaults: getScoutCreateFormValues(logicProps.initialValues, isInboxRedesignEnabled(values.featureFlags)),
errors: ({ name, description, body, config, dailyTime }) => {
const runIntervalError =
!Number.isFinite(config.run_interval_minutes) ||
@@ -201,7 +237,7 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
const tagsError = scoutTagsError(config.tags)
return {
- name: scoutNameError(name),
+ name: scoutNameError(name, isInboxRedesignEnabled(values.featureFlags)),
description: !description.trim()
? 'Description is required'
: description.length > SKILL_DESCRIPTION_MAX_LENGTH
@@ -226,7 +262,9 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
try {
const scout = await signalsScoutCreate(String(values.currentTeamId), {
- name: formValues.name.trim(),
+ name: isInboxRedesignEnabled(values.featureFlags)
+ ? scoutSkillNameFromInput(formValues.name)
+ : formValues.name.trim(),
description: formValues.description.trim(),
body: formValues.body.trim(),
config: formValues.config,
diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts
index bbeb47e9ab4d..8eea8ba21f87 100644
--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts
+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts
@@ -39,9 +39,11 @@ import {
} from '../inboxAnalytics'
import { SignalScoutRunSummary } from '../types'
import { aiConsentDisabledReason } from '../utils/aiConsent'
-import { compareScoutsByName, scoutGroup, ScoutRosterRow } from '../utils/scoutGroups'
+import { compareScoutsByName, SCOUT_GROUP_ORDER, scoutGroup, ScoutGroupKey, ScoutRosterRow } from '../utils/scoutGroups'
export type ScoutEnabledFilter = 'all' | 'enabled' | 'disabled'
+/** Roster order: A to Z by name, or by lifecycle group so scouts that need a decision lead. */
+export type ScoutRosterSort = 'name' | 'status'
import {
computeFleetSummary,
computeScoutRollups,
@@ -192,6 +194,7 @@ export interface scoutFleetLogicValues {
manualRunScoutIds: string[]
rollups: Map<string, ScoutRollup>
rosterEvaluatedAt: number
+ rosterGroupCounts: Record<ScoutGroupKey, number>
rosterScouts: ScoutRosterRow[]
runningChatType: ScoutChatType | null
runsWindow: {
@@ -206,6 +209,7 @@ export interface scoutFleetLogicValues {
scoutEnabledFilter: ScoutEnabledFilter
scoutMetadata: ScoutMetadataApi | null
scoutMetadataLoading: boolean
+ scoutRosterSort: ScoutRosterSort
scoutRuns: SignalScoutRunSummary[]
scoutRunsLoadedOnce: boolean
scoutRunsLoading: boolean
@@ -339,6 +343,9 @@ export interface scoutFleetLogicActions {
setScoutEnabledFilter: (filter: ScoutEnabledFilter) => {
filter: ScoutEnabledFilter
}
+ setScoutRosterSort: (sort: ScoutRosterSort) => {
+ sort: ScoutRosterSort
+ }
setScoutSearch: (search: string) => {
search: string
}
@@ -399,8 +406,14 @@ export interface scoutFleetLogicMeta {
rosterEvaluatedAt: number,
activeScoutTags: string[],
scoutSearch: string,
- scoutEnabledFilter: ScoutEnabledFilter
+ scoutEnabledFilter: ScoutEnabledFilter,
+ scoutRosterSort: ScoutRosterSort
) => ScoutRosterRow[]
+ rosterGroupCounts: (
+ scoutConfigs: SignalScoutConfigApi[] | null,
+ rollups: Map<string, ScoutRollup>,
+ rosterEvaluatedAt: number
+ ) => Record<ScoutGroupKey, number>
emittedFindingsSummary: (fleetFindingsSummary: FleetFindingsSummaryApi | null) => {
authoredReportCount: number
count: number
@@ -450,6 +463,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
setScoutSearch: (search: string) => ({ search }),
setRosterEvaluatedAt: (evaluatedAt: number) => ({ evaluatedAt }),
setScoutEnabledFilter: (filter: ScoutEnabledFilter) => ({ filter }),
+ setScoutRosterSort: (sort: ScoutRosterSort) => ({ sort }),
// Bulk-applies the roster filters from the URL. Kept out of `actionToUrl` so hydrating from a
// link does not echo the same URL back as a fresh history entry.
hydrateRosterFilters: (search: string, filter: ScoutEnabledFilter, tags: string[]) => ({
@@ -652,6 +666,12 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
hydrateRosterFilters: (_, { filter }) => filter,
},
],
+ scoutRosterSort: [
+ 'name' as ScoutRosterSort,
+ {
+ setScoutRosterSort: (_, { sort }) => sort,
+ },
+ ],
rosterEvaluatedAt: [
0,
{
@@ -781,6 +801,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
s.activeScoutTags,
s.scoutSearch,
s.scoutEnabledFilter,
+ s.scoutRosterSort,
],
(
scoutConfigs: SignalScoutConfig[] | null,
@@ -788,11 +809,12 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
rosterEvaluatedAt: number,
activeScoutTags: string[],
scoutSearch: string,
- scoutEnabledFilter: ScoutEnabledFilter
+ scoutEnabledFilter: ScoutEnabledFilter,
+ scoutRosterSort: ScoutRosterSort
): ScoutRosterRow[] => {
const query = scoutSearch.trim().toLowerCase()
const now = new Date(rosterEvaluatedAt)
- return [...(scoutConfigs ?? [])]
+ const rows = [...(scoutConfigs ?? [])]
.filter((config) => configMatchesScoutTags(config, activeScoutTags))
.filter(
(config) =>
@@ -807,6 +829,37 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
)
.sort(compareScoutsByName)
.map((config) => ({ config, group: scoutGroup(config, rollups.get(config.skill_name), now) }))
+ if (scoutRosterSort === 'status') {
+ // Stable: rows are already A to Z, so scouts in one group keep their name order.
+ rows.sort((a, b) => SCOUT_GROUP_ORDER.indexOf(a.group) - SCOUT_GROUP_ORDER.indexOf(b.group))
+ }
+ return rows
+ },
+ ],
+ /**
+ * Group sizes over the whole fleet, unnarrowed by search — the roster stats state how many
+ * scouts need a decision, and that number must not move as you type into the search box.
+ */
+ rosterGroupCounts: [
+ (s) => [s.scoutConfigs, s.rollups, s.rosterEvaluatedAt],
+ (
+ scoutConfigs: SignalScoutConfig[] | null,
+ rollups: Map<string, ScoutRollup>,
+ rosterEvaluatedAt: number
+ ): Record<ScoutGroupKey, number> => {
+ const now = new Date(rosterEvaluatedAt)
+ const counts: Record<ScoutGroupKey, number> = {
+ needs_you: 0,
+ working: 0,
+ watching: 0,
+ dry_run: 0,
+ settling_in: 0,
+ off: 0,
+ }
+ for (const config of scoutConfigs ?? []) {
+ counts[scoutGroup(config, rollups.get(config.skill_name), now)] += 1
+ }
+ return counts
},
],
// Fleet-wide output tally for the "Scout findings" callout, read from the cheap backend
diff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.ts
index 567578f3ca38..ea6f392d824a 100644
--- a/products/signals/frontend/inbox/types.ts
+++ b/products/signals/frontend/inbox/types.ts
@@ -169,11 +169,30 @@ export const SOURCE_STEERING_KEY = 'steering'
export const SOURCE_DEFAULT_NOT_ACTIONABLE_KEY = 'default_not_actionable'
export const SOURCE_STEERING_MAX_LENGTH = 2000
-// ── Inbox 2.0 IA: tabs + scope ──────────────────────────────────────────────
+// ── Inbox IA: page tabs, report sections, scope ──────────────────────────────
-export type InboxTabKey = 'pulls' | 'reports' | 'scouts' | 'not-actionable' | 'runs' | 'archived' | 'config'
-
-export const INBOX_TAB_KEYS: InboxTabKey[] = [
+/**
+ * The inbox's page-level tabs. Each is a URL segment (`/inbox/<tab>`), so the keys are pinned.
+ * The union covers both inbox layouts: the redesign (`INBOX_TAB_KEYS`, behind
+ * `FEATURE_FLAGS.INBOX_REDESIGN`) and the layout it replaces (`INBOX_LEGACY_TAB_KEYS`). Each
+ * layout redirects the other's segments (see `inboxTabRedirectPath`), so a link made under one
+ * layout still opens under the other.
+ */
+export type InboxTabKey =
+ | 'reports'
+ | 'scouts'
+ | 'settings'
+ | 'pulls'
+ | 'not-actionable'
+ | 'runs'
+ | 'archived'
+ | 'config'
+
+/** The redesign's page tabs. */
+export const INBOX_TAB_KEYS: InboxTabKey[] = ['reports', 'scouts', 'settings']
+
+/** The page tabs with the redesign flag off: one tab per report list, plus Runs and Configuration. */
+export const INBOX_LEGACY_TAB_KEYS: InboxTabKey[] = [
'pulls',
'reports',
'scouts',
@@ -184,9 +203,10 @@ export const INBOX_TAB_KEYS: InboxTabKey[] = [
]
export const INBOX_TAB_LABEL: Record<InboxTabKey, string> = {
- pulls: 'Pull requests',
reports: 'Reports',
scouts: 'Scouts',
+ settings: 'Settings',
+ pulls: 'Pull requests',
'not-actionable': 'Not actionable',
runs: 'Runs',
archived: 'Archive',
@@ -195,9 +215,10 @@ export const INBOX_TAB_LABEL: Record<InboxTabKey, string> = {
/** What each tab holds, surfaced as the scene description while that tab is active so new users can orient themselves. */
export const INBOX_TAB_DESCRIPTION: Record<InboxTabKey, string> = {
- pulls: 'Pull requests agents opened to resolve reports. Review and merge them on GitHub.',
- reports: 'Issues and opportunities agents found in your product data, researched and prioritized for your review.',
+ reports: 'Issues and opportunities found in your product, ready to review.',
scouts: 'Scheduled agents that sweep this project and file what they find.',
+ settings: 'Signal sources, PR generation, code access, and notifications.',
+ pulls: 'Pull requests agents opened to resolve reports. Review and merge them on GitHub.',
'not-actionable':
'Reports judged not actionable because they are too vague, lack supporting evidence, or describe expected behavior.',
runs: 'Project-wide list of agent runs, for debugging.',
@@ -205,6 +226,59 @@ export const INBOX_TAB_DESCRIPTION: Record<InboxTabKey, string> = {
config: 'Set up signal sources, scouts, and how autonomously agents can act.',
}
+/** With the redesign flag off, the Reports tab is only the researched reports, and its description says so. */
+export const INBOX_LEGACY_TAB_DESCRIPTION: Record<InboxTabKey, string> = {
+ ...INBOX_TAB_DESCRIPTION,
+ reports: 'Issues and opportunities agents found in your product data, researched and prioritized for your review.',
+}
+
+/**
+ * The sections of the Reports list, in render order: work waiting on you first, then work waiting
+ * on an agent. Each is a collapsible run of report cards with
+ * its own fixed server filter (see `INBOX_REPORT_SECTION_LIST_PARAMS`), keyed `reportListLogic`
+ * instance, header count, and pagination — the sections stack in one column rather than switching.
+ * pinned: these keys are the `tab` property on the inbox analytics events, the `data-attr` on each
+ * section header, and the keys of the persisted expanded/collapsed state, so they outlive renames of
+ * the labels above them (`needs-decision` is now "Needs a PR", `monitoring` is "Review and merge").
+ */
+export const INBOX_REPORT_SECTION_KEYS = ['monitoring', 'needs-decision', 'resolved', 'not-actionable'] as const
+export type InboxReportSectionKey = (typeof INBOX_REPORT_SECTION_KEYS)[number]
+
+/**
+ * The section the inbox is fundamentally about: what triage mode walks, and the one whose For-you
+ * count decides the default scope.
+ */
+export const INBOX_PRIMARY_REPORT_SECTION_KEY: InboxReportSectionKey = 'needs-decision'
+
+export const INBOX_REPORT_SECTION_LABEL: Record<InboxReportSectionKey, string> = {
+ monitoring: 'Review and merge',
+ 'needs-decision': 'Needs a PR',
+ resolved: 'Resolved',
+ 'not-actionable': 'Not actionable',
+}
+
+/** One line per section, shown under its header while the section is open. */
+export const INBOX_REPORT_SECTION_DESCRIPTION: Record<InboxReportSectionKey, string> = {
+ monitoring: 'Reports with a pull request open, ready for you to review and merge on GitHub.',
+ 'needs-decision': 'Reports an agent can act on that have no pull request yet.',
+ resolved: 'Reports resolved by a merged pull request, and reports you archived.',
+ 'not-actionable':
+ 'Reports judged not actionable because they are too vague, lack supporting evidence, or describe expected behavior.',
+}
+
+/**
+ * Sections only rendered for staff users (internal). Not actionable is an internal triage surface;
+ * every other section is public to any team member.
+ */
+export const INBOX_STAFF_ONLY_REPORT_SECTION_KEYS: InboxReportSectionKey[] = ['not-actionable']
+
+/** Small tag rendered next to a section's label in its header. */
+export const INBOX_REPORT_SECTION_TAG: Partial<Record<InboxReportSectionKey, 'Staff'>> = {
+ 'not-actionable': 'Staff',
+}
+
+// ── Legacy inbox IA (redesign flag off): one tab per report list ─────────────
+
/**
* The Configuration tab holds the agent-setup widgets. It only appears when the scene is too
* narrow for the right-hand setup rail (see `AgentSetupColumn`); on wide viewports the rail
@@ -212,13 +286,7 @@ export const INBOX_TAB_DESCRIPTION: Record<InboxTabKey, string> = {
*/
export const INBOX_CONFIG_TAB_KEY: InboxTabKey = 'config'
-/** Tabs that show a report-count chip. */
-export const INBOX_REPORT_TAB_KEYS: InboxTabKey[] = ['pulls', 'reports', 'not-actionable', 'runs', 'archived']
-
-/**
- * Tabs only visible to staff users (internal). The Not-actionable reports view is an internal
- * triage surface; everything else (including Runs) is public to any team member.
- */
+/** Tabs only visible to staff users (internal), mirroring `INBOX_STAFF_ONLY_REPORT_SECTION_KEYS`. */
export const INBOX_STAFF_ONLY_TAB_KEYS: InboxTabKey[] = ['not-actionable']
/** Small tag rendered next to a tab's label in the tab bar. */
@@ -226,19 +294,35 @@ export const INBOX_TAB_TAG: Partial<Record<InboxTabKey, 'Staff' | 'Alpha'>> = {
'not-actionable': 'Staff',
}
-/** The flat report-list tabs that share the keyed reportListLogic + InboxReportList primitive. */
+/** The flat report-list tabs that share the keyed `reportListLogic` + `InboxReportList` primitive. */
export const INBOX_FLAT_LIST_TAB_KEYS = ['pulls', 'reports', 'not-actionable', 'archived'] as const
export type InboxFlatListTabKey = (typeof INBOX_FLAT_LIST_TAB_KEYS)[number]
-export interface InboxTabCounts {
- pulls: number
- reports: number
- 'not-actionable': number
- runs: number
- archived: number
+/**
+ * Each legacy report tab shows exactly one of the redesign's sections, with the same server filter.
+ * Both layouts share the keyed `reportListLogic` instances through this map, so a report loaded
+ * under one layout is found by the other and the mount-time count loaders are not duplicated.
+ */
+export const INBOX_LEGACY_TAB_SECTION: Record<InboxFlatListTabKey, InboxReportSectionKey> = {
+ pulls: 'monitoring',
+ reports: 'needs-decision',
+ 'not-actionable': 'not-actionable',
+ archived: 'resolved',
+}
+
+/** The inverse of `INBOX_LEGACY_TAB_SECTION`: the legacy tab that lists a section's reports. */
+export const INBOX_SECTION_LEGACY_TAB: Record<InboxReportSectionKey, InboxFlatListTabKey> = {
+ monitoring: 'pulls',
+ 'needs-decision': 'reports',
+ 'not-actionable': 'not-actionable',
+ resolved: 'archived',
}
-export const EMPTY_TAB_COUNTS: InboxTabCounts = { pulls: 0, reports: 0, 'not-actionable': 0, runs: 0, archived: 0 }
+/**
+ * The legacy counterpart of `INBOX_PRIMARY_REPORT_SECTION_KEY`: the Pull requests tab is the one
+ * whose For-you count decides the default scope with the flag off.
+ */
+export const INBOX_LEGACY_PRIMARY_REPORT_SECTION_KEY: InboxReportSectionKey = 'monitoring'
/** `for-you` (suggested-reviewer reports), `entire-project` (all), or `teammate:<uuid>`. */
export type InboxScope = 'for-you' | 'entire-project' | `teammate:${string}`
diff --git a/products/signals/frontend/inbox/utils/inboxRedesign.ts b/products/signals/frontend/inbox/utils/inboxRedesign.ts
new file mode 100644
index 000000000000..cc09c958a9ce
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/inboxRedesign.ts
@@ -0,0 +1,11 @@
+import { FEATURE_FLAGS } from 'lib/constants'
+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
+
+/**
+ * Whether the inbox shows the redesign (report sections, triage mode, the Settings tab, scout
+ * cards) or the layout it replaces. One reader for every logic, so the flag key is written once.
+ * Components read the same flag through `useFeatureFlag('INBOX_REDESIGN')`.
+ */
+export function isInboxRedesignEnabled(featureFlags: FeatureFlagsSet): boolean {
+ return !!featureFlags[FEATURE_FLAGS.INBOX_REDESIGN]
+}
diff --git a/products/signals/frontend/inbox/utils/inboxReportUrls.test.ts b/products/signals/frontend/inbox/utils/inboxReportUrls.test.ts
new file mode 100644
index 000000000000..6dda8b231275
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/inboxReportUrls.test.ts
@@ -0,0 +1,54 @@
+import { urls } from 'scenes/urls'
+
+import { inboxReportDetailUrl, inboxTabRedirectPath } from './inboxReportUrls'
+
+describe('inbox report urls', () => {
+ describe('inboxReportDetailUrl', () => {
+ it('links straight to the report from inside the inbox', () => {
+ expect(inboxReportDetailUrl('r1')).toBe(urls.inboxReport('reports', 'r1'))
+ })
+
+ it('carries the return path for a card embedded outside the inbox', () => {
+ expect(inboxReportDetailUrl('r1', '/customers')).toBe(
+ `${urls.inboxReport('reports', 'r1')}?back=%2Fcustomers`
+ )
+ })
+
+ it('addresses the report through its legacy tab when asked', () => {
+ expect(inboxReportDetailUrl('r1', undefined, 'pulls')).toBe(urls.inboxReport('pulls', 'r1'))
+ })
+ })
+
+ // Slack notifications and bookmarks carry whichever tab segments were live when they were
+ // written, and the flag can flip between visits, so each layout redirects the other's segments.
+ describe('inboxTabRedirectPath', () => {
+ it.each<[string | undefined, string | null]>([
+ // The three old report lists are sections of one list now, so they all land on it.
+ ['pulls', urls.inbox('reports')],
+ ['archived', urls.inbox('reports')],
+ ['not-actionable', urls.inbox('reports')],
+ ['runs', urls.inboxRuns()],
+ ['config', urls.inbox('settings')],
+ // Live segments and bare report ids are left for their own route handlers.
+ ['reports', null],
+ ['scouts', null],
+ ['settings', null],
+ ['0198a1b2-report-id', null],
+ [undefined, null],
+ ])('under the redesign maps %s', (tab, path) => {
+ expect(inboxTabRedirectPath(tab, true)).toBe(path)
+ })
+
+ it.each<[string | undefined, string | null]>([
+ ['settings', urls.inbox('config')],
+ ['pulls', null],
+ ['config', null],
+ ['runs', null],
+ ['reports', null],
+ ['0198a1b2-report-id', null],
+ [undefined, null],
+ ])('with the flag off maps %s', (tab, path) => {
+ expect(inboxTabRedirectPath(tab, false)).toBe(path)
+ })
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/inboxReportUrls.ts b/products/signals/frontend/inbox/utils/inboxReportUrls.ts
new file mode 100644
index 000000000000..c5961f77b08f
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/inboxReportUrls.ts
@@ -0,0 +1,45 @@
+import { combineUrl } from 'kea-router'
+
+import { urls } from 'scenes/urls'
+
+import { InboxTabKey } from '../types'
+
+/**
+ * A report's detail URL, with an optional `back` path for surfaces outside the inbox that embed
+ * report cards (the detail header reads it to label its back button). Under the redesign the
+ * Reports list is one column of sections, so `tab` stays `reports` and back always lands where the
+ * card was; the legacy layout addresses the report through the tab that listed it.
+ */
+export function inboxReportDetailUrl(reportId: string, backUrl?: string, tab: InboxTabKey = 'reports'): string {
+ return backUrl
+ ? combineUrl(urls.inboxReport(tab, reportId), { back: backUrl }).url
+ : urls.inboxReport(tab, reportId)
+}
+
+/**
+ * Where an `/inbox/<tab>` segment from the other inbox layout lands, or null for a segment the
+ * current layout serves itself. Slack notifications, bookmarks, and links from other products
+ * carry whichever segments were live when they were written, and the flag can flip between
+ * visits, so each layout owns a redirect for the other's segments.
+ *
+ * Under the redesign the three old report lists (`pulls`, `archived`, `not-actionable`) are
+ * sections of one list, so they all resolve to it. With the flag off, the redesign's Settings
+ * tab is the Configuration tab.
+ */
+export function inboxTabRedirectPath(tab: string | undefined, redesign: boolean): string | null {
+ if (!redesign) {
+ return tab === 'settings' ? urls.inbox('config') : null
+ }
+ switch (tab) {
+ case 'pulls':
+ case 'archived':
+ case 'not-actionable':
+ return urls.inbox('reports')
+ case 'runs':
+ return urls.inboxRuns()
+ case 'config':
+ return urls.inbox('settings')
+ default:
+ return null
+ }
+}
diff --git a/products/signals/frontend/inbox/utils/reportPresentation.test.ts b/products/signals/frontend/inbox/utils/reportPresentation.test.ts
new file mode 100644
index 000000000000..14bb1425475f
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportPresentation.test.ts
@@ -0,0 +1,24 @@
+import { parsePrUrlParts } from './reportPresentation'
+
+describe('parsePrUrlParts', () => {
+ it('parses a canonical GitHub PR URL', () => {
+ expect(parsePrUrlParts('https://github.com/PostHog/posthog/pull/123/files')).toEqual({
+ owner: 'PostHog',
+ repo: 'posthog',
+ number: '123',
+ repoSlug: 'PostHog/posthog',
+ })
+ })
+
+ // `implementation_pr_url` is task-run output, so a PR-shaped path on any other host must not
+ // become an "Open in GitHub" action.
+ it.each([
+ ['another host', 'https://evil.example/PostHog/posthog/pull/123'],
+ ['a host that starts with github.com', 'https://github.com.evil.example/PostHog/posthog/pull/123'],
+ ['plain http', 'http://github.com/PostHog/posthog/pull/123'],
+ ['a GitHub path that is not a pull request', 'https://github.com/PostHog/posthog/issues/123'],
+ ['a bare PR reference', 'PostHog/posthog#123'],
+ ])('rejects %s', (_name, url) => {
+ expect(parsePrUrlParts(url)).toBeNull()
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/reportPresentation.ts b/products/signals/frontend/inbox/utils/reportPresentation.ts
index 7bd6f9591fd8..798abc221dd4 100644
--- a/products/signals/frontend/inbox/utils/reportPresentation.ts
+++ b/products/signals/frontend/inbox/utils/reportPresentation.ts
@@ -93,10 +93,18 @@ export interface ParsedPrUrlParts {
repoSlug: string
}
-/** Parse a canonical GitHub PR URL into its owner / repo / number / repoSlug parts. */
+/**
+ * Parse a canonical GitHub PR URL (`https://github.com/<owner>/<repo>/pull/<number>`) into its parts.
+ * Any other host returns null: `implementation_pr_url` comes from task-run output, so a PR-shaped path
+ * on an arbitrary host would otherwise let a task label an attacker's site "Open in GitHub".
+ */
export function parsePrUrlParts(prUrl: string): ParsedPrUrlParts | null {
try {
- const match = new URL(prUrl).pathname.match(PR_URL_PATH)
+ const url = new URL(prUrl)
+ if (url.protocol !== 'https:' || url.hostname !== 'github.com') {
+ return null
+ }
+ const match = url.pathname.match(PR_URL_PATH)
if (!match) {
return null
}
diff --git a/products/signals/frontend/inbox/utils/reportSummary.test.ts b/products/signals/frontend/inbox/utils/reportSummary.test.ts
new file mode 100644
index 000000000000..95031f0abfc7
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportSummary.test.ts
@@ -0,0 +1,91 @@
+import { parseReportSummary } from './reportSummary'
+
+describe('parseReportSummary', () => {
+ const PROMPT_SHAPED =
+ 'Users on the key form hit a dead button.\n\n' +
+ '## Problem\n\nThe click handler returns early.\n\n' +
+ '## Impact\n\n**1,410 users** in 28 hours.\n\n[Dead clicks](chart:dead-clicks)\n\n' +
+ '## Solution\n\nSet the errors before the return.'
+
+ it('splits the lead and the prompt sections, keeping each body offset into the source', () => {
+ const parsed = parseReportSummary(PROMPT_SHAPED)
+
+ expect(parsed.lead).toEqual('Users on the key form hit a dead button.')
+ expect(parsed.sections.map((section) => [section.kind, section.heading, section.body])).toEqual([
+ ['problem', 'Problem', 'The click handler returns early.'],
+ ['impact', 'Impact', '**1,410 users** in 28 hours.\n\n[Dead clicks](chart:dead-clicks)'],
+ ['solution', 'Solution', 'Set the errors before the return.'],
+ ])
+ for (const section of parsed.sections) {
+ expect(PROMPT_SHAPED.slice(section.bodyOffset, section.bodyOffset + section.body.length)).toEqual(
+ section.body
+ )
+ }
+ })
+
+ it.each([
+ ['## Fix', 'solution', 'Solution'],
+ ['## Recommended fix:', 'solution', 'Solution'],
+ ['### The problem', 'problem', 'Problem'],
+ ['## Next steps', 'other', 'Next steps'],
+ ])('maps the heading %s to the %s section', (heading, kind, label) => {
+ const [section] = parseReportSummary(`Lead.\n\n${heading}\n\nBody.`).sections
+
+ expect(section).toMatchObject({ kind, heading: label, body: 'Body.' })
+ })
+
+ it('returns the whole summary as the lead when there are no headings', () => {
+ // Scout-authored and hand-edited summaries do not promise the prompt's headings.
+ const summary = 'Signups fell 40%.\n\nRecommend: roll back the flag.'
+
+ expect(parseReportSummary(summary)).toEqual({ lead: summary, leadOffset: 0, sections: [] })
+ })
+
+ it('offsets the lead past leading whitespace so an inline chart still resolves', () => {
+ // A pipeline-written summary can open with a newline. The lead is trimmed for display, but its
+ // offset must point past that whitespace, or a chart placement (keyed on the untrimmed
+ // summary) misses and the chart renders nowhere.
+ const noHeadings = parseReportSummary('\n\nSignups fell. [Chart][c]\n\n[c]: chart:signups')
+ expect(noHeadings.leadOffset).toBe(2)
+ expect(noHeadings.lead).toEqual('Signups fell. [Chart][c]\n\n[c]: chart:signups')
+
+ const withSection = parseReportSummary(' Lead line.\n\n## Impact\n\nBody.')
+ expect(withSection.leadOffset).toBe(2)
+ expect(withSection.lead).toEqual('Lead line.')
+ })
+
+ it.each([
+ // H4 is past the section-heading cap, so it never opens a section.
+ ['## Problem', '#### Detail\n\nMore.'],
+ // An H3 nested under an H2 section is a subheading, not a peer section. Splitting it out would
+ // also push the Create PR action (rendered at the end of the solution section) above it.
+ ['## Solution', '### Rollout\n\nShip behind a flag.'],
+ ])('keeps a deeper heading inside the %s section body', (sectionHeading, deeperBlock) => {
+ const sections = parseReportSummary(`Lead.\n\n${sectionHeading}\n\n${deeperBlock}`).sections
+
+ expect(sections).toHaveLength(1)
+ expect(sections[0].body).toEqual(deeperBlock)
+ })
+
+ it('keeps recognized sections that follow a shallower heading', () => {
+ // A stray shallower heading (e.g. a document title) must not swallow the recognized sections
+ // below it: Problem and Solution are named sections, so they still split into their own.
+ const parsed = parseReportSummary('Lead.\n\n# Report\n\n## Problem\n\nA.\n\n## Solution\n\nB.')
+
+ expect(parsed.sections.map((section) => section.kind)).toEqual(['other', 'problem', 'solution'])
+ })
+
+ it('appends reference definitions to every slice so chart links still resolve', () => {
+ const summary = 'Lead [Daily][d].\n\n## Impact\n\n[Daily][d]\n\n[d]: chart:daily'
+ const parsed = parseReportSummary(summary)
+
+ expect(parsed.lead).toEqual('Lead [Daily][d].\n\n[d]: chart:daily')
+ expect(parsed.sections[0].body).toEqual('[Daily][d]\n\n[d]: chart:daily')
+ expect(summary.slice(parsed.sections[0].bodyOffset)).toMatch(/^\[Daily\]\[d\]/)
+ })
+
+ it('treats an empty or missing summary as an empty lead', () => {
+ expect(parseReportSummary(null)).toEqual({ lead: '', leadOffset: 0, sections: [] })
+ expect(parseReportSummary(' \n')).toEqual({ lead: '', leadOffset: 0, sections: [] })
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/reportSummary.ts b/products/signals/frontend/inbox/utils/reportSummary.ts
new file mode 100644
index 000000000000..5fdfa3e1ac28
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportSummary.ts
@@ -0,0 +1,143 @@
+// Splits a report summary into the sections the research prompt asks for: a one-sentence lead
+// before any heading, then `## Problem`, `## Impact`, and `## Solution`. The structure is a prompt
+// convention, not a schema: scout-authored summaries, user edits, and appended notes can all skip
+// the headings, so a summary without any renders whole through `lead` and an empty `sections`.
+//
+// Parsed with mdast rather than a line regex for the same reason as `chartPlacement`: the renderer
+// resolves `chart:` references by their offset into the raw summary, so each section carries the
+// offset its body starts at and the body is a verbatim slice of the source.
+
+import { fromMarkdown } from 'mdast-util-from-markdown'
+
+export type ReportSummarySectionKind = 'problem' | 'impact' | 'solution' | 'other'
+
+export interface ReportSummarySection {
+ kind: ReportSummarySectionKind
+ /** Heading as shown. Known kinds use the canonical label; others keep the author's text. */
+ heading: string
+ /** Raw markdown under the heading, trimmed. */
+ body: string
+ /** Offset of `body` in the full summary, so chart placements resolve against the original. */
+ bodyOffset: number
+}
+
+export interface ParsedReportSummary {
+ /** Markdown before the first heading, trimmed. The whole summary when there are no headings. */
+ lead: string
+ /** Offset of `lead` in the full summary, so chart placements resolve against the original. */
+ leadOffset: number
+ sections: ReportSummarySection[]
+}
+
+const SECTION_LABELS: Record<Exclude<ReportSummarySectionKind, 'other'>, string> = {
+ problem: 'Problem',
+ impact: 'Impact',
+ solution: 'Solution',
+}
+
+// The prompt says `## Solution`; the aliases cover the phrasings models and people drift to.
+const SECTION_KINDS: Record<string, Exclude<ReportSummarySectionKind, 'other'>> = {
+ problem: 'problem',
+ 'the problem': 'problem',
+ impact: 'impact',
+ solution: 'solution',
+ fix: 'solution',
+ 'the fix': 'solution',
+ 'proposed fix': 'solution',
+ 'recommended fix': 'solution',
+ recommendation: 'solution',
+}
+
+function headingText(node: any): string {
+ const collect = (child: any): string =>
+ typeof child?.value === 'string' ? child.value : (child?.children ?? []).map(collect).join('')
+ return collect(node).trim().replace(/:$/, '').trim()
+}
+
+function sectionKind(heading: string): ReportSummarySectionKind {
+ return SECTION_KINDS[heading.toLowerCase()] ?? 'other'
+}
+
+/**
+ * Definitions (`[id]: chart:x`) resolve anywhere in the summary, so a slice that doesn't already hold
+ * one gets it appended. Appending keeps the offsets of everything before it intact.
+ */
+function withDefinitions(summary: string, children: any[], body: string, start: number, end: number): string {
+ const missing = children
+ .filter((node) => node?.type === 'definition' && node.position)
+ .filter((node) => node.position.start.offset < start || node.position.start.offset >= end)
+ .map((node) => summary.slice(node.position.start.offset, node.position.end.offset))
+ return missing.length > 0 && body ? `${body}\n\n${missing.join('\n')}` : body
+}
+
+/** Leading whitespace trimmed with the offset moved past it, so `bodyOffset` still lands on the body. */
+function trimmedSlice(summary: string, start: number, end: number): { text: string; offset: number } {
+ const raw = summary.slice(start, end)
+ const leading = raw.length - raw.trimStart().length
+ return { text: raw.trim(), offset: start + leading }
+}
+
+export function parseReportSummary(summary: string | null | undefined): ParsedReportSummary {
+ const source = typeof summary === 'string' ? summary : ''
+ // `leadOffset` points the renderer past any leading whitespace: chart placements are keyed on
+ // offsets into the untrimmed summary, but `lead` is trimmed for display. Zero when the lead is
+ // empty — there is nothing to place a chart against.
+ const leadSlice = trimmedSlice(source, 0, source.length)
+ const whole: ParsedReportSummary = {
+ lead: leadSlice.text,
+ leadOffset: leadSlice.text ? leadSlice.offset : 0,
+ sections: [],
+ }
+ if (!whole.lead) {
+ return whole
+ }
+
+ let children: any[]
+ try {
+ children = fromMarkdown(source).children ?? []
+ } catch {
+ return whole
+ }
+
+ // A heading splits the summary into sections when it names a recognized section (Problem /
+ // Impact / Solution and their aliases) or sits at or above the depth of the section already open.
+ // An unrecognized, deeper heading — e.g. `### Rollout` under `## Solution` — is a subheading, so
+ // it stays inside the current section's body. Headings past depth 3 never split (H4+ stay in a body).
+ const headingIndexes: number[] = []
+ let openDepth = Number.POSITIVE_INFINITY
+ children.forEach((node, index) => {
+ if (node?.type !== 'heading' || node.depth > 3 || !node.position) {
+ return
+ }
+ if (sectionKind(headingText(node)) !== 'other' || node.depth <= openDepth) {
+ headingIndexes.push(index)
+ openDepth = node.depth
+ }
+ })
+ if (headingIndexes.length === 0) {
+ return whole
+ }
+
+ const leadEnd = children[headingIndexes[0]].position.start.offset
+ const lead = trimmedSlice(source, 0, leadEnd)
+ const sections = headingIndexes.map((headingIndex, position): ReportSummarySection => {
+ const heading = headingText(children[headingIndex])
+ const kind = sectionKind(heading)
+ const bodyStart = children[headingIndex].position.end.offset
+ const next = headingIndexes[position + 1]
+ const bodyEnd = next === undefined ? source.length : children[next].position.start.offset
+ const body = trimmedSlice(source, bodyStart, bodyEnd)
+ return {
+ kind,
+ heading: kind === 'other' ? heading : SECTION_LABELS[kind],
+ body: withDefinitions(source, children, body.text, bodyStart, bodyEnd),
+ bodyOffset: body.offset,
+ }
+ })
+
+ return {
+ lead: withDefinitions(source, children, lead.text, 0, leadEnd),
+ leadOffset: lead.text ? lead.offset : 0,
+ sections,
+ }
+}
diff --git a/products/signals/frontend/inbox/utils/signalLinks.test.ts b/products/signals/frontend/inbox/utils/signalLinks.test.ts
new file mode 100644
index 000000000000..ee866d2d2cde
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/signalLinks.test.ts
@@ -0,0 +1,53 @@
+import { genericSignalLink } from './signalLinks'
+
+describe('genericSignalLink', () => {
+ it.each([
+ {
+ name: 'links a PostHog entity from source_product + source_id before any URL on extra',
+ signal: {
+ source_product: 'error_tracking',
+ source_id: 'issue-1',
+ extra: { url: 'https://example.com/elsewhere' },
+ },
+ expected: { to: '/error_tracking/issue-1', label: 'View issue', external: false },
+ },
+ {
+ name: 'links the logs scene without an entity id',
+ signal: { source_product: 'logs', source_id: '', extra: {} },
+ expected: { to: '/logs', label: 'View logs', external: false },
+ },
+ {
+ name: 'prefers html_url over url on extra',
+ signal: {
+ source_product: 'github',
+ source_id: '42',
+ extra: {
+ url: 'https://api.github.com/repos/o/r/issues/42',
+ html_url: 'https://github.com/o/r/issues/42',
+ },
+ },
+ expected: { to: 'https://github.com/o/r/issues/42', label: 'View in GitHub', external: true },
+ },
+ {
+ name: 'humanizes a source product that has no filter option',
+ signal: {
+ source_product: 'sentry',
+ source_id: 's-1',
+ extra: { url: 'https://sentry.example.com/issues/1' },
+ },
+ expected: { to: 'https://sentry.example.com/issues/1', label: 'View in Sentry', external: true },
+ },
+ {
+ name: 'ignores a relative path on extra',
+ signal: { source_product: 'jira', source_id: 'J-1', extra: { url: '/browse/J-1' } },
+ expected: null,
+ },
+ {
+ name: 'returns null when nothing links',
+ signal: { source_product: 'jira', source_id: 'J-1', extra: {} },
+ expected: null,
+ },
+ ])('$name', ({ signal, expected }) => {
+ expect(genericSignalLink(signal as any)).toEqual(expected)
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/signalLinks.ts b/products/signals/frontend/inbox/utils/signalLinks.ts
new file mode 100644
index 000000000000..78806e3e88cc
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/signalLinks.ts
@@ -0,0 +1,74 @@
+import { identifierToHuman } from 'lib/utils/strings'
+import { urls } from 'scenes/urls'
+
+import { INBOX_SOURCE_OPTIONS } from '../filterOptions'
+import { safeHttpUrl } from './reportPresentation'
+
+/**
+ * Deep link into the PostHog product an entity came from, or null when the product has no entity
+ * page or the entity id is missing. `logs` has no per-entity page, so it links to the logs scene.
+ */
+export function signalEntityUrl(sourceProduct: string, entityId?: string | null): string | null {
+ switch (sourceProduct) {
+ case 'error_tracking':
+ return entityId ? urls.errorTrackingIssue(entityId) : null
+ case 'session_replay':
+ return entityId ? urls.replaySingle(entityId) : null
+ case 'llm_analytics':
+ return entityId ? urls.aiObservabilityTrace(entityId) : null
+ case 'logs':
+ return urls.logs()
+ default:
+ return null
+ }
+}
+
+const ENTITY_LINK_LABELS: Record<string, string> = {
+ error_tracking: 'View issue',
+ session_replay: 'View replay',
+ llm_analytics: 'View trace',
+ logs: 'View logs',
+}
+
+/** Keys emitters use for the object's own web address, in preference order. */
+const EXTRA_URL_KEYS = ['html_url', 'url', 'web_url', 'permalink', 'link'] as const
+
+export interface SignalLink {
+ to: string
+ label: string
+ /** True for a link that leaves PostHog, so callers open it in a new tab. */
+ external: boolean
+}
+
+function sourceProductLabel(sourceProduct: string): string {
+ return (
+ INBOX_SOURCE_OPTIONS.find((option) => option.value === sourceProduct)?.label ?? identifierToHuman(sourceProduct)
+ )
+}
+
+/**
+ * Best available link for a signal that has no dedicated card, or whose `extra` doesn't satisfy
+ * that card's guard: a PostHog entity page from `(source_product, source_id)` first, then an
+ * http(s) URL the emitter put on `extra`. Relative paths on `extra` are ignored because, without
+ * a product to anchor them, there is no way to tell a real route from an emitter's internal key.
+ */
+export function genericSignalLink(signal: {
+ source_product: string
+ source_id: string
+ extra: unknown
+}): SignalLink | null {
+ const entityUrl = signalEntityUrl(signal.source_product, signal.source_id)
+ if (entityUrl) {
+ return { to: entityUrl, label: ENTITY_LINK_LABELS[signal.source_product] ?? 'View', external: false }
+ }
+ const extra =
+ typeof signal.extra === 'object' && signal.extra !== null ? (signal.extra as Record<string, unknown>) : {}
+ for (const key of EXTRA_URL_KEYS) {
+ const candidate = extra[key]
+ const url = typeof candidate === 'string' ? safeHttpUrl(candidate) : null
+ if (url) {
+ return { to: url, label: `View in ${sourceProductLabel(signal.source_product)}`, external: true }
+ }
+ }
+ return null
+}
diff --git a/products/signals/manifest.tsx b/products/signals/manifest.tsx
index 0111e23206e8..175f3e48f277 100644
--- a/products/signals/manifest.tsx
+++ b/products/signals/manifest.tsx
@@ -4,9 +4,11 @@ import type { InboxTabKey } from './frontend/inbox/types'
export const manifest: ProductManifest = {
name: 'Signals',
urls: {
- // Inbox 2.0 tab-first routing: /inbox, /inbox/<tab>, /inbox/<tab>/<reportId>.
+ // Tab-first routing: /inbox, /inbox/<tab>, /inbox/<tab>/<reportId>.
inbox: (tab?: InboxTabKey | ':tab'): string => `/inbox${tab ? `/${tab}` : ''}`,
inboxReport: (tab: InboxTabKey | ':tab', reportId: string | ':reportId'): string => `/inbox/${tab}/${reportId}`,
+ // Triage mode: the Needs-a-decision queue one report at a time, full-width over the list.
+ inboxTriage: (): string => '/inbox/reports/triage',
// Scout detail surface, full-width over the inbox list (the fleet section lives in the Configuration tab).
// An optional finding id deep-links straight to one emitted finding (best-effort: only resolves while
// that finding is still in the scout's recent runs window).
@@ -20,6 +22,8 @@ export const manifest: ProductManifest = {
inboxScratchpad: (): string => '/inbox/scouts/scratchpad',
// Cross-fleet findings browse/search surface, reached from the scout-findings callout.
inboxFindings: (): string => '/inbox/scouts/findings',
+ // Project-wide list of scout and signal-pipeline runs, reached from the roster footer.
+ inboxRuns: (): string => '/inbox/scouts/runs',
},
scenes: {
Inbox: {
@@ -32,9 +36,11 @@ export const manifest: ProductManifest = {
routes: {
'/inbox': ['Inbox', 'inbox'],
'/inbox/:tab': ['Inbox', 'inbox'],
- // Static memory and findings routes, registered before `:skillName` so they aren't read as scout names.
+ // Static panel routes, registered before `:skillName` / `:reportId` so they aren't read as ids.
'/inbox/scouts/scratchpad': ['Inbox', 'inbox'],
'/inbox/scouts/findings': ['Inbox', 'inbox'],
+ '/inbox/scouts/runs': ['Inbox', 'inbox'],
+ '/inbox/reports/triage': ['Inbox', 'inbox'],
// Registered before the generic report route: both are two-segment `/inbox/x/y` shapes.
'/inbox/scouts/:skillName': ['Inbox', 'inbox'],
// Deep-link to a single scout finding: the bare scout route plus a trailing `/<finding>` segment.
diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.json
index ce826ed403f7..64e7473ecee4 100644
--- a/services/mcp/src/tools/links/app-url-manifest.json
+++ b/services/mcp/src/tools/links/app-url-manifest.json
@@ -824,6 +824,11 @@
"params": ["tab", "reportId"],
"scope": "project"
},
+ "inboxRuns": {
+ "template": "/inbox/scouts/runs",
+ "params": [],
+ "scope": "project"
+ },
"inboxScout": {
"template": "/inbox/scouts/{skillName}",
"params": ["skillName"],
@@ -834,6 +839,11 @@
"params": [],
"scope": "project"
},
+ "inboxTriage": {
+ "template": "/inbox/reports/triage",
+ "params": [],
+ "scope": "project"
+ },
"ingestionWarnings": {
"template": "/data-management/ingestion-warnings",
"params": [],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
index a2e1f4dfe878..52ce6e63f842 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
@@ -13,7 +13,7 @@
"type": "object"
},
"url": {
- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/button-tiles/{buttonTileId}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/text-tiles/{textTileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/comments\n/data-management/comments/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/scouts/findings\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/actions/{actionId}\n/replay-vision/actions/{actionId}/edit\n/replay-vision/actions/{actionId}/runs/{runId}\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay-vision/{scannerId}/actions/new\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/bots\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/button-tiles/{buttonTileId}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/text-tiles/{textTileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/comments\n/data-management/comments/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/actions/{actionId}\n/replay-vision/actions/{actionId}/edit\n/replay-vision/actions/{actionId}/runs/{runId}\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay-vision/{scannerId}/actions/new\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/bots\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
"type": "string"
}
},