fix(done,mayor): push branch before MR creation, restart runtime on attach

done.go: Push branch to origin BEFORE creating MR bead (hq-6dk53, hq-a4ksk)
- The MR bead triggers Refinery to process the branch
- If branch isnt pushed, Refinery finds nothing to merge
- The worktree gets nuked at end of gt done, losing commits forever
- This is why polecats kept submitting MRs with empty branches

mayor.go: Restart runtime with context when attaching (hq-95xfq)
- When runtime has exited, gt may at now respawns with startup beacon
- Previously, attaching to dead session left agent with no context
- Now matches gt handoff behavior: hook check, inbox check, full prime

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mayor
2026-01-13 17:53:18 -08:00
committed by Steve Yegge
parent 5882039715
commit 4ee1a4472d
2 changed files with 57 additions and 1 deletions

View File

@@ -264,6 +264,16 @@ func runDone(cmd *cobra.Command, args []string) error {
return fmt.Errorf("branch '%s' has 0 commits ahead of %s; nothing to merge\nMake and commit changes first, or use --status DEFERRED to exit without completing", branch, originDefault)
}
// CRITICAL: Push branch BEFORE creating MR bead (hq-6dk53, hq-a4ksk)
// The MR bead triggers Refinery to process this branch. If the branch
// isn't pushed yet, Refinery finds nothing to merge. The worktree gets
// nuked at the end of gt done, so the commits are lost forever.
fmt.Printf("Pushing branch to remote...\n")
if err := g.Push("origin", branch, false); err != nil {
return fmt.Errorf("pushing branch '%s' to origin: %w\nCommits exist locally but failed to push. Fix the issue and retry.", branch, err)
}
fmt.Printf("%s Branch pushed to origin\n", style.Bold.Render("✓"))
if issueID == "" {
return fmt.Errorf("cannot determine source issue from branch '%s'; use --issue to specify", branch)
}