Skip to content

feat(providers): Messages ingress onto Responses-only upstreams (MessagesViaResponses) #1085

Description

@weselben

Part of #723 (dialect independence across providers). Blocked by #1084.

Filed from code research done for #1084 (AI agent, verified against source). No human reporter hit this in production yet.

Problem

The /v1/messages ingress translates Anthropic Messages requests into canonical chat requests (ADR-0007). It then dispatches to the provider's chat surface (internal/server/messages_handler.go:255 -> StreamChatCompletion / ExecuteChatCompletion at lines 269 and 283).

Responses-only upstreams (today: the chatgpt provider on the Codex backend) return 501 unsupported_provider_operation on the chat surface (internal/providers/chatgpt/chatgpt.go:140). An Anthropic client (Claude Code, other Messages harnesses) cannot use these providers today.

What is missing

#1084 adds the chat-to-Responses adapter (ChatViaResponses). When it merges, the chain /v1/messages -> canonical chat -> Responses upstream becomes possible in principle. This issue tracks what remains after #1084:

  • Verification. End-to-end tests for the double translation: Messages request -> chat -> Responses upstream -> chat chunks -> Messages SSE events.
  • Thinking and reasoning replay. Anthropic thinking blocks must survive two translations. The extra_content replay state must round-trip: Messages -> chat reasoning_content/extra_content -> Responses reasoning items -> back. Loss points must be named and tested.
  • Loss points. Document what the double translation drops (for example: cache_control is already rejected at ingress; Codex drops temperature, top_p, max_output_tokens). Follow the reject-or-document doctrine of Issue: tool strict is dropped on both the Anthropic and Gemini output paths #1055. No silent loss.
  • Interleaved thinking and tool calls. Anthropic clients interleave thinking blocks and tool use. The chat hub merges adjacent assistant messages and tool calls. The order must survive the round trip.

Out of scope

  • A direct Messages-to-Responses converter. The chat hub stays canonical. No N-by-M translator matrix.
  • Changes to the native Anthropic-to-Anthropic passthrough (internal/server/messages_native.go).

Notes

Activity

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

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