BlockingConfirmationStrategy ignores an empty argument replacement
Los mantenedores suelen responder en 1 día
@Aarkin7 ya está trabajando en esto.
Desde el 22/11/2026.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
El error está en haystack/hooks/human_in_the_loop/strategies.py, alrededor de la línea 124, donde la rama modify comprueba new_tool_params por su valor de verdad, por lo que un dict vacío se descarta. Lee ese bloque y luego ejecuta el script de reproducción sin conexión del issue tanto con Agent.run() como con Agent.run_async(). Está terminado cuando la herramienta recibe su valor por defecto 'dry_run' y el historial de mensajes muestra los argumentos {} en ambos modos, con una prueba de regresión que cubra el reemplazo vacío.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When a confirmation UI returns ConfirmationUIResult(action="modify", new_tool_params={}), BlockingConfirmationStrategy keeps the original tool arguments instead of applying the empty replacement.
For a tool with optional parameters, removing all arguments should let it use its defaults. In the example below, the model requests record_scope(scope="production"), and the UI replaces the arguments with {}. The tool should use its default "dry_run", but it receives "production" instead.
No exception or warning is raised. The original arguments also remain in the conversation history, with no modification feedback.
Expected behavior
An explicit {} should replace the original arguments. The tool should run with its defaults, and the conversation should reflect the change.
To reproduce
This runs offline and only records a string in a local list. No API key or external action is involved. Save as repro_empty_hitl_replacement.py and run from the repository:
hatch --version
HAYSTACK_TELEMETRY_ENABLED=false hatch -e test run python repro_empty_hitl_replacement.py
import asyncio
from haystack.components.agents import Agent
from haystack.components.generators.chat import MockChatGenerator
from haystack.dataclasses import ChatMessage, ToolCall
from haystack.hooks.human_in_the_loop import (
AlwaysAskPolicy,
BlockingConfirmationStrategy,
ConfirmationHook,
ConfirmationUIResult,
)
from haystack.tools import Tool
class EmptyReplacementUI:
def get_user_confirmation(self, tool_name, tool_description, tool_params):
return ConfirmationUIResult(action="modify", new_tool_params={})
def make_agent():
observed = []
def record_scope(scope: str = "dry_run") -> str:
observed.append(scope)
return scope
tool = Tool(
name="record_scope",
description="Record the scope locally; perform no external action.",
parameters={"type": "object", "properties": {"scope": {"type": "string"}}},
function=record_scope,
)
generator = MockChatGenerator(
responses=[
ChatMessage.from_assistant(
tool_calls=[ToolCall(tool_name="record_scope", arguments={"scope": "production"}, id="call-1")]
),
"done",
]
)
strategy = BlockingConfirmationStrategy(
confirmation_policy=AlwaysAskPolicy(), confirmation_ui=EmptyReplacementUI()
)
agent = Agent(
chat_generator=generator,
tools=[tool],
hooks={"before_tool": [ConfirmationHook(confirmation_strategies={"record_scope": strategy})]},
)
return agent, observed
async def main():
for mode in ("sync", "async"):
agent, observed = make_agent()
messages = [ChatMessage.from_user("Record the scope.")]
result = agent.run(messages=messages) if mode == "sync" else await agent.run_async(messages=messages)
arguments = [tc.arguments for message in result["messages"] for tc in (message.tool_calls or [])]
print(f"{mode}: tool received {observed}; tool-call arguments {arguments}")
asyncio.run(main())
Actual output:
sync: tool received ['production']; tool-call arguments [{'scope': 'production'}]
async: tool received ['production']; tool-call arguments [{'scope': 'production'}]
Expected output:
sync: tool received ['dry_run']; tool-call arguments [{}]
async: tool received ['dry_run']; tool-call arguments [{}]
Cause and suggested fix
The check at strategies.py:124 treats {} as if no replacement was supplied:
if confirmation_ui_result.action == "modify" and confirmation_ui_result.new_tool_params:
Checking new_tool_params is not None would honor empty replacements while preserving the current handling of None.
I also verified that a custom strategy returning ToolExecutionDecision(..., final_tool_params={}) correctly uses the tool's defaults. The executor already supports empty arguments; the problem is in the built-in strategy.
Related issue
#13046 concerns a custom strategy that omits final_tool_params. Here, the UI explicitly supplies {}, and the built-in strategy ignores it.
FAQ Check
- Have you had a look at our FAQ page?
System
- OS: macOS
- Haystack: latest pull of
main - Reproduced with both
Agent.run()andAgent.run_async()through Hatch
- Lenguaje dominante
- Python
- Estrellas
- 27.1k
- Forks
- 3.5k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 239
Preparar el entorno
- 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 deepset-ai/haystack
-
P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
deepset-ai/haystack#13830 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
DocumentSplitter misplaces repeated literal chunks from an overlapping custom splitterPosiblemente ocupada @davidsbatista la tomó hace 7 días. AbiertoP2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepset-ai/haystack#13806 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
CSVToDocument accepts an unsupported conversion_mode and silently converts in row modePosiblemente ocupada @Lesereingrape la tomó hace 54 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
deepset-ai/haystack#13070 ·
Los mantenedores suelen responder en 1 día
-
InMemoryDocumentStore: count_unique_metadata_by_filter and get_metadata_field_unique_values disagree on int/float/bool valuesPosiblemente ocupada @sjrl la tomó hace 14 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepset-ai/haystack#13040 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
CSVToDocument row mode fails on CR-separated CSV inputPosiblemente ocupada @julian-risch la tomó hace 55 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
deepset-ai/haystack#13022 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de deepset-ai/haystack
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
micronaut-projects/micronaut-core#14585 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
langgenius/graphon#443 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
docling-project/docling-serve#788 ·
Los mantenedores suelen responder en 1 día
-
Mend: dependency security vulnerability untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
opensearch-project/cross-cluster-replication#1805 ·
Los mantenedores suelen responder en 1 día