Skip to content

Fix duplicate reasoning_effort kwargs for GPT-5.4 xhigh runs #12

Closed

Description

@lgxyc

This was generated by AI during triage.

Problem

当 models[*].use 配置为 langchain_openai:ChatOpenAI,并且模型配置里显式写了 reasoning_effort,同时前端聊天请求也通过 run context 传入 reasoning_effort 时,DeerFlow 会在实例化 ChatOpenAI 时抛出:

langchain_openai.chat_models.base.ChatOpenAI() got multiple values for keyword argument 'reasoning_effort'

当前这个问题阻断了通过 OpenAI-compatible gateway 使用 gpt-5.4,并且让 xhigh 这类需要默认或显式传入的 reasoning effort 无法在工作台正常使用。

Reproduction

当前本地配置使用:

  • model: gpt-5.4
  • use: langchain_openai:ChatOpenAI
  • base_url: https://rawchat.cn/codex
  • config-level reasoning_effort: xhigh

复现方式:

  1. 在 config.yaml 的模型项中配置 reasoning_effort
  2. 从前端工作台发起聊天,前端会根据 mode 再传一份 reasoning_effort
  3. 后端 create_chat_model() 调用 ChatOpenAI(**kwargs, **model_settings_from_config) 时因重复 key 报错

最小复现:

create_chat_model(name='gpt-5.4', thinking_enabled=True, reasoning_effort='high')

结果:

TypeError: langchain_openai.chat_models.base.ChatOpenAI() got multiple values for keyword argument 'reasoning_effort'

Expected behavior

  • 配置文件里的 reasoning_effort 应作为默认值存在
  • 运行时 context 里的 reasoning_effort 应能安全覆盖默认值,而不是触发重复传参异常
  • 如果用户坚持使用 xhigh,工作台也应能显式表达并传递 xhigh,而不是被现有 high 上限截断

Activity

  1. added
    bugSomething isn't working
    ready-for-agentFully specified and ready for an AFK coding agent
    area:frontendNext.js frontend under frontend/
    area:backendGateway / runtime / core backend under backend/
    on Jun 30, 2026
  2. lgxyc commented on Jun 30, 2026

    @lgxyc
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: Fix reasoning_effort collisions for OpenAI-compatible GPT-5.4 runs, and allow explicit xhigh reasoning effort from the workspace.

    Current behavior:
    When a model configured with langchain_openai:ChatOpenAI has a config-level reasoning_effort default and the frontend also sends reasoning_effort through run context, model construction fails with ChatOpenAI() got multiple values for keyword argument 'reasoning_effort'. Separately, the workspace only models reasoning effort up to high, so a user who needs xhigh cannot express it explicitly in the UI and the frontend's mode-derived defaults cap out at high.

    Desired behavior:
    OpenAI-compatible model construction should accept both a config default and a runtime reasoning_effort override without duplicate-keyword failures. Runtime context should override config defaults when thinking is enabled, while any internally forced thinking-disabled behavior should still win when thinking is disabled. The workspace should also be able to represent and send xhigh explicitly so GPT-5.4-style runs can stay at xhigh end-to-end instead of being truncated to high.

    Key interfaces:

    • create_chat_model() runtime/config merge semantics for OpenAI-compatible BaseChatModel providers
    • The run-context shape that carries reasoning_effort from the frontend into the Gateway
    • Workspace reasoning-effort types and selector UI, which currently cap the value set at high

    Acceptance criteria:

    • A config-level reasoning_effort default plus a runtime reasoning_effort override no longer raises duplicate-keyword TypeError for langchain_openai:ChatOpenAI
    • When thinking is enabled, runtime reasoning_effort overrides the config default for OpenAI-compatible models
    • When thinking is disabled, any forced disable-path reasoning_effort still takes precedence over a runtime override
    • The workspace types and UI can explicitly represent and send xhigh
    • Regression coverage exists for both the backend merge behavior and the frontend xhigh support path

    Out of scope:

    • Changing non-OpenAI provider semantics unrelated to reasoning_effort
    • Redesigning the workspace mode system beyond the minimum needed to support xhigh
  3. lgxyc commented on Jun 30, 2026

    @lgxyc
    OwnerAuthor

    实现进展:

    本次修复包含:

    • 后端消除 ChatOpenAI 的 reasoning_effort 重复传参冲突
    • 仅在 DeerFlow 自己注入 forced disable fallback 时,才让该值压过 runtime override
    • 前端补齐 xhigh 类型、默认映射和请求级传递语义
    • 新增 backend/frontend 回归测试

    验证已完成:backend lint、backend 定向 pytest、frontend 定向单测、frontend check、frontend build、以及真实 gpt-5.4 调用。

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

    area:backendGateway / runtime / core backend under backend/area:frontendNext.js frontend under frontend/bugSomething isn't workingready-for-agentFully specified and ready for an AFK coding agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions