- Fix high severity: Add git checkout before rebase to ensure operation
happens on the correct branch. Previously, if workspace HEAD was on a
different branch (e.g., agent switched to main temporarily), rebase would
silently modify the wrong branch, report success with incorrect metadata,
and leave PR branch un-rebased and workspace corrupted.
- Fix medium severity: Emit pr.rebase_error event and notify human when
rebase fails with non-conflict errors (dirty workspace, push rejection,
etc.). Previously these errors were only logged to metadata without any
notification, making persistent rebase issues invisible to operators.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>