Skip to content

Normalize bounded Codex Responses requests into the Exchange IR #42

Description

@tiammomo

Summary

Implement the second policy-sized child of #39 after #40 merges: normalize the typed Codex request into ModelPort Exchange while preserving Responses-native, metadata-minimized evidence and keeping all runtime routes disabled.

Actual behavior

The parser slice can validate the pinned Codex request syntax, but ModelPort cannot yet represent that request in its provider-neutral Exchange IR without losing protocol/path identity or tool-call causality.

Expected behavior

A Responses-native ClientRequest normalizes the bounded text/function subset into Exchange with stable semantic evidence and strict causal validation, while provider rendering and /v1/responses remain fail closed.

Acceptance criteria

  • Starts from main after Add the pinned Codex Responses parser and content-free fixture #40 merges; normalizes ordered text/function history and parallel calls; rejects duplicate, missing, or out-of-order call evidence; preserves openai-responses and /v1/responses identity; excludes client_metadata from fingerprints, estimates, parameters, forwarding, and ledger evidence; provider rendering and the HTTP route remain disabled; focused tests and boundary documentation pass.

Additional context

Context

This is the Exchange-normalization child of #39 and follows the parser/fixture slice in #40. It must start from main only after #40 merges; it is not a stacked pull request.

The parser establishes the bounded request syntax pinned to codex-cli 0.148.0-alpha.21. This issue establishes the semantic boundary needed before any experimental HTTP handler: ModelPort must retain Responses-native client evidence even if a later provider adapter renders the normalized request through another protocol.

Scope

  • Add a ClientRequest variant for the typed bounded Codex Responses request.
  • Normalize instructions, text messages, function calls, function-call outputs, function tools, tool choice, parallel-tool intent, reasoning effort, and typed response controls into the existing Exchange IR.
  • Preserve item order. Group adjacent parallel function calls into one assistant turn and require every pending call to receive exactly one matching output before a new message or call batch begins.
  • Reject duplicate/empty item IDs, duplicate/empty call IDs, missing outputs, out-of-order outputs, duplicate tools, and role/content mismatches.
  • Preserve openai-responses, /v1/responses, route name, and a stable semantic fingerprint as client evidence.
  • Parse and bound Codex client_metadata but exclude it from the semantic fingerprint, input estimate, normalized parameters, provider forwarding, and ledger evidence.
  • Keep provider rendering fail closed for the new client variant until the response adapter slice is implemented.
  • Add focused unit tests for ordering, parallel causality, evidence identity, metadata minimization, and render rejection.
  • Document the internal Exchange behavior while stating that no Responses HTTP route or SSE renderer exists.

Non-goals

  • Registering POST /v1/responses or changing Dashboard compatibility status.
  • Rendering provider requests or translating provider output into Responses events.
  • Supporting multimodal input, reasoning-history items, structured output, hosted tools, WebSocket, Realtime, background responses, or general Responses compatibility.
  • Depending on an unmerged branch: implementation starts only after Add the pinned Codex Responses parser and content-free fixture #40 is on main.

Dependencies

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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions