#39195·gitea

[Actions] Support `concurrency: queue: max` to allow more than one pending run per concurrency group

Author: kool2zeroCreated Aug 31, 2026Updated Sep 27, 2026
Labelstype/proposal

What problem would this solve?

Gitea's concurrency implementation (#24769, shipped via #32751 in 1.26) reproduces GitHub Actions' semantics as they stood at the time: one in-progress run plus at most one pending run per group. When a third run enters the group, it supersedes the run that was already pending, which is silently discarded.

For conventional CI that behavior is correct and desirable — a pending build for an older commit has no value once a newer commit arrives.

It breaks down when Gitea Actions is used as a general-purpose job scheduler/orchestrator, which is an increasingly common deployment for self-hosted instances: workflow_dispatch triggered from an external application or API, self-hosted runners pinned to specific hosts, and jobs that perform ETL runs, database procedures, service restarts, or user-initiated operations. In that model every dispatch is a distinct unit of real work — a specific user request, a specific batch, a specific machine — and dropping a pending run means losing work rather than skipping a redundant one.

Concretely: if three users submit requests within the same minute against a workflow that must not run concurrently, request #2 is discarded and only #1 and #3 execute. There is no error, no notification, and the dispatching application receives a 204 either way, so it cannot detect the loss.

The only reliable workaround today is to stop using concurrency for serialization and instead dedicate a separate act_runner instance with capacity: 1 and a unique label per serialization domain, relying on the normal (unbounded, FIFO) runner task queue instead. That does work, but it:

I could not find an existing issue or PR tracking this for Gitea.

What do you propose?

Add support for the queue key inside the concurrency block, matching GitHub's syntax so that workflows remain portable:

yaml
concurrency:
  group: ${{ github.workflow }}-${{ inputs.environment }}
  queue: max              # "single" (default) | "max"
  cancel-in-progress: false

Semantics

  • queue: single — current behavior. At most one pending run per group; a new run supersedes the pending one. This stays the default, so upgrading changes nothing for existing workflows.
  • queue: max — multiple runs may sit pending in the group and execute sequentially in FIFO order. Validation

Reject queue: max together with cancel-in-progress: true as a workflow validation error, as GitHub does — the two are contradictory.

Queue limit

GitHub caps this at 100 pending runs per group. For Gitea I'd suggest making the cap an instance setting rather than a hard constant, since self-hosted deployments vary widely in scale:

ini
[actions]
CONCURRENCY_QUEUE_LIMIT = 100

The behavior on hitting the cap should be decided explicitly — either match GitHub, or reject the dispatch with an error so the caller learns the work was not accepted. For API-driven orchestration the second is more useful, so exposing it in the dispatch response would be valuable if that's feasible.

Scope

Support queue everywhere concurrency is already accepted — both workflow level and job level.

UI (optional follow-up, not required for the core feature)

The recent work in #38476 to explain why a job is blocked or waiting would pair naturally with this: showing a run's position in its concurrency queue would make a deep queue legible. Not necessary for a first implementation.

Backward compatibility

Defaulting queue to single means no behavior change for any existing workflow on upgrade.