Skip to content

Bug: non-streaming Responses-to-Chat conversion returns HTTP 400 "completed" #711

Description

@beilo

Environment

  • Aether: v0.7.12
  • Image revision: 06f5d3c8c0fec4599767749f6b321ec640ebb3da
  • Client surface: OpenAI-compatible API
  • Provider endpoint format: openai:responses

Problem

When Aether converts a successful non-streaming Responses API result to an OpenAI Chat Completions response, it appears to treat the top-level Responses status "completed" as an error. The outer /v1/chat/completions request then returns HTTP 400:

{
  "error": {
    "message": "completed",
    "type": "invalid_request_error",
    "code": "completed"
  }
}

The same model/provider succeeds through /v1/responses, and Chat Completions succeeds when streaming is enabled.

Minimal reproduction

# Fails
curl "$AETHER/v1/chat/completions" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL",
    "messages": [{"role": "user", "content": "Reply OK"}],
    "stream": false,
    "max_tokens": 32
  }'

# Succeeds
curl "$AETHER/v1/chat/completions" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL",
    "messages": [{"role": "user", "content": "Reply OK"}],
    "stream": true,
    "max_tokens": 32
  }'

# Also succeeds
curl "$AETHER/v1/responses" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL",
    "input": "Reply OK",
    "max_output_tokens": 32
  }'

Observed matrix:

Request Result
/v1/chat/completions, stream:false HTTP 400, completed error
/v1/chat/completions, stream:true HTTP 200, normal SSE ending with finish_reason:"stop"
/v1/responses, non-streaming HTTP 200, normal response with status:"completed"

Aether access logs for one request show the inner Responses request completing with 200, followed by the outer Chat Completions request returning 400 under the same trace ID:

POST /v1/responses         execution_runtime_sync status_code=200
POST /v1/chat/completions  execution_runtime_sync status_code=400

This reproduces with both text-only and image input, so it does not appear specific to multimodal request handling.

Expected behavior

A Responses payload with HTTP 200 and top-level status: "completed", no non-null error, and no type: "error" should be converted to a successful Chat Completion response.

Suspected cause

The sync/finalize response conversion appears to use the successful top-level status value as error text/code. completed should be recognized as a successful terminal status, not classified as invalid_request_error.

Likely relevant paths:

  • apps/aether-gateway/src/execution_runtime/submission.rs
  • Responses-to-Chat non-streaming compilation/finalize code in crates/aether-ai/formats

A regression test covering HTTP 200 + status:"completed" for openai:responses -> openai:chat with stream:false would catch this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions