[v14.0/forgejo] fix: when expanding a dynamic matrix, original 'needs' access was lost #11166

Merged
mfenniak merged 2 commits from mfenniak/forgejo:bp-11164 into v14.0/forgejo 2026-02-15 23:55:09 +01:00
Member

Backport: #11164

Manual backport required due to conflicts with recent workflow expansion work.

(cherry picked from commit c7d23fa6e8)

Release notes

  • Bug fixes
    • PR: fix: when expanding a dynamic matrix, original 'needs' access was lost
**Backport:** #11164 Manual backport required due to conflicts with recent workflow expansion work. (cherry picked from commit c7d23fa6e84417e359d501cc3bca2c1dfd6eed95) <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/11166): <!--number 11166 --><!--line 0 --><!--description Zml4OiB3aGVuIGV4cGFuZGluZyBhIGR5bmFtaWMgbWF0cml4LCBvcmlnaW5hbCAnbmVlZHMnIGFjY2VzcyB3YXMgbG9zdA==-->fix: when expanding a dynamic matrix, original 'needs' access was lost<!--description--> <!--end release-notes-assistant-->
Member
Where does that come from? The following is a preview of the release notes for this pull request, as they will appear in the upcoming release. They are derived from the content of the `release-notes/11166.md` file, if it exists, or the title of the pull request. They were also added at the bottom of the description of this pull request for easier reference.

This message and the release notes originate from a call to the release-notes-assistant.

@@ -4,2 +4,10 @@
 
 (cherry picked from commit c7d23fa6e84417e359d501cc3bca2c1dfd6eed95)
+
+<!--start release-notes-assistant-->
+
+## Release notes
+<!--URL:https://codeberg.org/forgejo/forgejo-->
+- Bug fixes
+  - [PR](https://codeberg.org/forgejo/forgejo/pulls/11166): <!--number 11166 --><!--line 0 --><!--description Zml4OiB3aGVuIGV4cGFuZGluZyBhIGR5bmFtaWMgbWF0cml4LCBvcmlnaW5hbCAnbmVlZHMnIGFjY2VzcyB3YXMgbG9zdA==-->fix: when expanding a dynamic matrix, original 'needs' access was lost<!--description-->
+<!--end release-notes-assistant-->

Release notes

  • Bug fixes
    • PR: fix: when expanding a dynamic matrix, original 'needs' access was lost
<details> <summary>Where does that come from?</summary> The following is a preview of the release notes for this pull request, as they will appear in the upcoming release. They are derived from the content of the `release-notes/11166.md` file, if it exists, or the title of the pull request. They were also added at the bottom of the description of this pull request for easier reference. This message and the release notes originate from a call to the [release-notes-assistant](https://code.forgejo.org/forgejo/release-notes-assistant). ```diff @@ -4,2 +4,10 @@ (cherry picked from commit c7d23fa6e84417e359d501cc3bca2c1dfd6eed95) + +<!--start release-notes-assistant--> + +## Release notes +<!--URL:https://codeberg.org/forgejo/forgejo--> +- Bug fixes + - [PR](https://codeberg.org/forgejo/forgejo/pulls/11166): <!--number 11166 --><!--line 0 --><!--description Zml4OiB3aGVuIGV4cGFuZGluZyBhIGR5bmFtaWMgbWF0cml4LCBvcmlnaW5hbCAnbmVlZHMnIGFjY2VzcyB3YXMgbG9zdA==-->fix: when expanding a dynamic matrix, original 'needs' access was lost<!--description--> +<!--end release-notes-assistant--> ``` </details> <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/11166): <!--number 11166 --><!--line 0 --><!--description Zml4OiB3aGVuIGV4cGFuZGluZyBhIGR5bmFtaWMgbWF0cml4LCBvcmlnaW5hbCAnbmVlZHMnIGFjY2VzcyB3YXMgbG9zdA==-->fix: when expanding a dynamic matrix, original 'needs' access was lost<!--description--> <!--end release-notes-assistant-->
mfenniak force-pushed bp-11164 from f027131da4
Some checks failed
issue-labels / backporting (pull_request_target) Has been skipped
issue-labels / cascade (pull_request_target) Has been skipped
requirements / merge-conditions (pull_request) Successful in 3s
testing / frontend-checks (pull_request) Successful in 1m19s
testing / backend-checks (pull_request) Successful in 5m56s
issue-labels / release-notes (pull_request_target) Successful in 6m23s
testing / test-unit (pull_request) Successful in 7m12s
testing / test-remote-cacher (redis) (pull_request) Successful in 1m52s
testing / test-remote-cacher (valkey) (pull_request) Successful in 1m51s
testing / test-remote-cacher (redict) (pull_request) Successful in 2m19s
testing / test-remote-cacher (garnet) (pull_request) Successful in 2m23s
testing / test-e2e (pull_request) Successful in 21m25s
testing / test-mysql (pull_request) Successful in 23m50s
testing / test-sqlite (pull_request) Successful in 28m40s
testing / test-pgsql (pull_request) Successful in 31m56s
testing / security-check (pull_request) Failing after 2m20s
to 0c19b502b2
Some checks failed
requirements / merge-conditions (pull_request) Successful in 4s
testing / frontend-checks (pull_request) Successful in 53s
issue-labels / release-notes (pull_request_target) Failing after 1m13s
testing / backend-checks (pull_request) Successful in 2m58s
testing / test-unit (pull_request) Successful in 5m49s
testing / test-remote-cacher (valkey) (pull_request) Successful in 1m58s
testing / test-remote-cacher (garnet) (pull_request) Successful in 1m58s
testing / test-remote-cacher (redict) (pull_request) Successful in 1m57s
testing / test-remote-cacher (redis) (pull_request) Successful in 2m0s
testing / test-e2e (pull_request) Successful in 17m29s
testing / test-mysql (pull_request) Successful in 19m33s
testing / test-sqlite (pull_request) Successful in 24m36s
testing / security-check (pull_request) Has been skipped
testing / test-pgsql (pull_request) Failing after 30m29s
2026-02-06 16:05:39 +01:00
Compare
fix: newly expanded dynamic matrix jobs can become stuck in a 'blocked' state
All checks were successful
requirements / merge-conditions (pull_request) Successful in 3s
issue-labels / release-notes (pull_request_target) Successful in 1m1s
testing / frontend-checks (pull_request) Successful in 1m45s
testing / backend-checks (pull_request) Successful in 5m22s
testing / test-unit (pull_request) Successful in 9m4s
testing / test-remote-cacher (redis) (pull_request) Successful in 2m36s
testing / test-remote-cacher (valkey) (pull_request) Successful in 2m22s
testing / test-remote-cacher (garnet) (pull_request) Successful in 2m52s
testing / test-remote-cacher (redict) (pull_request) Successful in 3m35s
testing / test-e2e (pull_request) Successful in 32m47s
testing / test-mysql (pull_request) Successful in 35m43s
testing / test-sqlite (pull_request) Successful in 42m19s
testing / test-pgsql (pull_request) Successful in 47m19s
testing / security-check (pull_request) Successful in 1m21s
milestone / set (pull_request_target) Successful in 9s
issue-labels / backporting (pull_request_target) Has been skipped
77d5cefc72
The end-to-end tests are currently failing on v15: https://code.forgejo.org/forgejo/end-to-end/actions/runs/4900/jobs/8/attempt/1#jobstep-4-356   This is a regression from #11164.

The cause of this regression is:
- When the job emitter emits new jobs, it *now* sets their `Needs` field correctly, fixed in #11164.
- If a job has `needs` set to a non-empty array, it will start as status **blocked**: db037fca50/models/actions/run.go (L369-L370)

This got past manual testing and the end-to-end test run in #11164 because it is intermittent.  If the runner invokes `UpdateTask` multiple times once the status of the job is settled, then the API will invoke the job emitter multiple times -- a second run would unblock the newly blocked jobs.  Podman-based runners do this often due to a long cleanup time, and Docker-based runners (like the end-to-end test) can do it randomly depending on a race condition.

db037fca50/routers/api/actions/runner/runner.go (L241-L244)

The fix for this is to reinvoke the job emitter's logic whenever new jobs are created, so that their new blocked state can be reevaluated to see if it is correct or not.  This is treated cautiously by examining if new jobs are present.

Reviewed-on: #11184
Reviewed-by: Andreas Ahlenstorf <[email protected]>
Co-authored-by: Mathieu Fenniak <[email protected]>
Co-committed-by: Mathieu Fenniak <[email protected]>
Author
Member

Added a backport of #11184 into this PR, for the regression fix that it includes.

Added a backport of #11184 into this PR, for the regression fix that it includes.
Author
Member

@aahlenst When you have a minute, could you please review this backport of #11164 to v14? It's the same PR you've reviewed previously, but required manual merge conflict resolution due to the workflow expansion changes that have landed since v14. 🙂

@aahlenst When you have a minute, could you please review this backport of #11164 to v14? It's the same PR you've reviewed previously, but required manual merge conflict resolution due to the workflow expansion changes that have landed since v14. 🙂
aahlenst approved these changes 2026-02-15 22:27:38 +01:00
mfenniak merged commit 8ef91fa1cc into v14.0/forgejo 2026-02-15 23:55:09 +01:00
mfenniak deleted branch bp-11164 2026-02-15 23:55:21 +01:00
Sign in to join this conversation.
No reviewers
No labels
arch
riscv64
backport/v1.19
backport/v1.20
backport/v1.21/forgejo
backport/v10.0/forgejo
backport/v11.0/forgejo
backport/v12.0/forgejo
backport/v13.0/forgejo
backport/v14.0/forgejo
backport/v15.0/forgejo
backport/v16.0/forgejo
backport/v17.0/forgejo
backport/v7.0/forgejo
backport/v8.0/forgejo
backport/v9.0/forgejo
breaking
bug
bug
confirmed
bug
duplicate
bug
needs-more-info
bug
new-report
bug
reported-upstream
code/actions
code/api
code/auth
code/auth/faidp
code/auth/farp
code/email
code/federation
code/git
code/migrations
code/packages
code/wiki
database
MySQL
database
PostgreSQL
database
SQLite
dependency-upgrade
dependency
Chi
dependency
Chroma
dependency
F3
dependency
ForgeFed
dependency
garage
dependency
Gitea
dependency
Golang
Discussion
duplicate
enhancement/feature
forgejo/accessibility
forgejo/branding
forgejo/ci
forgejo/commit-graph
forgejo/documentation
forgejo/furnace cleanup
forgejo/i18n
forgejo/interop
forgejo/moderation
forgejo/privacy
forgejo/release
forgejo/scaling
forgejo/security
forgejo/ui
Gain
High
Gain
Nice to have
Gain
Undefined
Gain
Very High
good first issue
i18n/backport-stable
impact
large
impact
medium
impact
small
impact
unknown
Incompatible license
issue
closed
issue
do-not-exist-yet
issue
open
manual test
Manually tested during feature freeze
OS
FreeBSD
OS
Linux
OS
macOS
OS
Windows
problem
QA
regression
release blocker
Release Cycle
Feature Freeze
release-blocker
v7.0
release-blocker
v7.0.1
release-blocker
v7.0.2
release-blocker
v7.0.3
release-blocker
v7.0.4
release-blocker
v8.0.0
release-blocker/v9.0.0
run-all-playwright-tests
run-end-to-end-tests
stage
2-research
stage
3-design
stage
4-implementation
test
manual
test
needed
test
needs-help
test
not-needed
test
present
untested
User research - time-tracker
valuable code
worth a release-note
User research - Accessibility
User research - Blocked
User research - Community
User research - Config (instance)
User research - Errors
User research - Filters
User research - Future backlog
User research - Git workflow
User research - Labels
User research - Moderation
User research - Needs input
User research - Notifications/Dashboard
User research - Rendering
User research - Repo creation
User research - Repo units
User research - Security
User research - Settings (in-app)
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
forgejo/forgejo!11166
No description provided.