@@ -20,6 +20,7 @@ import type {
2020 Block ,
2121 RepoPRState ,
2222 SeerExplorerResponse ,
23+ SeerExplorerRunId ,
2324} from 'sentry/views/seerExplorer/types' ;
2425import {
2526 isSeerExplorerEnabled ,
@@ -30,6 +31,7 @@ import {
3031type SeerExplorerChatResponse = {
3132 message : Block ;
3233 run_id : number ;
34+ sentry_run_id ?: string | null ;
3335} ;
3436
3537type SeerExplorerUpdateResponse = {
@@ -170,7 +172,7 @@ export const useSeerExplorer = () => {
170172 overrideCtxEngEnable : boolean ;
171173 pageName : string ;
172174 query : string ;
173- runId : number | null ;
175+ runId : SeerExplorerRunId | null ;
174176 screenshot : string | undefined ;
175177 }
176178 > ( {
@@ -209,8 +211,11 @@ export const useSeerExplorer = () => {
209211 } ,
210212 onSuccess : ( response , params ) => {
211213 if ( params . runId === null ) {
212- // set run ID if this is a new session
213- dispatch ( { type : 'set run id' , payload : response . run_id } ) ;
214+ // Prefer the UUID; fall back to the numeric run_id for legacy runs.
215+ dispatch ( {
216+ type : 'set run id' ,
217+ payload : response . sentry_run_id ?? response . run_id ,
218+ } ) ;
214219 } else {
215220 // invalidate the query so fresh data is fetched
216221 queryClient . invalidateQueries ( {
@@ -243,7 +248,7 @@ export const useSeerExplorer = () => {
243248 {
244249 inputId : string ;
245250 orgSlug : string ;
246- runId : number | null ;
251+ runId : SeerExplorerRunId | null ;
247252 responseData ?: Record < string , any > ;
248253 }
249254 > ( {
@@ -309,7 +314,7 @@ export const useSeerExplorer = () => {
309314 const { mutate : createPRMutate } = useMutation <
310315 SeerExplorerUpdateResponse ,
311316 RequestError ,
312- { orgSlug : string ; runId : number | null ; repoName ?: string }
317+ { orgSlug : string ; runId : SeerExplorerRunId | null ; repoName ?: string }
313318 > ( {
314319 mutationFn : async params => {
315320 setHasSentInterrupt ( false ) ;
@@ -367,7 +372,7 @@ export const useSeerExplorer = () => {
367372 RequestError ,
368373 {
369374 orgSlug : string ;
370- runId : number | null ;
375+ runId : SeerExplorerRunId | null ;
371376 }
372377 > ( {
373378 mutationFn : async params => {
@@ -405,7 +410,7 @@ export const useSeerExplorer = () => {
405410
406411 /** Switches to a different run and fetches its latest state. */
407412 const switchToRun = useCallback (
408- ( newRunId : number | null , { onSuccess} : { onSuccess ?: ( ) => void } = { } ) => {
413+ ( newRunId : SeerExplorerRunId | null , { onSuccess} : { onSuccess ?: ( ) => void } = { } ) => {
409414 if ( newRunId === runId ) {
410415 return ;
411416 }
@@ -436,7 +441,11 @@ export const useSeerExplorer = () => {
436441 ) ;
437442
438443 const sendMessage = useCallback (
439- ( query : string , explicitInsertIndex ?: number , explicitRunId ?: number | null ) => {
444+ (
445+ query : string ,
446+ explicitInsertIndex ?: number ,
447+ explicitRunId ?: SeerExplorerRunId | null
448+ ) => {
440449 if ( ! orgSlug ) {
441450 return ;
442451 }
@@ -643,7 +652,6 @@ export const useSeerExplorer = () => {
643652 ] ;
644653
645654 const baseSession = rawSessionData ?? {
646- run_id : runId ?? undefined ,
647655 blocks : [ ] ,
648656 status : 'processing' as const ,
649657 updated_at : new Date ( ) . toISOString ( ) ,
0 commit comments