Skip to content

feat(api): add bounded Responses compatibility (#153) - #167

Draft
tcballard wants to merge 1 commit into
codex/enterprise-canary-tripwiresfrom
codex/enterprise-responses-api
Draft

feat(api): add bounded Responses compatibility (#153)#167
tcballard wants to merge 1 commit into
codex/enterprise-canary-tripwiresfrom
codex/enterprise-responses-api

Conversation

@tcballard

Copy link
Copy Markdown
Contributor

Summary

Adds the bounded authenticated Responses API compatibility surface for #153.

Scope

Included

  • /v1/responses and /responses on local and authenticated managed data-plane routers
  • strict text and bounded multi-turn input normalization over the existing Chat Completions path
  • explicit support for model, input, instructions, stream, max_output_tokens, and temperature
  • normalized buffered response shape and input/output/total usage fields
  • bounded Responses SSE events with one terminal response.completed or response.failed event
  • explicit unsupported-field and unsupported-content errors rather than silent field loss
  • input history, output, response-body, and upstream event bounds
  • decision-only/dry-run preservation, route/auth/privacy/budget/accounting reuse, tests, ADR, and docs

Excluded

  • changes to the deterministic scorer or provider credentials
  • tools, background jobs, stored conversations, previous-response references, or multimodal parts
  • a second provider execution path or a Chat Completions contract change
  • ChatGPT consumer-account access through OpenAI Platform credentials

Product / Architecture Decisions

  • Responses is an adapter boundary over the authoritative authenticated Chat Completions execution path, so routing, eligibility, privacy, budgets, failover, and accounting remain one implementation.
  • The accepted field set is intentionally narrow and deny-unknown; unsupported features fail closed with wayfinder_router_unsupported_request.
  • Text and message history are bounded before delivery; provider response bytes and streaming event/output growth are bounded during relay.
  • Streaming emits response.created, ordered text deltas, and exactly one terminal event. Duplicate [DONE] markers and late upstream events cannot create a second terminal or second accounting operation.
  • Provider usage is normalized only when present; missing usage is omitted rather than fabricated. Existing Chat Completions behavior remains unchanged.

User-Facing Contract

CLI / Human Output

No CLI command changes. OpenAI-shaped clients may POST to /v1/responses (or /responses) using the documented bounded text/multi-turn contract.

JSON Output

Buffered success returns object: response, status: completed, a message output item, and normalized usage when the provider supplies it. Unsupported fields return wayfinder_router_unsupported_request; existing route headers and decision-only responses remain available.

Exit Codes

No CLI exit-code changes.

Verification

Ran

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --workspace --all-targets --locked (242 gateway tests plus all workspace crates and live Redis tests)
  • cargo +1.85.0 check --manifest-path rust/Cargo.toml --locked -p wayfinder-gateway
  • cargo +1.85.0 test --manifest-path rust/Cargo.toml --locked -p wayfinder-gateway responses_ -- --nocapture

Covered

  • buffered aliases and normalized provider usage
  • fragmented SSE, ordered text deltas, duplicate terminal markers, and one terminal event
  • bounded multi-turn translation and oversized history rejection
  • strict unknown/unsupported field behavior
  • dry-run/decision-only preservation for buffered and streaming requests
  • existing Chat Completions, Redis, parity, concurrency, and provider behavior through the full suite

Review Path

Stacked on #166 (bounded canary tripwires), targeting codex/enterprise-canary-tripwires. Review after #166.

Notes For Reviewer

This is compatibility, not a claim of full OpenAI Responses feature parity. Tools, background execution, stored conversations, previous-response references, and multimodal content are intentionally rejected until each has an explicit bounded contract. The existing Chat Completions route remains the sole execution and accounting path.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant