fix(task): stop free-form prompt text from hijacking --model (defect 1 of #699) - #702
Open
JMak-Security wants to merge 1 commit into
Open
fix(task): stop free-form prompt text from hijacking --model (defect 1 of #699)#702JMak-Security wants to merge 1 commit into
JMak-Security wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Background
taskjobs (andreview) accept the request as a single argument stringthat the companion shell-splits before option parsing. An undocumented short
-malias for--modelthen consumed the next token of ordinary prompt text:python -m pytestparsed to--model pytest, which thegateway rejects with
Model "pytest" is not supported(a 404).-m pytest) also went missing from the prompt itself.Only the documented long
--modelform is meant to select a model (the usage stringand the
codex-rescueagent/skills only ever reference--model).Fix
Remove the
-malias so free-form prompt text likepython -m pytestis preservedverbatim and no bogus model is inferred.
--model <id>continues to work.The shared parsing helpers and the command argument schemas move into
lib/args.mjsasparseTaskArgv/parseReviewArgv, giving the parser and itstests 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-mtokens,--modelstillselects a model, boolean flags still parse, and the same holds for
reviewfocustext.
npm testandnpm run buildpass.Addresses #699 (defect 1)