Skip to content

fix(config): add missing llm wrapper structs for agents and tools TOM…#47

Merged
iohub merged 2 commits into
mainfrom
feat-openai-go
May 6, 2026
Merged

fix(config): add missing llm wrapper structs for agents and tools TOM…#47
iohub merged 2 commits into
mainfrom
feat-openai-go

Conversation

@iohub
Copy link
Copy Markdown
Owner

@iohub iohub commented May 6, 2026

Summary by Sourcery

Wrap agents and tools LLM configuration sections in dedicated structs and surface the active LLM model in the TUI status bar by publishing model metadata from agents and exposing model names via the LLM engine interface.

New Features:

  • Display the currently used LLM model name in the TUI status bar while tasks are running.

Enhancements:

  • Introduce wrapper structs for agents and tools LLM configuration sections to better align with the TOML layout.
  • Extend the LLM engine interface and implementations to expose the configured model name for observability.

Tests:

  • Update agent tests with a mock engine implementation of the new Model method.

iohub and others added 2 commits May 6, 2026 20:49
…L sections

The TOML config uses [agents.llm] and [tools.llm] nested structures
(matching [global.llm]), but the Go structs mapped [agents] and [tools]
directly to AgentsLLMConfig/ToolsLLMConfig without the intermediate llm
level. This caused all per-agent and per-tool provider overrides to be
silently ignored, falling back to the global default.

Add AgentsConfig and ToolsConfig wrapper structs to match the TOML layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Model() method to Engine interface and implementations, publish
model_info events from RunAgentLoop and ConductorAgent, and display
the active model name in the TUI footer status bar (e.g. "◷ Running [deepseek-v4-pro]...").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 6, 2026

Reviewer's Guide

Adds wrapper structs for agents and tools LLM config sections to align with TOML structure, and introduces an Engine.Model API that is used to publish and display the current LLM model name in the TUI status bar while tasks run.

Sequence diagram for publishing and displaying LLM model info in the TUI

sequenceDiagram
    actor User
    participant ConductorAgent
    participant Executor as ExecutorRunAgentLoop
    participant Publisher
    participant EventLoop as EventChannel
    participant TUI as TUIModel

    User->>ConductorAgent: start task (Run)
    ConductorAgent->>ConductorAgent: LLM.Model()
    ConductorAgent->>Publisher: Publish(model_info, {model, agent}, agentName)
    Publisher-->>EventLoop: push taskEvent model_info

    User->>Executor: start tool-based task
    Executor->>Executor: cfg.LLM.Model()
    Executor->>Publisher: Publish(model_info, {model, agent}, AgentName)
    Publisher-->>EventLoop: push taskEvent model_info

    loop task event handling
        EventLoop-->>TUI: taskEventMsg(model_info)
        TUI->>TUI: extract model from Content
        TUI->>TUI: currentModel = model
        TUI->>TUI: Update view
        TUI-->>User: status bar shows Running [model]...
    end

    EventLoop-->>TUI: taskCompleteMsg
    TUI->>TUI: taskRunning = false
    TUI->>TUI: currentModel = ""
    TUI-->>User: status bar cleared of model name
Loading

Class diagram for updated configuration wrappers and LLM engine interface

classDiagram
    direction LR

    class Config {
        +TopLevelConfig Global
        +AgentsConfig Agents
        +ToolsConfig Tools
        +AppConfig App
        +AgentConfig Agent
        +ContextCompactConfig Compact
        +string resolveAgentProvider(agentName)
        +AgentLLMOverride getAgentOverride(agentName)
        +string resolveToolProvider(toolName)
        +ToolLLMOverride getToolOverride(toolName)
        +string resolveEffectiveProviderName()
    }

    class TopLevelConfig {
        +GlobalLLMConfig LLM
    }

    class AgentsConfig {
        +AgentsLLMConfig LLM
    }

    class ToolsConfig {
        +ToolsLLMConfig LLM
    }

    class AgentsLLMConfig {
        +string UseProvider
        +AgentLLMOverride Conductor
        +AgentLLMOverride Coding
        +AgentLLMOverride Repo
        +AgentLLMOverride Chat
        +AgentLLMOverride Meta
        +AgentLLMOverride DevOps
    }

    class ToolsLLMConfig {
        +string UseProvider
        +ToolLLMOverride MicroAgent
        +ToolLLMOverride Thinking
        +ToolLLMOverride ImplPlan
    }

    class Engine {
        <<interface>>
        +GenerateContent(ctx, messages, tools, opts) Response
        +Model() string
    }

    class OpenAIEngine {
        -client
        -string model
        +OpenAIEngine NewOpenAIEngine(baseURL, apiKey, model)
        +GenerateContent(ctx, messages, tools, opts) Response
        +Model() string
    }

    class LoggingEngine {
        -Engine inner
        +GenerateContent(ctx, messages, tools, opts) Response
        +Model() string
    }

    class ConductorAgent {
        +string Name()
        +Engine LLM
        +Publisher Publisher
        +Run(ctx, input, mem) string
    }

    class ExecutorConfig {
        +Engine LLM
        +Publisher Publisher
        +string AgentName
        +bool SystemAsHuman
    }

    class Publisher {
        +Publish(eventType, content, source)
    }

    Config --> TopLevelConfig : has
    Config --> AgentsConfig : has
    Config --> ToolsConfig : has
    Config --> AppConfig : has
    Config --> AgentConfig : has
    Config --> ContextCompactConfig : has

    AgentsConfig --> AgentsLLMConfig : wraps
    ToolsConfig --> ToolsLLMConfig : wraps

    OpenAIEngine ..|> Engine
    LoggingEngine ..|> Engine

    ConductorAgent --> Engine : uses as LLM
    ConductorAgent --> Publisher : publishes events

    ExecutorConfig --> Engine : uses as LLM
    ExecutorConfig --> Publisher : publishes events

    Publisher <.. ConductorAgent : calls Publish
    Publisher <.. ExecutorConfig : calls Publish
Loading

File-Level Changes

Change Details Files
Wrap agents and tools LLM configuration in dedicated structs to match TOML layout and update provider resolution logic accordingly.
  • Introduce AgentsConfig and ToolsConfig wrapper types that each contain an LLM sub-struct.
  • Change the root Config struct to use AgentsConfig and ToolsConfig instead of raw AgentsLLMConfig and ToolsLLMConfig.
  • Update agent provider resolution and override lookup helpers to dereference the nested LLM field on AgentsConfig.
  • Update tool provider resolution and override lookup helpers to dereference the nested LLM field on ToolsConfig.
  • Adjust resolveEffectiveProviderName to read provider defaults from the nested AgentsConfig.LLM and ToolsConfig.LLM structures.
internal/config/config.go
Surface the active LLM model to the TUI by publishing model_info events from agents/executor and rendering the model name in the status bar while a task is running.
  • Extend the TUI model with a currentModel field that tracks the active LLM model name.
  • Handle taskEventMsg of type model_info to extract and store the model name from event content, and reset it on task completion.
  • Update the TUI footer status line to include the model name in the running-task indicator when available.
  • Publish model_info events from ConductorAgent.Run and RunAgentLoop using the configured LLM model and agent name so the TUI can subscribe and display them.
tui.go
internal/agents/conductor.go
internal/agents/executor.go
Extend the LLM engine abstraction with a Model method and implement it across engines and tests so callers can query the configured model name.
  • Add a Model() string method to the Engine interface to expose the engine's configured model name.
  • Implement Model on OpenAIEngine to return the stored model field.
  • Have LoggingEngine.Model delegate to the wrapped inner engine implementation.
  • Update the mock LLM engine in conductor tests to implement the Model method, returning a fixed mock model name.
internal/llm/engine.go
internal/llm/engine_openai.go
internal/llm/llm.go
internal/agents/conductor_test.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@iohub iohub merged commit fe40552 into main May 6, 2026
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @iohub, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant