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:
andreicarpen 2026-04-19 11:13:38 +03:00
parent 690aa10b47
commit 0a89d657f0
1 changed files with 12 additions and 2 deletions

View File

@ -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') {
// stopPollingprogress.json resume generating
emit('update-status', 'error')
stopPolling()
} else if (res.data.status === 'completed') {
emit('update-status', 'completed')
} else if (prevStatus !== res.data.status) {