gitDiffToRemote fails on an unpushed topic branch when the remote default branch contains a slash

オープン 初心者向け
#61,441 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, rust
領域
devtools

調査の方向性

バグは codex-rs/git-utils/src/info.rs(456〜477行目付近)のデフォルトブランチ解決処理にあります。この処理は refs/remotes/origin/release/stable の最後のスラッシュ以降のテキストだけを残しています。まずそこから着手し、代わりに refs/remotes/<remote>/ という接頭辞を正確に取り除いてください。ブランチ名が保持されることを確認してください。issue の再現手順で origin/release/stable の SHA と topic.txt を追加する diff が返り、単一コンポーネントの対照ケースが引き続き成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

app-server bug CLI

The app-server RPC cannot generate a patch for a local topic branch based on origin/release/stable. It returns JSON-RPC error -32600 even though the base commit is available locally. The same sequence with the default branch named stable returns the correct SHA and patch.

Environment Official Codex CLI 0.169.0, Linux x86_64, Git 2.52.0. Reproduced with two local Git repositories and no network or model calls.

Steps to reproduce

d=$(mktemp -d)
git init -q -b release/stable "$d/upstream"
echo base > "$d/upstream/base.txt"
git -C "$d/upstream" add base.txt
git -C "$d/upstream" -c user.name=Repro -c [email protected] commit -qm base
git clone -q "$d/upstream" "$d/work"
git -C "$d/work" switch -qc topic
echo change > "$d/work/topic.txt"
git -C "$d/work" add topic.txt
git -C "$d/work" -c user.name=Repro -c [email protected] commit -qm topic
git -C "$d/work" symbolic-ref refs/remotes/origin/HEAD
git -C "$d/work" diff --stat origin/release/stable

Start codex app-server --stdio. Send initialize with {"clientInfo":{"name":"repro","version":"1"},"capabilities":{}}, then the initialized notification. Call gitDiffToRemote with {"cwd":"<absolute path to work>"}.

Observed Git prints refs/remotes/origin/release/stable and a one-line insertion in topic.txt. Codex returns -32600: failed to compute git diff to remote for cwd: ….

Expected Return the SHA of origin/release/stable and a diff adding topic.txt, just as the single-component default-branch control does.

Suggested fix The Rust default-branch resolver takes everything after the final slash, turning release/stable into stable. Strip the exact refs/remotes/<remote>/ prefix to keep the full branch name. Related issue #30940 demonstrates a similar truncation in the Desktop JavaScript branch picker. This reproduction exercises the Rust RPC directly. Rust resolver

主要言語
Rust
スター
135k
フォーク
21.4k
平均マージ
1分
マージ済み PR(30日)
997

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/codex のほかの issue

openai/codex の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。