Skip to content

fix: treat task --help and unknown flags as CLI errors (#539)#547

Open
stantheman0128 wants to merge 1 commit into
openai:mainfrom
stantheman0128:fix/539-task-help-unknown-flags
Open

fix: treat task --help and unknown flags as CLI errors (#539)#547
stantheman0128 wants to merge 1 commit into
openai:mainfrom
stantheman0128:fix/539-task-help-unknown-flags

Conversation

@stantheman0128

Copy link
Copy Markdown

Summary

AI assistance

Assisted by Cursor/Grok. I reviewed the diff, ran the tests below, and checked open PRs for overlap (#128/#535 are test-only coverage; #378 is adversarial focus parsing).

Evidence

node --test tests/args.test.mjs tests/commands.test.mjs tests/render.test.mjs
# 14 pass (includes task --help + unknown --flag with fake-codex: no threads)

node --test --test-name-pattern "task runs when the active provider" tests/runtime.test.mjs
# 1 pass

Test plan

  • task --help --cwd <tmp> --json prints Usage and exits 0
  • task --not-a-real-flag errors with Unknown option and does not create a thread
  • Normal task prompt still runs under fake-codex

Reject unrecognized --options instead of swallowing them into the prompt, and print usage for --help/-h without dispatching a Codex thread.

Co-authored-by: Cursor <cursoragent@cursor.com>
@stantheman0128
stantheman0128 requested a review from a team July 23, 2026 11:13

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

Copy link
Copy Markdown

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: 0e0cd92549

ℹ️ 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 +75 to +76
if (rejectUnknownOptions) {
throw new Error(`Unknown option: -${shortKey}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep short-flag text usable in task prompts

When task is invoked in the documented quoted raw-argument form, normalizeArgv re-splits the natural-language prompt before it reaches this parser, so any prompt that mentions a short CLI flag or negative-style token now fails here before Codex is dispatched. For example, task "investigate grep -R usage" exits with Unknown option: -R instead of sending that prompt, which is a common shape for debugging command-line behavior; the parser should either stop option parsing once prompt text starts or avoid rejecting single-dash tokens for prompt-taking commands.

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.

task --help (and any unknown --flag) is swallowed into the prompt and dispatches a real thread, hijacking --resume-last

1 participant