Skip to content

Conversation

@Galaxy-0
Copy link
Contributor

Fixes #8404

Description

This PR addresses Issue #8404 where code reviews incorrectly included unstaged working directory changes.

Changes

  • Added staged_only option to CreateGhostCommitOptions in ghost_commits.rs.
  • Updated create_ghost_commit_with_report to support staged_only:
    • When true, it copies the current git index directly to the temporary index.
    • When false (default), it preserves existing behavior (staging all worktree changes).
  • Fixed a flaky test in codex-core/src/seatbelt.rs related to bash output assertions.

Verification

  • Verified via local tests in codex-git.

Galaxy-0 and others added 2 commits December 22, 2025 14:07
This change introduces a 'staged_only' flag to CreateGhostCommitOptions. When enabled, it creates a ghost commit reflecting only the files currently staged in the git index, rather than all worktree changes. This addresses Issue openai#8404 where reviews were incorrectly including unstaged changes. Also includes a fix for a flaky seatbelt test in codex-core.
@etraut-openai
Copy link
Collaborator

@Galaxy-0, thanks for the contribution. Please remove the flaky test fix. We prefer not to combine unrelated changes into a single commit. If you'd like to submit a separate PR for the flaky test fix, that's OK.

@etraut-openai etraut-openai added the needs-response Additional information is requested label Jan 7, 2026
@etraut-openai
Copy link
Collaborator

Also, I don't see any tests for the new functionality.

@etraut-openai
Copy link
Collaborator

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61d178a065

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 393 to 395
if !force_include.is_empty() {
let mut args = Vec::with_capacity(force_include.len() + 2);
args.push(OsString::from("add"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid re-staging force-includes in staged-only snapshots

When staged_only is enabled, the temp index is copied from the real index above, but this block always runs git add --force on force_include paths, which re-reads those files from the working tree. If any forced path has unstaged edits (e.g. an ignored config file changed after staging), those unstaged contents will be pulled into the ghost commit, defeating the “staged-only” guarantee that motivated this change. Consider skipping this block in staged-only mode or only adding force-included paths that are already staged in the real index.

Useful? React with 👍 / 👎.

@etraut-openai
Copy link
Collaborator

Also, please take a look at the codex code review comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-response Additional information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review against base branch includes working-tree changes and repeats non-diff hallucinated findings

2 participants