Skip to content

Improve slack cancellation alerts - #12454

Closed
desrosj wants to merge 9 commits into
WordPress:trunkfrom
desrosj:improve-slack-cancellation-alerts
Closed

Improve slack cancellation alerts#12454
desrosj wants to merge 9 commits into
WordPress:trunkfrom
desrosj:improve-slack-cancellation-alerts

Conversation

@desrosj

@desrosj desrosj commented Jul 9, 2026

Copy link
Copy Markdown
Member

This changes the logic that controls when a cancelled notification is posted to Slack so that only the second run is reported as cancelled to avoid too many notifications from being posted.

Additionally, there is new logic added to distinguish workflows that time out from cancelled ones. The available GitHub Actions functions and contexts to not make a timed_out outcome available, but the REST API does.

Trac ticket: Core-65845.

Use of AI Tools

Claude Code was used to create the initial PR.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

desrosj added 2 commits July 8, 2026 20:59
This changes the logic for cancellation notifications in Slack to only send a cancellation notice only when the run is cancelled on the second attempt.

Because a `cancelled` status can represent several different outcomes (manually cancelled, timeout value reached, etc.), this notification type is often unnecessarily noisy.
@desrosj desrosj self-assigned this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@desrosj
desrosj marked this pull request as ready for review August 16, 2026 21:12
@desrosj
desrosj requested a review from johnbillion August 16, 2026 21:12
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props desrosj.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj
desrosj requested review from lancewillett and a lite review from Copilot August 16, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the reusable Slack notifications workflow to distinguish timeouts from other cancellations, and wires a new Slack webhook secret through the various CI workflows that call it.

Changes:

  • Add a new required reusable-workflow secret (SLACK_GHA_TIMEOUT_WEBHOOK) and pass it from all calling workflows.
  • Detect timeouts by querying workflow-run-attempt jobs via the GitHub REST API and exposing the result as a job output.
  • Split notifications into separate cancelled vs timeout jobs based on that detection.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/workflow-lint.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/upgrade-testing.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/upgrade-develop-testing.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/test-old-branches.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/test-coverage.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/test-build-processes.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/test-and-zip-default-themes.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/slack-notifications.yml Adds the timeout webhook secret, detects timed-out runs, and posts a dedicated timeout notification instead of treating it as a cancellation.
.github/workflows/phpunit-tests.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/phpstan-static-analysis.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/php-compatibility.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/performance.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/local-docker-environment.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/javascript-type-checking.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/javascript-tests.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/install-testing.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/end-to-end-tests.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.
.github/workflows/coding-standards.yml Passes the new timeout Slack webhook secret into the reusable Slack notifications workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/slack-notifications.yml Outdated
Comment thread .github/workflows/slack-notifications.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

Suppressed comments (1)

.github/workflows/slack-notifications.yml:243

  • The cancelled job condition still allows this job to run whenever cancelled() is true, which can bypass the new github.run_attempt == 2 gating and also bypass the timed_out split (a timed-out run is typically also considered cancelled). This can lead to cancelled notifications being posted on attempt 1 and/or alongside the new timeout notification.

Consider relying on the explicit inputs.calling_status (already computed by callers) and remove the || cancelled() fallback, or at least include the same run_attempt/timed_out gating in that path as well.

    if: ${{ ( inputs.calling_status == 'cancelled' && github.run_attempt == 2 && needs.prepare.outputs.timed_out != 'true' ) || cancelled() }}

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No blockers. Logic is sound.

@desrosj

desrosj commented Aug 16, 2026

Copy link
Copy Markdown
Member Author

The part limiting notifications to only the second run was committed in r62740. The timed_out logic was committed in r63310.

@desrosj desrosj closed this Aug 16, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in WordPress Project Build Tooling Aug 16, 2026
@desrosj
desrosj deleted the improve-slack-cancellation-alerts branch August 16, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants