Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,169 changes: 499 additions & 670 deletions .github/workflows/reusable-dispatch.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/contributing/workflow-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**Secret threading:** GHA reusable workflows do not inherit secrets — they must be explicitly forwarded by every caller. (Repository and organization-level `vars` are automatically visible inside called reusable workflows and do not need forwarding.) When any reusable workflow (`.github/workflows/reusable-*.yml`) adds a new `secrets:` or `inputs:` (`workflow_call`) entry, trace the caller chains and ensure every hop forwards the new entry:

- **Per-repo chain:** shim template → `reusable-dispatch.yml` (stage logic for triage/code/review/fix/retro/prioritize is inlined directly as jobs per [ADR 62](../ADRs/0062-dispatch-version-skew.md) — there is no separate `reusable-<agent>.yml` hop for the dispatch path; thread new secrets/inputs into the relevant inline job). Exception: `prioritize.yml` is installed per-repo as a thin caller that receives `workflow_dispatch` from the scheduler and calls the remaining standalone `reusable-prioritize.yml` directly, bypassing the dispatch shim. The per-org scaffold thin callers and standalone stage workflows were removed ([ADR 44](../ADRs/0044-deprecate-per-org-installation-mode.md)).
- **Per-repo chain:** shim template → `reusable-dispatch.yml` (stage logic for triage/code/review/fix/retro/prioritize is inlined directly per [ADR 62](../ADRs/0062-dispatch-version-skew.md), in two stage-matrix jobs: `agent` runs triage, review, retro and prioritize, and `coder` runs code and fix, each with its own steps gated on `matrix.stage` — there is no separate `reusable-<agent>.yml` hop for the dispatch path; thread new secrets/inputs into the relevant stage's steps). Exception: `prioritize.yml` is installed per-repo as a thin caller that receives `workflow_dispatch` from the scheduler and calls the remaining standalone `reusable-prioritize.yml` directly, bypassing the dispatch shim. The per-org scaffold thin callers and standalone stage workflows were removed ([ADR 44](../ADRs/0044-deprecate-per-org-installation-mode.md)).

**Silent failures and required-flag consistency:** Omitting a secret that is `required: true` at every hop in the chain fails loudly at workflow-call validation time and self-enforces. However, a secret whose `required` flag is `false` at any upstream hop can still arrive as an empty string at a downstream `required: true` consumer — GitHub Actions' required-secret validation only checks key presence, not that the resolved value is non-empty. The standalone prioritize workflow also passes optional GCP inputs to the fullsend action and leaves credential preparation to `fullsend run`, matching dispatch. An explicit `fullsend_version` override with both GCP credentials supplied also runs the compatibility GCP preparation step, so older CLIs continue to support Vertex. Per-repo GCP inputs are optional because an OpenAI-only repository does not use them; for the fleet harnesses' optional GCP mount, `fullsend run` rejects missing credentials before the pre-script on Vertex. Treat a missing forwarding hop as a correctness bug, not a cosmetic issue.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/dev/behaviour-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Each stub error is a `*drivers.NotImplementedError` (package `pkg/behaviourtest/
- **Run matching:** a run matches by workflow file name, event, and creation time, truncated to whole seconds. Forgejo identifies a workflow by its file name only, so the directory of the workflow path does not matter. The event is the run's `trigger_event` (the workflow's `on` key, for example `pull_request_target`) when Forgejo reports it, and the webhook event otherwise. When no matching run appears, `WaitForWorkflow` returns a `*ci.NotDispatchedError`, so steps retry once with the clock-skew buffer and the failure diagnostics list the repository's runs. `ListRecentRuns` sets `forge.WorkflowRun.Path` to the workflow file name.
- **Status:** Forgejo's `success`, `failure`, `cancelled`, and `skipped` become a `completed` run with that conclusion, `running` becomes `in_progress`, `waiting` becomes `queued`, and `blocked` becomes `waiting`.
- **Artifacts:** every artifact comes from the run that uploaded it, by the existing names (`fullsend-<agent>`, optionally with `.matrix-<n>`). The `...After` downloads scan the runs created since the trigger, newest first, and download from the newest run whose own listing has a match. Agent downloads only use completed runs. The driver never uses a repository-wide artifact listing. An instance that serves artifacts directly from object storage answers the download with a redirect, which the adapter refuses like every redirect of an authenticated request.
- **Agent jobs:** harness agents are recognised by the GitHub Actions job names (`Harness run (<agent>)`, or the stage name such as `Triage` for a built-in stage), matched by suffix, or by the agent's artifact in a completed run.
- **Agent jobs:** harness agents are recognised by the GitHub Actions job names (`Harness run (<agent>)`, matched by suffix; for a built-in stage `Agent (<stage>)` or `Coder (<stage>)`, or the legacy stage name such as `Triage` from a workflow pinned to an older commit, matched on the job's own name), or by the agent's artifact in a completed run.
- **Empty matrix:** a harness run settles as an empty matrix when it completed, its `Harness dispatch` job succeeded, and no `Harness run (<agent>)` job was scheduled. The unexpanded matrix job may be skipped or absent: Forgejo replaces a matrix job with its expanded jobs once the matrix is known.

#### Managed forgejo-dev stack
Expand Down
13 changes: 7 additions & 6 deletions docs/guides/user/cel-triggers-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ GitLab routes agents through its own built-in router and does not evaluate

The review, retro, triage and prioritize agents are the exception on
GitHub: a `trigger` you set on the agent's entry in `config.yaml` decides
whether the built-in `Review`, `Retro`, `Triage` or `Prioritize` job starts,
whether the built-in agent job starts for it (shown on the pull request as
`Agent (review)`, `Agent (retro)`, `Agent (triage)` or `Agent (prioritize)`),
in place of the stage-based rules. A harness `trigger:` field never changes
built-in routing; copy it into `config.yaml` to opt in. See
[Routing built-in agents with triggers](#routing-built-in-agents-with-triggers).
Expand Down Expand Up @@ -303,8 +304,8 @@ same-repository pull request is opened, pushed to, marked ready or labeled
`ready-for-review`, and on a `/fs-review` comment. To decide it
yourself, give the `review` entry in `.fullsend/config.yaml` a `trigger`: a
[CEL expression](#writing-cel-triggers) over the event. The review still
runs in the same `Review` job; the trigger only decides whether that job
starts.
runs in the same `Agent (review)` job; the trigger only decides whether that
job starts.

#### Example: review only on `/fs-review`

Expand Down Expand Up @@ -368,8 +369,8 @@ a trigger you keep in a harness, copy the expression into the `review` entry's
`trigger` in `config.yaml`. The kill switch and `enabled: false` on the review
entry keep working as before. The `Route`
job evaluates the trigger with the fullsend CLI built at the dispatch
workflow's commit; if your workflow call pins `fullsend_version`, the `Review`
job runs that version instead.
workflow's commit; if your workflow call pins `fullsend_version`, the
`Agent (review)` job runs that version instead.

#### Known differences from the default rules

Expand Down Expand Up @@ -480,7 +481,7 @@ A trigger decides which events start a retro, not who may start one:
The triage and prioritize agents opt in the same way as review: give the
`triage` or `prioritize` entry in `.fullsend/config.yaml` a `trigger`, and
that trigger, not the dispatch workflow's built-in rules, decides whether the
`Triage` or `Prioritize` job starts. The rules in
`Agent (triage)` or `Agent (prioritize)` job starts. The rules in
[What opts a repository in](#what-opts-a-repository-in) apply to both, with
`triage` or `prioritize` in place of `review`. Each agent opts in on its own: a
`triage` trigger does not change when prioritize runs. To check either trigger
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/user/customizing-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@ requests need a `/fs-review` comment), when the
`ready-for-review` label is added, and on a `/fs-review` comment. To decide it
yourself, give the `review` entry in `.fullsend/config.yaml` a `trigger`: a
[CEL expression](cel-triggers-reference.md) over the event. The review still
runs in the same `Review` job; the trigger only decides whether that job
starts.
runs in the same `Agent (review)` job; the trigger only decides whether that
job starts.

To stop the automatic review on every pull request but keep `/fs-review`, add
this entry to `.fullsend/config.yaml` on your default branch:
Expand Down
8 changes: 4 additions & 4 deletions internal/scaffold/fork_pr_workflow_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ func TestForkPRWorkflowRunWiring(t *testing.T) {
}
}
assert.Equal(t, "${{ steps.fork-pr.outputs.number }}", route.Outputs["pr_number"])
for _, job := range []string{"review", "retro"} {
assert.True(t, strings.HasSuffix(wf.Jobs[job].Concurrency.Group,
"${{ github.event.pull_request.number || github.event.issue.number || needs.route.outputs.pr_number }}"), job)
}
// review and retro run in the agent job, whose concurrency group falls
// back to the fork PR number on workflow_run.
assert.True(t, strings.HasSuffix(wf.Jobs["agent"].Concurrency.Group,
"${{ github.event.pull_request.number || github.event.issue.number || needs.route.outputs.pr_number }}"), "agent")
assert.Contains(t, wf.Jobs["harness-dispatch"].If, "github.event_name != 'workflow_run'")
assert.NotContains(t, wf.Jobs["harness-run"].If, "workflow_run", "a precomputed matrix may come from any event")
}
8 changes: 5 additions & 3 deletions internal/scaffold/pr_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func checkoutSteps(t *testing.T, content []byte) map[string][]map[string]string
Jobs map[string]struct {
Steps []struct {
Name string `yaml:"name"`
If string `yaml:"if"`
Uses string `yaml:"uses"`
With map[string]string `yaml:"with"`
} `yaml:"steps"`
Expand All @@ -86,7 +87,7 @@ func checkoutSteps(t *testing.T, content []byte) map[string][]map[string]string
if !strings.HasPrefix(step.Uses, "actions/checkout@") {
continue
}
with := map[string]string{"name": step.Name}
with := map[string]string{"name": step.Name, "if": step.If}
for k, v := range step.With {
with[k] = v
}
Expand All @@ -103,7 +104,7 @@ func checkoutSteps(t *testing.T, content []byte) map[string][]map[string]string
// - the caller repository at the base SHA (or the default branch, which is
// what github.ref was on pull_request_target);
// - the reusable workflow's repository at trustedWorkflowSHA;
// - the fix job's explicit PR-head checkout, which runs on pull_request_review.
// - the fix stage's explicit PR-head checkout, which runs on pull_request_review.
func TestEveryCheckoutHasTrustedRef(t *testing.T) {
for _, file := range []string{".github/workflows/reusable-dispatch.yml", ".github/workflows/reusable-prioritize.yml"} {
t.Run(file, func(t *testing.T) {
Expand All @@ -118,7 +119,8 @@ func TestEveryCheckoutHasTrustedRef(t *testing.T) {
case repo == "${{ job.workflow_repository }}":
assert.Equal(t, "${{ "+trustedWorkflowSHA+" }}", ref, where)
case ref == "${{ steps.context.outputs.head_ref }}":
assert.Equal(t, "fix", job, "%s: only the fix job checks out the PR head", where)
assert.Equal(t, "coder", job, "%s: only the fix stage checks out the PR head", where)
assert.Equal(t, "matrix.stage == 'fix'", with["if"], "%s: only the fix stage checks out the PR head", where)
case repo == "":
assert.Regexp(t, `github\.event_name == 'pull_request'[ )]`, ref, where)
assert.Contains(t, ref, "github.event_name == 'pull_request_target'", where)
Expand Down
Loading