Repository navigation
Serve tool-using OpenAI deployments through the stateless Responses API - #117
Merged
Merged
Conversation
6 tasks done
This was referenced Oct 28, 2026
nlundee
reviewed
Oct 29, 2026
Collaborator
There was a problem hiding this comment.
@bdb-dd I'll take this one over too and get it in, unless you'd rather finish it yourself.
The approach is right: one openai-chat registration, options.api to pin, and a learned switch only on the exact refusal, so discovered deployments just work. store: false with the full history, reasoning carried in the existing continuation, and the switch kept per endpoint connection. I merged it with today's main (22 commits ahead): the only conflict is the ADR index, and the provider, port-model, plugins and model-admin tests (124) pass with tsc -b clean.
What I'll change:
- ADR number. 0040 went to Langfuse (#100), and 0041 to 0043 are taken by #179, #125 and #185, so this becomes 0044, with the links in
docs/providers.mdand the index. - Where the reasoning lives. One line in the ADR that the encrypted reasoning in
continuationstays in the run's messages and is never written to the task's events or the database. - ADR wording. Rules in present tense like the other records ("The provider sends", not "Keep"/"Add"), and drop "The orchestrator verifies the deployment live before release", which doesn't match how we release.
- Rebase, mark it ready, and smoke test it live on Foundry with
gpt-6.1-sol(a tool round trip, streaming and non-streaming) before merging.
nlundee
force-pushed
the
feat/openai-responses
branch
from
October 29, 2026 13:11
d3dfe63 to
37c5ae3
Compare
nlundee
marked this pull request as ready for review
October 29, 2026 13:12
Map full model history, tools, reasoning continuation, schemas and streaming through the Responses API. Learn the specific Foundry tools/reasoning refusal per deployment and expose transport selection to operators. Verify both APIs against the model port contract, 150 focused tests and ten sabotage mutations. Document catalog options and ADR 0039.
Replay ordered Responses output through the opaque continuation while accepting older reasoning-only continuations. Cover streamed and non-streamed tool turns and document the replay contract.
Honor the abort signal when the SDK ends a stream silently and before yielding terminal chunks. Cover cancellation after both streamed text and terminal-snapshot text without successful metering.
0040 went to the Langfuse record, and 0041 to 0043 are taken by open pull requests. The record now states its rules in the present tense, says that encrypted reasoning stays in the run's messages and is never stored, names gpt-5.6-sol, the deployment that refuses tools on Chat Completions on Digdir's Foundry resource, and drops the release step that does not match how we release.
nlundee
force-pushed
the
feat/openai-responses
branch
from
October 29, 2026 13:24
37c5ae3 to
552cb3b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
OpenAI deployments can be served through the stateless Responses API (
/v1/responses) behind the sameModelPortcontract (chat,chatStream). That includes tools, tool results, streaming, JSON schema, usage and reasoning. ADR 0040 describes it.openai-chatendpoint registration stays as it is. A per-modeloptions.apichooses the API:responsesuses the Responses API;chat-completionspins the existing API;/v1/responsesfor function tools, it retries the request through Responses and remembers that per deployment and endpoint.Discovered deployments therefore work without hand configuration. The choice is visible as
transport: { api, source: default | configured | learned }in the model description, the operator listing and OpenAPI.input, and system messages become developer messages;function_callitems keyed bycall_id, and tool results becomefunction_call_output;{type: 'function', strict: false};reasoning: { effort },max_output_tokens;text.format;store: false, and noprevious_response_id: the platform owns the history. Encrypted reasoning content is requested and replayed through the existing opaquecontinuation, with no strategy contract change. Usage maps input, output and cached tokens.Why
Foundry's
gpt-6.1-solrefuses function tools on Chat Completions with everyreasoning_effortit accepts (noneis rejected too), and answers: "To use function tools, use /v1/responses or set reasoning_effort to 'none'." Every agent-loop or tool-using run on it failed.Tests
responses.test.ts(fake HTTP) and the port-model contract suite for both APIs cover:gpt-6.1-sol. The first tool request learned the switch (transport: {api: responses, source: learned}) and returned the tool call. The tool-result round trip answered correctly, non-streaming and streaming, with usage reported.providers-openai,port-model,pluginsand the API model and schema suites. Typecheck, lint, format and boundaries are clean.Draft, for review.
Independent verification
A separate verifier found two issues. Assistant phases and output order were lost when history was replayed. And a cancelled stream could surface as unavailable, or as a metered success. Both are fixed with regression tests. Re-verified live on Foundry with gpt-6.1-sol after the fixes, non-streaming and streaming.