File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -1017,18 +1017,41 @@ function MaestroConsoleInner() {
10171017 }
10181018
10191019 // Sessions must have aiTabs - if missing, this is a data corruption issue
1020+ // Create a default tab to prevent crashes when code calls .find() on aiTabs
10201021 if ( ! session . aiTabs || session . aiTabs . length === 0 ) {
10211022 console . error (
1022- '[restoreSession] Session has no aiTabs - data corruption, skipping :' ,
1023+ '[restoreSession] Session has no aiTabs - data corruption, creating default tab :' ,
10231024 session . id
10241025 ) ;
1026+ const defaultTabId = generateId ( ) ;
10251027 return {
10261028 ...session ,
10271029 aiPid : - 1 ,
10281030 terminalPid : 0 ,
10291031 state : 'error' as SessionState ,
10301032 isLive : false ,
10311033 liveUrl : undefined ,
1034+ aiTabs : [
1035+ {
1036+ id : defaultTabId ,
1037+ agentSessionId : null ,
1038+ name : null ,
1039+ state : 'idle' as const ,
1040+ logs : [
1041+ {
1042+ id : generateId ( ) ,
1043+ timestamp : Date . now ( ) ,
1044+ source : 'system' as const ,
1045+ text : '⚠️ Session data was corrupted and has been recovered with a new tab.' ,
1046+ } ,
1047+ ] ,
1048+ starred : false ,
1049+ inputValue : '' ,
1050+ stagedImages : [ ] ,
1051+ createdAt : Date . now ( ) ,
1052+ } ,
1053+ ] ,
1054+ activeTabId : defaultTabId ,
10321055 } ;
10331056 }
10341057
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import { AgentSessionsBrowser } from './AgentSessionsBrowser';
3434import { TabBar } from './TabBar' ;
3535import { WizardConversationView , DocumentGenerationView } from './InlineWizard' ;
3636import { gitService } from '../services/git' ;
37+ import { remoteUrlToBrowserUrl } from '../../shared/gitUtils' ;
3738import { useGitBranch , useGitDetail , useGitFileStatus } from '../contexts/GitStatusContext' ;
3839import { formatShortcutKeys } from '../utils/shortcutFormatter' ;
3940import { calculateContextTokens } from '../utils/contextUsage' ;
@@ -939,10 +940,8 @@ export const MainPanel = React.memo(
939940 < button
940941 onClick = { ( e ) => {
941942 e . stopPropagation ( ) ;
942- const url = gitInfo . remote . startsWith ( 'http' )
943- ? gitInfo . remote
944- : `https://${ gitInfo . remote } ` ;
945- window . open ( url . replace ( / \. g i t $ / , '' ) , '_blank' ) ;
943+ const url = remoteUrlToBrowserUrl ( gitInfo . remote ) ;
944+ if ( url ) window . open ( url , '_blank' ) ;
946945 } }
947946 className = "text-xs font-mono truncate hover:underline text-left"
948947 style = { { color : theme . colors . textMain } }
You can’t perform that action at this time.
0 commit comments