Summary
codex workflow fix code-review currently mutates the code-review workflow by adding a hard-coded usage.options block for the old public API. That block includes removed actions and flags such as read-report, incremental, resume, --action, --target-ref, --base-ref, --review-id, --review-model, and --repro-model.
This conflicts with the current TS-first workflow contract for code-review, where src/workflow.ts owns the API and autocomplete contract. The current public API is only plan and review, with the supported input fields action, commit, target, workingDirectory, model, output, and detailed.
Reproduction
From a clean ~/.codex/workflows/code-review workflow checkout with no usage: block in workflow.yaml:
codex workflow fix code-review
Observe that workflow.yaml is modified to append a legacy block like:
usage:
options:
- flag: --action
valueHint: <review|read-report|list-reports|incremental|resume>
description: Run mode: review, read-report, list-reports, incremental, or resume.
- flag: --review-id
valueHint: <string>
description: Existing review ID for read-report, incremental, or resume.
# ...more removed flags...
Actual Behavior
The fixer adds stale autocomplete metadata for the old code-review API.
This directly contradicts the workflow's current docs and tests:
README.md says old actions read-report, list-reports, incremental, resume, and retry-repro are no longer public.
README.md says removed flags such as --action, --review-id, --target-ref, --base-ref, etc. are rejected.
src/workflow.ts parses the action as the first positional argument and rejects unsupported flags.
src/tests/code-review-redesign.test.ts asserts review --action review fails with Unsupported CLI flag '--action'.
Expected Behavior
codex workflow fix code-review should not add workflow.yaml usage.options for this TS-first workflow.
Autocomplete and public API metadata should come from src/workflow.ts / generated contract / complete(...), not from stale YAML metadata. If the fixer still needs to repair static metadata, it should only repair neutral metadata such as id, command, title, or userDescription, and should not reintroduce removed API flags.
Likely Source
The stale block appears to be hard-coded in the CLI compatibility repair path:
codex-rs/cli/src/workflow_cmd/compat.rs
apply_compatibility_repairs(...)
is_code_review_repair_target(...)
repair_code_review_workflow_metadata(...)
CODE_REVIEW_USAGE_OPTIONS_YAML
There are also CLI tests that currently encode the old expectation and should be updated, for example:
codex-rs/cli/tests/workflows__cli.rs::assert_code_review_autocomplete_metadata
Suggested Fix
- Remove the special-case injection of
CODE_REVIEW_USAGE_OPTIONS_YAML for code-review.
- Update CLI repair tests so they no longer expect
usage.options, --action, --review-id, or other removed code-review flags.
- Add or update a regression test proving
codex workflow fix code-review does not mutate an already-valid TS-first code-review workflow by appending legacy usage.options.
- Keep
codex workflow validate code-review green after the repair behavior changes.
Validation Used Locally
After manually removing the stale block from the workflow checkout, the workflow validation loop passes:
codex workflow validate code-review
bun run typecheck
bun run build
bun test --preload ./src/tests/setup-env.ts src/tests/*.test.ts
Observed result: code-review is valid, typecheck/build pass, and 4 workflow tests pass.
Summary
codex workflow fix code-reviewcurrently mutates thecode-reviewworkflow by adding a hard-codedusage.optionsblock for the old public API. That block includes removed actions and flags such asread-report,incremental,resume,--action,--target-ref,--base-ref,--review-id,--review-model, and--repro-model.This conflicts with the current TS-first workflow contract for
code-review, wheresrc/workflow.tsowns the API and autocomplete contract. The current public API is onlyplanandreview, with the supported input fieldsaction,commit,target,workingDirectory,model,output, anddetailed.Reproduction
From a clean
~/.codex/workflows/code-reviewworkflow checkout with nousage:block inworkflow.yaml:Observe that
workflow.yamlis modified to append a legacy block like:Actual Behavior
The fixer adds stale autocomplete metadata for the old
code-reviewAPI.This directly contradicts the workflow's current docs and tests:
README.mdsays old actionsread-report,list-reports,incremental,resume, andretry-reproare no longer public.README.mdsays removed flags such as--action,--review-id,--target-ref,--base-ref, etc. are rejected.src/workflow.tsparses the action as the first positional argument and rejects unsupported flags.src/tests/code-review-redesign.test.tsassertsreview --action reviewfails withUnsupported CLI flag '--action'.Expected Behavior
codex workflow fix code-reviewshould not addworkflow.yamlusage.optionsfor this TS-first workflow.Autocomplete and public API metadata should come from
src/workflow.ts/ generated contract /complete(...), not from stale YAML metadata. If the fixer still needs to repair static metadata, it should only repair neutral metadata such asid,command,title, oruserDescription, and should not reintroduce removed API flags.Likely Source
The stale block appears to be hard-coded in the CLI compatibility repair path:
codex-rs/cli/src/workflow_cmd/compat.rsapply_compatibility_repairs(...)is_code_review_repair_target(...)repair_code_review_workflow_metadata(...)CODE_REVIEW_USAGE_OPTIONS_YAMLThere are also CLI tests that currently encode the old expectation and should be updated, for example:
codex-rs/cli/tests/workflows__cli.rs::assert_code_review_autocomplete_metadataSuggested Fix
CODE_REVIEW_USAGE_OPTIONS_YAMLforcode-review.usage.options,--action,--review-id, or other removedcode-reviewflags.codex workflow fix code-reviewdoes not mutate an already-valid TS-firstcode-reviewworkflow by appending legacyusage.options.codex workflow validate code-reviewgreen after the repair behavior changes.Validation Used Locally
After manually removing the stale block from the workflow checkout, the workflow validation loop passes:
Observed result:
code-review is valid, typecheck/build pass, and 4 workflow tests pass.