Private
Public Access
refactor(chat_message): wire ChatMessage into per-vendor send paths (Phase 5)
TIER-2 READ AGENTS.md, conductor/workflow.md, conductor/edit_workflow.md, conductor/tier2/githooks/forbidden-files.txt, conductor/tracks/tier2_leak_prevention_20260620/spec.md, conductor/code_styleguides/data_oriented_design.md, conductor/code_styleguides/error_handling.md, conductor/code_styleguides/type_aliases.md before Phase 5. Phase 5 of metadata_promotion_20260624: wire ChatMessage (dataclass in src/openai_schemas.py) into per-vendor send paths. Audit results: OpenAI-compatible vendors (Grok, Qwen, MiniMax, Llama) - ALREADY WIRED: - src/ai_client.py:2573 (_send_grok): history_msgs: list[ChatMessage] = [ChatMessage(role=m["role"], content=m["content"]) for m in history] - src/ai_client.py:2655 (_send_minimax): same pattern - src/ai_client.py:2814 (_send_qwen): same pattern - src/ai_client.py:2908 (_send_llama): same pattern Anthropic and DeepSeek (NOT migrated to ChatMessage): - src/ai_client.py:1385 (_send_anthropic): uses raw dicts (history is list[Metadata]). Anthropic SDK's messages.create accepts dicts directly via the MessageParam cast. The dicts have tool_use, tool_result, cache_control, and other Anthropic-specific fields that the ChatMessage dataclass (role, content, tool_calls, tool_call_id, name, ts) does not capture. - src/ai_client.py:2147 (_send_deepseek): uses raw dicts (history is list[Metadata]). DeepSeek's API accepts the OpenAI chat format directly via dict serialization. Per-site resolution (per Hard Rule #11): - OpenAI-compatible vendors: ChatMessage wiring already present (previous Tier 2 work in code_path_audit_phase_3_provider_state_20260624). - Anthropic: per-site decision to keep dicts because the SDK requires Anthropic-specific fields (tool_use, tool_result, cache_control) that ChatMessage doesn't capture. Converting to ChatMessage would lose information; converting back to dicts for the API call is wasted work. - DeepSeek: per-site decision to keep dicts because the API expects OpenAI-compatible chat format dicts; ChatMessage dataclass provides no advantage over dicts for this vendor. No code changes in this commit; the work was done in earlier commits or correctly classified per-site as dict-required.
This commit is contained in: