@@ -355,10 +355,9 @@ export class SessionService {
355355 this . subscribeToChannel ( taskRunId ) ;
356356
357357 try {
358- const persistedMode = getConfigOptionByCategory (
359- persistedConfigOptions ,
360- "mode" ,
361- ) ?. currentValue ;
358+ const modeOpt = getConfigOptionByCategory ( persistedConfigOptions , "mode" ) ;
359+ const persistedMode =
360+ modeOpt ?. type === "select" ? modeOpt . currentValue : undefined ;
362361
363362 trpcClient . workspace . verify
364363 . query ( { taskId } )
@@ -429,7 +428,7 @@ export class SessionService {
429428 . mutate ( {
430429 sessionId : taskRunId ,
431430 configId : opt . id ,
432- value : opt . currentValue ,
431+ value : String ( opt . currentValue ) ,
433432 } )
434433 . catch ( ( error ) => {
435434 log . warn (
@@ -1636,7 +1635,9 @@ export class SessionService {
16361635
16371636 // Optimistic update
16381637 const updatedOptions = configOptions . map ( ( opt ) =>
1639- opt . id === configId ? { ...opt , currentValue : value } : opt ,
1638+ opt . id === configId
1639+ ? ( { ...opt , currentValue : value } as SessionConfigOption )
1640+ : opt ,
16401641 ) ;
16411642 sessionStoreSetters . updateSession ( session . taskRunId , {
16421643 configOptions : updatedOptions ,
@@ -1652,15 +1653,17 @@ export class SessionService {
16521653 } catch ( error ) {
16531654 // Rollback on error
16541655 const rolledBackOptions = configOptions . map ( ( opt ) =>
1655- opt . id === configId ? { ...opt , currentValue : previousValue } : opt ,
1656+ opt . id === configId
1657+ ? ( { ...opt , currentValue : previousValue } as SessionConfigOption )
1658+ : opt ,
16561659 ) ;
16571660 sessionStoreSetters . updateSession ( session . taskRunId , {
16581661 configOptions : rolledBackOptions ,
16591662 } ) ;
16601663 updatePersistedConfigOptionValue (
16611664 session . taskRunId ,
16621665 configId ,
1663- previousValue ,
1666+ String ( previousValue ) ,
16641667 ) ;
16651668 log . error ( "Failed to set session config option" , {
16661669 taskId,
@@ -1697,7 +1700,7 @@ export class SessionService {
16971700 track ( ANALYTICS_EVENTS . SESSION_CONFIG_CHANGED , {
16981701 task_id : taskId ,
16991702 category,
1700- from_value : configOption . currentValue ,
1703+ from_value : String ( configOption . currentValue ) ,
17011704 to_value : value ,
17021705 } ) ;
17031706 }
0 commit comments