Skip to content

bug: codexCli.commandSpecific is leaked into createCodexCli() and rejected as an unknown default setting #1679

Description

@citruso

Description

task-master-ai@0.43.1 accepts codexCli.commandSpecific as valid Task Master configuration, but later forwards it into createCodexCli({ defaultSettings }).

This causes valid Task Master config to fail with:

Invalid default settings: Unrecognized key: "commandSpecific"

commandSpecific is a Task Master configuration feature and should be resolved internally before provider initialization. It should not be passed through to Codex CLI as a raw provider setting.

Steps to Reproduce

Use a config like this:

{
  "codexCli": {
    "sandboxMode": "workspace-write",
    "approvalMode": "on-failure",
    "commandSpecific": {
      "parse-prd": {
        "approvalMode": "never"
      }
    }
  }
}

Then run:

task-master parse-prd --input=example_prd.txt

Expected Behavior

  • commandSpecific should be accepted as Task Master config
  • per-command settings should be resolved internally
  • only Codex CLI supported keys should be passed into createCodexCli({ defaultSettings })

Actual Behavior

Task Master fails before real execution with:

Warning: Invalid Codex CLI settings in config: [
  {
    "code": "custom",
    "path": [
      "commandSpecific"
    ],
    "message": "Invalid command name in commandSpecific"
  }
]. Falling back to default.

Technical Details

The problematic code is in the source provider file:

In that method, the resolved per-command settings object is spread directly into defaultSettings before calling createCodexCli(...).

Current source logic:

// Merge global + command-specific settings from config
const settings = getCodexCliSettingsForCommand(params.commandName) || {};

// Get validated reasoningEffort - always pass to override Codex CLI global config
const validatedReasoningEffort = this._getValidatedReasoningEffort(
  params.modelId,
  settings.reasoningEffort
);

// Inject API key only if explicitly provided; OAuth is the primary path
const defaultSettings = {
  ...settings,
  reasoningEffort: validatedReasoningEffort,
  ...(params.apiKey
    ? { env: { ...(settings.env || {}), OPENAI_API_KEY: params.apiKey } }
    : {})
};

return createCodexCli({ defaultSettings });

The issue is that settings may still include commandSpecific, so it gets copied into defaultSettings and then forwarded into createCodexCli(...), where Codex CLI rejects it as an unknown key.

References (Relevant Code Snippets Included)

Source file:

  • src/ai-providers/codex-cli.js

Relevant source logic:

// Merge global + command-specific settings from config
const settings = getCodexCliSettingsForCommand(params.commandName) || {};

// Get validated reasoningEffort - always pass to override Codex CLI global config
const validatedReasoningEffort = this._getValidatedReasoningEffort(
  params.modelId,
  settings.reasoningEffort
);

// Inject API key only if explicitly provided; OAuth is the primary path
const defaultSettings = {
  ...settings,
  reasoningEffort: validatedReasoningEffort,
  ...(params.apiKey
    ? { env: { ...(settings.env || {}), OPENAI_API_KEY: params.apiKey } }
    : {})
};

return createCodexCli({ defaultSettings });

Proposed fix shape:

const settings = getCodexCliSettingsForCommand(params.commandName) || {};

// Strip `commandSpecific` from the resolved settings object before constructing `defaultSettings`
const { commandSpecific, ...safeSettings } = settings;

const validatedReasoningEffort = this._getValidatedReasoningEffort(
  params.modelId,
  settings.reasoningEffort
);

const defaultSettings = {
  ...safeSettings,
  reasoningEffort: validatedReasoningEffort,
  ...(params.apiKey
    ? { env: { ...(safeSettings.env || {}), OPENAI_API_KEY: params.apiKey } }
    : {})
};

return createCodexCli({
  defaultSettings
});

Environment

  • task-master-ai@0.43.1
  • Provider: codex-cli
  • OS: Windows 11
  • Shell: PowerShell

Additional Context

Please add a test covering:

  • config with codexCli.commandSpecific
  • successful provider initialization
  • assertion that commandSpecific is not forwarded into Codex CLI default settings

I verified locally that removing commandSpecific before createCodexCli(...) fixes this failure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ai-modelsAI model integration and configurationarea:cliCLI functionalitybugSomething isn't workingmedium-priorityImportant but not urgentprovider:claude-codeClaude Code integrated models

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions