Skip to content

Fetch a re-run's errors again when the new attempt fails too [patch] - #397

Merged
matt-edmondson merged 3 commits into
mainfrom
claude/issue-394-rerun-errors
Nov 4, 2026
Merged

matt-edmondson merged 3 commits into
mainfrom
claude/issue-394-rerun-errors

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #394

What was wrong

A GitHub re-run keeps its run id. When attempt 2 also failed and the app never saw it as Pending or Running, the stored run was already Failure with attempt 1's errors. ShouldFetchRunErrors therefore returned false, and the row showed the new start time next to the previous attempt's errors indefinitely.

Change

  • GitHub.IsNewAttempt(storedStarted, started): true when a run that was read before comes back with a different run_started_at. A run read for the first time (no stored start) doesn't count.
  • GitHub.StartAttempt(run, started): records the start time and, on a new attempt, drops the previous attempt's errors. UpdateRunFromWorkflowAsync calls it in place of assigning run.Started directly.
  • Because a failed run with no errors is always fetched, dropping the stale errors is enough for ShouldFetchRunErrors to read the new attempt's jobs. If that fetch hits an API error, the errors stay empty, and the next update retries, as it does today.
  • The GitHub runs that fail with startup_failure or a timed-out job show no error text, and their jobs list is re-fetched every time the run is updated #311 guarantee still holds: an unchanged failed run keeps its errors and isn't refetched on every update.

Tests

GitHubRunErrorsTests gains three tests:

  • a failed re-run of a failed run drops its old errors and is fetched again
  • re-reading an unchanged failed run keeps its errors and doesn't refetch
  • a run read for the first time is not a new attempt

With the error-clearing in StartAttempt disabled, AFailedReRunOfAFailedRunFetchesItsJobsAgain fails. The full suite passes: 165/165.

The companion issue #395 (a re-run that isn't among the workflow's 10 newest runs is never re-read) is separate and not covered here.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vfJW5KENnPmXEat6KQ92F

A GitHub re-run keeps the run id. When attempt 2 also failed and the app
never saw it pending or running, the stored run was already a failure with
attempt 1's errors, so ShouldFetchRunErrors returned false and the row kept
showing the previous attempt's errors next to the new start time.

UpdateRunFromWorkflowAsync now compares the stored start time with the run's
run_started_at before overwriting it. A changed start time is a new attempt:
the old errors are dropped and the jobs are fetched again if it failed. An
unchanged failed run still isn't refetched on every update (#311).

Fixes #394

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5KENnPmXEat6KQ92F
SonarCloud's quality gate failed at 33% coverage on new code because the
attempt check lived in the private UpdateRunFromWorkflowAsync. StartAttempt
now records the start time, drops a previous attempt's errors and reports
whether the attempt is new, and is covered directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5KENnPmXEat6KQ92F
Clearing a new attempt's stale errors already makes ShouldFetchRunErrors
fetch them, since a failure with no errors is always fetched. The extra
newAttempt parameter is gone, StartAttempt just records the start time and
drops the old errors, and UpdateRunFromWorkflowAsync changes by one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5KENnPmXEat6KQ92F
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit f9d9b55 into main Nov 4, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the claude/issue-394-rerun-errors branch November 4, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A GitHub re-run that fails again keeps showing the first attempt's errors: the run's jobs are never fetched again

2 participants