Skip to content

Conversation

@aibrahim-oai
Copy link
Collaborator

External (non-OpenAI) Pull Request Requirements

Before opening this Pull Request, please read the dedicated "Contributing" markdown file or your PR may be closed:
https://github.com/openai/codex/blob/main/docs/contributing.md

If your PR conforms to our contribution guidelines, replace this text with a detailed and high quality description of your changes.

Include a link to a bug report or enhancement request.

@edward-bayes edward-bayes changed the title improve parsed commands [CODEX-4427] improve parsed commands Jan 9, 2026
@aibrahim-oai
Copy link
Collaborator Author

@codex fix lint annd tests

@chatgpt-codex-connector
Copy link
Contributor

Summary

Testing

  • just fmt
  • just fix -p codex-core
  • ⚠️ cargo test -p codex-core (fails in this environment: loopback 403 responses, /bin/sh incompatibility, and exec timeout test still failing)
  • cargo test -p codex-core exec::tests::kill_child_process_group_kills_grandchildren_on_timeout -- --nocapture
  • ⚠️ Not run (requires approval): cargo test --all-features

View task →

@aibrahim-oai
Copy link
Collaborator Author

@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: b5e59ff1a1

ℹ️ 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 +1625 to +1629
let args_no_connector = trim_at_connector(args);
let non_flags: Vec<&String> = args_no_connector
.iter()
.filter(|p| !p.starts_with('-'))
.collect();
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 Skip grep option values before extracting query

The new parse_grep_like only drops args starting with -, so option values that are positional (e.g. -m 1, -C 3) are treated as the search pattern. Per git grep -h, flags like -m, --max-count <n> and -C <n> take a value, so a command such as git grep -m 1 TODO src will be summarized as searching for 1 with path TODO instead of pattern TODO and path src. Now that git/egrep/fgrep parsing routes here, this mislabels common usages and should skip flag values similarly to skip_flag_values (and respect --).

Useful? React with 👍 / 👎.

Comment on lines +2240 to 2243
if let Some(path) = single_non_flag_operand(tail, &[]) {
let name = short_display_path(&path);
ParsedCommand::Read {
cmd: shlex_join(main_cmd),
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 Preserve operands after -- for cat reads

single_non_flag_operand filters out any operand that starts with -, which means cat -- -weird (a standard way to read a file whose name begins with -) is now parsed as Unknown. The previous logic handled cat -- <file> without rejecting dash-prefixed filenames, so this change regresses support for that valid CLI form. This also affects other readers using the same helper (e.g., bat/less/more).

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants