Skip to content

[Quality] Fix AI refinement — error handling, stub interfaces, provider deduplication #51

@ibourgeois

Description

@ibourgeois

Problems

  1. No error handling: IdeaRefinementService::refine() makes an AI call with no try/catch. If Ollama is unavailable, an unhandled exception reaches the user as a 500.
  2. Stub interfaces: IdeaRefinementAgent implements HasTools (returns []) and Conversational (returns []). Both add no value for a single-turn refinement — they should be removed.
  3. Duplicate configuration: IdeaRefinementAgent has #[Provider('ollama')] and #[Model('llama3.1')] class attributes, but IdeaRefinementService overrides both at runtime. One source of truth should be chosen.

Required Changes

  • IdeaRefinementService::refine(): wrap the AI call in try/catch; on failure, throw a user-friendly exception or return a safe fallback
  • IdeaRefinementAgent: remove HasTools interface and its tools() method; remove Conversational interface and its messages() method
  • IdeaRefinementAgent: remove #[Provider] and #[Model] class attributes — provider/model is already set in the service

Files

  • app/Services/Ideas/IdeaRefinementService.php
  • app/Ai/Agents/Ideas/IdeaRefinementAgent.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions