Skip to content

Conversation

@Zettat123
Copy link
Contributor

@Zettat123 Zettat123 commented Nov 3, 2025

#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.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 3, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Nov 3, 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 3, 2025
Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would want to let cancellation succeed if a user requested it in this case, proposal here: #35842 . Backport is bigger step, so this doctor command is good.

With my test data of #35842, this PR works

func TestActionsCancelStuckJobDoctor(t *testing.T) {
	defer tests.PrepareTestEnv(t)()

	for _, check := range doctor.Checks {
		if check.Name != "fix-actions-unfinished-run-status" {
			continue
		}
		check.Run(t.Context(), log.GetLogger(log.DEFAULT), true)

		// check if the run is cancelled by id
		run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{
			ID: 805,
		})
		assert.Equal(t, actions_model.StatusCancelled, run.Status)
	}
}

I think having tests for this doctor command is generally better.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 3, 2025
@Zettat123
Copy link
Contributor Author

I think having tests for this doctor command is generally better.

Thank you for the test data. I added test in 9f100d1

@techknowlogick techknowlogick merged commit bb1f523 into go-gitea:main Nov 4, 2025
25 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Nov 4, 2025
@wxiaoguang
Copy link
Contributor

Usually end users have no idea about the "doctor" commands.

Is it possible to make the "runs" self-healing? For example: cancel it via UI?

I believe adding more doctor commands is not a proper approach.

Zettat123 added a commit to Zettat123/gitea that referenced this pull request Nov 4, 2025
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.
@Zettat123
Copy link
Contributor Author

Usually end users have no idea about the "doctor" commands.

Is it possible to make the "runs" self-healing? For example: cancel it via UI?

I believe adding more doctor commands is not a proper approach.

Yes. This PR is used to help users quickly fix the incorrect run status. #35842 will allow users to cancel the run even if all jobs are done

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

Labels

backport/v1.25 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants