---
title: "Reject irrelevant events before allocating runners"
description: "Put event and change conditions before runner allocation so irrelevant comments or edits do not start expensive jobs."
url: https://starsling.dev/ci-playbooks/techniques/gate-irrelevant-events
canonicalUrl: https://starsling.dev/ci-playbooks/techniques/gate-irrelevant-events
---

# Reject irrelevant events before allocating runners

Put event and change conditions before runner allocation so irrelevant comments or edits do not start expensive jobs.

## How to choose an approach

Compare the examples by repository setup, prerequisites, and risks before adopting one. Each company implemented this in its own environment; measure each change against your own baseline.

- **[Mastra](https://starsling.dev/ci-playbooks/mastra#comment-gates)**: Use it when Comment-triggered automation starts expensive checks for ordinary discussion. Check before adopting: Event matching and command parsing must agree. Preserve author authorization, edit/removal handling and fork trust, and keep permission checks separate from event filtering.
- **[OpenAI](https://starsling.dev/ci-playbooks/openai#isolate-metadata-edits)**: Use it when Description-only edits rerun the same source checks or cancel an active run. Check before adopting: Title validators, retargets and metadata checks still need their events. A skipped run must never overwrite a failed, pending or missing required result.
- **[OpenAI](https://starsling.dev/ci-playbooks/openai#gate-before-runner)**: Use it when Expensive jobs start only to find that every useful step will skip. Check before adopting: Keep stable required check names and require the preparation job to succeed. An unknown diff runs the checks.

## Apply this technique

````text
Evaluate and apply this CI technique to my repository: Reject irrelevant events before allocating runners.

Put event and change conditions before runner allocation so irrelevant comments or edits do not start expensive jobs.

Read the technique and its source-backed company examples: https://starsling.dev/ci-playbooks/techniques/gate-irrelevant-events.md

Inspect this repository’s CI workflows, build and test commands, dependencies, and recent run timings. Identify where this technique applies and explain the expected benefit using this repository’s evidence.
Measure a baseline from recent comparable runs: elapsed time, queue time, runner minutes and failures where available. If data is unavailable, say what cannot be measured.
Compare relevant company approaches, checking prerequisites, platform differences and tradeoffs. Rank applicable options by evidence, fit and measurable opportunity; do not present company results as predictions for this repo.
Recommend the smallest safe change, show what checks and fallback paths remain, and ASK ME WHICH CHANGE TO APPROVE BEFORE EDITING ANY FILES.
Only after approval, work on a new feature branch, make one reversible change, and open a reviewable pull request. Never merge or push to a default or protected branch.
Keep required checks, test coverage, deployment and release behavior intact. Validate the change and compare equivalent runs where possible; report limitations and what should be monitored after merge.
````

## How companies used this technique

Read what each company changed and follow the original sources.

### Mastra: Do not start a runner for irrelevant comments

Mastra gated the major-version job on the exact command in the new or previous comment body. This adapts the non-content-event recipe to issue_comment, preserving command removal as well as addition.

Evidence: Source PR/commit evidence

Use it when: Comment-triggered automation starts expensive checks for ordinary discussion.

Before applying it: Event matching and command parsing must agree. Preserve author authorization, edit/removal handling and fork trust, and keep permission checks separate from event filtering.

[Read more in the Mastra playbook](https://starsling.dev/ci-playbooks/mastra#comment-gates)

[Primary source](https://github.com/mastra-ai/mastra/pull/22381)

### OpenAI: Keep metadata edits from restarting source validation

Codex Security skips its source checks on body-only PR edits, gives those events their own concurrency group, and renames the skipped aggregates. Title, base and combined edits still run full validation.

Evidence: Source PR/commit evidence

Body-only edits skip source validation in their own concurrency group ([Source](https://github.com/openai/codex-security/pull/1708))

Use it when: Description-only edits rerun the same source checks or cancel an active run.

Before applying it: Title validators, retargets and metadata checks still need their events. A skipped run must never overwrite a failed, pending or missing required result.

[Read more in the OpenAI playbook](https://starsling.dev/ci-playbooks/openai#isolate-metadata-edits)

[Primary source](https://github.com/openai/codex-security/pull/1708)

### OpenAI: Skip irrelevant jobs before allocating runners

The Agents SDK already classified each change in a preparation job. Linux and Windows packaging jobs now read that output in a job-level condition, and two explicit Linux jobs keep the versioned required check names when they skip. SDK changes and unknown diffs still run the tests.

Evidence: Source PR/commit evidence

Packaging jobs skip at job level for changes outside the SDK ([Source](https://github.com/openai/openai-agents-python/pull/5264))

Use it when: Expensive jobs start only to find that every useful step will skip.

Before applying it: Keep stable required check names and require the preparation job to succeed. An unknown diff runs the checks.

[Read more in the OpenAI playbook](https://starsling.dev/ci-playbooks/openai#gate-before-runner)

[Primary source](https://github.com/openai/openai-agents-python/pull/5264)

## CI optimization is continuous work.

Apply this technique yourself, or use StarSling Runners for faster GitHub Actions and optional agent-driven optimization PRs, which teams on eligible paid plans can turn on.

[Get self-improving CI](https://starsling.dev/products/runners)

## Related techniques

### [Run CI once per pull request commit](https://starsling.dev/ci-playbooks/techniques/run-ci-once)

Remove overlapping push and pull request triggers so each change receives one intended validation run.

3 implementations · 3 companies (Anthropic, Shopify, Spotify)

### [Cancel superseded pull request runs](https://starsling.dev/ci-playbooks/techniques/cancel-superseded-runs)

Free runner capacity by canceling validation that a newer commit has replaced. Keep required main-branch and release runs intact.

4 implementations · 4 companies (Anthropic, Mastra, Stripe, Uber)

### [Install and build only the workspace packages a job uses](https://starsling.dev/ci-playbooks/techniques/scope-workspace-builds)

Scope dependency installation and builds to the package or lane under test, including its actual dependencies.

3 implementations · 3 companies (Linear, Mastra, Shopify)

## Company Playbooks

### [Anthropic](https://starsling.dev/ci-playbooks/anthropic)

Run only affected tests

### [DoorDash](https://starsling.dev/ci-playbooks/doordash)

Run build and test in parallel, sharded across CI agents

### [Linear](https://starsling.dev/ci-playbooks/linear)

Benchmark the same job on faster hardware

### [Mastra](https://starsling.dev/ci-playbooks/mastra)

StarSling runners for the slowest test workflow

### [OpenAI](https://starsling.dev/ci-playbooks/openai)

Rank CI fixes by the minutes they save

### [Ramp](https://starsling.dev/ci-playbooks/ramp)

Move a CPU-bound test suite to a faster CPU

### [Shopify](https://starsling.dev/ci-playbooks/shopify)

Let an agent iterate against one CI metric

### [Spotify](https://starsling.dev/ci-playbooks/spotify)

Build arm64 on native arm64 runners

### [Stripe](https://starsling.dev/ci-playbooks/stripe)

Run only the tests a change can reach

### [Uber](https://starsling.dev/ci-playbooks/uber)

Build the merge-queue speculations most likely to be needed

## Related guides

Implementation guides for this technique.

### [Cancel superseded CI runs](https://starsling.dev/best-practices/github-actions/cancel-superseded-runs)

Use concurrency groups to keep PR verification focused on the latest commit.

### [Build and test only what changed](https://starsling.dev/best-practices/github-actions/build-only-affected)

Scope work with your dependency graph and keep a full-run fallback.

### [Cut CI queue time](https://starsling.dev/best-practices/github-actions/cut-queue-time)

Measure waiting time and identify concurrency or capacity constraints.

### [Filter workflows by changed files](https://starsling.dev/best-practices/github-actions/path-filter-workflows)

Use paths and job conditions while keeping required checks reporting.
