Repository navigation
Description
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:
- Run 25957291177 → created issue #57
- Run 25957804763 → created issue #58
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
kaovilai commentedon May 16, 2026
Additional concern: fallback issue deduplication
The
fallback-to-issuehandler creates issues without checking for existing similar fallback issues. This leads to duplicates when multiple runs hit the same protected files:push-triggered runs.The agent's pre-flight instructions say to check for existing open issues with the
continuous-improvementlabel before acting, but: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-issuehandler should search for existing open issues with the sametitle-prefixand 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