Skip to content

fix: remove branch checkout rollback to preserve branch state on failure#2058

Open
jonathanlab wants to merge 1 commit intomainfrom
posthog-code/keep-branch-checked-out-after-task-creation-failure
Open

fix: remove branch checkout rollback to preserve branch state on failure#2058
jonathanlab wants to merge 1 commit intomainfrom
posthog-code/keep-branch-checked-out-after-task-creation-failure

Conversation

@jonathanlab
Copy link
Copy Markdown
Contributor

When a PR creation saga fails at a later step (e.g., during push or commit), the rollback mechanism was incorrectly checking out the previous branch, losing the user's current working branch state. The branch should remain checked out regardless of subsequent operation failures.


Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 17f6ee1d-e76c-4ed6-aac6-04183d722858
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Comments Outside Diff (1)

  1. apps/code/src/main/services/git/create-pr-saga.ts, line 90-93 (link)

    P2 The empty rollback is intentionally correct here, but it would help to add an explanatory comment — the pushing step already uses the same pattern with an inline comment (// no meaningful rollback can happen here w/o force push). Without a comment, it's easy for future readers to assume this is a forgotten implementation rather than a deliberate choice.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/main/services/git/create-pr-saga.ts
    Line: 90-93
    
    Comment:
    The empty rollback is intentionally correct here, but it would help to add an explanatory comment — the `pushing` step already uses the same pattern with an inline comment (`// no meaningful rollback can happen here w/o force push`). Without a comment, it's easy for future readers to assume this is a forgotten implementation rather than a deliberate choice.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/main/services/git/create-pr-saga.ts:90-93
The empty rollback is intentionally correct here, but it would help to add an explanatory comment — the `pushing` step already uses the same pattern with an inline comment (`// no meaningful rollback can happen here w/o force push`). Without a comment, it's easy for future readers to assume this is a forgotten implementation rather than a deliberate choice.

```suggestion
          rollback: async () => {}, // intentionally no-op: branch should remain checked out if later steps fail
        });
      }
    }
```

Reviews (1): Last reviewed commit: "fix(code): remove unnecessary branch rol..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant