After a failed create, a script asks "does this branch already have a pull request?" and the lookup also returns closed ones. An old closed request then reads as success, and the real error is dropped again.
Name the state you need in the lookup. A find-by-name call can fall back to closed records.
Make each guard rule fail alone in a test. A rule that only fails beside another is untested.
Make each guard rule fail alone in a test. A rule that only fails beside another is untested.