Skip to content

fix: refuse repeated single-value flags and correct CLI help - #107

Merged
youdie006 merged 4 commits into
mainfrom
fix/cli-flag-parsing
Nov 17, 2026
Merged

youdie006 merged 4 commits into
mainfrom
fix/cli-flag-parsing

Conversation

@youdie006

Copy link
Copy Markdown
Owner

What changed

CLI parsing and help defects from the 2026-11-09 bug hunt (against 0.40.50), each reproduced again with the built CLI on main 3b0bd6b:

  1. A single-value flag given twice kept the first value. tasks create --title First --title Second saved "First"; --timeout-ms 300000 ... --timeout-ms 900000 sent with 300000, so an agent appending an override after its defaults got the default. assertGivenOnce in src/cli-args.ts is called by assertOnlyOptions, readPositionalsWithOptions and parseAskProArgs, so every command refuses it: "--title was given twice; give it once, with the value you mean." REPEATABLE_VALUE_FLAGS (--file, --attach, --tool, --command, --artifact) matches every readRepeatedFlag use. Words after -- are not counted; boolean flags may still repeat. The MCP pro_consult argv builder and the picker's command builders pass each single-value flag at most once (checked).
  2. A value starting with -- was reported as missing, and --prompt=x got "Did you mean --prompt?". Now: "--prompt cannot take "..." as its value: an argument that starts with "--" is read as an option. Reword the value ..." and "Options do not take "=value"; give the value as the next argument: --prompt "x"". --title --prompt p still says "--title requires a value". No --flag=value syntax was added.
  3. Help gaps: ui --help / ui -h / ui help print a new ui help; version --help prints help and version --bogus is refused; help checks now accept the command's own boolean flags (tasks/receipts/sessions list --json --help, pro blockers/list/latest/show --json, pro report-issue --confirm).
  4. The dash-led argument hint always named prodex ask. It now appears only for ask, pro ask and pro browser ask and names the command that was run; tasks list - gets a plain "Unknown option".
  5. Stale help text: setup, browser and pro help said the model rows cannot be clicked (or that GPT-5.6 Sol is rejected); they are walked by keyboard since 0.40.34, with a click as the fallback. pro help said creating a project from the CLI was planned; --project-new "name" works and is now listed. README and docs/cli-reference.md carried the same stale sentence and are corrected too.
  6. max vs Max: the mapping is unchanged; the invalid-effort error, the --effort help lines, README and the CLI reference now say that max in any case but Max means 매우 높음, while Max is Work's Max rung.

Verification

  • Test-first: new tests/cli-flag-parsing.test.ts (17 tests); 14 failed on their assertions before any code change, 3 are regression guards. Two mutations were caught (dropping --command from the repeatable list; showing the ask hint for other commands). tests/dash-prompt-hint.test.ts was updated for the new parameter.
  • npx tsc --noEmit clean; full suite 1951 passed, 3 skipped; npm run release:verify ok (subagent run; no pinned help line changed). CLI test files re-run by the main thread after the README/docs edit: 257 passed.
  • Not run: the interactive picker (prodex ui help was checked as printed output only). No browser, no ChatGPT.

Four ledger listing defects found by the 2026-11-09 bug hunt:

- One untrusted older result failed `results show latest`, `results
  artifact latest` and MCP `bridge_list_results` for every trusted
  result beside it. The store now splits results into trusted and
  untrusted; `latest` resolves to the newest trusted one (as `pro
  latest` does) and `bridge_list_results` lists the trusted ones with
  `untrusted_skipped` and each untrusted record's reason. Fetching an
  untrusted result by id still refuses.
- `pro blockers --cwd` turned one corrupt result record into "No
  consults recorded in this repo." with rc=0. With --cwd the record's
  error now fails the command; across all roots the bad root is named
  on stderr and the others are still reported.
- `sessions cancel <id>` stamped last_used_at, so the cancelled session
  became "latest" and `sessions cancel latest` refused while a newer
  session was still running. Cancelling now keeps last_used_at.
- `--since 2026-02-30` was read as 2026-03-02; impossible dates are
  refused.

Verified: each new test failed on its assertion before its fix; tsc
clean; full suite 1944 passed, 3 skipped (subagent run), and the five
changed test files re-run here (397 passed).

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
CLI parsing and help defects found by the 2026-11-09 bug hunt:

- A single-value flag given twice silently kept the first value
  (`--title First --title Second` saved "First"; `--timeout-ms` given
  twice sent with the first). The shared parsers now refuse it with
  "--title was given twice; give it once, with the value you mean.";
  --file, --attach, --tool, --command and --artifact still repeat.
- A value starting with "--" was reported as missing, and
  `--prompt=x` got "Did you mean `--prompt`?". Both now say what is
  wrong and how to pass the value.
- `ui --help`, `ui help`, `version --help` and help requests that
  carry a command's own flags (`tasks list --json --help`) now print
  help; `version --bogus` is refused instead of ignored.
- The "put -- before it: prodex ask" hint now appears only for the ask
  commands and names the one that was run.
- Help, README and docs said the model rows cannot be clicked; they
  are walked by keyboard since 0.40.34. `pro help` said creating a
  project from the CLI was planned; `--project-new` works.
- The effort alias lists now say that `max` (any case but `Max`) means
  매우 높음 while `Max` is the Work rung.

Verified: 17 new tests (14 failed first, 3 are guards); two mutations
caught; tsc clean; full suite 1951 passed, 3 skipped and
`npm run release:verify` ok (subagent run); CLI test files re-run here
(257 passed). The MCP consult and picker argument builders pass each
single-value flag at most once.

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T00:13:18.973225Z e3b9950 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

What this touches

  • browser adapter
  • bridge store
  • CLI
  • MCP
  • tests

19 file(s), 767 line(s) changed. Tests changed.

Worth a look

  • Careful read: touches the receipt/integrity path.

This is an automated first pass, not a review. CI is the gate; a person decides.

…trusted

# Conflicts:
#	CHANGELOG.md
#	src/store.ts
…to fix/cli-flag-parsing

# Conflicts:
#	CHANGELOG.md
@youdie006
youdie006 merged commit 09b314c into main Nov 17, 2026
7 checks passed
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.

1 participant