Skip to content

Windows app appears unstable around branch/worktree state #16290

Open

Description

@mccartyflame

What version of the Codex App are you using (From “About Codex” dialog)?

26.325.31654

What subscription do you have?

Pro

What platform is your computer?

No response

What issue are you seeing?

The Windows app appears unstable around branch/worktree state. I was switched from the task branch to main, could not switch back, and had to migrate to a new branch. After that, generated diffs in a large monolith file became hard to trust because duplicate/conflicting changes may have been introduced by branch/context instability rather than intentional edits. Separately, menu popups are unreliable and clip off-screen, which makes recovery harder. During coding, I’m seeing repeated PowerShell runtime errors including null dereference on .Trim() and malformed \ command execution. Combined with branch/worktree instability, this makes generated diffs in large files hard to trust because partial or corrupted edits may be introduced by execution failures rather than intended code changes.

What steps can reproduce the bug?

Open Codex desktop app on Windows.
Load a repo with an existing feature branch
Start a task and allow Codex to operate on that branch.
Continue working for several iterations (code generation, apply patches, run tests).
Observe branch context in the app.
Attempt to switch back to the original task branch after context changes.

What is the expected behavior?

Stable branch context
Reliable menu interactions
Clean command execution
Small, surgical diffs aligned to task scope

Additional information

No response

Activity

  1. added
    appIssues related to the Codex desktop app
    on Mar 31, 2026
  2. added
    bugSomething isn't working
    windows-osIssues related to Codex on Windows systems
    tool-callsIssues related to tool calling
    on Mar 31, 2026
  3. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor
  4. DisabledAbel commented on Mar 31, 2026

    @DisabledAbel

    Why this happens

    Codex creates its branch from a snapshot of main at task start. If main moves forward before Codex finishes (even a README edit or an auto-generated commit), the PR lands with conflicts — even though you never touched those files. It's a race condition between Codex's branch base and the current main.

    Workaround that worked for me

    I created a GitHub Actions workflow that auto-resolves conflicts by merging main into the Codex branch with -X theirs (keeping Codex's changes):

    name: Auto Fix Conflicts
    
    on:
      pull_request:
        types: [opened, synchronize, reopened]
      workflow_dispatch:
        inputs:
          branch:
            description: "Branch to fix"
            required: false
            default: ""
    
    jobs:
      auto-fix:
        runs-on: ubuntu-latest
        permissions:
          contents: write
          pull-requests: write
    
        steps:
          - name: Checkout repo
            uses: actions/checkout@v5
            with:
              ref: ${{ github.event.inputs.branch || github.head_ref }}
              token: ${{ secrets.GITHUB_TOKEN }}
              fetch-depth: 0
    
          - name: Configure git identity
            run: |
              git config user.name "conflict-bot"
              git config user.email "bot@example.com"
    
          - name: Fetch base branch
            run: git fetch origin main
    
          - name: Try auto-merge (prefer incoming changes)
            run: git merge -X theirs origin/main || true
    
          - name: Detect conflicts
            id: conflicts
            run: |
              files=$(git diff --name-only --diff-filter=U)
              echo "files=$files" >> $GITHUB_OUTPUT
    
          - name: Auto resolve conflicts (fallback)
            if: steps.conflicts.outputs.files != ''
            run: |
              for file in ${{ steps.conflicts.outputs.files }}; do
                echo "Resolving $file"
                git checkout --theirs $file
                git add $file
              done
    
          - name: Commit & push changes
            run: |
              git add .
              git commit -m "🤖 Auto-resolved merge conflicts" || echo "No changes"
              git push

    Key things that tripped me up:

    • permissions: contents: write is required or the push silently fails with 403
    • git config must come before the merge step, not just before the commit
    • Use actions/checkout@v5 to avoid the Node 20 deprecation warning

    Would love to see Codex handle this natively — maybe by rebasing its branch on main right before opening the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingtool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions