Skip to content

Conversation

@Zettat123
Copy link
Contributor

Backport #35840

#35783 fixes an actions rerun bug. Due to this bug, some runs may be incorrectly marked as StatusWaiting even though all the jobs are in done status. These runs cannot be run or cancelled. This PR adds a new doctor command to fix the inconsistent run status.

gitea doctor check --run fix-actions-unfinished-run-status --fix

Thanks to @ChristopherHX for the test.

incorrectly marked as `StatusWaiting` even though all the jobs are in
done status. These runs cannot be run or cancelled. This PR adds a new
doctor command to fix the inconsistent run status.

```
gitea doctor check --run fix-actions-unfinished-run-status --fix
```

Thanks to @ChristopherHX  for the test.
@GiteaBot GiteaBot added this to the 1.25.1 milestone Nov 4, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 4, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Nov 4, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 4, 2025
@lutinglt
Copy link
Contributor

lutinglt commented Nov 4, 2025

Perhaps we should add a timeout period for waiting for scheduling? Marking exceeding the waiting time as an error.

@Zettat123
Copy link
Contributor Author

Perhaps we should add a timeout period for waiting for scheduling? Marking exceeding the waiting time as an error.

We have a cron task to clear jobs that have been in StatusWaiting for a long time.

// CancelAbandonedJobs cancels jobs that have not been picked by any runner for a long time
func CancelAbandonedJobs(ctx context.Context) error {
jobs, err := db.Find[actions_model.ActionRunJob](ctx, actions_model.FindRunJobOptions{
Statuses: []actions_model.Status{actions_model.StatusWaiting, actions_model.StatusBlocked},
UpdatedBefore: timeutil.TimeStampNow().AddDuration(-setting.Actions.AbandonedJobTimeout),
})

But CancelAbandonedJobs doesn't check runs. Maybe we should improve it to make it check runs in StatusWaiting or StatusBlocked status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants