fix: flex-mode via config/flag (#813)

* Add flexMode to stored config, and use it during config loading unless
the flag is explicitly passed.
* If the config asks for flexMode and the model doesn't support it,
silently disable flexMode.

Resolves #803
This commit is contained in:
Corry Haines
2025-05-10 16:18:20 -07:00
committed by GitHub
parent 646e7e9c11
commit b42ad670f1
2 changed files with 18 additions and 8 deletions

View File

@@ -309,7 +309,7 @@ config = {
notify: Boolean(cli.flags.notify),
reasoningEffort:
(cli.flags.reasoning as ReasoningEffort | undefined) ?? "high",
flexMode: Boolean(cli.flags.flexMode),
flexMode: cli.flags.flexMode || (config.flexMode ?? false),
provider,
disableResponseStorage,
};
@@ -323,15 +323,19 @@ try {
}
// For --flex-mode, validate and exit if incorrect.
if (cli.flags.flexMode) {
if (config.flexMode) {
const allowedFlexModels = new Set(["o3", "o4-mini"]);
if (!allowedFlexModels.has(config.model)) {
// eslint-disable-next-line no-console
console.error(
`The --flex-mode option is only supported when using the 'o3' or 'o4-mini' models. ` +
`Current model: '${config.model}'.`,
);
process.exit(1);
if (cli.flags.flexMode) {
// eslint-disable-next-line no-console
console.error(
`The --flex-mode option is only supported when using the 'o3' or 'o4-mini' models. ` +
`Current model: '${config.model}'.`,
);
process.exit(1);
} else {
config.flexMode = false;
}
}
}