Opus finding
`gh pr list --head $BRANCH` does not scope by base and may match the wrong PR if branch names collide across same-day runs
lowbugmedium
- .github/workflows/sync-upstream.yml:88-94
The branch name uses only a UTC date stamp (`sync/upstream-YYYYMMDD`). If the workflow is run multiple times the same day via `workflow_dispatch` after the first PR is merged or closed, `gh pr list` defaults to open PRs; once a PR is merged the next run on the same day will `git checkout -b` against an existing local branch creation (fine in fresh runners) and `git push` may fast-forward or be rejected because the remote branch already exists with merged history. There is no handling for the `push` failing due to non-fast-forward, and no `--state all` on the lookup so a previously-closed PR for the same branch will be re-created in a confusing state.
Recommendation
Include the upstream short SHA or a timestamp with hours/minutes in the branch name, and use `git push --force-with-lease` plus `gh pr list --state all` when looking up existing PRs.