@@ -799,8 +799,10 @@ export class SessionService {
799799 const msg = acpMsg . message ;
800800
801801 if ( isJsonRpcRequest ( msg ) && msg . method === "session/prompt" ) {
802+ // acpMsg.ts is local time (set in-process) — matches Date.now() used in sendLocalPrompt
802803 sessionStoreSetters . updateSession ( taskRunId , {
803804 isPromptPending : true ,
805+ promptStartedAt : acpMsg . ts ,
804806 } ) ;
805807 }
806808
@@ -813,6 +815,7 @@ export class SessionService {
813815 ) {
814816 sessionStoreSetters . updateSession ( taskRunId , {
815817 isPromptPending : false ,
818+ promptStartedAt : null ,
816819 } ) ;
817820
818821 const stopReason = ( msg . result as { stopReason ?: string } ) . stopReason ;
@@ -1042,6 +1045,7 @@ export class SessionService {
10421045 ) : Promise < { stopReason : string } > {
10431046 sessionStoreSetters . updateSession ( session . taskRunId , {
10441047 isPromptPending : true ,
1048+ promptStartedAt : Date . now ( ) ,
10451049 } ) ;
10461050
10471051 try {
@@ -1052,6 +1056,7 @@ export class SessionService {
10521056 // Clear pending state on success
10531057 sessionStoreSetters . updateSession ( session . taskRunId , {
10541058 isPromptPending : false ,
1059+ promptStartedAt : null ,
10551060 } ) ;
10561061 return result ;
10571062 } catch ( error ) {
@@ -1072,10 +1077,12 @@ export class SessionService {
10721077 errorDetails ||
10731078 "Session connection lost. Please retry or start a new task." ,
10741079 isPromptPending : false ,
1080+ promptStartedAt : null ,
10751081 } ) ;
10761082 } else {
10771083 sessionStoreSetters . updateSession ( session . taskRunId , {
10781084 isPromptPending : false ,
1085+ promptStartedAt : null ,
10791086 } ) ;
10801087 }
10811088
@@ -1223,6 +1230,11 @@ export class SessionService {
12231230
12241231 const previousValue = configOptions [ optionIndex ] . currentValue ;
12251232
1233+ // Skip if value is already set — avoids expensive IPC round-trip (e.g. setModel ~2s)
1234+ if ( previousValue === value ) {
1235+ return ;
1236+ }
1237+
12261238 // Optimistic update
12271239 const updatedOptions = configOptions . map ( ( opt ) =>
12281240 opt . id === configId ? { ...opt , currentValue : value } : opt ,
@@ -1623,6 +1635,7 @@ export class SessionService {
16231635 startedAt : Date . now ( ) ,
16241636 status : "connecting" ,
16251637 isPromptPending : false ,
1638+ promptStartedAt : null ,
16261639 pendingPermissions : new Map ( ) ,
16271640 messageQueue : [ ] ,
16281641 } ;
0 commit comments