Repository navigation
feat(#8726): let a CEL trigger decide review routing #8729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
| # 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Vendored installs stop review routing 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
|
||
| 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 }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 13. Reviews can use a different trigger 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
|
||
| 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: | ||
|
|
@@ -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 | ||
|
|
||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 12. A maintainer push can review a blocked pr 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
|
||
| skip) STAGE="" ;; | ||
|
Comment on lines
+605
to
+608
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Configured review runs twice 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
|
||
| *) CEL_ROUTE_SOURCE="bash" ;; | ||
| esac | ||
|
Comment on lines
+605
to
+610
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 11. A trigger can start review on a plain issue comment 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
|
||
| 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}" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. A broken cli install in shadow mode stops all dispatch
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsDismiss ↗ | View ↗