From cf03343fcfc86fdd43ecddcf786947a39b22b8e1 Mon Sep 17 00:00:00 2001 From: furiosa Date: Thu, 1 Jan 2026 15:45:17 -0800 Subject: [PATCH] fix(mq): Add push verification before MR submission (gt-2hwi9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL: Prevents work loss from unpushed commits. The bug: gt mq submit created MR beads without verifying the branch was pushed to remote. This allowed polecats to create MR beads for unpushed work, which the Refinery would skip and the Witness would nuke, losing work. The fix: Add same push verification that gt done uses. Now both code paths require git push before MR submission. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/mq_submit.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/cmd/mq_submit.go b/internal/cmd/mq_submit.go index cdc49eb7..46191dff 100644 --- a/internal/cmd/mq_submit.go +++ b/internal/cmd/mq_submit.go @@ -82,6 +82,17 @@ func runMqSubmit(cmd *cobra.Command, args []string) error { return fmt.Errorf("cannot submit main/master branch to merge queue") } + // CRITICAL: Verify branch is pushed before creating MR bead + // This prevents work loss when MR is created but commits aren't on remote. + // See: gt-2hwi9 (Polecats not pushing before signaling done) + pushed, unpushedCount, err := g.BranchPushedToRemote(branch, "origin") + if err != nil { + return fmt.Errorf("checking if branch is pushed: %w", err) + } + if !pushed { + return fmt.Errorf("branch has %d unpushed commit(s); run 'git push -u origin %s' first", unpushedCount, branch) + } + // Parse branch info info := parseBranchName(branch)