Aborting a streaming Responses API request drops the function_call item, breaking the next turn with 400 "No tool call found for function call output"
Los mantenedores suelen responder en 1 día
@SparshGarg999 ya está trabajando en esto.
Desde el 15/8/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Empieza reproduciendo el flujo de la API de Responses en streaming con client.responses.create(..., stream=True), stream.close() y conversations.items.list(). Rastrea cómo se gestionan los eventos response.output_item.added cuando el stream se cierra, tomando como contexto la corrección vinculada del JavaScript SDK. Se considera terminado cuando el elemento function_call persiste después de abortar y el turno posterior function_call_output tiene éxito sin un error 400.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
When a Responses API request is aborted mid-stream (client closes the stream) after a function_call item has already been streamed back, that item is never persisted to the conversation. The next turn on the same conversation that sends the matching function_call_output fails with:
400 No tool call found for function call output with call_id call_q7hr5y6HlCZkOvJ4t5cYPZM9.
The caller executes the tool locally after the abort, so the output exists and is valid — but the remote conversation has no record of the tool call it belongs to. The API gives no signal at abort time that the streamed items were discarded.
Additional context
Same issue has been fixed in the js sdk in https://github.com/openai/openai-agents-js/pull/1241
To Reproduce
client.conversations.create()→ keepconv_id.- Stream a
responses.create(..., conversation=conv_id, tools=[...], stream=True)whose prompt triggers the tool. - On the
response.output_item.addedevent for thefunction_callitem, close the stream (stream.close()). - Verify the conversation's items:
conversations.items.list(conversation_id=conv_id)→ empty, thefunction_callwas never committed. - Send the next turn on the same conversation with the tool's
function_call_output+ a user message. - See
400 No tool call found for function call output with call_id ....
Code snippets
import openai
client = openai.OpenAI()
tools = [{
"type": "function",
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]},
}]
conv = client.conversations.create()
conv_id = conv.id
# 1) streaming turn that triggers a tool call
stream = client.responses.create(
model="gpt-4.1-mini",
input="What is the weather in Amsterdam?",
conversation=conv_id,
tools=tools,
stream=True,
)
call_id = None
for event in stream:
if event.type == "response.output_item.added" and event.item.type == "function_call":
call_id = event.item.call_id
print("captured:", call_id)
stream.close() # abort mid-stream
break
# 2) the function_call was NOT persisted
items = client.conversations.items.list(conversation_id=conv_id)
print("persisted items:", [i.type for i in items.data]) # -> []
# 3) next turn on the SAME conversation
client.responses.create(
model="gpt-4.1-mini",
input=[
{"type": "function_call_output", "call_id": call_id, "output": '{"temp": 18, "condition": "cloudy"}'},
{"type": "message", "role": "user", "content": "Is it cold?"},
],
conversation=conv_id,
tools=tools,
)
# -> BadRequestError 400: No tool call found for function call output with call_id call_q7hr5y6HlCZkOvJ4t5cYPZM9.
OS
Windows 10
Python version
Python v3.11.5
Library version
openai v2.45.0
- Lenguaje dominante
- Python
- Estrellas
- 31.8k
- Forks
- 7.3k
- Merge medio
- 1 d 3 h
- PR fusionados (30 d)
- 131
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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 openai/openai-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
openai/openai-python#4022 · 19 comentarios ·
Los mantenedores suelen responder en 1 día
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providersPosiblemente ocupada @mohmedmm la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
openai/openai-python#4017 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Querystring drops explicit empty-string scalar valuesPosiblemente ocupada @sylvesterkaczmarek la tomó hace 31 días. Abiertosdk-breaking-change v4
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
openai/openai-python#3837 ·
Los mantenedores suelen responder en 1 día
-
Define + export `ServiceTiers` string literalPosiblemente ocupada @SparshGarg999 la tomó hace 57 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openai/openai-python#3556 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Empty OPENAI_BASE_URL prevents fallback to default API endpointPosiblemente ocupada @Sehastrajit-S la tomó hace 23 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openai/openai-python#2927 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de openai/openai-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NousResearch/hermes-agent#136483 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
[BUG] LazyStackedTensorDictStore zeroes the last byte of a new key set on the last elementPosiblemente ocupada @peterdsharpe la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pytorch/tensordict#2307 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
GrokModel.generate/a_generate pass an OpenAI-style list-of-dicts to xai_sdk.chat.user(), so every call crashes with a protobuf TypeError before any network I/OPosiblemente ocupada @Christian-Sidak la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
confident-ai/deepeval#3436 · 1 comentario ·
Los mantenedores suelen responder en 1 día