:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): configure extra repositories for implementation tasks (#120436)
posthog[bot]a11ff6d1b3b8
diff --git a/docs/internal/task-run-api.md b/docs/internal/task-run-api.mdindex 79f6f95190f1..a7f51eb59166 100644--- a/docs/internal/task-run-api.md+++ b/docs/internal/task-run-api.md@@ -69,7 +69,11 @@ Run responses omit internal cost accounting, including gateway request IDs.GitHub credentials that require user action fail the run without retrying. Fresh runs and resumed sandboxes preserve the actionable error, and Temporal does not report these expected failures to error tracking.-Sandbox GitHub tokens are scoped to the repositories requested by the run. When GitHub rejects a repository scope, the run refreshes installation access and resolves renamed repositories by their GitHub ID. Public repositories outside the installation can be cloned anonymously; private or missing repositories require the user to check repository access. Public-only access results are cached for five minutes before checking again. GitHub outages and connection failures remain retryable, including failures during token refresh.+Sandbox GitHub tokens are scoped to the repositories requested by the run.+A self-driving implementation run also gets the project's extra implementation repositories that share the selected repository's owner.+The server stores that list in `github_access_repositories` at creation and keeps it on resume.+Run state updates cannot change it, and the run does not clone those repositories.+When GitHub rejects a repository scope, the run refreshes installation access and resolves renamed repositories by their GitHub ID. Public repositories outside the installation can be cloned anonymously; private or missing repositories require the user to check repository access. Public-only access results are cached for five minutes before checking again. GitHub outages and connection failures remain retryable, including failures during token refresh.Without an authenticated GitHub token, the agent can still read public repositories and repository files already in its workspace. It asks the user to connect GitHub when the work requires unavailable private repository or publishing access.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a5459cadd6b5..9ab236cbe129 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12479,9 +12479,9 @@ snapshots:scenes-app-inbox-scene--self-driving-verdict-pending--light:hash: v1.k794b7964.96cdbec6c78e8daedb06be4a0134093efcd5838af69e6e7d1722a3892cf561b5.iJ2K0zNhOVgGAPY6JvduyhDBODMwk-CN7_mAdB8scOgscenes-app-inbox-scene--settings--dark:- hash: v1.k794b7964.ba567cdfc6668f7a66217fc8da3c6faacea2a6e4c2e37986d35a86836a26b1f3.XazbMGtvFuUWHEdboMaSAp-s17euAesrh6MsHEWKnss+ hash: v1.k794b7964.5d3b14a70ad66dedc5721197efa5c943c48fc310a9478e0c6503d83512a54e4e.ngvR1B3bnYaXytKq3W2S1ZkF6WGbJG_ckRXFK-UDhToscenes-app-inbox-scene--settings--light:- hash: v1.k794b7964.28302953284a52a8528b3d1efcb4f2ad18810c5ce2e49b1ed3fd7e5ab47b96af.soB1jj05zglX_rXQ45t0UioivW6Ezm05GH9AtT5j7vQ+ hash: v1.k794b7964.72906ad9972deb6b3c3492dfd2f655779c81c807116713eefa82b5ff46adc1ae.mnAqR8rp5r7-h801X12KN_IpMZSXFLHI4eqOjyW0xVIscenes-app-inbox-scene--triage--dark:hash: v1.k794b7964.77e43b36fdcd81befecf4de80e489050f525840924ec6ddef37c23a9179dbe8a.B3qkZFYBncFaPn2EBg4cBoYu_LIwW29imNwBdLXF5eoscenes-app-inbox-scene--triage--light:@@ -12975,73 +12975,77 @@ snapshots:scenes-app-inbox-scoutwritescopespicker--with-granted-scopes--light:hash: v1.k794b7964.38bb2713d5a27df4d995f81ea85e3ef349648bc8953cbfae8f32d5937fe5ad66.Ebm2yDfCEukJbCMGPp8tYhu-wz91pOz2dvkjomAKINAscenes-app-inbox-selfdrivingsection--daily-limit-reached--dark:- hash: v1.k794b7964.695a20dbf7826fbf791988e3b2a6523449c284c5d39835ade9e0929e79011ad8.okw0M7KppUTBR-y3ZC-7sylkDQG-Q_8pOx4VysDqmcU+ hash: v1.k794b7964.b8c16ce2d4abec243b8387090d49973c6efeae4bdbc943341b4af606a49972ca.g7XgcnpfL35YuiDU-tPXRKs6ol9fKac7CkkE1Uu7Bccscenes-app-inbox-selfdrivingsection--daily-limit-reached--light:- hash: v1.k794b7964.ea9f326e9c21fd8ddb7358cba50adb57a64aa865948f09d83f87fb73518ac122.bbzrauc2dw2j3ShmQ5L6XFS25_GKC1jk1HX-cW5y9wk+ hash: v1.k794b7964.cd54fc7b383a3f877257ee6489f7ce9b9b63b89f79fd8f1843046ae71b180417.314Z9oNCWpGGV3mkGZ-yMqT5av4dT6KWRN5FXTEjj24scenes-app-inbox-selfdrivingsection--daily-limit-set--dark:- hash: v1.k794b7964.cacf92112504e429d145dc2ab82eed5a08547cafe5530f94a2b447b747079d5c.nPscdaYJR2lZxwhuBgY6ilm-4j_JK1Kuz5EzxcYB5eE+ hash: v1.k794b7964.6a5f8351198a65478fd4df25063e9961d3e5ae92657701841edfd12920b7922d.ZRgg91-CWVXovYsn14MTPW-Jvt1aw0vBJy26qRI_9uAscenes-app-inbox-selfdrivingsection--daily-limit-set--light:- hash: v1.k794b7964.2f18adda62b380c4fd2a4b70194e7fa82506d1841d69de02e591de3bee7266b9.c-UfUcm8r9x1AVOo0yzeoAqWmlkp6MskHbJuFDC7TPk+ hash: v1.k794b7964.bc26e1543e1498d81f1083ad35091f2c5b8e9504a5f8920eba508fbf292fc935.GEdbX8gyXaHw0IOTE533QUDyWXJdY8Xp5AX_fjJR_SMscenes-app-inbox-selfdrivingsection--disabled--dark:- hash: v1.k794b7964.9b205493fd9d6617bfb20a668f572ac2f9dfe6c9f018f35d8257e070b1f3f491.J-iN3vAcF8C9xfUgkS7pEGc0b4G6ry7d0jEroEGIFR0+ hash: v1.k794b7964.b8ffc067f3cb4a031ccb6d6acd36133ff9c33a9edfbed93199e50bc5a2f129d2.RzsU0abgNH9lQjRlCcnLrvDs0hDaoJPHBf_iRNjLu3Iscenes-app-inbox-selfdrivingsection--disabled--light:- hash: v1.k794b7964.fff36254b02b8a2869858b43485ea6226851f87473b8548c7e35c9bdff0fe6fe.VwrYwC9KZzA6EWDZB0WPfYRq_EVoeQ7U8LvdARodAPk+ hash: v1.k794b7964.ce1ca8a63087739f89d8ed8a1b89bdec6e006f54bff7c59757712788942b70f0.j6VSSAWtk3SQCD1u0qFzxf8iCHThZ_hZxXr04eUkBBEscenes-app-inbox-selfdrivingsection--git-hub-assignment-on--dark:- hash: v1.k794b7964.7012ab24a54f09d53d3aefdd8b03b7821a0d5df8d795c71dd8fd4ac1152e2bfe.Dyb5NhjSPXi-zFgsznPQNiin1isSUDk52YsGX737Iws+ hash: v1.k794b7964.ecac858c0d90fcb61e09ff8df7a82116da8fb9f81cbe7cc935883ca5fd54c4b5.vANCg3Lu6Y7ki1RagiafeYxs2CRYU6iMAmYKPCSxFjkscenes-app-inbox-selfdrivingsection--git-hub-assignment-on--light:- hash: v1.k794b7964.8b006e6eb1178872cbb7ae65d8077576b4367bbe0f393de90d290a7148f8bb47.r0ABtt3jX87cE7ksiog72cKqbTjdHL1xLokBkop8W0I+ hash: v1.k794b7964.1ae9deed1e101355685e52964826d3c7dd5b7e273a37d6b454ce4145cf146503.igVASTG09IJJU-khUOCx2UBfxRx31PkKm6CQwlEgfIYscenes-app-inbox-selfdrivingsection--issue-tracker-configured--dark:- hash: v1.k794b7964.5aaff58c67811d235b64cd6fd43ddaf86913c3ab8566a625768dc1d515957819.G7ZSNP_k8WGCiNGPdAwAF1llDl7UIE8JtpUjJV5yzY0+ hash: v1.k794b7964.ca5a25c05baaaa3ebc8298de24d47f9a732dbd8cedce039ba1adf5a337662b4c.EhMy8SY5dvTJlomU-n-tumL1yIwRjXXSNze0S_9_26Yscenes-app-inbox-selfdrivingsection--issue-tracker-configured--light:- hash: v1.k794b7964.8389492d2ddb18009bc6a8a883e6ec0ed35eb61ee7c964530158e7ca1e3c2a7e.xQrqqICvkdMBCGVf8AJXiHij3RrBrPLHdHwPHzBng00+ hash: v1.k794b7964.9d79693a1108d7b359cc782b0d4173822ff95568bdcb9ced9ee84da2cec1f0c3.cekUDSIanhKe0DTNRUot5ljfrRZdCkeA2tGk1YN0icAscenes-app-inbox-selfdrivingsection--issue-tracker-unavailable--dark:- hash: v1.k794b7964.f33a9909ec4fddc5d498775dd6e61c2fa6031b7fe02210298ee00a9e63aa382b.87Pq7xLEshA0_0IyDTQjDJP4w-mAC4z39qh_VQxXmcU+ hash: v1.k794b7964.2171637a9e31d84b2becf7eeeb8550900f4358070a68b5ed6529a6765d69054d.VUikBCcgYPwzAu-0lqDM3mueqpXk566fBFCpeeE3n8Qscenes-app-inbox-selfdrivingsection--issue-tracker-unavailable--light:- hash: v1.k794b7964.543a84fd49a862be5dcf810a799fbdf8eba938e1a7b98793d61005943d71e16d.wUIEIbYH7OftoQiBgotYwp3Cab-ySlZQ5fnPL0ehq6A+ hash: v1.k794b7964.734a71d418d6d88543b607f47ca88b92233774e69ffeb7e3f1194eef3bc8d08e.RqIMwj82U1O1DMCdTr0LfhYRpECsgcv65rcft3tgXpIscenes-app-inbox-selfdrivingsection--no-daily-limit--dark:- hash: v1.k794b7964.f33a9909ec4fddc5d498775dd6e61c2fa6031b7fe02210298ee00a9e63aa382b.uIG5c3OSKvSQonzcOBlLpcoHQYe79z-3zzUeRLVX-Ww+ hash: v1.k794b7964.2171637a9e31d84b2becf7eeeb8550900f4358070a68b5ed6529a6765d69054d.m2q-Q-URdik1tGrG_MC8KwPn44t8AkkfKxjVBA9bg7Yscenes-app-inbox-selfdrivingsection--no-daily-limit--light:- hash: v1.k794b7964.543a84fd49a862be5dcf810a799fbdf8eba938e1a7b98793d61005943d71e16d.RVrcDVFYZd54Wl_xRP4iaDOwZHAygiltQceUHUxm12k+ hash: v1.k794b7964.734a71d418d6d88543b607f47ca88b92233774e69ffeb7e3f1194eef3bc8d08e.vqtXwwO1YyEUjiXIXFjJAIgvGdNbvSI8jRiZdiDSU50scenes-app-inbox-selfdrivingsection--personal-default--dark:- hash: v1.k794b7964.f33a9909ec4fddc5d498775dd6e61c2fa6031b7fe02210298ee00a9e63aa382b.wJ6GU4dBRTn0F4uKxoMMM3C7v555n57rnDtnKaSiLZM+ hash: v1.k794b7964.2171637a9e31d84b2becf7eeeb8550900f4358070a68b5ed6529a6765d69054d.4_Eo9fHhB4buFvKGmpcOE42hnAiA9cnz8k1b0xHtCeQscenes-app-inbox-selfdrivingsection--personal-default--light:- hash: v1.k794b7964.543a84fd49a862be5dcf810a799fbdf8eba938e1a7b98793d61005943d71e16d.VWJ9thKajurBG8TASBOiq9vsgie5LmCnNIR2t1s9oks+ hash: v1.k794b7964.734a71d418d6d88543b607f47ca88b92233774e69ffeb7e3f1194eef3bc8d08e.Qq0uiH1nbtqHNe-3i1Uk1q4V1wnXnxRkiu4iK-EG6QUscenes-app-inbox-selfdrivingsection--personal-override--dark:- hash: v1.k794b7964.c5e001303c0be7f344d98e2aa8b0b1ef240fa2671e018532555edcd94d3c74bd.MNwPoueXp4wjh609KgvlhAImFCbZYqeojq5PDWMCpic+ hash: v1.k794b7964.211cf3fe37c4d4d20bec6358731c5b36f67213b66af53ce63f32d9a414bef1b9.EnYAs7R85X4tV5Sh8odAm9w6FqLT-5s7p8NDdJ7v07Ascenes-app-inbox-selfdrivingsection--personal-override--light:- hash: v1.k794b7964.83a9e5943153b7d497a8cd6e0a89e5b890af73a2c31acdab2df3991a3c79ce09.SS3WlXHY6Tabvby4jcJ4dQoh7Bl2UTF2y73ORYDOfj4+ hash: v1.k794b7964.c2a84a88efabb52dd2f14c737bab6fd1b82912136dad59cee8bc75c136c2d3c3.FA3SP6yxirvwOC4Mr8Z8JivQpCfDxGpSGZsw1H2yDVwscenes-app-inbox-selfdrivingsection--pull-request-ready-for-review--dark:- hash: v1.k794b7964.00e0d856117d243459367a3e4bd5f7cc6cd43cda3fe9872d342ae9b8bc688d54.9bB6hY7GnrtIZZRmXxo9lIF_5lvoiQiaQMkN8IWFORU+ hash: v1.k794b7964.62f6a84655e794c182061013592f7d7dedd04aa840c725ee3f17cea819fd0d34.NxKYJrhgArJyYXvwh-kSKqrvY1ERzPGi0bIK_tYI9vIscenes-app-inbox-selfdrivingsection--pull-request-ready-for-review--light:- hash: v1.k794b7964.f2257669bd57975e587db3908413b03cb8bfa26267804332361b2a0d72f0f078.hd9KNwc8ORnJdicHYOAJFU1GsewA6SiyFlNCe76CDq4+ hash: v1.k794b7964.8e22332ca6b295d4d604673e1331669655d4bc9ad06b7d48d691d482d70ccc59.SWBuoK7re-0Rml4oaJ-xOkpVyQP6tJ7ZRdwZl2C7sXYscenes-app-inbox-selfdrivingsection--settings-tab--dark:- hash: v1.k794b7964.73d54d684491b967580f16c8f040f7dc0672d1d47eea733dfd72515353f3a283.jsJn6NIkxuO4kW60JT5MNq2jqjhwywYIasG-hnKtgmE+ hash: v1.k794b7964.02a1b3af09edec0f42f45f3e411b89603bf69d73311b36da6399e534bf963289.InP8Rm9zp7OMimuYkCJ80tuUz46LOQsX4ya7iJUIM8gscenes-app-inbox-selfdrivingsection--settings-tab--light:- hash: v1.k794b7964.f939e35b6372f295f13403c926cfe0e3fae65c31fce353d0d9f1ece4f8062c8e.OCcSSCffkbrErjrhS03gNtz9JtfeEzgsVt6Wj3uurKQ+ hash: v1.k794b7964.357b176a5120f55a229dd57032292cf09855a4eb7158aa853bac5ba9ead76b78.YM7b6XZ_lzpWiMdgSByHvY-901gxtJtGHaOTpeykzHIscenes-app-inbox-selfdrivingsection--settings-tab-base-branches--dark:- hash: v1.k794b7964.037702be4e4749b04341ba60377272d3dbd80c9a57f68bef328e2c6c8c3c4da2.FX2I6HqOxd2ga3DyvWu4CmvrLnI2rXuGJy4OTlwNGcA+ hash: v1.k794b7964.7f8a21aca11db57c7229126a07dd7315f2602f195a5b7c9159f9465ea079d077.csRpT7eAVB_lMGuBhrgvL8zIjcD-ZJGzWegXTS3uBGAscenes-app-inbox-selfdrivingsection--settings-tab-base-branches--light:- hash: v1.k794b7964.38a73ca6a69e7696f4c8ea7444857fc452f1404d1826416247f439a009945484.zVoYfS-GKAwtDPgz_vApSJHKeUL0ltV0_R0fh3_eFiM+ hash: v1.k794b7964.96c4f530c7ea6cedeab5ec67dbb819a8313ede3f3b0259dd8aeaee25b42e685b.eNtZvWnGhZ0oKfrtQd9n5s1Sx79ij8IN-8_5cQnc9AQscenes-app-inbox-selfdrivingsection--settings-tab-base-branches-without-git-hub--dark:- hash: v1.k794b7964.ffa8896ff2257c8e716c1f69ff4e44ce9ab02282e79958ade0207d04386aa0d4.1CwFTqs7SXZiR5ZvXBkvBATOh1J7w89SbmtXlaeNEEI+ hash: v1.k794b7964.b9fd3580200ec291da41de13c8b54b124b6c4e5a51cf0e8874a1c989284360a6.Uu5StPPYvhbXLyj9p_NuYLT1wPG1SPuG5mpkWkqfjEcscenes-app-inbox-selfdrivingsection--settings-tab-base-branches-without-git-hub--light:- hash: v1.k794b7964.11e08c171bf353ccfee2db70c57ea3ccaa6b12e8b0a03d02c83119e3a4e16cdc.a7G9bxu9jDd0qadX7F4U_OwhtIO57VLnLLZjb64Huq8+ hash: v1.k794b7964.eec5a03c8a1e7ab980e43259b1528ba1d8eb080c6425092e85119d7f9650045a.LRppn59BYBLYZJ23_UfLabqigTXeCMcyLmAXak6MAQQscenes-app-inbox-selfdrivingsection--settings-tab-disabled--dark:- hash: v1.k794b7964.77c441704273d76b7dfeadf555f9e20d6521591218183e4aa724914260459d36.HJb6E6tHZgI-yeIrgpb4TVGgiwcQqhYnN7fTiLws_k8+ hash: v1.k794b7964.8fd8b4cc89ce8ee5084b305dcdabb35cf9b1aec28cfdd88ec6914984f7210e4a.jRwZuq8Y57AcGOXigA_A1hRlc47R6sMmsTxE887amToscenes-app-inbox-selfdrivingsection--settings-tab-disabled--light:- hash: v1.k794b7964.af88839aa3b693934557a8c56e5b64abecad7ca3bc9a4d84b7a338376fd8d52c.uTBJPAOtZkMoCzF37Td3guXFmRe-jSMpd1w8uk2NTEA+ hash: v1.k794b7964.e92ff3845d81cae3b4e60c20d92b7d78de56da2884c646bb1da2afc5cd45133f.x6GmS5rWBAOIZCplBSLCd6G6Drvs4kc3N2s0Y_7IntU+ scenes-app-inbox-selfdrivingsection--settings-tab-extra-repositories--dark:+ hash: v1.k794b7964.60020dc08f80979955ae6018cc49b53d489eaf739139eae740978ff33695db5a.LiGNrH7pzoBZHV3hWlIdzt_0hRx1EirmBH6ErXGVAVY+ scenes-app-inbox-selfdrivingsection--settings-tab-extra-repositories--light:+ hash: v1.k794b7964.bea08de8cafd6ed1b27c8ad804ae0bfd2601fe8e4e1dcff9fe39547c2dd92828.pQjgki-_9eNkbbNSc5NmClJsdJ7i4qwHambbXkufkU4scenes-app-inbox-selfdrivingsection--settings-tab-issue-tracker-jira--dark:- hash: v1.k794b7964.41f8cb0d40cdfe1f30fdebcf68042f24ee33367da507a368b7dd975021b430ac.H420utrLer2NAkgVYqihR6I28K9j3nVT_XDcfIMLD7E+ hash: v1.k794b7964.f3342f1ea7587c017a0c2b19f90f5aacc4b71f32544b9cc262a28c6b9cf12082.yP4b4ben6FQPaugf2Gx-18CwAxwA7TWTQGMweLZO1vQscenes-app-inbox-selfdrivingsection--settings-tab-issue-tracker-jira--light:- hash: v1.k794b7964.aaaabd1b81adf2925d41b6f1669df2fd51b40a51ca45136d7b957497aa4eec7f.H79XAtJQOt39ysPpGobM1UfSra_wvUi9AfngAxkg-xk+ hash: v1.k794b7964.ee60d883e9d73207f287a20b88cf683ddc3a65fdb6c12e5427ae9eb5829364be.Sf0-MKpnZYYTp8bA5iHPUsGPvYUywgE-HLsRRQaQrTIscenes-app-inbox-selfdrivingsection--settings-tab-narrow--dark:- hash: v1.k794b7964.dc72ce7f6450d86f61aabe9aec6f346325fc6fad9d2d9168931ea43cac770a6a.-0dRG3TQXxaPJ27QdpYWymIxoqW_mrjqVw-Naw7NqhU+ hash: v1.k794b7964.a99007a645871f8a2f04c8551560e0272bfd8d6a1a1f0b1d0147269120e2e444.Ykjg_226M36DHhki9OVbgrMZTLBn3KcqikdmiIGJyM4scenes-app-inbox-selfdrivingsection--settings-tab-narrow--light:- hash: v1.k794b7964.3c8a7580a33ef3e0b58a39c9248a92898a290568d5f78d13a7ae719eb188258a.yV89Z-Q64XKnpeh_sezuDUVpVRwZrHSRzTerZyWpHHU+ hash: v1.k794b7964.b9274df09c41dccf56e63036209f619c376fd46834b17558bd403421b019b9fa.1QGvrjTYAOy1d5wyz4MMKe5B2Q2fqwOjrlZ8sqnWOLwscenes-app-inbox-selfdrivingsection--settings-tab-pull-request-label--dark:- hash: v1.k794b7964.4d62e7926695f50bd7b02ea4092752e7965713dbc423c76d08e1d3298243ed73.IOWkj7p1fx5_V80m_ox9tMjLPbGfSeoiccWRtK2_psA+ hash: v1.k794b7964.801e106a32c814e173c4cb07d9a256bd831ab1bcee476f67c0f2e5d4c46449b2.snIPnRCbRkGjsnKWI11jI2PK3HlDehcbFS-VAvhaKMUscenes-app-inbox-selfdrivingsection--settings-tab-pull-request-label--light:- hash: v1.k794b7964.8e029066ec5eff3a0860a1f497fd5b5e436b707b927ba291b3bc9ab41003df9e.2_Thr1X2vS4SYU8ahO2fZMAf9DKuKnusmCm-MqqYl6Y+ hash: v1.k794b7964.855393817f32f2c1a09951da2a1d29b8c825d0740acb8fbcc76f8f06fb0bc6c2.3BqTKii4wY46BAgVymycOOz_uXvutj1w4JGzHmo9ji0scenes-app-inbox-signal-cards--all-sources--dark:hash: v1.k794b7964.c23ba49824c663d604c2fb7b3a9f1e619538a8467f84f8ef83db26c2e585ab1b.Sxd64grePFgHAwyuax_T65ns2I4GkYa0Do6P8rVwFIIscenes-app-inbox-signal-cards--all-sources--light:diff --git a/products/signals/backend/auto_start.py b/products/signals/backend/auto_start.pyindex 84d310e8fcef..8c78cf2aaf1d 100644--- a/products/signals/backend/auto_start.py+++ b/products/signals/backend/auto_start.py@@ -41,6 +41,7 @@ from products.signals.backend.billing import (from products.signals.backend.enums import ReportLinkKindfrom products.signals.backend.free_trial import capture_signal_report_free_trial_paused, self_driving_free_trial_enabledfrom products.signals.backend.github_optional import ResearchAccessPolicy+from products.signals.backend.implementation_repositories import implementation_access_repositoriesfrom products.signals.backend.models import (MAX_SCOUT_CONTENT_REVISIONS,SignalReport,@@ -324,6 +325,17 @@ def _head_branch_instruction(head_branch: str) -> str:)+def _access_repositories_instruction(repository: str, access_repositories: list[str]) -> str:+ if not access_repositories:+ return ""+ names = ", ".join(f"`{name}`" for name in access_repositories)+ return (+ f"\n\nYour GitHub credentials also cover {names}, which the project configured for implementation "+ "tasks, for example to upload PR screenshots. They are not cloned. Use `gh` or clone one yourself "+ f"when the task needs it. Open the PR on `{repository}` as usual."+ )++def _stack_base_instruction(stack_base_branch: str | None) -> str:if not stack_base_branch:return ""@@ -798,7 +810,13 @@ def _create_implementation_task_if_absent(# Create the task before the provider issue. A failed task creation must not leave an external# issue that says Self-driving started work when no run exists.head_branch = _generate_self_driving_head_branch(title)- description = description + _head_branch_instruction(head_branch)+ # Read at creation, so a settings change applies to the next task and never to a running one.+ access_repositories = implementation_access_repositories(team_id, repository)+ description = (+ description+ + _head_branch_instruction(head_branch)+ + _access_repositories_instruction(repository, access_repositories)+ )exempt_reason: str | None = Nonetask_id: str | None = None@@ -927,6 +945,7 @@ def _create_implementation_task_if_absent(# into protected run state so the review carve-out can verify the PR is this run's.self_driving_head_branch=head_branch,stack_base_branch=stack_base_branch,+ github_access_repositories=access_repositories,# Internal so the run stays out of the default task list; the report surfaces it by id.internal=True,runtime_adapter=agent_runtime.runtime_adapter,diff --git a/products/signals/backend/implementation_repositories.py b/products/signals/backend/implementation_repositories.pynew file mode 100644index 000000000000..99c00f714b9a--- /dev/null+++ b/products/signals/backend/implementation_repositories.py@@ -0,0 +1,89 @@+"""Extra repositories that self-driving implementation tasks may read and write.++A project lists them in `SignalTeamConfig.implementation_repositories`. They widen the run's GitHub+token only: the run clones the selected repository and opens its pull request there, as before.+"""++import re+from collections.abc import Iterable, Sequence++import structlog++from posthog.egress.limiter.policies import Priority+from posthog.integrations import IntegrationManager+from posthog.models.integration import GitHubIntegration++from products.signals.backend.models import SignalTeamConfig++logger = structlog.get_logger(__name__)++# Each entry widens every implementation token in the project, so the list stays short.+MAX_IMPLEMENTATION_REPOSITORIES = 20++_REPOSITORY_PATTERN = re.compile(r"^[a-z0-9._-]+/[a-z0-9._-]+$")+++class InvalidImplementationRepository(ValueError):+ pass+++def normalize_implementation_repositories(values: Iterable[str]) -> list[str]:+ """Lowercased, deduplicated "organization/repository" names in input order."""+ normalized: list[str] = []+ for value in values:+ repository = str(value).strip().lower()+ if not _REPOSITORY_PATTERN.match(repository):+ raise InvalidImplementationRepository(+ f"'{value}' is not a GitHub repository. Use the 'organization/repository' form."+ )+ if repository not in normalized:+ normalized.append(repository)+ if len(normalized) > MAX_IMPLEMENTATION_REPOSITORIES:+ raise InvalidImplementationRepository(+ f"Too many repositories ({len(normalized)}). The maximum is {MAX_IMPLEMENTATION_REPOSITORIES}."+ )+ return normalized+++def repositories_missing_from_installations(team_id: int, repositories: Sequence[str]) -> list[str]:+ """The entries of `repositories` that no team-level GitHub installation of the project can reach.++ Only team-level installations count, because the implementation token is minted from one. A+ personal connection could name repositories the project never connected.+ """+ if not repositories:+ return []+ reachable: set[str] = set()+ for integration in IntegrationManager.github.oauth.list(team_id):+ github = GitHubIntegration(integration, source="signals_implementation_repositories", priority=Priority.NORMAL)+ try:+ cached = github.list_all_cached_repositories()+ except Exception:+ logger.warning(+ "implementation_repositories_installation_unreadable",+ team_id=team_id,+ integration_id=integration.id,+ exc_info=True,+ )+ continue+ reachable.update(str(repository.get("full_name", "")).lower() for repository in cached)+ return [repository for repository in repositories if repository not in reachable]+++def implementation_access_repositories(team_id: int, repository: str) -> list[str]:+ """The configured repositories an implementation task on `repository` gets, without `repository`.++ Only entries with the same owner as `repository` apply. One GitHub installation covers one+ account, so an entry from another owner is outside the installation the task's token comes from.+ """+ owner = repository.lower().partition("/")[0]+ configured = (+ SignalTeamConfig.objects.filter(team_id=team_id).values_list("implementation_repositories", flat=True).first()+ )+ if not isinstance(configured, list):+ return []+ return [+ entry+ for entry in configured+ if isinstance(entry, str) and entry.partition("/")[0] == owner and entry != repository.lower()+ ]diff --git a/products/signals/backend/migrations/0219_signalteamconfig_implementation_repositories.py b/products/signals/backend/migrations/0219_signalteamconfig_implementation_repositories.pynew file mode 100644index 000000000000..bc712d598045--- /dev/null+++ b/products/signals/backend/migrations/0219_signalteamconfig_implementation_repositories.py@@ -0,0 +1,15 @@+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0218_monitoring_tracker_close_index"),+ ]++ operations = [+ migrations.AddField(+ model_name="signalteamconfig",+ name="implementation_repositories",+ field=models.JSONField(blank=True, db_default=[], default=list),+ ),+ ]diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txtindex 98dea87fff13..e2390b6e0b86 100644--- a/products/signals/backend/migrations/max_migration.txt+++ b/products/signals/backend/migrations/max_migration.txt@@ -1 +1 @@-0218_monitoring_tracker_close_index+0219_signalteamconfig_implementation_repositoriesdiff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex d12a25e1af87..2ed3c505664d 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -272,6 +272,10 @@ class SignalTeamConfig(ModelActivityMixin, UUIDModel):# shares with everybody. A null or blank name falls back to DEFAULT_PULL_REQUEST_LABEL.pull_request_label_enabled = models.BooleanField(default=False, db_default=False)pull_request_label = models.CharField(max_length=GITHUB_LABEL_NAME_MAX_LENGTH, null=True, blank=True)+ # Lowercased "organization/repository" names that implementation tasks may also read and write,+ # for example an assets repository a PR uploads screenshots to. They widen the run's GitHub token+ # only. The run never clones them, and the PR target stays the selected repository.+ implementation_repositories = models.JSONField(default=list, db_default=[], blank=True)# Opt-out of anomaly scoring (see anomaly_scores/queue.py). The `anomaly-scoring` flag payload# still decides which projects are enrolled, so turning this on cannot enroll a project.anomaly_scoring_enabled = models.BooleanField(default=True, db_default=True)diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex 96998a534e79..501b33754df4 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -81,6 +81,12 @@ from .artefact_schemas import ()from .briefing_reports import SUMMARY_LEAD_LIMIT, summary_leadfrom .daily_limit import reports_generated_today, team_day_start+from .implementation_repositories import (+ MAX_IMPLEMENTATION_REPOSITORIES,+ InvalidImplementationRepository,+ normalize_implementation_repositories,+ repositories_missing_from_installations,+)from .models import (GITHUB_LABEL_NAME_MAX_LENGTH,MAX_SCOUT_REPORT_NOTES,@@ -499,6 +505,19 @@ class SignalTeamConfigSerializer(serializers.ModelSerializer):"when it does not exist yet. Only used while pull_request_label_enabled is true."),)+ implementation_repositories = serializers.ListField(+ child=serializers.CharField(max_length=255),+ required=False,+ max_length=MAX_IMPLEMENTATION_REPOSITORIES,+ help_text=(+ "Extra GitHub repositories, as 'organization/repository', that self-driving implementation "+ "tasks can read and write within the connected GitHub App's permissions, for example an "+ "assets repository for PR screenshots. A task gets only the entries with the same owner as "+ "its selected repository. They are not cloned, and the PR still targets the selected "+ "repository. Each new entry must be reachable through one of the project's GitHub "+ "installations. Changes apply to tasks started afterwards. Empty by default."+ ),+ )anomaly_scoring_enabled = serializers.BooleanField(required=False,help_text=(@@ -533,6 +552,24 @@ class SignalTeamConfigSerializer(serializers.ModelSerializer):representation[field] = representation[field] or ""return representation+ def validate_implementation_repositories(self, value: list[str]) -> list[str]:+ try:+ repositories = normalize_implementation_repositories(value)+ except InvalidImplementationRepository as error:+ raise serializers.ValidationError(str(error))+ # Entries already stored passed this check when they were added, so removing one never+ # waits on GitHub.+ stored = set(getattr(self.instance, "implementation_repositories", None) or [])+ added = [repository for repository in repositories if repository not in stored]+ team_id = self.instance.team_id if self.instance is not None else self.context["get_team"]().id+ missing = repositories_missing_from_installations(team_id, added)+ if missing:+ raise serializers.ValidationError(+ f"The project's GitHub connection can't reach {', '.join(missing)}. "+ "Give the PostHog GitHub App access to it in your GitHub installation settings, then try again."+ )+ return repositories+def validate_pull_request_label(self, value: str | None) -> str | None:# One stored shape for "use the default", so a team that clears the box does not get a# label GitHub would refuse.@@ -583,6 +620,7 @@ class SignalTeamConfigSerializer(serializers.ModelSerializer):"github_issue_writeback_enabled","pull_request_label_enabled","pull_request_label",+ "implementation_repositories","anomaly_scoring_enabled","anomaly_scoring_available","reports_generated_today",diff --git a/products/signals/backend/test/test_auto_start.py b/products/signals/backend/test/test_auto_start.pyindex bb8353c88679..961c5525f81e 100644--- a/products/signals/backend/test/test_auto_start.py+++ b/products/signals/backend/test/test_auto_start.py@@ -677,6 +677,9 @@ def test_create_implementation_task_if_absent_is_idempotent(organization, team,report = SignalReport.objects.create(team=team, status=SignalReport.Status.READY, title="t", summary="s", signal_count=0, total_weight=0.0)+ SignalTeamConfig.objects.update_or_create(+ team=team, defaults={"implementation_repositories": ["owner/assets", "other/assets", "owner/repo"]}+ )created_tasks = []@@ -737,6 +740,10 @@ def test_create_implementation_task_if_absent_is_idempotent(organization, team,# self-driving reviews (the agent pushes to a name the server never stamped).assert call_kwargs["self_driving_head_branch"].startswith("posthog-self-driving/")assert call_kwargs["self_driving_head_branch"] in call_kwargs["description"]+ # Only same-owner entries apply, because the token comes from the selected repository's installation.+ assert call_kwargs["github_access_repositories"] == ["owner/assets"]+ assert "`owner/assets`" in call_kwargs["description"]+ assert call_kwargs["repository"] == "owner/repo"# The gate the second evaluation observed is the legacy SignalReportTask implementation link,# written in the same transaction as the task; the task_run artefact is the work-log entry# alongside.diff --git a/products/signals/backend/test/test_signal_team_config_api.py b/products/signals/backend/test/test_signal_team_config_api.pyindex c0bd2059ce98..569ea984a5b5 100644--- a/products/signals/backend/test/test_signal_team_config_api.py+++ b/products/signals/backend/test/test_signal_team_config_api.py@@ -9,11 +9,13 @@ from parameterized import parameterizedfrom rest_framework import statusfrom posthog.models.activity_logging.activity_log import ActivityLog+from posthog.models.integration import GitHubIntegration, Integrationfrom posthog.models.organization import OrganizationMembershipfrom posthog.models.team.extensions import get_or_create_team_extensionfrom products.signals.backend.agent_instructions import AGENT_STEERING_MAX_LENGTH, STEERING_FIELDSfrom products.signals.backend.facade.api import set_default_slack_notification_channel+from products.signals.backend.implementation_repositories import MAX_IMPLEMENTATION_REPOSITORIESfrom products.signals.backend.models import SignalReport, SignalTeamConfigfrom products.signals.backend.serializers import MAX_AUTOSTART_BASE_BRANCH_ENTRIES, SignalTeamConfigSerializerfrom products.signals.backend.views import SignalTeamConfigViewSet@@ -61,6 +63,8 @@ class TestSignalTeamConfigAPI(APIBaseTest):for field in STEERING_FIELDS.values():response = self.client.post(self._url(), {field: "New rules."}, format="json")assert response.status_code == 403, response.content+ response = self.client.post(self._url(), {"implementation_repositories": ["acme/assets"]}, format="json")+ assert response.status_code == 403, response.contentassert self.client.post(self._url(), {"autostart_enabled": False}, format="json").status_code == 200def test_steering_save_preserves_a_concurrent_autonomy_change(self) -> None:@@ -386,8 +390,53 @@ class TestSignalTeamConfigAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OK, response.json()assert len(self._activity()) == 1+ @parameterized.expand(+ [+ (+ "reachable_entries_are_normalized",+ [],+ ["Acme/Assets", "acme/assets", "acme/docs"],+ status.HTTP_200_OK,+ ["acme/assets", "acme/docs"],+ ),+ ("unreachable_entry_is_rejected", [], ["acme/assets", "other/secret"], status.HTTP_400_BAD_REQUEST, []),+ # A stored entry that lost access can still be removed, and kept, without a fresh check.+ ("stored_entry_skips_the_check", ["acme/gone"], ["acme/gone"], status.HTTP_200_OK, ["acme/gone"]),+ ]+ )+ def test_update_implementation_repositories_checks_new_entries_against_the_installation(+ self, _name: str, stored: list[str], sent: list[str], expected_status: int, expected: list[str]+ ) -> None:+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()+ self.config.implementation_repositories = stored+ self.config.save(update_fields=["implementation_repositories"])+ Integration.objects.create(team=self.team, kind="github", config={"account": {"name": "acme"}})++ with patch.object(+ GitHubIntegration,+ "list_all_cached_repositories",+ return_value=[{"full_name": "acme/assets"}, {"full_name": "acme/docs"}],+ ):+ response = self.client.post(self._url(), {"implementation_repositories": sent}, format="json")++ assert response.status_code == expected_status, response.content+ self.config.refresh_from_db()+ assert self.config.implementation_repositories == (expected or stored)+class TestSignalTeamConfigSerializerValidation(SimpleTestCase):+ @parameterized.expand(+ [+ ("not_owner_slash_repo", ["assets"]),+ ("too_many_entries", [f"acme/repo{i}" for i in range(MAX_IMPLEMENTATION_REPOSITORIES + 1)]),+ ]+ )+ def test_implementation_repositories_rejects_malformed_input(self, _name: str, value: list[str]) -> None:+ serializer = SignalTeamConfigSerializer(data={"implementation_repositories": value}, partial=True)+ assert not serializer.is_valid()+ assert "implementation_repositories" in serializer.errors+@parameterized.expand(list(STEERING_FIELDS.values()))def test_steering_rejects_oversized_instructions(self, field: str) -> None:serializer = SignalTeamConfigSerializer(data={field: "x" * AGENT_STEERING_MAX_LENGTH}, partial=True)diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex c56114552d79..47586fa8ab81 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -669,16 +669,20 @@ class SignalSourceConfigViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):)+# A task agent that could edit this list would widen the GitHub token of every later implementation run.+_SANDBOX_PROTECTED_CONFIG_FIELDS = (*STEERING_FIELDS.values(), "implementation_repositories")++class SignalSteeringPermission(TeamMemberStrictManagementPermission):def has_permission(self, request: Request, view: APIView) -> bool:if (request.method in ("GET", "HEAD", "OPTIONS")or not isinstance(request.data, dict)- or not any(field in request.data for field in STEERING_FIELDS.values())+ or not any(field in request.data for field in _SANDBOX_PROTECTED_CONFIG_FIELDS)):return Trueif is_sandbox_oauth_request(request):- self.message = "Task agents cannot modify steering instructions."+ self.message = "Task agents cannot modify steering instructions or implementation repositories."return Falsereturn super().has_permission(request, view)diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 7783d6f8ed6b..61d308451e1e 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -724,6 +724,12 @@ export interface SignalTeamConfigApi {* @nullable*/pull_request_label?: string | null+ /**+ * Extra GitHub repositories, as 'organization/repository', that self-driving implementation tasks can read and write within the connected GitHub App's permissions, for example an assets repository for PR screenshots. A task gets only the entries with the same owner as its selected repository. They are not cloned, and the PR still targets the selected repository. Each new entry must be reachable through one of the project's GitHub installations. Changes apply to tasks started afterwards. Empty by default.+ * @maxItems 20+ * @items.maxLength 255+ */+ implementation_repositories?: string[]/** Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */anomaly_scoring_enabled?: boolean/** Whether anomaly scoring covers this project, so anomaly_scoring_enabled has an effect. PostHog decides which projects anomaly scoring covers. */diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex eb6f777ba411..90b9ed48063c 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -29,6 +29,10 @@ export const signalsConfigCreateBodyMaxReportsPerDayMax = 2147483647export const signalsConfigCreateBodyPullRequestLabelMax = 50+export const signalsConfigCreateBodyImplementationRepositoriesItemMax = 255++export const signalsConfigCreateBodyImplementationRepositoriesMax = 20+export const SignalsConfigCreateBody = /* @__PURE__ */ zod.object({autostart_enabled: zod.boolean()@@ -119,6 +123,13 @@ export const SignalsConfigCreateBody = /* @__PURE__ */ zod.object({.describe("The label name self-driving applies, at most 50 characters. Null or blank means 'self-driving'. The label is created in the repository when it does not exist yet. Only used while pull_request_label_enabled is true."),+ implementation_repositories: zod+ .array(zod.string().max(signalsConfigCreateBodyImplementationRepositoriesItemMax))+ .max(signalsConfigCreateBodyImplementationRepositoriesMax)+ .optional()+ .describe(+ "Extra GitHub repositories, as 'organization\/repository', that self-driving implementation tasks can read and write within the connected GitHub App's permissions, for example an assets repository for PR screenshots. A task gets only the entries with the same owner as its selected repository. They are not cloned, and the PR still targets the selected repository. Each new entry must be reachable through one of the project's GitHub installations. Changes apply to tasks started afterwards. Empty by default."+ ),anomaly_scoring_enabled: zod.boolean().optional()diff --git a/products/signals/frontend/inbox/components/config/SelfDrivingSection.stories.tsx b/products/signals/frontend/inbox/components/config/SelfDrivingSection.stories.tsxindex b43a1887857a..be9d06ee6cd1 100644--- a/products/signals/frontend/inbox/components/config/SelfDrivingSection.stories.tsx+++ b/products/signals/frontend/inbox/components/config/SelfDrivingSection.stories.tsx@@ -18,6 +18,8 @@ interface CardState {myThreshold?: string | null/** Repositories that branch from somewhere other than their default branch. */baseBranches?: Record<string, string>+ /** Extra repositories implementation tasks can also write to. */+ implementationRepositories?: string[]dailyLimit?: number | nullreportsToday?: number/** Personal opt-in to being added as a GitHub assignee on the implementation PR. */@@ -43,6 +45,7 @@ function useAutonomyMocks({projectThreshold = 'P2',myThreshold = null,baseBranches = {},+ implementationRepositories = [],dailyLimit = null,reportsToday = 0,githubAssign = false,@@ -61,6 +64,7 @@ function useAutonomyMocks({autostart_enabled: enabled,default_autostart_priority: projectThreshold,autostart_base_branches: baseBranches,+ implementation_repositories: implementationRepositories,issue_tracking_integration: issueTrackingIntegration,issue_tracking_config: issueTrackingConfig,max_reports_per_day: dailyLimit,@@ -148,6 +152,17 @@ export const SettingsTabBaseBranchesWithoutGitHub: Story = {render: () => <SettingsCard width="wide" baseBranches={{ 'posthog/posthog.com': 'develop' }} />,}+// An assets repository every implementation task can also write to: the list and the Add repository button render.+export const SettingsTabExtraRepositories: Story = {+ render: () => (+ <SettingsCard+ width="wide"+ integrations={[GITHUB_INTEGRATION]}+ implementationRepositories={['posthog/pr-assets']}+ />+ ),+}+// A Jira tracker with a saved project: the target reads as text with a Change button, and no picker mounts.export const SettingsTabIssueTrackerJira: Story = {render: () => (diff --git a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsxindex 9ca01a70318e..a5222354109d 100644--- a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx+++ b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx@@ -222,6 +222,140 @@ function BaseBranchesRow(): JSX.Element {)}+function ImplementationRepositoryPicker(): JSX.Element {+ const {+ draftImplementationRepositoryIntegrationId,+ draftImplementationRepository,+ addImplementationRepositoryDisabledReason,+ teamConfigUpdating,+ } = useValues(signalTeamConfigLogic)+ const {+ setDraftImplementationRepositoryIntegrationId,+ setDraftImplementationRepository,+ addImplementationRepository,+ setImplementationRepositoryPickerOpen,+ } = useActions(signalTeamConfigLogic)+ const { githubIntegrations } = useValues(integrationsLogic)++ const integrationId = draftImplementationRepositoryIntegrationId ?? githubIntegrations[0].id++ return (+ <div className="flex flex-wrap items-center gap-1">+ {githubIntegrations.length > 1 && (+ <LemonSelect+ size="small"+ value={integrationId}+ options={githubIntegrations.map((integration) => ({+ value: integration.id,+ label: integration.display_name,+ }))}+ disabledReason={teamConfigUpdating ? 'Saving changes' : undefined}+ onChange={(next) => next != null && setDraftImplementationRepositoryIntegrationId(next)}+ aria-label="GitHub organization"+ />+ )}+ <GitHubRepositoryCombobox+ integrationId={integrationId}+ value={draftImplementationRepository}+ disabled={teamConfigUpdating}+ onChange={(repo) => setDraftImplementationRepository(repo ?? '')}+ placeholder="Repository"+ />+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconPlus />}+ disabledReason={addImplementationRepositoryDisabledReason ?? undefined}+ loading={teamConfigUpdating}+ data-attr="signals-implementation-repository-add"+ onClick={() => addImplementationRepository()}+ >+ Add+ </LemonButton>+ <LemonButton+ type="tertiary"+ size="small"+ disabledReason={teamConfigUpdating ? 'Saving changes' : undefined}+ onClick={() => setImplementationRepositoryPickerOpen(false)}+ >+ Cancel+ </LemonButton>+ </div>+ )+}++/**+ * Repositories every implementation task may also write to, such as an assets repository for PR+ * screenshots. Same list-plus-picker shape as the base branch overrides above, and for the same+ * reason the picker mounts only on request.+ */+function ImplementationRepositoriesRow(): JSX.Element {+ const { githubIntegrations } = useValues(integrationsLogic)+ const { implementationRepositories, implementationRepositoryPickerOpen, teamConfigUpdating } =+ useValues(signalTeamConfigLogic)+ const { setImplementationRepositoryPickerOpen, removeImplementationRepository } = useActions(signalTeamConfigLogic)++ return (+ <AutonomySettingRow+ title="Extra repositories"+ description={+ githubIntegrations.length > 0 ? (+ "Agents can also read and write these repositories, for example to upload PR screenshots. They aren't cloned, and PRs still go to the report's repository. Only repositories from the same GitHub organization as the report's repository apply."+ ) : (+ <span>+ Agents can also read and write these repositories, for example to upload PR screenshots.{' '}+ <Link to={urls.settings('project-integrations')}>Connect GitHub</Link> to add one.+ </span>+ )+ }+ >+ {(githubIntegrations.length > 0 || implementationRepositories.length > 0) && (+ <div className="flex flex-col gap-2 py-3">+ {implementationRepositories.length > 0 && (+ <ul className="m-0 flex list-none flex-col gap-1 p-0">+ {implementationRepositories.map((repo) => (+ <li key={repo} className="flex flex-wrap items-center gap-2">+ <span+ className="min-w-0 flex-1 basis-40 truncate text-sm text-default"+ title={repo}+ >+ {repo}+ </span>+ <LemonButton+ type="tertiary"+ size="small"+ icon={<IconX />}+ loading={teamConfigUpdating}+ aria-label={`Remove ${repo}`}+ data-attr="signals-implementation-repository-remove"+ onClick={() => removeImplementationRepository(repo)}+ />+ </li>+ ))}+ </ul>+ )}+ {githubIntegrations.length > 0 &&+ (implementationRepositoryPickerOpen ? (+ <ImplementationRepositoryPicker />+ ) : (+ <div>+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconPlus />}+ data-attr="signals-implementation-repository-open"+ onClick={() => setImplementationRepositoryPickerOpen(true)}+ >+ Add repository+ </LemonButton>+ </div>+ ))}+ </div>+ )}+ </AutonomySettingRow>+ )+}+/** Providers that can hold a tracker issue, with the label the picker shows for each. */const ISSUE_TRACKER_LABELS: Partial<Record<IntegrationType['kind'], string>> = {github: 'GitHub issues',@@ -819,6 +953,7 @@ export function SelfDrivingSection(): JSX.Element {<AutonomySettingGroup title="Pull requests" description="Applies to everyone in this project."><PullRequestGenerationRow /><BaseBranchesRow />+ <ImplementationRepositoriesRow /><ProjectPullRequestStateRow /><GitHubIssueWritebackRow /><PullRequestLabelRow />diff --git a/products/signals/frontend/inbox/logics/signalTeamConfigLogic.test.ts b/products/signals/frontend/inbox/logics/signalTeamConfigLogic.test.tsindex 7e6aa46dff49..b9afb94ca0f8 100644--- a/products/signals/frontend/inbox/logics/signalTeamConfigLogic.test.ts+++ b/products/signals/frontend/inbox/logics/signalTeamConfigLogic.test.ts@@ -416,4 +416,24 @@ describe('signalTeamConfigLogic', () => {expect(lastPostBody?.autostart_base_branches).toEqual({ 'acme/api': 'develop' })expect(logic.values.baseBranchOverrides).toEqual([{ repo: 'acme/api', branch: 'develop' }])})++ it('appends an extra implementation repository once and closes the picker', async () => {+ await mountWith({})+ logic.actions.setImplementationRepositoryPickerOpen(true)+ logic.actions.setDraftImplementationRepository('Acme/Assets')+ logic.actions.addImplementationRepository()+ await expectLogic(logic).toFinishAllListeners()++ expect(lastPostBody?.implementation_repositories).toEqual(['acme/assets'])+ expect(logic.values.implementationRepositoryPickerOpen).toBe(false)++ lastPostBody = null+ logic.actions.setImplementationRepositoryPickerOpen(true)+ logic.actions.setDraftImplementationRepository('acme/assets')+ logic.actions.addImplementationRepository()+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.addImplementationRepositoryDisabledReason).toBe('This repository is already in the list')+ expect(lastPostBody).toBeNull()+ })})diff --git a/products/signals/frontend/inbox/logics/signalTeamConfigLogic.ts b/products/signals/frontend/inbox/logics/signalTeamConfigLogic.tsindex a11d4da785ca..8074079abec2 100644--- a/products/signals/frontend/inbox/logics/signalTeamConfigLogic.ts+++ b/products/signals/frontend/inbox/logics/signalTeamConfigLogic.ts@@ -25,6 +25,7 @@ const VISIBILITY_REFETCH_THROTTLE_MS = 5 * 1000// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface signalTeamConfigLogicValues {addBaseBranchOverrideDisabledReason: string | null+ addImplementationRepositoryDisabledReason: string | nullanomalyScoringAvailable: booleananomalyScoringEnabled: booleanautostartEnabled: boolean@@ -36,10 +37,14 @@ export interface signalTeamConfigLogicValues {draftBaseBranchBranch: stringdraftBaseBranchIntegrationId: number | nulldraftBaseBranchRepo: string+ draftImplementationRepository: string+ draftImplementationRepositoryIntegrationId: number | nulldraftIssueTrackerIntegrationId: number | nulldraftMaxReportsPerDay: number | nulldraftPullRequestLabel: stringgithubIssueWritebackEnabled: boolean+ implementationRepositories: string[]+ implementationRepositoryPickerOpen: booleanissueTrackerConfig: Record<string, string>issueTrackerIntegrationId: number | nullissueTrackerTargetPickerOpen: boolean@@ -61,6 +66,9 @@ export interface signalTeamConfigLogicActions {addBaseBranchOverride: () => {value: true}+ addImplementationRepository: () => {+ value: true+ }clearDraftBaseBranch: () => {value: true}@@ -109,6 +117,9 @@ export interface signalTeamConfigLogicActions {removeBaseBranchOverride: (repo: string) => {repo: string}+ removeImplementationRepository: (repo: string) => {+ repo: string+ }saveDraftMaxReportsPerDay: () => {value: true}@@ -127,6 +138,12 @@ export interface signalTeamConfigLogicActions {setDraftBaseBranchRepo: (repo: string) => {repo: string}+ setDraftImplementationRepository: (repo: string) => {+ repo: string+ }+ setDraftImplementationRepositoryIntegrationId: (integrationId: number | null) => {+ integrationId: number | null+ }setDraftIssueTrackerIntegrationId: (integrationId: number | null) => {integrationId: number | null}@@ -136,6 +153,9 @@ export interface signalTeamConfigLogicActions {setDraftPullRequestLabel: (value: string) => {value: string}+ setImplementationRepositoryPickerOpen: (open: boolean) => {+ open: boolean+ }setIssueTrackerTargetPickerOpen: (open: boolean) => {open: boolean}@@ -154,6 +174,7 @@ export interface signalTeamConfigLogicMeta {autostartEnabled: (teamConfig: SignalTeamConfig | null) => booleandefaultAutostartPriority: (teamConfig: SignalTeamConfig | null) => SignalReportPrioritybaseBranchOverrides: (teamConfig: SignalTeamConfig | null) => BaseBranchOverride[]+ implementationRepositories: (teamConfig: SignalTeamConfig | null) => string[]maxReportsPerDay: (teamConfig: SignalTeamConfig | null) => number | nulldefaultOpenPullRequestReady: (teamConfig: SignalTeamConfig | null) => booleangithubIssueWritebackEnabled: (teamConfig: SignalTeamConfig | null) => boolean@@ -179,6 +200,10 @@ export interface signalTeamConfigLogicMeta {draftBaseBranchRepo: string,draftBaseBranchBranch: string) => string | null+ addImplementationRepositoryDisabledReason: (+ draftImplementationRepository: string,+ implementationRepositories: string[]+ ) => string | null}}@@ -221,6 +246,11 @@ export const signalTeamConfigLogic = kea<signalTeamConfigLogicType>([saveDraftPullRequestLabel: true,setDraftIssueTrackerIntegrationId: (integrationId: number | null) => ({ integrationId }),setBaseBranchPickerOpen: (open: boolean) => ({ open }),+ setImplementationRepositoryPickerOpen: (open: boolean) => ({ open }),+ setDraftImplementationRepositoryIntegrationId: (integrationId: number | null) => ({ integrationId }),+ setDraftImplementationRepository: (repo: string) => ({ repo }),+ addImplementationRepository: true,+ removeImplementationRepository: (repo: string) => ({ repo }),setIssueTrackerTargetPickerOpen: (open: boolean) => ({ open }),}),loaders(() => {@@ -293,6 +323,32 @@ export const signalTeamConfigLogic = kea<signalTeamConfigLogicType>([clearDraftBaseBranch: () => false,},],+ // Same mount-on-request rule as the base branch picker. A successful add closes it, a failed+ // one keeps it open so the person can read the error and pick again.+ implementationRepositoryPickerOpen: [+ false,+ {+ setImplementationRepositoryPickerOpen: (_, { open }) => open,+ patchTeamConfigSuccess: (state, { payload }) =>+ payload?.patch && 'implementation_repositories' in payload.patch ? false : state,+ },+ ],+ draftImplementationRepositoryIntegrationId: [+ null as number | null,+ {+ setDraftImplementationRepositoryIntegrationId: (_, { integrationId }) => integrationId,+ },+ ],+ draftImplementationRepository: [+ '',+ {+ setDraftImplementationRepository: (_, { repo }) => repo,+ setDraftImplementationRepositoryIntegrationId: () => '',+ setImplementationRepositoryPickerOpen: () => '',+ patchTeamConfigSuccess: (state, { payload }) =>+ payload?.patch && 'implementation_repositories' in payload.patch ? '' : state,+ },+ ],issueTrackerTargetPickerOpen: [false,{@@ -372,6 +428,10 @@ export const signalTeamConfigLogic = kea<signalTeamConfigLogicType>([.map(([repo, branch]) => ({ repo, branch })).sort((a, b) => a.repo.localeCompare(b.repo)),],+ implementationRepositories: [+ (s) => [s.teamConfig],+ (teamConfig: SignalTeamConfig | null): string[] => teamConfig?.implementation_repositories ?? [],+ ],maxReportsPerDay: [(s) => [s.teamConfig],(teamConfig: SignalTeamConfig | null): number | null => teamConfig?.max_reports_per_day ?? null,@@ -457,6 +517,17 @@ export const signalTeamConfigLogic = kea<signalTeamConfigLogicType>([return draftBaseBranchBranch.trim() ? null : 'Choose a branch first'},],+ addImplementationRepositoryDisabledReason: [+ (s) => [s.draftImplementationRepository, s.implementationRepositories],+ (draftImplementationRepository: string, implementationRepositories: string[]): string | null => {+ if (!isRepositoryKey(draftImplementationRepository)) {+ return 'Choose a repository first'+ }+ return implementationRepositories.includes(draftImplementationRepository.trim().toLowerCase())+ ? 'This repository is already in the list'+ : null+ },+ ],}),listeners(({ actions, values, cache }) => {// The patch is applied optimistically before these listeners run, so the setting names are@@ -501,6 +572,22 @@ export const signalTeamConfigLogic = kea<signalTeamConfigLogicType>([delete next[repo]actions.patchTeamConfig({ autostart_base_branches: next })},+ addImplementationRepository: () => {+ if (values.addImplementationRepositoryDisabledReason) {+ return+ }+ actions.patchTeamConfig({+ implementation_repositories: [+ ...values.implementationRepositories,+ values.draftImplementationRepository.trim().toLowerCase(),+ ],+ })+ },+ removeImplementationRepository: ({ repo }) => {+ actions.patchTeamConfig({+ implementation_repositories: values.implementationRepositories.filter((entry) => entry !== repo),+ })+ },saveDraftMaxReportsPerDay: () => {// Guard the Enter path against double-submission: the Save button disables itself while// a save runs, but LemonInput's onPressEnter does not, so also bail while any requestdiff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.tsindex 8838b9dc6766..2eb11d774900 100644--- a/products/signals/frontend/inbox/types.ts+++ b/products/signals/frontend/inbox/types.ts@@ -414,6 +414,8 @@ export interface SignalTeamConfig {pull_request_label_enabled?: boolean/** The label name to apply, at most 50 characters. Null or blank means the default label. */pull_request_label?: string | null+ /** Extra 'org/repo' names implementation tasks can read and write. They are not cloned and never become the PR target. */+ implementation_repositories?: string[]/** Whether anomaly scoring writes $anomaly_score events for this project. True by default; false opts out. */anomaly_scoring_enabled?: boolean/** Read-only: whether anomaly scoring covers this project, so the switch above has an effect. Never send in a patch. */diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.pyindex d3ec7168812d..7194a2593a58 100644--- a/products/tasks/backend/facade/api.py+++ b/products/tasks/backend/facade/api.py@@ -3041,6 +3041,8 @@ _PROTECTED_RUN_STATE_KEYS = frozenset(TASK_OWNERSHIP_VERSION_STATE_KEY,"pr_authorship_mode","repositories",+ # Decides which repositories the run's GitHub token can write to.+ "github_access_repositories","verified_pr_urls","prewarmed","await_user_message",@@ -9433,7 +9435,13 @@ def warm_task_resume_sandbox("custom_image_id": custom_image_id,}extra_state.update(_github_credential_source_extra_state(resolved_pr_authorship_mode, None))- for protected_key in ("wizard_head_branch", "self_driving_head_branch", "stack_base_branch", "github_read_access"):+ for protected_key in (+ "wizard_head_branch",+ "self_driving_head_branch",+ "stack_base_branch",+ "github_read_access",+ "github_access_repositories",+ ):if protected_key in (previous_run.state or {}):extra_state[protected_key] = (previous_run.state or {})[protected_key]if "imported_from" in (previous_run.state or {}):@@ -9828,6 +9836,11 @@ def run_task(prev_stack_base_branch = (previous_run.state or {}).get("stack_base_branch")if prev_stack_base_branch:extra_state["stack_base_branch"] = prev_stack_base_branch+ # The resumed agent still works with the repositories it was told about, so its token must+ # keep covering them. The key is PATCH-protected, so this copy is the only way it carries.+ prev_github_access_repositories = (previous_run.state or {}).get("github_access_repositories")+ if prev_github_access_repositories:+ extra_state["github_access_repositories"] = prev_github_access_repositoriesif pipeline_rerun and is_implementation:extra_state["ai_stage"] = "implementation"diff --git a/products/tasks/backend/models.py b/products/tasks/backend/models.pyindex 32cf5be4a4e4..1725b5ca17b4 100644--- a/products/tasks/backend/models.py+++ b/products/tasks/backend/models.py@@ -1272,6 +1272,7 @@ class Task(Taggable, DeletedMetaFields, models.Model):wizard_head_branch: str | None = None,self_driving_head_branch: str | None = None,stack_base_branch: str | None = None,+ github_access_repositories: list[str] | None = None,pending_user_message: str | None = None,custom_image_builder_id: str | None = None,custom_image_id: str | None = None,@@ -1534,6 +1535,13 @@ class Task(Taggable, DeletedMetaFields, models.Model):if stack_base_branch:extra_state["stack_base_branch"] = stack_base_branch+ # Repositories the run's GitHub token covers, kept apart from `repositories` because that+ # list also decides what provisioning clones. Credential minting, refresh, and resume read it.+ if github_access_repositories and resolved_repositories:+ extra_state["github_access_repositories"] = list(+ dict.fromkeys([*resolved_repositories, *(name.lower() for name in github_access_repositories)])+ )+# The first message handed to the agent once its server is ready (forward_pending_user_message# reads it from run state). Without it a background run boots the agent idle — it never gets a# prompt and just sits there while relay_sandbox_events waits for events that never come.@@ -1684,6 +1692,7 @@ class Task(Taggable, DeletedMetaFields, models.Model):wizard_head_branch: str | None = None,self_driving_head_branch: str | None = None,stack_base_branch: str | None = None,+ github_access_repositories: list[str] | None = None,pending_user_message: str | None = None,workflow_id_prefix: str | None = None,scheduled_at: datetime | None = None,@@ -1797,6 +1806,7 @@ class Task(Taggable, DeletedMetaFields, models.Model):wizard_head_branch=wizard_head_branch,self_driving_head_branch=self_driving_head_branch,stack_base_branch=stack_base_branch,+ github_access_repositories=github_access_repositories,pending_user_message=pending_user_message,custom_image_builder_id=custom_image_builder_id,custom_image_id=custom_image_id,@@ -3170,6 +3180,11 @@ class TaskRun(models.Model):"repositories": (self.state or {}).get("repositories")or self.task.repositoriesor ([self.task.repository] if self.task.repository else []),+ # Repositories the run's token covers beyond what it clones, to measure that grant's adoption.+ "github_extra_access_repository_count": len(+ set((self.state or {}).get("github_access_repositories") or [])+ - set((self.state or {}).get("repositories") or [])+ ),"origin_product": self.task.origin_product,"title": self.task.title,"signal_report_id": str(self.task.signal_report_id) if self.task.signal_report_id else None,diff --git a/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py b/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.pyindex 8aa7ac60e3be..2c44fe2fce5a 100644--- a/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py+++ b/products/tasks/backend/temporal/process_task/activities/get_task_processing_context.py@@ -216,6 +216,17 @@ class TaskProcessingContext:return repositoriesreturn [self.repository] if self.repository else []+ @property+ def github_access_repositories(self) -> list[str]:+ """Repositories the run's GitHub token covers: the cloned ones plus any granted at creation.++ Only token minting reads this. Remote rewrites and cloning stay on ``repositories``.+ """+ access = (self.state or {}).get("github_access_repositories")+ if isinstance(access, list) and access and all(isinstance(repository, str) for repository in access):+ return access+ return self.repositories+@propertydef github_read_access(self) -> bool:"""Run that asked to be downscoped to a read-only GitHub token (see Task.create_and_run).diff --git a/products/tasks/backend/temporal/process_task/sandbox_credentials.py b/products/tasks/backend/temporal/process_task/sandbox_credentials.pyindex 58718832479f..fecf9ba8bedd 100644--- a/products/tasks/backend/temporal/process_task/sandbox_credentials.py+++ b/products/tasks/backend/temporal/process_task/sandbox_credentials.py@@ -555,7 +555,7 @@ class GitHubSandboxCredential:cause=cause,)try:- return get_github_token(task.github_integration_id, repositories=ctx.repositories)+ return get_github_token(task.github_integration_id, repositories=ctx.github_access_repositories)except Integration.DoesNotExist as e:raise CredentialUnavailableError("GitHub integration for this run no longer exists",diff --git a/products/tasks/backend/temporal/process_task/tests/test_utils.py b/products/tasks/backend/temporal/process_task/tests/test_utils.pyindex 1e8fcba4f0c2..b7314bd475bb 100644--- a/products/tasks/backend/temporal/process_task/tests/test_utils.py+++ b/products/tasks/backend/temporal/process_task/tests/test_utils.py@@ -1234,6 +1234,18 @@ class TestGetSandboxGitHubToken(SimpleTestCase):("task_repository", {}, "acme/api", ["acme/api"]),("pinned_list_ignores_changed_task_repository", {"repositories": ["acme/api"]}, "acme/new", ["acme/api"]),("empty_pinned_list_ignores_task_repository", {"repositories": []}, "acme/api", []),+ (+ "access_list_widens_clone_list",+ {"repositories": ["acme/api"], "github_access_repositories": ["acme/api", "acme/assets"]},+ "acme/api",+ ["acme/api", "acme/assets"],+ ),+ (+ "empty_access_list_keeps_clone_list",+ {"repositories": ["acme/api"], "github_access_repositories": []},+ "acme/api",+ ["acme/api"],+ ),])@patch("products.tasks.backend.temporal.process_task.utils.get_github_token")diff --git a/products/tasks/backend/temporal/process_task/utils.py b/products/tasks/backend/temporal/process_task/utils.pyindex 885d0758840e..4f38edf0d2a7 100644--- a/products/tasks/backend/temporal/process_task/utils.py+++ b/products/tasks/backend/temporal/process_task/utils.py@@ -937,7 +937,11 @@ def _installation_repository_names(github_integration: GitHubIntegrationBase, redef _sandbox_repositories(state: dict[str, Any] | None, repository: str | None) -> list[str]:- # Same rule as TaskProcessingContext.repositories, so the token covers exactly what the run clones.+ # Same rule as TaskProcessingContext.github_access_repositories: what the run clones, plus any+ # repositories its creator granted on top. Never wider, so an empty grant keeps the clone scope.+ access = (state or {}).get("github_access_repositories")+ if isinstance(access, list) and access and all(isinstance(r, str) for r in access):+ return accesspinned = (state or {}).get("repositories")if isinstance(pinned, list) and all(isinstance(r, str) for r in pinned):return pinneddiff --git a/products/tasks/backend/tests/test_agent_instructions.py b/products/tasks/backend/tests/test_agent_instructions.pyindex b1a8f67e3979..be55dd0c13b8 100644--- a/products/tasks/backend/tests/test_agent_instructions.py+++ b/products/tasks/backend/tests/test_agent_instructions.py@@ -180,7 +180,16 @@ class TestAgentInstructionsAPI(APIBaseTest):[("tasks/config/agent_instructions", "agent_instructions", "agent instructions"),("tasks/@me/config/agent_instructions", "agent_instructions", "agent instructions"),- ("signals/config", "research_instructions", "steering instructions"),+ (+ "signals/config",+ "research_instructions",+ "steering instructions or implementation repositories",+ ),+ (+ "signals/config",+ "implementation_repositories",+ "steering instructions or implementation repositories",+ ),])def test_a_task_agent_cannot_rewrite_instructions(self, path: str, field: str, label: str) -> None:@@ -213,7 +222,10 @@ class TestAgentInstructionsAPI(APIBaseTest):client = APIClient()client.credentials(HTTP_AUTHORIZATION=f"Bearer {token.token}")- response = client.post(f"/api/projects/{self.team.id}/{path}/", {field: "Change the project rules."})+ value: str | list[str] = (+ ["attacker/assets"] if field == "implementation_repositories" else "Change the project rules."+ )+ response = client.post(f"/api/projects/{self.team.id}/{path}/", {field: value}, format="json")assert response.status_code == 403, response.contentassert response.json()["detail"] == f"Task agents cannot modify {label}."read_path = path.removesuffix("/agent_instructions")diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex 523917da624a..c66d132944cb 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -7886,6 +7886,8 @@ class TestTaskRunAPI(BaseTaskAPITest):"ai_agent_name": "signals-scout-general",# the stamped branch is the unforgeable run->PR link; a writable value re-aims it"self_driving_head_branch": "posthog-self-driving/attacker-000000",+ # a writable access list widens what the run's GitHub token can write to+ "github_access_repositories": ["attacker/attacker"],"runtime_adapter": "codex","provider": "openai","model": "claude-opus-4-8",@@ -7959,6 +7961,7 @@ class TestTaskRunAPI(BaseTaskAPITest):assert run.state["sandbox_gone"] is Falseassert run.state["ai_stage"] == "research" # cannot forge implementation provenanceassert run.state["self_driving_head_branch"] == "posthog-self-driving/real-3f9a2c"+ assert "github_access_repositories" not in run.stateassert run.state["runtime_adapter"] == "claude"assert run.state["provider"] == "anthropic"assert run.state["model"] == "claude-sonnet-5"diff --git a/products/tasks/backend/tests/test_facade.py b/products/tasks/backend/tests/test_facade.pyindex b47ddd47b2be..b19369f8736a 100644--- a/products/tasks/backend/tests/test_facade.py+++ b/products/tasks/backend/tests/test_facade.py@@ -1418,9 +1418,10 @@ class TestFacadeReadsAndMappers(TestCase):[("self_driving_head_branch", "posthog-self-driving/fix-abc123"),("stack_base_branch", "posthog-self-driving/schema-abc123"),+ ("github_access_repositories", ["acme/api", "acme/assets"]),])- def test_run_task_resume_carries_self_driving_branch_stamp(self, state_key: str, branch: str):+ def test_run_task_resume_carries_self_driving_branch_stamp(self, state_key: str, branch: str | list[str]):# The signals review carve-out binds a PR to its run by matching the PR head ref against the# PATCH-protected state.self_driving_head_branch stamp. A resume mints a new run, so the# stamp must be copied forward or the carve-out stops matching the successor — the receiverdiff --git a/products/tasks/backend/tests/test_models.py b/products/tasks/backend/tests/test_models.pyindex e96bfbc70c35..67e34e557889 100644--- a/products/tasks/backend/tests/test_models.py+++ b/products/tasks/backend/tests/test_models.py@@ -507,6 +507,35 @@ class TestTask(TestCase):state = TaskRun.objects.get(id=mock_execute_workflow.call_args.kwargs["run_id"]).stateself.assertEqual(state["repositories"], ["posthog/posthog", "posthog/posthog-js"])+ @parameterized.expand(+ [+ ("granted", ["PostHog/pr-assets", "posthog/posthog"], ["posthog/posthog", "posthog/pr-assets"]),+ ("nothing_granted", [], None),+ ]+ )+ @patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")+ def test_create_and_run_keeps_github_access_apart_from_the_clone_list(+ self, _name: str, granted: list[str], expected_access: list[str] | None, mock_execute_workflow+ ):+ user = User.objects.create(email="[email protected]")+ Integration.objects.create(team=self.team, kind="github", config={})++ with self.captureOnCommitCallbacks(execute=True):+ task = Task.create_and_run(+ team=self.team,+ title="Implementation",+ description="Test Description",+ origin_product=Task.OriginProduct.SIGNAL_REPORT,+ user_id=user.id,+ repository="posthog/posthog",+ github_access_repositories=granted,+ )++ self.assertEqual(task.repositories, ["posthog/posthog"])+ state = TaskRun.objects.get(id=mock_execute_workflow.call_args.kwargs["run_id"]).state+ self.assertEqual(state["repositories"], ["posthog/posthog"])+ self.assertEqual(state.get("github_access_repositories"), expected_access)+@patch("products.tasks.backend.temporal.client.execute_task_processing_workflow")def test_create_and_run_threads_github_read_access_into_state(self, mock_execute_workflow):from products.tasks.backend.temporal.process_task.activities.get_task_processing_context import ( # noqa: PLC0415 — activities import the workflow stack; keep it off this module's import pathdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex ce3621392fe1..afa4a139043e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -112021,6 +112021,12 @@ export namespace Schemas {* @nullable*/pull_request_label?: string | null;+ /**+ * Extra GitHub repositories, as 'organization/repository', that self-driving implementation tasks can read and write within the connected GitHub App's permissions, for example an assets repository for PR screenshots. A task gets only the entries with the same owner as its selected repository. They are not cloned, and the PR still targets the selected repository. Each new entry must be reachable through one of the project's GitHub installations. Changes apply to tasks started afterwards. Empty by default.+ * @maxItems 20+ * @items.maxLength 255+ */+ implementation_repositories?: string[];/** Whether anomaly scoring scores this project's active trends insights every hour and writes the results as $anomaly_score events, which are not billed. True by default. Set false to stop new scores; events written before stay. Turning it on does not enroll a project that anomaly_scoring_available reports as not covered. */anomaly_scoring_enabled?: boolean;/** Whether anomaly scoring covers this project, so anomaly_scoring_enabled has an effect. PostHog decides which projects anomaly scoring covers. */diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex d0d196b8c77f..b8f8b8ec0c8f 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -193,6 +193,10 @@ export const signalsConfigCreateBodyMaxReportsPerDayMax = 2147483647export const signalsConfigCreateBodyPullRequestLabelMax = 50+export const signalsConfigCreateBodyImplementationRepositoriesItemMax = 255++export const signalsConfigCreateBodyImplementationRepositoriesMax = 20+export const SignalsConfigCreateBody = () => zod.object({autostart_enabled: zod.boolean()@@ -283,6 +287,13 @@ export const SignalsConfigCreateBody = () => zod.object({.describe("The label name self-driving applies, at most 50 characters. Null or blank means 'self-driving'. The label is created in the repository when it does not exist yet. Only used while pull_request_label_enabled is true."),+ implementation_repositories: zod+ .array(zod.string().max(signalsConfigCreateBodyImplementationRepositoriesItemMax))+ .max(signalsConfigCreateBodyImplementationRepositoriesMax)+ .optional()+ .describe(+ "Extra GitHub repositories, as 'organization\/repository', that self-driving implementation tasks can read and write within the connected GitHub App's permissions, for example an assets repository for PR screenshots. A task gets only the entries with the same owner as its selected repository. They are not cloned, and the PR still targets the selected repository. Each new entry must be reachable through one of the project's GitHub installations. Changes apply to tasks started afterwards. Empty by default."+ ),anomaly_scoring_enabled: zod.boolean().optional()diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 2aff930a69e1..95f5b52783e4 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -1250,6 +1250,7 @@ const InboxSteeringInstructionsUpdateSchema = () => {github_issue_writeback_enabled: true,pull_request_label_enabled: true,pull_request_label: true,+ implementation_repositories: true,anomaly_scoring_enabled: true,})}