Skip to content

[plan] Add error return to MCPConfigProvider.RenderMCPConfig interface #17470

@github-actions

Description

@github-actions

Objective

Update the MCPConfigProvider interface method RenderMCPConfig to return error, and update all four engine implementations and their callers accordingly, so errors from the underlying RenderJSONMCPConfig helper are not silently discarded.

Context

Identified in Sergo audit discussion #17303. Currently RenderJSONMCPConfig always returns nil, so there is no active bug — but the interface design makes correct error propagation impossible. As the helper evolves, any future errors it returns will be silently swallowed by the _ = RenderJSONMCPConfig(...) pattern in all four engine implementations.

Locations to Update

File Role
pkg/workflow/agentic_engine.go:154 Interface declaration
pkg/workflow/agentic_engine.go:296 Base implementation
pkg/workflow/claude_mcp.go:12 Claude engine implementation
pkg/workflow/gemini_mcp.go:12 Gemini engine implementation
pkg/workflow/codex_mcp.go:13 Codex engine implementation
pkg/workflow/copilot_mcp.go:12 Copilot engine implementation

Plus all callers of RenderMCPConfig via the MCPConfigProvider interface.

Approach

1. Update the interface:

// Before
RenderMCPConfig(yaml *strings.Builder, tools map[string]any, mcpTools []string, workflowData *WorkflowData)

// After
RenderMCPConfig(yaml *strings.Builder, tools map[string]any, mcpTools []string, workflowData *WorkflowData) error

2. Update each engine implementation:

// Before
func (e *ClaudeEngine) RenderMCPConfig(...) {
    _ = RenderJSONMCPConfig(yaml, tools, mcpTools, workflowData, JSONMCPConfigOptions{...})
}

// After
func (e *ClaudeEngine) RenderMCPConfig(...) error {
    return RenderJSONMCPConfig(yaml, tools, mcpTools, workflowData, JSONMCPConfigOptions{...})
}

3. Update all callers to handle the returned error with proper error wrapping (%w).

Acceptance Criteria

  • Interface MCPConfigProvider.RenderMCPConfig returns error
  • All four engine implementations (Claude, Gemini, Codex, Copilot) return the error from RenderJSONMCPConfig
  • All callers check and propagate the returned error
  • go build ./... succeeds with no compile errors
  • go test ./pkg/workflow/... passes
  • make agent-finish passes

Generated by Plan Command for issue #discussion #17303

  • expires on Feb 23, 2026, 12:17 PM UTC

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions