fix(report): clear failed state on resume_start and report_complete
Two symptoms reported after a successful resume: 1. Banner stays visible even though the report finished — because the historical 'error' log entry still lives in agent_log.jsonl, and every fetch from line 0 re-flipped reportStatus to 'failed'. 2. Polling dies mid-resume — stopPolling() was called when the error entry was re-read, killing the timers before the resume_start / report_complete entries landed. Fixes: - On 'resume_start': reset reportStatus back to 'generating' so the banner clears as soon as the resume kicks in. - On 'report_complete': force reportStatus='completed', clear reportError. Belt-and-suspenders even if an older error entry is re-read later. - Remove stopPolling() from the error handlers (both agent-log and progress-poll). The polling naturally stops on report_complete; if a real terminal failure never resumes, the component unmounts when the user navigates away. Better to waste a few extra polls than to soft-lock the UI during a legitimate resume. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
690aa10b47
commit
0a89d657f0
|
|
@ -2077,19 +2077,29 @@ const fetchAgentLog = async () => {
|
|||
if (log.action === 'report_complete') {
|
||||
isComplete.value = true
|
||||
currentSectionIndex.value = null // 确保清除 loading 状态
|
||||
// 清掉历史 error 日志留下的 failed 态,防止 banner 残留
|
||||
reportStatus.value = 'completed'
|
||||
reportError.value = null
|
||||
emit('update-status', 'completed')
|
||||
stopPolling()
|
||||
// 滚动逻辑统一在循环结束后的 nextTick 中处理
|
||||
}
|
||||
|
||||
// Resume 日志 = 之前的 error 已被跨过,继续生成中
|
||||
if (log.action === 'resume_start') {
|
||||
reportStatus.value = 'generating'
|
||||
reportError.value = null
|
||||
}
|
||||
|
||||
// Agent 抛出错误时直接标记失败 —— 比 progress.json 轮询更即时,
|
||||
// 也能兜底 update_progress 写失败的场景
|
||||
// 注意:这里不 stopPolling,否则 Resume 后重新拉取日志会再次命中
|
||||
// 这个历史 error 条目并立刻杀掉定时器,导致无法感知后续 resume/complete。
|
||||
if (log.action === 'error') {
|
||||
reportStatus.value = 'failed'
|
||||
reportError.value = log.details?.error || log.details?.message || null
|
||||
currentSectionIndex.value = null
|
||||
emit('update-status', 'error')
|
||||
stopPolling()
|
||||
}
|
||||
|
||||
if (log.action === 'report_start') {
|
||||
|
|
@ -2199,8 +2209,8 @@ const fetchProgress = async () => {
|
|||
reportError.value = res.data.status === 'failed' ? (res.data.message || null) : null
|
||||
|
||||
if (res.data.status === 'failed') {
|
||||
// 不 stopPolling:progress.json 可能在 resume 后翻回 generating
|
||||
emit('update-status', 'error')
|
||||
stopPolling()
|
||||
} else if (res.data.status === 'completed') {
|
||||
emit('update-status', 'completed')
|
||||
} else if (prevStatus !== res.data.status) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue