Skip to content

fix: use GitHub App token in feature flag cleanup workflow to trigger CI#10642

Merged
captainsafia merged 2 commits into
masterfrom
oz-agent/fix-feature-flag-cleanup-ci-trigger
May 14, 2026
Merged

fix: use GitHub App token in feature flag cleanup workflow to trigger CI#10642
captainsafia merged 2 commits into
masterfrom
oz-agent/fix-feature-flag-cleanup-ci-trigger

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

Description

The feature_flag_cleanup.yml workflow creates PRs using peter-evans/create-pull-request with token: ${{ github.token }}. GitHub does not trigger workflows from events generated by the default GITHUB_TOKEN — this is a built-in safeguard against recursive workflow runs. As a result, the Warp CI workflow never ran on feature flag cleanup PRs, making their checks appear stalled until a human manually pushed a commit to the branch.

This PR switches to a GitHub App token minted from the Oz for OSS identity (OZ_MGMT_GHA_APP_ID / OZ_MGMT_GHA_PRIVATE_KEY) using actions/create-github-app-token@v3, so the pull_request.opened event properly triggers downstream workflows including CI.

Affected PRs (examples):

Linked Issue

N/A — discovered during investigation of stalled CI on #10485.

Testing

  • Verified the OZ_MGMT_GHA_APP_ID and OZ_MGMT_GHA_PRIVATE_KEY secrets are already used by other workflows in this repo (update-pr-review-local.yml, update-triage-local.yml, update-dedupe-local.yml)
  • I have manually tested my changes locally with ./script/run

N/A — this is a CI workflow change, not a code change. It will be validated when the next feature flag cleanup run creates a PR and CI triggers.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/159eafa2-0c0f-483c-99a9-a461b5bdb3a8
Run: https://oz.staging.warp.dev/runs/019e16ef-48f7-789c-9294-e926e5bff1e0
This PR was generated with Oz.

The feature_flag_cleanup workflow used ${{ github.token }} when creating
PRs via peter-evans/create-pull-request. GitHub does not trigger workflows
from events generated by the default GITHUB_TOKEN, so the Warp CI workflow
never ran on these PRs — checks appeared stalled until a human pushed a
commit.

Switch to a GitHub App token minted from the Oz for OSS identity
(OZ_MGMT_GHA_APP_ID / OZ_MGMT_GHA_PRIVATE_KEY) so the pull_request.opened
event triggers downstream workflows including CI.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 11, 2026
@captainsafia captainsafia marked this pull request as ready for review May 11, 2026 14:40
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 11, 2026

@captainsafia

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR switches the feature flag cleanup workflow from the default GITHUB_TOKEN to a GitHub App installation token so cleanup PR creation can trigger downstream pull_request workflows.

Concerns

  • The newly added token-generation action is referenced by a mutable tag while it receives the GitHub App private key.

Security

  • Pin actions/create-github-app-token to a full commit SHA before passing OZ_MGMT_GHA_PRIVATE_KEY to it.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread .github/workflows/feature_flag_cleanup.yml Outdated
@captainsafia captainsafia requested a review from szgupta May 11, 2026 17:48
@szgupta
Copy link
Copy Markdown
Member

szgupta commented May 14, 2026

@captainsafia i don't think i have enough context to review this. Feels like someone with more knowledge about this flow should review given how many different attempts we've made to fix it. Tagging in @bnavetta

@szgupta szgupta requested review from bnavetta and removed request for szgupta May 14, 2026 02:53
@captainsafia
Copy link
Copy Markdown
Contributor Author

@szgupta Yep, totally understand. I tagged you in because you originally reported the issue with feature flag cleanup PRs not having CI triggered.

@bnavetta This is another version of the "commit from workflows don't trigger CI if you use the default token" problem we've run into elsewhere. I'm circumventing that here by using the identity provided by the Oz for OSS app to circumvent that here.

I know we've talked about moving this to a scheduled agent and avoiding GHA altogether. Maybe this issue is another motivation for us to just peel the bandaid on that.

Copy link
Copy Markdown
Contributor

@bnavetta bnavetta left a comment

Choose a reason for hiding this comment

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

I know we've talked about moving this to a scheduled agent and avoiding GHA altogether. Maybe this issue is another motivation for us to just peel the bandaid on that.

Yeah maybe - I wonder if we want cloud->cloud orchestration + some of the integrations v2 automation work first. It'd be great if we could have one agent reliably produce structured data on stale feature flags, and then kick off N others to clean up a few. That was always kind of the intent with this workflow, which is why it has 2 separate agent steps.

It's a hack, but a human closing and reopening the PR also triggers CI - we could go with that assuming a person is reviewing the PRs anyways. The workflow is supposed to auto-assign to whoever initially enabled the flag, but that may have regressed.

@captainsafia captainsafia merged commit 140d095 into master May 14, 2026
25 of 26 checks passed
@captainsafia captainsafia deleted the oz-agent/fix-feature-flag-cleanup-ci-trigger branch May 14, 2026 16:08
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants