BlockingConfirmationStrategy ignores an empty argument replacement
I maintainer di solito rispondono entro 1 giorno
@Aarkin7 ci sta già lavorando.
Dal 22/11/2026.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Il bug si trova in haystack/hooks/human_in_the_loop/strategies.py, intorno alla riga 124, dove il ramo modify verifica new_tool_params per il suo valore di verità, quindi un dict vuoto viene scartato. Leggi quel blocco, poi esegui lo script di riproduzione offline dell'issue sia con Agent.run() sia con Agent.run_async(). È completato quando lo strumento riceve il suo default 'dry_run' e la cronologia dei messaggi mostra gli argomenti {} in entrambe le modalità, con un test di regressione che copra la sostituzione vuota.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 27.1k
- Fork
- 3.5k
- Merge medio
- 1g 8h
- PR unite (30g)
- 239
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di deepset-ai/haystack
-
P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
deepset-ai/haystack#13830 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
DocumentSplitter misplaces repeated literal chunks from an overlapping custom splitterForse già presa @davidsbatista l’ha presa 7 giorni fa. ApertaP2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
deepset-ai/haystack#13806 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
CSVToDocument accepts an unsupported conversion_mode and silently converts in row modeForse già presa @Lesereingrape l’ha presa 54 giorni fa. ApertaP3
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
deepset-ai/haystack#13070 ·
I maintainer di solito rispondono entro 1 giorno
-
InMemoryDocumentStore: count_unique_metadata_by_filter and get_metadata_field_unique_values disagree on int/float/bool valuesForse già presa @sjrl l’ha presa 14 giorni fa. ApertaP3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
deepset-ai/haystack#13040 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
CSVToDocument row mode fails on CR-separated CSV inputForse già presa @julian-risch l’ha presa 55 giorni fa. ApertaP3
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
deepset-ai/haystack#13022 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di deepset-ai/haystack
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
micronaut-projects/micronaut-core#14585 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
langgenius/graphon#443 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: Management endpoints /v1/memory/stats and /v1/memory/counts bypass API key authenticationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
docling-project/docling-serve#788 ·
I maintainer di solito rispondono entro 1 giorno
-
Mend: dependency security vulnerability untriaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
opensearch-project/cross-cluster-replication#1805 ·
I maintainer di solito rispondono entro 1 giorno