openai / openai/codex

Prevent PR workflow pushes from targeting the tracked default branch

Open
#39,560 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug model-behavior
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by reproducing the branch setup and push workflow described in the issue, then trace the PR branch creation and push path. Done means a PR-task push cannot resolve to the default branch without explicit authorization, and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.