fix(web): address model retry review feedback

This commit is contained in:
Yichen Jiang
2026-07-29 14:23:03 +08:00
parent 602f594c4b
commit 49131c47c5
28 changed files with 301 additions and 61 deletions

View File

@@ -33,6 +33,7 @@ interface FixtureTiming {
appendTitle(id: string, title: string): void
beginModelRetry(id: string): void
scheduleModelRetry(id: string, retry?: number, delayMs?: number): void
cancelModelRetryDuringBackoff(id: string, delayMs?: number): void
completeModelRetry(id: string): void
}
@@ -216,3 +217,27 @@ it('retracts a failed stream at llm/retry and retains the durable notice after r
await expect(`${JSON.stringify({ beforeRetry, firstRetry, scheduled, expanded, completed }, null, 2)}\n`)
.toMatchFileSnapshot('./snapshots/model-retry.json')
})
it('labels a retry cancelled during backoff without claiming that it started', async () => {
bootFixtureApp()
await selectFixtureSession()
const timing = (globalThis as Record<string, unknown>).__fxTiming as FixtureTiming
act(() => { timing.beginModelRetry('fx-alpha') })
await screen.findByText('应撤回的半截回复')
act(() => { timing.cancelModelRetryDuringBackoff('fx-alpha', 1_500) })
const notice = await screen.findByRole('status')
await waitFor(() => { expect(notice.textContent).toContain('重试已取消') })
await waitFor(() => { expect(screen.queryByText('应撤回的半截回复')).toBeNull() })
const disclosure = notice.closest('details')
if (disclosure === null) throw new Error('cancelled retry disclosure missing')
const cancelled = {
notice: notice.textContent,
partialVisible: screen.queryByText('应撤回的半截回复') !== null,
animated: disclosure.dataset.active === 'true',
}
await expect(`${JSON.stringify(cancelled, null, 2)}\n`)
.toMatchFileSnapshot('./snapshots/model-retry-cancel.json')
})

View File

@@ -0,0 +1,5 @@
{
"notice": "模型请求重试已取消1/2 · 2s",
"partialVisible": false,
"animated": false
}