@@ -45,7 +45,7 @@ function handleDecision(session: KokoTerminalAiSession, action: Extract<AiTimeli
4545 if ( ! decisionId || session . decisions . has ( decisionId ) ) return ;
4646
4747 const override = session . executionOverrides . get ( decisionId ) ;
48- const execution = terminalExecutionMode ( override || action . data . execution ) ;
48+ const execution = terminalExecutionMode ( override || action . data . execution , session ) ;
4949 const toolCallId = String ( action . data . toolCallId || "" ) ;
5050 if ( action . approved && toolCallId && ( override || execution !== "auto" ) ) {
5151 session . executionOverrides . set ( toolCallId , execution ) ;
@@ -174,7 +174,8 @@ export const terminalAiPanelDomain: AiPanelDomainAdapter = {
174174 {
175175 label : context . t ( "RightPanel.AIModePtyShort" ) ,
176176 description : context . t ( "RightPanel.AIModePty" ) ,
177- value : "pty"
177+ value : "pty" ,
178+ disabled : ! current . ptyExec
178179 } ,
179180 {
180181 label : context . t ( "RightPanel.AIModeBackgroundShort" ) ,
@@ -253,8 +254,7 @@ export const terminalAiPanelDomain: AiPanelDomainAdapter = {
253254 updateExecutionMode ( session , value ) {
254255 const current = terminalSession ( session ) ;
255256 if ( ! current ) return ;
256- const mode = String ( value || "auto" ) ;
257- current . executionMode = mode === "pty" || mode === "background" ? mode : "auto" ;
257+ current . executionMode = terminalExecutionMode ( value , current ) ;
258258 } ,
259259
260260 handleTimelineAction ( session , action ) {
@@ -265,7 +265,7 @@ export const terminalAiPanelDomain: AiPanelDomainAdapter = {
265265 return ;
266266 }
267267 if ( action . type === "set-execution-override" ) {
268- current . executionOverrides . set ( action . id , action . value ) ;
268+ current . executionOverrides . set ( action . id , terminalExecutionMode ( action . value , current ) ) ;
269269 return ;
270270 }
271271 if ( action . type === "set-step-expanded" ) {
0 commit comments