Skip to content

protected-files fallback-to-issue: handler attempts git push before short-circuiting, produces inferior fallback issue #32596

Closed

Description

@kaovilai

Problem

When protected-files: { policy: fallback-to-issue } is configured and the patch modifies protected files (e.g., .github/workflows/), the safe-output handler logs a warning about protected files but still attempts the git push instead of short-circuiting to the review issue flow. When the push then fails (e.g., missing workflows permission), the handler creates a "git push operation failed" fallback issue instead of the proper "Protected Files" review issue.

This produces an inferior user experience:

Protected Files review issue (expected) Push failure fallback issue (actual)
Alert level [!WARNING] [!NOTE]
Message "the patch modifies protected files" "the git push operation failed"
Action Compare URL to create PR with one click Bundle download instructions (multi-step git fetch/git update-ref/git push commands)
Protected files listed Yes, with links to changed files No
Root cause visible Yes — clearly about protected files No — looks like a generic push failure

Reproduction

Repository: https://github.com/kaovilai/kaovilai

Workflow: continuous-improvement.md with:

permissions:
  contents: read
safe-outputs:
  create-pull-request:
    protected-files:
      policy: fallback-to-issue
      exclude: [README.md]

The agent found an improvement in .github/workflows/update-activity-log.yml and .github/workflows/update-pr-badges.yml (updating version comments from # v6 to # v6.0.2).

Run logs show the warning was detected but push was still attempted:

##[warning]Protected file protection triggered (fallback-to-issue): 
  .github/workflows/update-activity-log.yml, .github/workflows/update-pr-badges.yml. 
  Will create review issue instead of pull request.

Then the GraphQL signed push failed:

##[warning]pushSignedCommits: GraphQL signed push failed, falling back to git push: 
  Request failed due to following response errors:
  - Resource not accessible by integration

Then the git push fallback also failed:

! [remote rejected] (refusing to allow a GitHub App to create or update workflow 
  `.github/workflows/update-activity-log.yml` without `workflows` permission)

Only then did it create the fallback issue — but using the "push failed" template instead of the "Protected Files" template.

Affected runs:

Compare with correct behavior — issue #54 from the same workflow correctly shows the "Protected Files" template with a compare URL, because that run's patch (.github/FUNDING.yml) hit the protected-files check and short-circuited before attempting push.

Expected Behavior

When protected-files: { policy: fallback-to-issue } detects protected files, the handler should skip the push entirely and create the "Protected Files" review issue with:

  • [!WARNING] alert
  • List of protected files with links
  • One-click compare URL to create the PR

The push attempt is wasted work that will fail anyway (for workflow files, the workflows permission is missing; for other protected files, the policy already decided not to push).

Additional Bug: Closes #N in Fallback Issue Body

Issue #58's body starts with Closes #57 — the agent wrote this as part of its PR description (intending to close the earlier fallback issue). When the push failed and the handler created a fallback issue using the agent's PR body verbatim, the Closes #57 keyword carried over. This means closing issue #58 would auto-close #57 — unintended cross-issue side effect.

The fallback issue creation should strip or escape GitHub closing keywords (Closes, Fixes, Resolves + #N) from the agent's PR body when using it as issue body.

Note

Responses generated with Claude

Activity

  1. kaovilai commented on May 16, 2026

    @kaovilai
    Author

    Additional concern: fallback issue deduplication

    The fallback-to-issue handler creates issues without checking for existing similar fallback issues. This leads to duplicates when multiple runs hit the same protected files:

    • #57 and #58 are identical fallback issues for the same improvement, created ~26 minutes apart by two consecutive push-triggered runs.

    The agent's pre-flight instructions say to check for existing open issues with the continuous-improvement label before acting, but:

    1. The second run may have started before the first fallback issue was created
    2. Even if the agent checks, the safe-outputs handler itself doesn't deduplicate — it creates a new issue regardless

    Worse, if a workflow triggers on issues: opened, the fallback issue itself could trigger another run → which finds the same improvement → creates another fallback issue → potential cascade.

    Suggestion: The fallback-to-issue handler should search for existing open issues with the same title-prefix and similar title before creating a new one. If a match exists, it could add a comment to the existing issue instead.

    Note

    Responses generated with Claude

  2. locked and limited conversation to collaborators on May 16, 2026
  3. unlocked this conversation on May 16, 2026
  4. locked and limited conversation to collaborators on May 16, 2026
  5. unlocked this conversation on May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions