Skip to content

Prevent PR workflow pushes from targeting the tracked default branch #39560

Description

@donatj

Summary

During a Codex desktop task to create a new PR branch, the agent created a local branch from origin/master and then ran:

git push --set-upstream origin codex/pinch-to-zoom

Because the local branch tracked origin/master, the operation updated the remote default branch instead of creating origin/codex/pinch-to-zoom. The push output made that explicit:

codex/pinch-to-zoom -> master

The agent then had to create and push a revert to restore master.

Expected behavior

When the task is to create a new PR, Codex should not push directly to the repository default branch unless the user explicitly authorizes it. Before a push, it should verify that the remote target differs from the default branch, or use an explicit matching refspec such as:

git push --set-upstream origin HEAD:refs/heads/codex/pinch-to-zoom

Impact

This can make unreviewed changes visible on a shared default branch and requires a follow-up revert. The agent should fail closed or ask for confirmation when a planned branch push resolves to master.

Environment

Codex desktop on macOS, GitHub remote, with a local feature branch initially created from origin/master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingmodel-behaviorIssues related to behaviors exhibited by the model

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions