Skip to content

[BUG] Azure OpenAI backend: wrong base class, missing MCP/timing/compression support #983

@ncrispino

Description

@ncrispino

Problem

azure_openai.py extends LLMBackend directly instead of ChatCompletionsBackend. This means it lacks MCP support, custom tool support, StreamingBufferMixin (compression), and duplicates significant code from ChatCompletionsBackend.

Audit against massgen/skills/backend-integrator/SKILL.md found these issues:

Critical

  1. Wrong base classclass AzureOpenAIBackend(LLMBackend) should be ChatCompletionsBackend (or at minimum CustomToolAndMCPBackend). Azure OpenAI is OpenAI-compatible, so SKILL.md recommends ChatCompletionsBackend.
    • Claims FilesystemSupport.MCP but has no MCP implementation
    • No custom tool support
    • Duplicates param filtering, chunk conversion, and tool accumulation logic inline
  2. Missing timing methodsstart_api_call_timing(), record_first_token(), end_api_call_timing() are never called in stream_with_tools(). Breaks observability/metrics.
  3. No StreamingBufferMixin — No compression support. _clear_streaming_buffer() and _finalize_streaming_buffer() never called.

Medium

  1. Dead workflow tool code — Lines 353-777 contain elaborate workflow tool extraction logic (_build_workflow_tools_system_prompt(), _prepare_messages_with_workflow_tools(), _extract_workflow_tool_calls() with 5 strategies) that is never called from stream_with_tools().

Recommended Fix

Option A (preferred): Refactor to inherit from ChatCompletionsBackend. Remove duplicated code. This gives MCP, custom tools, compression, timing, and workflow tools for free. Azure-specific differences (endpoint config, API version, client creation) can be handled via overrides.

Option B: Keep LLMBackend inheritance but add missing timing calls, remove false FilesystemSupport.MCP claim (return NONE), and either wire up or remove dead workflow tool code.

Files

  • massgen/backend/azure_openai.py (~831 lines)
  • Tests: massgen/tests/test_azure_openai_backend.py
  • Configs: massgen/configs/providers/azure/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions