Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Provider layer: protocol raises TypeError, and the chat path has no request timeout

オープン
#674 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

OpenAIProvider._is_chat_completions_mode と 2 つの payload ビルダーから始め、providers/base.py の params が SDK にどのように到達するかを確認します。プロトコルの TypeError と停止した chat リクエストを再現し、その後、両方のパスに deadline があり、workflow/graph.py が先頭の BOM なしで保存されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Hi, while reading through the provider layer, we found two issues and one small file note. They're all in the same part of the code, so we're putting them together. If any of it is deliberate, or if we're misreading how the pieces fit, please tell us and feel free to close it.

1. Setting protocol raises TypeError

OpenAIProvider._is_chat_completions_mode reads the key from the provider params, so it reads as the intended way to pick between the two APIs:

def _is_chat_completions_mode(self, client) -> bool:
    protocol = self.params.get("protocol")
    if protocol == "chat":
        return True
    if protocol == "responses":
        return False
    # Default to Responses API only if it exists on the client
    return not hasattr(client, "responses")

But neither payload builder removes that key before handing the rest to the SDK — both end the same way:

        # Pass any remaining kwargs directly
        payload.update(params)
        return payload

params comes straight from the node config (self.params = config.params in providers/base.py), and the only keys popped along the way are max_tokens, max_output_tokens, temperature, tools, tool_choice and timeout. So protocol reaches the SDK as an unknown keyword argument:

TypeError: Completions.create() got an unexpected keyword argument 'protocol'

What we saw when we set protocol: chat on a node: the node caught the error and returned it as its output, so the workflow "completed" with

Error calling model gpt-4o: Completions.create() got an unexpected keyword argument 'protocol'

instead of an answer. protocol: responses behaves the same way, because _build_request_payload ends with the same payload.update(params) line — so today the parameter can't be used in either direction.

Possible fix: treat protocol like the other transport-level keys — params.pop("protocol", None) in both builders, or read it from the config object instead of from params.

2. The chat-completions path has no request timeout

The two API paths behave differently when the endpoint stops answering. The Responses payload builder sets a timeout:

# _build_request_payload
payload: Dict[str, Any] = {
    ...
    "temperature": params.pop("temperature", 0.7),
    "timeout": params.pop("timeout", 300),  # 5 min
}

The chat-completions builder (_build_chat_payload) sets none, and the client is created without one either (OpenAI(api_key=..., base_url=...)). So on that path the SDK defaults apply — on the version we looked at (openai 1.109.1):

Timeout(connect=5.0, read=600, write=600, pool=600)

An endpoint that is down fails fast (the 5 s connect timeout), which is fine. The case that isn't covered is an endpoint that accepts the connection and then goes quiet (a hung upstream, an overloaded gateway): the node then waits out the 600 s read timeout with no deadline of its own. That path isn't exotic — it's the one in use with a gateway or self-hosted endpoint, and it's also what the provider falls back to when the Responses attempt fails.

We noticed it with a stalled endpoint: the run sat there with no error and no output until we stopped it — the 300 s timeout that would have ended it only applies to the Responses path.

Possible fix: give _build_chat_payload the same "timeout": params.pop("timeout", 300) line (plus a client-level default), so both paths behave the same. Whether the default should be 300 s or something shorter is your call — the point is having a deadline on both paths.

3. Minor: workflow/graph.py starts with a UTF-8 BOM

The file's first three bytes are EF BB BF. Python's import machinery strips a leading BOM, so nothing in the runtime is affected — but tools that read the file as plain UTF-8 fail on line 1 with invalid character in identifier. Saving it as UTF-8 without BOM would fix that.

Happy to test a patch if you'd like one.

主要言語
Python
スター
34.3k
フォーク
4.3k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenBMB/ChatDev のほかの issue

OpenBMB/ChatDev の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。