Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

preserve_reasoning treats OPENAI_BASE_URL as a first-party OpenAI destination

未关闭
#4,594 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
ai

调研方向

Start in pkg/model/provider/openai: compare Client.firstPartyOpenAIDestination, which reads the ModelConfig.BaseURL field, with Client.effectiveBaseURL, which the issue says reasoning replay already uses. Check how preservesResponseState and shouldMergeConsecutiveMessages consume the result. Done means that OPENAI_BASE_URL pointing at a non-OpenAI host disables reasoning replay, and a test covers that case. Confirm the intended behavior with maintainers before changing shouldMergeConsecutiveMessages.

由索引模型根据 Issue 内容生成。

描述

area/providers/openai

Description

pkg/model/provider/openai decides whether a destination is first-party OpenAI in Client.firstPartyOpenAIDestination, which reads ModelConfig.BaseURL. openai.NewClient resolves the effective endpoint differently — base_url, then OPENAI_BASE_URL, then https://api.openai.com/v1 — and stores that result on the embedded config (base.Config.BaseURL). The OpenAI Go SDK also honours OPENAI_BASE_URL on its own.

A model config that names no base_url but points the environment at a local server is therefore classified as first-party OpenAI.

Expected Behavior

provider_opts.preserve_reasoning should not replay encrypted OpenAI reasoning items to an endpoint that is not OpenAI. The first-party determination should consider the endpoint requests actually go to, the way reasoning replay now does in #4485 (Client.effectiveBaseURL).

Actual Behavior

With provider: openai, no base_url, and OPENAI_BASE_URL=http://localhost:8080/v1:

  • firstPartyOpenAIDestination() returns true, so preservesResponseState() is on and reasoning items captured from OpenAI are replayed to the local server.
  • shouldMergeConsecutiveMessages has the same blind spot — it also reads the config field — though that one only affects consecutive-message merging.

Reaching it takes an explicit preserve_reasoning: true, so the blast radius is narrow, but the effect is the opposite of what firstPartyResponses' own comment intends ("Opaque state must not leak to a different vendor's compatible endpoint").

Steps to Reproduce

  1. Configure provider: openai with provider_opts: {preserve_reasoning: true} and no base_url.
  2. Export OPENAI_BASE_URL=http://localhost:8080/v1 against llama.cpp or vLLM.
  3. Run a turn that captures reasoning items, then inspect the next request body.

Additional context

Found while fixing #4363 in #4485. That PR deliberately leaves this path alone: it predates the PR, belongs to the Responses mechanism rather than Chat Completions, and changing it there would widen a review that is already about a different default. Happy to follow up with a PR.

主要语言
Go
星标
4.4k
派生
508
平均合并
7 小时 2 分钟
30 天内合并 PR
233

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

docker/docker-agent 的其他 Issue

查看 docker/docker-agent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。