git status -sb

Resolved 💬 6 comments Opened Sep 17, 2025 by peakyragnar Closed Nov 11, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.36.0

Which model were you using?

gpt-5-codex high

What platform is your computer?

MacOS

What steps can reproduce the bug?

Codex keeps running git status -sb over and over without being prompted.

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

6 Comments

trethore · 11 months ago

Short answer:
git status -sb and git diff form a simple safety check for agents applying patches:

  1. Use git status -sb to verify which files were modified, added, or deleted — ensuring only expected files were changed.
  2. Then run git diff to inspect the actual line-by-line changes, confirming the patch was applied as intended.
  3. Only if both checks look correct should the changes be staged and committed.

This workflow helps catch failed patch applications, stray file changes, or unintended modifications before committing.

This is totally normal for gpt-5-codex, it's just verifying that the changes are good.

peakyragnar · 11 months ago

Ok. Thank you. It is running multiple times - the command will appear 2-3 times in succession. This is normal?

nicholaswmin · 11 months ago

@peakyragnar yes - especially so if you have mem. files that require it to revalidate itself a million times.

ljw1004 · 11 months ago

@trethore @nicholaswmin The problem is far more than what you've suggested. For instance, I asked it a simple prompt

In this document I have five different example playlists to see how each one will render. Is there a neat HTML-and-CSS-only way to let me as a user switch between them? Or will I have to use javascript?"

and in its response it invoked "git status -sb" FIFTY TIMES.

I put up the full transcript (i.e. the complete set of JSON requests that were sent to the OpenAI Response endpoint), and the full JSON responses, so you can see what's up -- https://ljw1004.github.io/codex-trace/example-traces/git_status.html

Here's a screenshot

<img width="2060" height="6888" alt="Image" src="https://github.com/user-attachments/assets/5791d1f0-b192-412c-a8ff-464872b5ff6c" />

I experience Codex getting into "git status -sb" pathology about once every two hours as I work with it...

  • Once every two days I see infinite loops of "git status -sb" that I have to stop.
  • The more frequent pathology though is that I ask a question, and it gives an output_text block with the real answer, but then also invokes "git status -sb" and ends the conversation with a final output_text block that tells me about git status. Therefore, in the VSCode Codex UI, the real answer is hidden under "Finished working" and the visible answer is a useless one about git status. You can observe a variation of this in the screenshot I pasted above: the real answer was the first output_text block "You can make it work with ..." that included snippets, but the visible answer is less useful summary, a paraphrasing, one that no longer has code blocks.

If I terminate a conversation and start a new one, then the "git status -sb" pathology seems to go away for a time. I'm using Gpt-5-codex medium.

(Actually, the transcript that I linked to here has several instances of "git status -sb" pathology in it, earlier in the transcript).

I posted another example of "git status -sb" pathology here: https://www.reddit.com/r/OpenaiCodex/comments/1nm0hgg/ran_git_status_sb/

Ixe1 · 11 months ago

I'm also noticing this, as well as some other bash commands being repeated this morning. In my case I saw "git status -sb" four times in a row and then the same MySQL SELECT query executed three in a row, followed by another git status -sb, then an answer to the question I had, followed by yet another git status -sb (at which point I pressed Esc to stop it.

etraut-openai contributor · 9 months ago

Thanks for the bug report. We've shared the feedback with the team members who are responsible for training our codex models. We're tracking this feedback and similar reports so we can make the model more robust in future iterations.

If you see other model behavior that you'd like to report, please use the recently-added /feedback command in the CLI. That will provide us with additional details including logs and conversation text.