Skip to content

Tests for Responses path & reasoning fidelity #13

@HXYerror

Description

@HXYerror

Part of #1. Final gate before merging the Responses-API epic.

Goal

Add a test suite covering the new Responses-API surface and the Anthropic↔Responses round-trip. Mirrors the existing tests under `tests/`:

  • `tests/anthropic-request.test.ts`
  • `tests/anthropic-response.test.ts`
  • `tests/create-chat-completions.test.ts`

Tasks

  • `tests/responses-request.test.ts`:
    • Validates request shape (`input`, `tools`, `reasoning`, `previous_response_id`)
    • Validates header construction (X-Initiator, Copilot-Vision-Request, copilot-integration-id)
    • Validates that `reasoning_effort` budget tiers map correctly when coming from Anthropic `thinking.budget_tokens`
  • `tests/responses-response.test.ts`:
    • Output items array round-trip (reasoning + message + function_call interleaved)
    • `encrypted_content` is preserved (not stripped, not regenerated)
    • `status: null` is stripped
    • Streaming events: `response.output_text.delta`, `response.reasoning.delta`, `response.completed`
  • `tests/anthropic-to-responses.test.ts`:
    • Anthropic `thinking` block on input → Responses `reasoning` item with preserved `encrypted_content` in `signature`
    • Responses `reasoning` item on output → Anthropic `thinking` block emission
    • Multi-turn round-trip preserves blob across turns
    • Tool-call interleaving correct (reasoning → tool_use → reasoning → text)
  • `tests/model-routing.test.ts`:
    • `gpt-5.3-codex` on `/chat/completions` → 400 with helpful error
    • `gpt-4o` on `/responses` → translated to chat-completions or 400
    • `/v1/models` exposes `mode` field
  • Streaming integration test: full SSE → Anthropic SSE round-trip with reasoning model

Acceptance criteria

  • `bun test` passes with the new suite
  • Coverage focused on the encrypted_content blob lifecycle (most fragile part)
  • Regressions in existing chat-completions and `/v1/messages` tests caught

File pointers

  • Existing tests under `tests/` (mirror their style)
  • Bun test runner per `AGENTS.md`: `bun test tests/`

Metadata

Metadata

Assignees

No one assigned

    Labels

    anthropicAnthropic Messages API compatibilityreasoningReasoning / thinking / encrypted_contentresponses-apiOpenAI /v1/responses API supporttestTests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions