fix: validate transcript sessions before resume and fix FAB race condition
Server now checks that transcript .jsonl files exist before creating terminals, preventing dead sessions from --resume errors. Frontend shows error banner in modal when resume fails. Fixed race condition where init() would overwrite FAB terminal selection after page refresh by guarding with pendingSwitchTarget flag.
This commit is contained in:
@@ -6,6 +6,7 @@ const props = defineProps<{
|
||||
visible: boolean
|
||||
agents: { id: AgentName; label: string }[]
|
||||
currentAgent: AgentName
|
||||
error?: string | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -34,7 +35,8 @@ const hasAnySessions = computed(() =>
|
||||
// Reset state when modal opens
|
||||
watch(() => props.visible, async (open) => {
|
||||
if (open) {
|
||||
activeTab.value = 'new'
|
||||
// If reopening after a resume error, show the resume tab
|
||||
activeTab.value = props.error ? 'resume' : 'new'
|
||||
selectedAgent.value = props.currentAgent
|
||||
resumeFilter.value = 'all'
|
||||
initialPrompt.value = ''
|
||||
@@ -129,6 +131,16 @@ function handleResume(sessionId: string, agent: AgentName) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Error banner -->
|
||||
<div v-if="error" class="nsm-error">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="10"/>
|
||||
<line x1="12" y1="8" x2="12" y2="12"/>
|
||||
<line x1="12" y1="16" x2="12.01" y2="16"/>
|
||||
</svg>
|
||||
{{ error }}
|
||||
</div>
|
||||
|
||||
<!-- Body -->
|
||||
<div class="nsm-body">
|
||||
<!-- Tab: New session -->
|
||||
@@ -333,6 +345,24 @@ function handleResume(sessionId: string, agent: AgentName) {
|
||||
border-bottom-color: #6366f1;
|
||||
}
|
||||
|
||||
/* Error banner */
|
||||
.nsm-error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 1rem;
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
border-bottom: 1px solid rgba(239, 68, 68, 0.3);
|
||||
color: #f87171;
|
||||
font-size: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.nsm-error svg {
|
||||
flex-shrink: 0;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
.nsm-body {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user