Skip to content

fix(task): stop free-form prompt text from hijacking --model (defect 1 of #699) - #702

Open
JMak-Security wants to merge 1 commit into
openai:mainfrom
JMak-Security:fix/task-model-alias-prompt-swallow
Open

fix(task): stop free-form prompt text from hijacking --model (defect 1 of #699)#702
JMak-Security wants to merge 1 commit into
openai:mainfrom
JMak-Security:fix/task-model-alias-prompt-swallow

Conversation

@JMak-Security

Copy link
Copy Markdown

What

Background task jobs (and review) accept the request as a single argument string
that the companion shell-splits before option parsing. An undocumented short
-m alias for --model then consumed the next token of ordinary prompt text:

  • A prompt containing python -m pytest parsed to --model pytest, which the
    gateway rejects with Model "pytest" is not supported (a 404).
  • The swallowed words (-m pytest) also went missing from the prompt itself.

Only the documented long --model form is meant to select a model (the usage string
and the codex-rescue agent/skills only ever reference --model).

Fix

Remove the -m alias so free-form prompt text like python -m pytest is preserved
verbatim and no bogus model is inferred. --model <id> continues to work.

The shared parsing helpers and the command argument schemas move into
lib/args.mjs as parseTaskArgv / parseReviewArgv, giving the parser and its
tests a single source of truth (and removing the duplicated inline configs).

Scope

This addresses defect 1 of #699 (the model-alias parsing). The other defects in
that report (zombie background jobs, cancel hangs, discarded stderr) are separate
concerns and are intentionally out of scope here.

Tests

Adds tests/task-args.test.mjs: prompt text retains -m tokens, --model still
selects a model, boolean flags still parse, and the same holds for review focus
text. npm test and npm run build pass.

Addresses #699 (defect 1)

A `task`/`review` request is often passed as a single argument string that the
companion shell-splits before option parsing. An undocumented short `-m` alias for
`--model` then consumed the next token of ordinary prompt text: a prompt containing
`python -m pytest` parsed to `--model pytest`, which the gateway rejects with a 404,
and the swallowed words also went missing from the prompt.

Only the documented long `--model` form should select a model. Remove the `-m`
alias so prompt text like `python -m pytest` is preserved verbatim and no bogus
model is inferred; `--model <id>` continues to work.

The command argument schemas and shared parsing helpers (`normalizeArgv`,
`parseCommandInput`) move into `lib/args.mjs` as `parseTaskArgv`/`parseReviewArgv`
so the parser and its tests share a single source of truth. Adds regression tests.

Addresses defect 1 of openai#699.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JMak-Security
JMak-Security requested a review from a team August 30, 2026 15:08
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