@@ -5940,7 +5940,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
59405940 worktreePath === undefined
59415941 ? sql ``
59425942 : sql ` AND json_extract(t.payload_json, '$.worktreePath') = ${ worktreePath } `
5943- } ${ threadIds === undefined ? sql `` : sql ` AND t.thread_id IN ${ sql . in ( threadIds ) } ` }
5943+ } ${ threadIds === undefined ? sql `` : sql ` AND t.thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } )) ` }
59445944 ORDER BY t.updated_at ASC, t.thread_id ASC
59455945 ` ;
59465946
@@ -5953,14 +5953,14 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
59535953 : sql < ShellRunRow > `
59545954 SELECT thread_id, run_id, ordinal
59555955 FROM orchestration_v2_projection_runs
5956- WHERE thread_id IN ${ sql . in ( threadIds ) }
5956+ WHERE thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } ))
59575957 ` ;
59585958
59595959 const selectShellRunItemCounts = ( threadIds : ReadonlyArray < ThreadId > ) =>
59605960 sql < ShellRunItemCountRow > `
59615961 SELECT thread_id, run_id, COUNT(*) AS item_count
59625962 FROM orchestration_v2_projection_turn_items
5963- WHERE run_id IS NOT NULL AND thread_id IN ${ sql . in ( threadIds ) }
5963+ WHERE run_id IS NOT NULL AND thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } ))
59645964 GROUP BY thread_id, run_id
59655965 ` ;
59665966
@@ -5975,7 +5975,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
59755975 FROM (
59765976 SELECT thread_id, run_id, COUNT(*) AS item_count
59775977 FROM orchestration_v2_projection_turn_items
5978- WHERE thread_id IN ${ sql . in ( threadIds ) }
5978+ WHERE thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } ))
59795979 GROUP BY thread_id, run_id
59805980 ) counts
59815981 LEFT JOIN orchestration_v2_projection_runs r ON r.run_id = counts.run_id
@@ -5992,7 +5992,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
59925992 : sql < PayloadRow & { readonly thread_id : string } > `
59935993 SELECT thread_id, payload_json
59945994 FROM orchestration_v2_projection_provider_threads
5995- WHERE thread_id IN ${ sql . in ( threadIds ) }
5995+ WHERE thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } ))
59965996 ` ;
59975997
59985998 const selectShellPendingTurnItemRows = (
@@ -6008,7 +6008,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
60086008 WHERE i.type IN ('command_execution', 'dynamic_tool', 'subagent')
60096009 AND i.status NOT IN ('completed', 'interrupted', 'failed', 'cancelled')
60106010 AND (i.run_id IS NULL OR r.status <> 'rolled_back')
6011- ${ threadIds === undefined ? sql `` : sql `AND i.thread_id IN ${ sql . in ( threadIds ) } ` }
6011+ ${ threadIds === undefined ? sql `` : sql `AND i.thread_id IN (SELECT value FROM json_each( ${ encodeIdList ( threadIds ) } )) ` }
60126012 ${
60136013 activeRunIds . length === 0
60146014 ? sql ``
@@ -6017,7 +6017,7 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
60176017 UNION ALL
60186018 SELECT i.thread_id, i.payload_json, NULL AS owning_provider_instance_id
60196019 FROM orchestration_v2_projection_turn_items i
6020- WHERE i.run_id IN ${ sql . in ( activeRunIds ) }
6020+ WHERE i.run_id IN (SELECT value FROM json_each( ${ encodeIdList ( activeRunIds ) } ))
60216021 AND i.type IN ('file_change', 'file_search', 'web_search', 'compaction')
60226022 AND i.status IN ('running', 'waiting')
60236023 `
0 commit comments