[GH-ISSUE #7961] [Feature]: Dottore: let a model use the OpenAI Responses endpoint #4370

Closed
opened 2026-10-22 04:06:05 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7961

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Dottore calls each of its two models in one of two formats: OpenAI's Chat Completions (DOTTORE_<SLOT>_API=openai) or Claude's Messages (anthropic). Some providers serve GPT models only on the Responses endpoint (/v1/responses), or accept tool calls with reasoning only there. During the fork trial, for example, LinkAPI refused function tools with reasoning for gpt-6-luna on Chat Completions.

On such a provider, a GPT model cannot be Dottore's small or large model at all, and the team wants to be able to use GPT models there.

Proposed solution

Add a third API value, responses, for DOTTORE_SMALL_API and DOTTORE_LARGE_API. A model set to it is called through the OpenAI SDK's Responses API, with the same key and base URL settings as openai.

Calls stay stateless. Nothing is stored at the provider, and each turn's encrypted reasoning is sent back with the next turn, so the model keeps its reasoning between tool calls. The reply is converted to the Chat Completions shape the agent loop already uses, so the rest of the review is unchanged.

A working version of this provider was prototyped on the fork's lab branches in Promansis/Marinara-Engine@8b82196750, before Dottore moved to the two-model settings. It needs porting, not redesign.

Minimal fix

Files: .github/dottore-review/dottore_review.py and .github/dottore-review/README.md. No workflow change is needed, because dottore-review.yml already passes DOTTORE_SMALL_API and DOTTORE_LARGE_API through unchanged.

In dottore_review.py:

  1. APIS: add "responses" and update its comment. model_slot then accepts the value with no other change.
  2. review_clients: build the OpenAI client for responses as well as for openai.
  3. New responses_input(messages): system messages become instructions. User turns stay messages. An assistant turn resends its kept reasoning_items, then its text, then each tool call as a function_call item. A tool message becomes a function_call_output item with the same call_id.
  4. New responses_reply(...), with the same signature as openai_reply:
    • Stream ctx.clients[settings["slot"]].responses.create with store=False, include=["reasoning.encrypted_content"], reasoning={"effort": ...} when an effort is set, and the call's cache_key as prompt_cache_key through extra_body, as openai_reply does.
    • Send tools as {"type": "function", "strict": False, **tool["function"]}, only when there are tools.
    • Pass tool_choice values "auto" and "required" through unchanged, and convert only the named form to {"type": "function", "name": ...}. The lab version converted every value other than "auto", which fails on the "required" that run_agent now sends.
    • Take the result from the final response.completed or response.incomplete event. Raise StreamStalled on response.failed or error, on a stream that ends without a final response, and on httpx timeouts, as openai_reply does.
    • Return a SimpleNamespace with content, tool_calls and reasoning_items. Map usage to prompt_tokens, completion_tokens, prompt_tokens_details.cached_tokens and completion_tokens_details.reasoning_tokens, so call_cost_usd and the telemetry lines need no change.
  5. chat: dispatch responses to responses_reply.
  6. assistant_turn: keep reasoning_items in history next to claude_blocks.
  7. watched: count Responses delta events for text, function-call arguments and reasoning. Their delta is a plain string, so today a stalled Responses stream would report zero streamed characters.

In README.md, list responses in the Models table's API row. Under "Switching a model", add a line saying to use responses when the provider serves the model only on /v1/responses, with the same base URL form as openai (ending in /v1).

Out of scope: Claude Code repairs still require DOTTORE_SMALL_API=anthropic. There is no change to run_agent, the prompts, the price table or the two-model design.

Regression case: Dottore has no test harness in the repository, so the proof is a temporary script outside the repository, deleted afterwards. It feeds responses_input a recorded history of system, user, an assistant turn with reasoning items and one tool call, and the tool result. It asserts the item order, the matching call_ids and the resent reasoning. One live review on a pull request with known findings then runs with one model set to responses, and checks the Dottore roles: log line, a completed review and a non-zero cost line.

Alternatives considered

  • Use a provider that serves the model on Chat Completions. This works today, and the fork trial ran GPT Astra that way through LinkAPI. It is not available for every provider or model, and some providers accept tool calls with reasoning only on Responses.
  • Route through a Chat Completions proxy. This adds a service to run and secure for a small client-side change.

Additional context

  • Follows #7775 and #7776, which brought Dottore upstream with the openai and anthropic formats only.
  • The stateless design (store=False with encrypted reasoning) keeps reviews from leaving conversation state at the provider.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7961 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Dottore calls each of its two models in one of two formats: OpenAI's Chat Completions (`DOTTORE_<SLOT>_API=openai`) or Claude's Messages (`anthropic`). Some providers serve GPT models only on the Responses endpoint (`/v1/responses`), or accept tool calls with reasoning only there. During the fork trial, for example, LinkAPI refused function tools with reasoning for `gpt-6-luna` on Chat Completions. On such a provider, a GPT model cannot be Dottore's small or large model at all, and the team wants to be able to use GPT models there. ## Proposed solution Add a third API value, `responses`, for `DOTTORE_SMALL_API` and `DOTTORE_LARGE_API`. A model set to it is called through the OpenAI SDK's Responses API, with the same key and base URL settings as `openai`. Calls stay stateless. Nothing is stored at the provider, and each turn's encrypted reasoning is sent back with the next turn, so the model keeps its reasoning between tool calls. The reply is converted to the Chat Completions shape the agent loop already uses, so the rest of the review is unchanged. A working version of this provider was prototyped on the fork's lab branches in Promansis/Marinara-Engine@8b821967508ac740e15cf84d0ccab358e0eae2f2, before Dottore moved to the two-model settings. It needs porting, not redesign. ## Minimal fix Files: `.github/dottore-review/dottore_review.py` and `.github/dottore-review/README.md`. No workflow change is needed, because `dottore-review.yml` already passes `DOTTORE_SMALL_API` and `DOTTORE_LARGE_API` through unchanged. In `dottore_review.py`: 1. **`APIS`**: add `"responses"` and update its comment. `model_slot` then accepts the value with no other change. 2. **`review_clients`**: build the `OpenAI` client for `responses` as well as for `openai`. 3. **New `responses_input(messages)`**: system messages become `instructions`. User turns stay messages. An assistant turn resends its kept `reasoning_items`, then its text, then each tool call as a `function_call` item. A `tool` message becomes a `function_call_output` item with the same `call_id`. 4. **New `responses_reply(...)`**, with the same signature as `openai_reply`: - Stream `ctx.clients[settings["slot"]].responses.create` with `store=False`, `include=["reasoning.encrypted_content"]`, `reasoning={"effort": ...}` when an effort is set, and the call's `cache_key` as `prompt_cache_key` through `extra_body`, as `openai_reply` does. - Send tools as `{"type": "function", "strict": False, **tool["function"]}`, only when there are tools. - Pass `tool_choice` values `"auto"` and `"required"` through unchanged, and convert only the named form to `{"type": "function", "name": ...}`. The lab version converted every value other than `"auto"`, which fails on the `"required"` that `run_agent` now sends. - Take the result from the final `response.completed` or `response.incomplete` event. Raise `StreamStalled` on `response.failed` or `error`, on a stream that ends without a final response, and on httpx timeouts, as `openai_reply` does. - Return a `SimpleNamespace` with `content`, `tool_calls` and `reasoning_items`. Map usage to `prompt_tokens`, `completion_tokens`, `prompt_tokens_details.cached_tokens` and `completion_tokens_details.reasoning_tokens`, so `call_cost_usd` and the telemetry lines need no change. 5. **`chat`**: dispatch `responses` to `responses_reply`. 6. **`assistant_turn`**: keep `reasoning_items` in history next to `claude_blocks`. 7. **`watched`**: count Responses delta events for text, function-call arguments and reasoning. Their `delta` is a plain string, so today a stalled Responses stream would report zero streamed characters. In `README.md`, list `responses` in the Models table's `API` row. Under "Switching a model", add a line saying to use `responses` when the provider serves the model only on `/v1/responses`, with the same base URL form as `openai` (ending in `/v1`). Out of scope: Claude Code repairs still require `DOTTORE_SMALL_API=anthropic`. There is no change to `run_agent`, the prompts, the price table or the two-model design. **Regression case:** Dottore has no test harness in the repository, so the proof is a temporary script outside the repository, deleted afterwards. It feeds `responses_input` a recorded history of system, user, an assistant turn with reasoning items and one tool call, and the tool result. It asserts the item order, the matching `call_id`s and the resent reasoning. One live review on a pull request with known findings then runs with one model set to `responses`, and checks the `Dottore roles:` log line, a completed review and a non-zero cost line. ## Alternatives considered - **Use a provider that serves the model on Chat Completions.** This works today, and the fork trial ran GPT Astra that way through LinkAPI. It is not available for every provider or model, and some providers accept tool calls with reasoning only on Responses. - **Route through a Chat Completions proxy.** This adds a service to run and secure for a small client-side change. ## Additional context - Follows #7775 and #7776, which brought Dottore upstream with the `openai` and `anthropic` formats only. - The stateless design (`store=False` with encrypted reasoning) keeps reviews from leaving conversation state at the provider. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-24 04:03:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4370
No description provided.