fix: follow up prompt preservation changes (#292)

* fix: remove unused disabled prop, throttle SW update checks, precache icon

* fix: retract transient send error and restored prompt once server confirms send

When a long-running prompt request drops (gateway timeout or network error)
while the agent is actually working, the send error banner and the restored
prompt text were left in place. Tag send errors as 'network' and clear them
when the server confirms session activity (message.updated / session.idle),
also clearing the restored input text. Genuine server-reported session errors
(kind 'session') are preserved.

* style: restyle ErrorBanner with neutral card fill and destructive accent bar

Replace the all-red destructive Alert variant (transparent background, full
red text) with a neutral card-filled banner, a left destructive accent bar,
red icon, foreground title, and muted body/detail text. Improves the send-error
and git-error banners on the dark theme.
This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-27 09:26:37 -04:00
1 parent 71ba7371bc
commit 8d93f2f1f9
11 files changed
+215 -31

No files matched your search

@@ -38,6 +38,7 @@ describe('useSendErrorStore', () => {
title: 'Error',
message: 'Failed',
failedPrompt: 'queued message',
kind: 'session',
})
expect(useSendErrorStore.getState().queuedPrompts['session-1']).toBeUndefined()
})
@@ -51,4 +52,17 @@ describe('useSendErrorStore', () => {
expect(useSendErrorStore.getState().getError('session-1')).toBeNull()
})
it('clearNetworkError retracts a network error', () => {
useSendErrorStore.getState().setError({ sessionID: 'session-1', title: 'Error', message: 'msg', kind: 'network' })
useSendErrorStore.getState().clearNetworkError('session-1')
expect(useSendErrorStore.getState().getError('session-1')).toBeNull()
})
it('clearNetworkError preserves a server-reported session error', () => {
useSendErrorStore.getState().setQueuedPrompt('session-1', 'queued message')
useSendErrorStore.getState().failQueuedPrompt({ sessionID: 'session-1', title: 'Error', message: 'Failed' })
useSendErrorStore.getState().clearNetworkError('session-1')
expect(useSendErrorStore.getState().getError('session-1')).not.toBeNull()
})
})
+9 -3
View File
@@ -6,6 +6,7 @@ export interface SendError {
message: string
detail?: string
failedPrompt?: string
kind?: 'network' | 'session'
}
interface SendErrorStore {
@@ -14,8 +15,9 @@ interface SendErrorStore {
setError: (err: SendError) => void
setQueuedPrompt: (sessionID: string, prompt: string) => void
clearQueuedPrompt: (sessionID: string) => void
failQueuedPrompt: (err: Omit<SendError, 'failedPrompt'>) => void
failQueuedPrompt: (err: Omit<SendError, 'failedPrompt' | 'kind'>) => void
clearError: (sessionID: string) => void
clearNetworkError: (sessionID: string) => void
getError: (sessionID: string) => SendError | null
}
@@ -39,7 +41,7 @@ export const useSendErrorStore = create<SendErrorStore>((set, get) => ({
return { queuedPrompts }
})
},
failQueuedPrompt: (err: Omit<SendError, 'failedPrompt'>) => {
failQueuedPrompt: (err: Omit<SendError, 'failedPrompt' | 'kind'>) => {
set((state) => {
const failedPrompt = state.queuedPrompts[err.sessionID]
if (!failedPrompt) return state
@@ -48,7 +50,7 @@ export const useSendErrorStore = create<SendErrorStore>((set, get) => ({
return {
errors: {
...state.errors,
[err.sessionID]: { ...err, failedPrompt },
[err.sessionID]: { ...err, failedPrompt, kind: 'session' },
},
queuedPrompts,
}
@@ -61,6 +63,10 @@ export const useSendErrorStore = create<SendErrorStore>((set, get) => ({
return { errors: newErrors }
})
},
clearNetworkError: (sessionID: string) => {
if (get().errors[sessionID]?.kind === 'session') return
get().clearError(sessionID)
},
getError: (sessionID: string) => {
return get().errors[sessionID] || null
},