Provider layer: protocol raises TypeError, and the chat path has no request timeout
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Comience en OpenAIProvider._is_chat_completions_mode y en los dos constructores de payload, comprobando cómo los parámetros de providers/base.py llegan al SDK. Reproduzca el TypeError del protocolo y la solicitud de chat bloqueada, y después verifique que ambas rutas tienen un deadline y que workflow/graph.py se guarda sin su BOM inicial.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 34.5k
- Forks
- 4.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenBMB/ChatDev
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
-
CodeReviewModification never shows the programmer the six review regulations, so fixes are made blind to the checklist they are re-reviewed againstPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
FunctionManager silently drops tool modules containing dataclasses with postponed annotationsPosiblemente ocupada @inchang-ing la tomó hace 14 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Todos los issues de OpenBMB/ChatDev
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
task
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
danparshall/claude_researcher#87 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
datajoint/datajoint-python#1586 ·
Los mantenedores suelen responder en 1 día
-
1D intercept of length 1 is accepted as `fix_params` in population GLM with more than 1 unitPosiblemente ocupada @dhvani7014 la tomó hoy. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
flatironinstitute/nemos#642 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Broken links in the docsAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
uniswap-python/uniswap-python#487 ·