Skip to content
Closed
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
196 changes: 196 additions & 0 deletions .github/workflows/reusable-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,154 @@ jobs:
/OWNERS_ALIASES
sparse-checkout-cone-mode: false

# CEL review routing (#8726). FULLSEND_CEL_ROUTING_REVIEW = off (default),
# shadow (log the CEL decision next to the bash stage) or on (the CEL
# decision sets STAGE=review). When it is off or unset every cel-* step
# is skipped and "Determine stage" routes exactly as before. Only PR and
# comment events are evaluated; other events keep the bash stage.
- name: Checkout config for CEL review route
id: cel-config
if: ${{ (vars.FULLSEND_CEL_ROUTING_REVIEW == 'shadow' || vars.FULLSEND_CEL_ROUTING_REVIEW == 'on') && (github.event_name == 'pull_request_target' || github.event_name == 'issue_comment') }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Same trusted ref as the checkout above: the base branch for PR events.
ref: ${{ (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && github.event.pull_request.base.sha || github.sha }}
path: cel-route
persist-credentials: false
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' }}
sparse-checkout: |
.fullsend/
/OWNERS
/OWNERS_ALIASES
.defaults/action.yml
.defaults/.github/actions/install-fullsend-cli/
.fullsend/.defaults/action.yml
sparse-checkout-cone-mode: false

- name: Detect CLI install mode for CEL review route
id: cel-cli-mode
if: steps.cel-config.outcome == 'success'
shell: bash
run: |
set -euo pipefail
if [[ -f cel-route/.defaults/action.yml || -f cel-route/.fullsend/.defaults/action.yml ]]; then
echo "mode=vendored" >> "${GITHUB_OUTPUT}"
else
echo "mode=upstream" >> "${GITHUB_OUTPUT}"
fi

- name: Guard vendored install for CEL review route
if: steps.cel-config.outcome == 'success' && steps.cel-cli-mode.outputs.mode == 'vendored'
shell: bash
run: |
set -euo pipefail
if [[ ! -f cel-route/.fullsend/bin/fullsend ]]; then
echo "::error::broken --vendor install: vendored marker present but .fullsend/bin/fullsend is missing"
exit 1
fi
Comment on lines +186 to +194

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. A broken cli install in shadow mode stops all dispatch 🐞 Bug ☼ Reliability

None of the new install steps in the Route job have continue-on-error: not the CEL config
checkout, the vendored guard (which runs exit 1 itself), either install step, the upstream action
checkout, or the cache-artifact cp. Only "Evaluate CEL review route" and the cache save do. If any
of those steps fails while the variable is shadow or on, every later step is skipped, including
"Determine stage" (it runs only when earlier steps succeeded). The Route job then fails, so no stage
runs (triage, code, fix, retro or review) for that PR or comment event, even though shadow is meant
to be risk-free.
Agent Prompt
## Issue description
The CEL review-route install steps in the Route job can fail the whole job. When that happens "Determine stage" is skipped and no agent stage is dispatched, even in shadow mode.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[155-260]

## Recommended Fix
Add `continue-on-error: true` to every cel-* step: checkout, mode detect, vendored guard, cache restore, both installs, the upstream action checkout, expose and prepare. Gate "Evaluate CEL review route" on the install having succeeded, for example by checking that `command -v fullsend` works inside the step, so that "Determine stage" always runs and sees a non-success outcome. That outcome keeps the bash stage with ::warning:: in shadow or ::error:: in on.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


# Shares the harness-dispatch cache key, so whichever job installs first
# serves the other.
- name: Restore fullsend CLI cache for CEL review route
id: cel-cli-cache
if: steps.cel-config.outcome == 'success'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/fullsend-cache
key: fullsend-cli-${{ steps.cel-cli-mode.outputs.mode }}-${{ job.workflow_sha }}

- name: Install fullsend CLI for CEL review route (vendored defaults)
if: steps.cel-config.outcome == 'success' && steps.cel-cli-mode.outputs.mode == 'vendored' && steps.cel-cli-cache.outputs.cache-hit != 'true'
uses: ./cel-route/.defaults/.github/actions/install-fullsend-cli
Comment on lines +206 to +208

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Vendored installs stop review routing 🐞 Bug ≡ Correctness

The vendored install step invokes ./cel-route/.defaults/.github/actions/install-fullsend-cli,
although the detected vendored marker and binary live under cel-route/.fullsend/. On a vendored
repository with a cache miss, the local action cannot be found, so the route job fails before it can
determine a stage.
Agent Prompt
## Issue description
The CEL route detects the nested vendored layout but invokes an installer at a root path that is absent from that layout.
## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[165-172]
- .github/workflows/reusable-dispatch.yml[180-212]
## Recommended Fix
Use an installer action path that exists for the detected vendored layout, retaining the checked `.fullsend/bin/fullsend` as its binary input. Cover a vendored cache miss in the workflow tests.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

with:
mode: vendored
vendored_path: cel-route/.fullsend/bin/fullsend
github_token: ${{ github.token }}

- name: Checkout upstream install action for CEL review route
if: steps.cel-config.outcome == 'success' && steps.cel-cli-mode.outputs.mode == 'upstream' && steps.cel-cli-cache.outputs.cache-hit != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: .workflow-actions
fetch-depth: 1
sparse-checkout: |
.github/actions/install-fullsend-cli/
sparse-checkout-cone-mode: false

- name: Install fullsend CLI for CEL review route (upstream workflow)
if: steps.cel-config.outcome == 'success' && steps.cel-cli-mode.outputs.mode == 'upstream' && steps.cel-cli-cache.outputs.cache-hit != 'true'
uses: ./.workflow-actions/.github/actions/install-fullsend-cli
with:
mode: upstream
workflow_repository: ${{ job.workflow_repository }}
workflow_sha: ${{ job.workflow_sha }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

13. Reviews can use a different trigger 🔗 Cross-repo conflict ≡ Correctness

The CEL route installs and caches the CLI at job.workflow_sha, while the Review job uses
inputs.fullsend_version || job.workflow_sha; because the CLI build determines the agents ref, they
can resolve different review-harness triggers. When a caller overrides fullsend_version, CEL can
return run or skip for a trigger the executed harness does not have, return run where bash
is appropriate, or fall back to bash if the workflow-SHA CLI does not support --route.
Agent Prompt
## Issue description
An explicit `fullsend_version` changes the release used by Review but not the CLI used for CEL routing, so routing can evaluate a different review harness or use a CLI without `--route`.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[198-260]
- .github/workflows/reusable-dispatch.yml[1216-1223]

## Recommended Fix
Install the route CLI using the same effective version as Review, `inputs.fullsend_version || job.workflow_sha`, and include that value in the route CLI cache key so it cannot reuse a binary built for another version. Test routing with a caller-supplied `fullsend_version`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

github_token: ${{ github.token }}

- name: Expose cached fullsend CLI for CEL review route
if: steps.cel-config.outcome == 'success' && steps.cel-cli-cache.outputs.cache-hit == 'true'
shell: bash
run: |
set -euo pipefail
install_dir="${RUNNER_TEMP}/fullsend"
mkdir -p "${install_dir}"
cp "${RUNNER_TEMP}/fullsend-cache/fullsend" "${install_dir}/fullsend"
chmod +x "${install_dir}/fullsend"
echo "${install_dir}" >> "${GITHUB_PATH}"

- name: Prepare fullsend CLI cache artifact for CEL review route
if: steps.cel-config.outcome == 'success' && steps.cel-cli-cache.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/fullsend-cache"
cp "${RUNNER_TEMP}/fullsend/fullsend" "${RUNNER_TEMP}/fullsend-cache/fullsend"

- name: Save fullsend CLI cache for CEL review route
if: steps.cel-config.outcome == 'success' && steps.cel-cli-cache.outputs.cache-hit != 'true'
continue-on-error: true
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/fullsend-cache
key: fullsend-cli-${{ steps.cel-cli-mode.outputs.mode }}-${{ job.workflow_sha }}

# A failure here never fails the route job: "Determine stage" keeps the
# bash stage and reports the failure (::error:: when on, ::warning:: when
# shadow).
- name: Evaluate CEL review route
id: cel-review
if: steps.cel-config.outcome == 'success'
continue-on-error: true
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
EVENT_ACTION: ${{ inputs.event_action }}
run: |
set -euo pipefail
DECISION_JSON=$(fullsend dispatch \
--input-driver gha-event \
--config-dir cel-route/.fullsend \
--event-action "${EVENT_ACTION}" \
--route review)
printf '%s\n' "${DECISION_JSON}"
DECISION=$(jq -r '.decision // ""' <<<"${DECISION_JSON}")
case "${DECISION}" in
run|skip|bash) ;;
*)
echo "::error::Unexpected CEL review route decision: ${DECISION}"
exit 1
;;
esac
REASON=$(jq -r '.reason // ""' <<<"${DECISION_JSON}" | tr -d '\r\n')
HARNESS=$(jq -r '.harness // ""' <<<"${DECISION_JSON}" | tr -d '\r\n')
{
echo "decision=${DECISION}"
echo "reason=${REASON}"
echo "harness=${HARNESS}"
} >> "${GITHUB_OUTPUT}"

- name: Determine stage
id: route
env:
Expand All @@ -170,6 +318,11 @@ jobs:
ORG_NAME: ${{ github.repository_owner }}
FULLSEND_APP_SET: ${{ vars.FULLSEND_APP_SET || 'fullsend-ai' }}
GH_TOKEN: ${{ github.token }}
CEL_REVIEW_MODE: ${{ vars.FULLSEND_CEL_ROUTING_REVIEW }}
CEL_REVIEW_OUTCOME: ${{ steps.cel-review.outcome }}
CEL_REVIEW_DECISION: ${{ steps.cel-review.outputs.decision }}
CEL_REVIEW_REASON: ${{ steps.cel-review.outputs.reason }}
CEL_REVIEW_HARNESS: ${{ steps.cel-review.outputs.harness }}
run: |
set -euo pipefail

Expand Down Expand Up @@ -421,6 +574,49 @@ jobs:
;;
esac

# CEL review routing (#8726). off or unset leaves STAGE exactly as
# the bash rules above set it. shadow only logs. on lets the CEL
# decision set or clear STAGE=review, but never replaces another
# bash stage; decision=bash (the resolved review harness has no
# trigger) keeps the bash stage.
case "${CEL_REVIEW_MODE:-off}" in
off) ;;
shadow|on)
if [[ "${CEL_REVIEW_OUTCOME}" == "skipped" || -z "${CEL_REVIEW_OUTCOME}" ]]; then
: # Event type not evaluated by CEL: keep the bash stage.
elif [[ "${CEL_REVIEW_OUTCOME}" != "success" ]]; then
if [[ "${CEL_REVIEW_MODE}" == "on" ]]; then
echo "::error::CEL review route failed; keeping the bash stage '${STAGE}'. See the 'Evaluate CEL review route' step."
else
echo "::warning::CEL review route (shadow) failed. See the 'Evaluate CEL review route' step."
fi
elif [[ -n "${STAGE}" && "${STAGE}" != "review" ]]; then
echo "::notice::CEL review route: keeping bash stage '${STAGE}' (CEL decision ${CEL_REVIEW_DECISION})"
else
CEL_BASH_STAGE="${STAGE:-none}"
echo "::notice::CEL review route (${CEL_REVIEW_MODE}): bash=${CEL_BASH_STAGE} cel=${CEL_REVIEW_DECISION} reason=${CEL_REVIEW_REASON} harness=${CEL_REVIEW_HARNESS}"
if [[ "${CEL_REVIEW_MODE}" == "shadow" ]]; then
if [[ "${CEL_REVIEW_DECISION}" == "run" && "${STAGE}" != "review" ]] \
|| [[ "${CEL_REVIEW_DECISION}" == "skip" && "${STAGE}" == "review" ]]; then
echo "::warning::CEL review route mismatch: bash=${CEL_BASH_STAGE} cel=${CEL_REVIEW_DECISION} (${CEL_REVIEW_REASON})"
fi
echo "CEL review route (shadow): bash=${CEL_BASH_STAGE} cel=${CEL_REVIEW_DECISION}" >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
else
CEL_ROUTE_SOURCE="cel"
case "${CEL_REVIEW_DECISION}" in
run) STAGE="review" ;;
Comment on lines +605 to +607

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

12. A maintainer push can review a blocked pr 🐞 Bug ≡ Correctness

The CEL run branch starts review for a synchronized PR based on authorization of the event sender,
whereas the bash rule checks the PR author. When a write-authorized maintainer synchronizes a PR
whose author has read-only access, on replaces bash’s empty stage with review; the parity
fixture records this mismatch.
Agent Prompt
## Issue description
For PR synchronization, CEL authorizes the sender while the existing review router authorizes the PR author, allowing a review the bash router blocks.
## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[605-608]
- .github/workflows/reusable-dispatch.yml[514-519]
## Recommended Fix
Preserve the existing PR-author authorization constraint before applying a CEL `run` decision for PR events, and add a workflow-stage test for a read-only author whose PR is synchronized by a write-authorized sender.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

skip) STAGE="" ;;
Comment on lines +605 to +608

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

5. Configured review runs twice 📎 Requirement gap ≡ Correctness

When FULLSEND_CEL_ROUTING_REVIEW=on, a matching review trigger sets STAGE to review while
the independent harness-dispatch job can also return that configured review harness for execution.
The inline Review job and the resulting harness-run job then execute the same review event
separately.
Agent Prompt
## Issue description
A matching configured review harness causes the route job to start the built-in Review job while the independent harness-dispatch and harness-run jobs can execute the same review harness, resulting in duplicate review execution.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[605-608]
- .github/workflows/reusable-dispatch.yml[1698-1782]

## Recommended Fix
Ensure a review harness selected by the CEL route cannot also be emitted by harness-dispatch, or otherwise coordinate the jobs so each matching review event executes exactly once while preserving custom harness dispatch and the bash fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

*) CEL_ROUTE_SOURCE="bash" ;;
esac
Comment on lines +605 to +610

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

11. A trigger can start review on a plain issue comment 🐞 Bug ≡ Correctness

In on mode, the run branch sets STAGE=review for any issue_comment without checking
ISSUE_IS_PR, and the documented /fs-review trigger checks the command and actor but not whether
the comment is on a pull request. A /fs-review comment on an ordinary issue can therefore reach
the Review job with the issue’s URL and number as PR context, without a PR-head lookup or
pull_request payload.
Agent Prompt
## Issue description
In `on` mode, a CEL `run` decision can select the PR-only Review job for a comment on an ordinary issue. The documented `/fs-review` example trigger also permits those comments.

## Fix Focus Areas
- .github/workflows/reusable-dispatch.yml[593-610]
- docs/guides/user/customizing-agents.md[760-769]

## Recommended Fix
In the `on` branch, map `run` to `STAGE=review` only for `pull_request_target` events or `issue_comment` events with `ISSUE_IS_PR == true`. Otherwise, log a warning and leave `STAGE` empty. Add `&& (event.entity.kind == "change_proposal" || has(event.entity.linked_change_proposal))` to the documented example trigger.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

echo "review_route=${CEL_ROUTE_SOURCE}" >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
fi
fi
;;
*)
echo "::warning::FULLSEND_CEL_ROUTING_REVIEW='${CEL_REVIEW_MODE}' is not off, shadow or on; using bash routing"
;;
esac

if [[ -z "${STAGE}" ]]; then
echo "No stage matched — skipping dispatch"
echo "stage=" >> "${GITHUB_OUTPUT}"
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/workflow-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

**OWNERS-file authorization:** `has_repo_permission` in `reusable-dispatch.yml` supports an opt-in OWNERS-file path gated by `owners_file` in the `authorization` providers list in `.fullsend/config.yaml`. When enabled, the function checks the repo-root `OWNERS` (and `OWNERS_ALIASES` if present) before falling back to the collaborator API. Approvers get write-equivalent access; reviewers get triage-equivalent. `TestDispatchPerStageAuthorization` checks `has_repo_permission` including OWNERS role-mapping invariants. The Go harness-dispatch path (`internal/harnessdispatch/core.go`) has equivalent OWNERS resolution via `internal/owners`; changes to the OWNERS schema or role mapping must be kept in sync across both implementations.
**OWNERS-file authorization:** `has_repo_permission` in `reusable-dispatch.yml` supports an opt-in OWNERS-file path gated by `owners_file` in the `authorization` providers list in `.fullsend/config.yaml`. When enabled, the function checks the repo-root `OWNERS` (and `OWNERS_ALIASES` if present) before falling back to the collaborator API. Approvers get write-equivalent access; reviewers get triage-equivalent. `TestDispatchPerStageAuthorization` checks `has_repo_permission` including OWNERS role-mapping invariants. The Go harness-dispatch path (`AuthorizeEvent` in `internal/harnessdispatch/authorize.go`, shared by `fullsend dispatch` and its `--route` mode) has equivalent OWNERS resolution via `internal/owners`; changes to the OWNERS schema or role mapping must be kept in sync across both implementations.

**Security — consuming threaded inputs:** When a newly-threaded entry carries user- or event-controlled data, consume it via `env:` in the final `run:` step — never interpolate `${{ ... }}` directly into a shell block (see the Security note atop `reusable-dispatch.yml`). This prevents the GHA script-injection class of bugs the project defends against elsewhere.

Expand Down
2 changes: 2 additions & 0 deletions docs/guides/dev/behaviour-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@ The `fork-dispatch.feature` file defines the canonical fork-PR behaviour contrac

**`the kill switch is active in config.base.yaml`** — Sets `kill_switch: true` in `config.base.yaml` (the central/base layer) instead, leaving `config.yaml` unset. Use this step to verify that a base-file kill switch halts dispatch the same way an overlay one does, since the two files are read independently.

**`the repository variable "<NAME>" is "<value>"`** — Sets a repository variable on the enrolled repo, for example `FULLSEND_CEL_ROUTING_REVIEW` to `shadow` or `on`. The first time a scenario sets a name, the step records the previous value (or that the variable did not exist), and scenario cleanup restores it, so the slot's next scenario runs with the install defaults. Requires the GitHub SCM driver.

## Forge operational constraints

When modifying behaviour test repo provisioning, fork handling, or workflow dispatch, be aware of these constraints. They are not enforced by the compiler or linter — violations surface as cryptic API errors or silently dropped events in CI.
Expand Down
1 change: 1 addition & 0 deletions docs/guides/infrastructure/infrastructure-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ Repos whose `inference.auth` is `openai-wif` need no Fullsend-managed inference
- `FULLSEND_GCP_REGION` (value drift is detected and repaired by convergence)
- `FULLSEND_REVIEW_CLIENT_ID` — OAuth client ID of the review agent's GitHub App (best-effort, conditional on successful lookup)
- `FULLSEND_APP_SET` — GitHub App set prefix (apps named `{app-set}-{role}`); auto-set by the installer and repaired on convergence
- `FULLSEND_CEL_ROUTING_REVIEW` — optional, set by you: `off` (default), `shadow` or `on`; lets the review harness `trigger` decide when review runs ([Choosing when review runs](../user/customizing-agents.md#choosing-when-review-runs)); not set by `github setup`

#### GitLab

Expand Down
2 changes: 2 additions & 0 deletions docs/guides/user/cel-triggers-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ When you register a custom agent and give it a `trigger` expression, fullsend ha

Built-in agents (triage, code, review, fix, retro, prioritize) are routed by the dispatch workflow's stage-based routing logic. Custom agents with CEL triggers run alongside them — the two mechanisms coexist. A single event can trigger both a built-in agent via stage routing and one or more custom agents via CEL matching.

The review agent can opt in to CEL routing: with the variable `FULLSEND_CEL_ROUTING_REVIEW` set to `on`, the trigger on the resolved review harness decides whether the `Review` job starts, and `shadow` only logs that decision. A resolved review harness without a `trigger` keeps the stage-based routing, and an empty `trigger` in a harness with `base:` inherits the base trigger. See [Choosing when review runs](customizing-agents.md#choosing-when-review-runs).

You can also keep a hand-written workflow that invokes `fullsend run` with a fixed harness path. CEL-based dispatch and explicit harness invocation may run side by side in the same installation.

## Writing CEL triggers
Expand Down
Loading
Loading