Skip to content

Fail closed on GitHub API errors during the sync workflow.#38

Merged
vorporeal merged 1 commit intomainfrom
david/fail-closed-on-api-errors
May 6, 2026
Merged

Fail closed on GitHub API errors during the sync workflow.#38
vorporeal merged 1 commit intomainfrom
david/fail-closed-on-api-errors

Conversation

@vorporeal
Copy link
Copy Markdown
Contributor

@vorporeal vorporeal commented May 5, 2026

Description

get_pr_for_commit() was silently catching CalledProcessError and returning None on GitHub API failures. The loop detection code in is_sync_originated() treated this the same as "no PR found," causing it to fail-open: sync-originated commits were not filtered out, and the sync workflow created reverse-direction PRs that should never have existed.

This was the root cause of warpdotdev/warp#9591 (and 3 other PRs created on 2026-04-30), where public→private sync commits were synced back to public.

The fix removes the blanket except from get_pr_for_commit() so API errors propagate. In the loop detection path this aborts the sync run; in non-critical call sites (PR description building, reviewer lookup) the callers now catch and degrade gracefully with logging.

Testing

Added test_api_failure_propagates_when_trailer_present to verify that is_sync_originated raises on API failure instead of returning False. All existing loop detection tests continue to pass.

Co-Authored-By: Oz oz-agent@warp.dev

@cla-bot cla-bot Bot added the cla-signed label May 5, 2026
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vorporeal vorporeal requested a review from captainsafia May 5, 2026 22:51
@vorporeal vorporeal marked this pull request as ready for review May 5, 2026 22:51
@vorporeal vorporeal merged commit 03084b3 into main May 6, 2026
5 checks passed
@vorporeal vorporeal deleted the david/fail-closed-on-api-errors branch May 6, 2026 15:29
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.

2 participants