Introduce ActionRunAttempt to represent each execution of a run#37119
Introduce ActionRunAttempt to represent each execution of a run#37119Zettat123 wants to merge 37 commits intogo-gitea:mainfrom
ActionRunAttempt to represent each execution of a run#37119Conversation
3da69e5 to
7f338dd
Compare
| return err | ||
| } | ||
|
|
||
| run.LatestAttemptID = runAttempt.ID |
There was a problem hiding this comment.
UpdateRunAttempt calls UpdateRun again to sync status/started/stopped. That's three writes to action_run inside one transaction.
There was a problem hiding this comment.
Yes, I’ve noticed that issue as well. In this function, we need to create/update the same ActionRun record three times.
- Create the
ActionRunto getActionRun.ID - Use
ActionRun.IDto create aRunAttemptand writeRunAttempt.IDback toActionRun.LatestAttemptID - After all the jobs are created, update
ActionRun.Status(viaUpdateRunAttempt)
I'm not sure of a better way to handle this yet - any ideas are welcome.
RunAttempt to represent each execution of a runActionRunAttempt to represent each execution of a run
|
A few inconsistencies with GitHub's behavior: 1. On GitHub, Example from GitHub (cli/cli run 23574913305):
The 2. Missing GitHub's workflow run response includes 3. Attempt switcher label differs from GitHub On GitHub, the dropdown button shows just This comment was written by Claude Opus 4.6. |
Co-authored-by: silverwind <[email protected]> Signed-off-by: Zettat123 <[email protected]>
|
|
Fixed by 7c8e2a8. Please see the latest screenshots in description.
|
Updated |
Once we have a auto-registered runner available during |
I don't see it can be "easier" without the devtest page. Even if you ca have "auto-registered runner", how can you provide various different edge cases? |
|
Devtest page is good and simple, but it shouldn't be a maintenance burden like it currently seems to be. |
Show your proper approach to avoid such "maintenance burden" which can easily cover various edge cases and make developers can make changes to the related components and test the changes clearly. |
|
Probably mock the runner on RPC level, give it fake job(s) to run, then render those fake jobs using the same template used on regular pages. Probably not easy if you also want edge case coverage. |
Then what's the different from the current "devtest" page mocking? The current devtest page already provides the necessary mocking data. The template file is just one line |
There are already a mock runner inside the integration tests. |
|
Interesting. |
I think this is because the run summary page can only work when the path contains a |
|
I could swear it worked at some time... but yes I like |
Code Review: PR #37119 — Introduce
|
| Area | Assessment |
|---|---|
| Architecture | Strong — plan-based rerun model is correct |
| DB migration | Risky — destructive concurrency field removal, no transaction safety in execute phase |
| Backward compat | Mostly good — LatestAttemptID=0 pattern is sound |
| API design | Good, minor gaps in pagination |
| Test coverage | Good, some edge cases missing |
| Code quality | Generally clean, a few missing comments |
Main items to address before merging:
execRerunPlanshould be wrapped in a single DB transaction to prevent partial-state on failure.- Legacy job positional matching should either be hardened or clearly documented as a known limitation with a code comment.
- The destructive removal of concurrency columns from
ActionRunshould be explicitly noted in the migration with a comment explaining what data is dropped.

This PR introduces a new
ActionRunAttemptmodel and makes Actions execution attempt-scoped.Main Changes
ActionRunAttempt. The triggered jobs are then associated with this newActionRunAttemptrecord.ActionRunAttemptrecord for the workflow runActionRunJobrecords for the newActionRunAttemptrerunPlanto manage each rerun and refactored rerun flow into a two-phase plan-based model:buildRerunPlanexecRerunPlanRunAttemptID/actions/runs/{run_id})/actions/runs/{run_id}/attempts/{attempt_num})/repos/{owner}/{repo}/actions/runs/{run}/attempts/{attempt}/repos/{owner}/{repo}/actions/runs/{run}/attempts/{attempt}/jobsCompatibility
LatestAttemptID = 0and legacy jobs useRunAttemptID = 0. Therefore, these fields can be used to identify legacy runs and jobs and provide backward compatibility.RunAttemptID = 0.Improvements
run_attemptsemantics are now aligned with GitHub.Screenshots
Run with only one attempt:
Rerunning:
Latest attempt:
Previous attempt (rerun is not allowed):
Dropdown for attempt records: