Skip to content

[Bug]: Mandatory PR-tool instruction blocks gh fallback for another repository #41287

Closed as not planned

Description

@thenicekat

Summary

Since the PR-tools instruction added in #26751, a Codex agent can refuse to create a PR in a second repository even when the user explicitly requests gh, GitHub CLI authentication works, and the prepared branch is already pushed. The listed pull_request_create tool only operates on the thread's bound checkout, while the injected instruction forbids the working CLI alternative.

This report concerns the instruction-level deadlock, not a request to add cross-repository targeting to pull_request_create or to rebind a thread. The latter capability request was closed as not planned in #40463. A CLI fallback would resolve this bug without adding that feature.

Area

apps/server — host-injected runtime instructions / source-control MCP tools

Steps to reproduce

These steps describe the observed live session; they were not rerun as an isolated automated test.

  1. Start a Codex thread associated with repository A, on a supported GitHub host, so T3 lists its pull_request_* tools.
  2. Have the agent prepare, commit, and push a branch in repository B, using a separate local checkout/worktree. Keep repository B's primary checkout on main.
  3. Confirm the CLI route is available: gh api user succeeds and gh repo view owner/repo-b --json viewerPermission,isArchived reports WRITE and false.
  4. Ask the agent to create the PR in repository B. Explicitly request gh pr create --repo owner/repo-b --head fix/example --base main when it says the T3 create tool targets repository A.
  5. Observe that the agent refuses the CLI fallback because pull_request_* tools are listed, although the create tool cannot select repository B, its head branch, or its worktree.

Expected behavior

The agent can complete user-authorized PR creation through gh when the listed T3 tool cannot target the requested checkout. The instruction should require T3 tools only when they support the actual requested operation, with a CLI fallback otherwise. The resulting PR can still be linked through link_pull_request.

Actual behavior

Repeated explicit requests to use gh produce refusals citing the T3 runtime instruction. The branch is pushed successfully, but the PR is left uncreated and the user is given a manual command or GitHub creation link.

This is not a CLI authentication, sandbox, or GitHub write-permission denial. The agent stops before sending a PR creation request. We intentionally did not call pull_request_create against the wrong repository as a reproduction step.

Source evidence

Inspected upstream at 58e309e75b8f2fb2ad824a6437bfa920ab5398e9:

Impact

Blocks PR creation through the agent for a prepared branch outside the thread's associated repository, despite an authenticated CLI with write access. The existing manual CLI route remains available to the user.

Version and environment

  • Running T3 server: 0.1.11
  • macOS, arm64
  • Codex harness; observed with GPT-6.1 Terra and GPT-6.1 Sol
  • Current thread runtime mode: full-access
  • CLI authentication and target-repository WRITE permission directly verified

Related reports

Workaround

Run gh pr create --repo owner/repo-b --head fix/example --base main manually. Repeatedly authorizing the agent to use that route does not resolve the injected instruction conflict in the affected session.

Private repository names, user/account identifiers, local paths, and session identifiers are omitted.

Prepared by GPT-6.1 Sol through the Codex harness in T3 Code, at the user's request.

Activity

  1. juliusmarminge commented on Nov 23, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Commit 49ce71e (origin/main). Server: dev server started with T3CODE_DEV_SEED=0, fresh database, a stub gh on PATH that logged each call and answered gh pr create with a fake PR URL. Data: two local git repos with origin https://github.com/acme/repo-a.git and https://github.com/acme/repo-b.git; repo-b had branch fix/example committed in a separate worktree while its primary checkout stayed on main; repo-a added as the project (t3 project add). Threads: started with t3 thread start --provider codex --model <m> --wait (runtime mode full-access). Check: in a separate Terra thread on the same project, the agent listed its tools, which included all T3 PR/CI tools: pull_request_create, _list, _read, _update, _respond, _review, merge, ci_logs, ci_rerun, link/watch tools. The Codex rollout carried the unchanged <pull_request_linking> rule 'When pull_request* tools are listed, use them, not gh or cafe'. Runs: (1) gpt-6.1-sol, asked to open the repo-b PR and explicitly told to use gh pr create --repo acme/repo-b --head fix/example --base main; it ran exactly that, then called link_pull_request. (2) gpt-6.1-sol ×2 and gpt-6.1-terra ×2, asked only to create the PR in acme/repo-b against main, with no mention of gh; all 4 ran gh pr create --repo acme/repo-b --head fix/example --base main ... themselves; none refused and none called pull_request_create against repo-a. 5/5 created the PR through gh. The runtime instruction text is identical at the reporter's commit 58e309e and at main. Not replicated: the reporter's long live session with repeated pushback, which may have carried context that made the model refuse.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions