ductor icon indicating copy to clipboard operation
ductor copied to clipboard

bug: Background tasks don't inherit agent's cli_parameters (MCP config lost)

Open alexeymorozua opened this issue 8 months ago • 1 comments

Description

Background tasks (created via create_task.py, cron jobs, webhooks) do not inherit the agent's cli_parameters from config. This means MCP integrations (Jira, Figma, Postman) configured via --mcp-config in agents.json are unavailable in background tasks.

Root Cause

In cli/param_resolver.py, line 126, resolve_cli_config() only uses task-level overrides and ignores the base config's CLI parameters:

# Line 125-126 in param_resolver.py
# 5. Merge CLI parameters (currently no provider-specific params in flat config)
cli_parameters = [*overrides.cli_parameters]

Compare with how provider and model are resolved (lines 89, 92):

provider = overrides.provider or base_config.provider  # falls back to base
model = overrides.model or base_config.model            # falls back to base

CLI parameters should follow the same pattern — merge base config params with task overrides.

Expected Behavior

# Should be:
base_params = base_config.cli_parameters  # e.g. CLIParametersConfig with --mcp-config
provider_params = base_params.claude  # or codex/gemini based on resolved provider
cli_parameters = provider_params + [*overrides.cli_parameters]

This way background tasks inherit --mcp-config (and any other CLI params) from the agent config, while still allowing task-specific overrides.

Impact

  • MCP integrations (Jira, Figma, Postman) don't work in background tasks
  • Affects: cron jobs, webhook handlers, review tasks via trigger_review.sh
  • Workaround: pass all context explicitly in task prompt (agent can't access MCP tools)

Environment

  • Ductor v0.15.0
  • Affects all agents with MCP configured via cli_parameters in agents.json

alexeymorozua avatar Mar 23 '26 12:03 alexeymorozua

Fixed in v0.16.0 (commit bdbbf48).

resolve_cli_config was doing [*overrides.cli_parameters] at param_resolver.py:126, which dropped the base agent config entirely. Fixed by reading the per-provider bucket (getattr(base_config.cli_parameters, provider)) and concatenating with task overrides — mirrors the foreground orchestrator's cli_parameters.claude/codex/gemini pattern. MCP config keys now flow through cron, webhook, and named-session background spawns.

PleasePrompto avatar Apr 21 '26 10:04 PleasePrompto