openai/codex-plugin-cc · error · Error

Choose either --enable-review-gate or --disable-review-gate.

Error message

Choose either --enable-review-gate or --disable-review-gate.

What it means

handleSetup parses boolean options enable-review-gate and disable-review-gate. They are mutually exclusive because they write opposite values to the same config key (stopReviewGate). Throwing both would leave config in an ambiguous state, so the guard runs before any write.

Source

Thrown at plugins/codex/scripts/codex-companion.mjs:222

    node: nodeStatus,
    npm: npmStatus,
    codex: codexStatus,
    auth: authStatus,
    sessionRuntime: getSessionRuntimeStatus(process.env, workspaceRoot),
    reviewGateEnabled: Boolean(config.stopReviewGate),
    actionsTaken,
    nextSteps
  };
}

async function handleSetup(argv) {
  const { options } = parseCommandInput(argv, {
    valueOptions: ["cwd"],
    booleanOptions: ["json", "enable-review-gate", "disable-review-gate"]
  });

  if (options["enable-review-gate"] && options["disable-review-gate"]) {
    throw new Error("Choose either --enable-review-gate or --disable-review-gate.");
  }

  const cwd = resolveCommandCwd(options);
  const workspaceRoot = resolveCommandWorkspace(options);
  const actionsTaken = [];

  if (options["enable-review-gate"]) {
    setConfig(workspaceRoot, "stopReviewGate", true);
    actionsTaken.push(`Enabled the stop-time review gate for ${workspaceRoot}.`);
  } else if (options["disable-review-gate"]) {
    setConfig(workspaceRoot, "stopReviewGate", false);
    actionsTaken.push(`Disabled the stop-time review gate for ${workspaceRoot}.`);
  }

  const finalReport = await buildSetupReport(cwd, actionsTaken);
  outputResult(options.json ? finalReport : renderSetupReport(finalReport), options.json);
}

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Pass only one of --enable-review-gate or --disable-review-gate.
  2. Run setup with neither flag to just inspect status without changing the gate.
  3. Fix the automation to pass exactly one based on the desired boolean.

Example fix

// before
codex-companion.mjs setup --enable-review-gate --disable-review-gate
// after
codex-companion.mjs setup --enable-review-gate
Defensive patterns

Strategy: validation

Validate before calling

if (enableReviewGate && disableReviewGate) {
  throw new Error('Pick one gate flag');
}

Prevention

When it happens

Trigger: Running `/codex:setup --enable-review-gate --disable-review-gate` in a single invocation, often from a shell alias or automation that concatenates both.

Common situations: A config script that toggles based on a variable but always emits both flags, or a user trying to 'reset' by passing both.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/8a75163b6133b5ff. Report an issue: GitHub.