@@ -38,8 +38,33 @@ const createFixtureSource = Effect.fn("createMigrateDevDbFixtureSource")(functio
3838 '{"lineage":{"parentThreadId":"stopped-thread","relationshipToParent":"fork","rootThreadId":"stopped-thread"}}' ;
3939 const subagentPayload =
4040 '{"lineage":{"parentThreadId":"subagent-parent","relationshipToParent":"subagent","rootThreadId":"subagent-parent"},"forkedFrom":{"type":"node","nodeId":"node-1"}}' ;
41+ const watchedPayload = JSON . stringify ( {
42+ pullRequests : [
43+ {
44+ host : "github.com" ,
45+ repository : "owner/repo" ,
46+ number : 7 ,
47+ url : "https://github.com/owner/repo/pull/7" ,
48+ source : "agent" ,
49+ linkedAt : "2026-08-01T00:00:00.000Z" ,
50+ snapshot : null ,
51+ stack : null ,
52+ watch : {
53+ startedAt : "2026-08-01T00:00:00.000Z" ,
54+ headSha : null ,
55+ failedChecks : [ ] ,
56+ passed : false ,
57+ passedChecks : [ ] ,
58+ remarksThrough : "2026-08-01T00:00:00.000Z" ,
59+ remarkIds : [ ] ,
60+ conflicting : false ,
61+ wakes : 0 ,
62+ } ,
63+ } ,
64+ ] ,
65+ } ) ;
4166 const threads = [
42- [ "stopped-thread" , "project-kept" , "completed" , "{}" , "2026-08-01" ] ,
67+ [ "stopped-thread" , "project-kept" , "completed" , watchedPayload , "2026-08-01" ] ,
4368 [ "fork-thread" , "project-kept" , "completed" , forkPayload , "2026-08-02" ] ,
4469 [ "running-thread" , "project-kept" , "running" , "{}" , "2026-08-05" ] ,
4570 [ "settled-thread" , "project-kept" , "completed" , '{"settledAt":"2026-08-01"}' , "2026-08-05" ] ,
@@ -129,6 +154,11 @@ it.layer(NodeServices.layer)("migrate-dev-db", (it) => {
129154 SELECT stream_id FROM orchestration_events ORDER BY stream_id` ;
130155 const sessions = yield * sql < { provider_session_id : string } > `
131156 SELECT provider_session_id FROM orchestration_v2_projection_provider_sessions` ;
157+ const [ pullRequest ] = yield * sql < { url : string | null ; watch : string | null } > `
158+ SELECT
159+ json_extract(payload_json, '$.pullRequests[0].url') AS url,
160+ json_extract(payload_json, '$.pullRequests[0].watch') AS watch
161+ FROM orchestration_v2_projection_threads WHERE thread_id = 'stopped-thread'` ;
132162 const [ leftovers ] = yield * sql < {
133163 auth : number ;
134164 tasks : number ;
@@ -143,7 +173,7 @@ it.layer(NodeServices.layer)("migrate-dev-db", (it) => {
143173 (SELECT COUNT(*) FROM scheduled_task_webhook_pending) AS webhooks,
144174 (SELECT COUNT(*) FROM orchestration_v2_projection_context_transfers) AS transfers,
145175 (SELECT COUNT(*) FROM peer_environment_links) AS links` ;
146- return { threads, events, sessions, leftovers } ;
176+ return { threads, events, sessions, pullRequest , leftovers } ;
147177 } ) ,
148178 ) ;
149179 assert . deepStrictEqual (
@@ -158,6 +188,11 @@ it.layer(NodeServices.layer)("migrate-dev-db", (it) => {
158188 kept . sessions . map ( ( row ) => row . provider_session_id ) ,
159189 [ "session-shared" ] ,
160190 ) ;
191+ assert . deepStrictEqual (
192+ kept . pullRequest ,
193+ { url : "https://github.com/owner/repo/pull/7" , watch : null } ,
194+ "copied pull request links keep their history but stop being watched" ,
195+ ) ;
161196 assert . deepStrictEqual ( kept . leftovers , {
162197 auth : 0 ,
163198 tasks : 0 ,
0 commit comments