- Add merge verification to the pending_issue PR path (section 2), matching
the catch-up scan fix: if the PR is still open after _merge_pr returns, set
State/Question instead of claiming success and leaving the issue closed with
an unmerged PR.
- Replace _latest_ci_run() with _latest_main_ci_run() that filters to
non-pull_request events on the 'main' prettyref. The old limit=1 query
could return a PR-branch run, causing section 3 to misread CI as failed
and spawn a ci-fix agent when main was actually fine.
- Guard against redundant ci-fix agents: when the same main CI run ID has been
failing since the previous ci-fix started (agent pushed to a branch, not
main), check for any in-flight CI run before spawning another agent.
- Issue agent prompt: explicitly forbid "Closes #N" / "Fixes #N" in commit
messages. The loop is responsible for closing issues after CI passes;
commit-keyword auto-close would race with or bypass that logic.
- Global ci-fix prompt: restore "push directly to main" (ci-fix agents need to
land on main to clear the main CI run) and keep the "no issue references"
guard added in the previous commit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>