Skip to content

fix: confirmation strategies no longer bake stale tool args#11816

Merged
sjrl merged 2 commits into
v3from
fix-hitl-tool-arg-prep
Jun 30, 2026
Merged

fix: confirmation strategies no longer bake stale tool args#11816
sjrl merged 2 commits into
v3from
fix-hitl-tool-arg-prep

Conversation

@sjrl

@sjrl sjrl commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

Fixed a bug where configuring an Agent confirmation strategy could make a tool run with stale arguments. HITL confirmation prepared and baked each tool's final arguments up front (injecting inputs_from_state values from the state at the start of the tool calling step), which defeated the per-batch argument preparation in tool execution: a tool that reads a state key written by another tool in the same step would run with the pre-step value instead of the freshly produced one. HITL confirmation now operates on the model-requested arguments and leaves state injection to tool execution, so dependent tools again receive the correct values.

How did you test it?

Added new tests and updated existing ones.

Notes for the reviewer

Note: This is still technically a breaking change in addition to being a bug fix since now we only show the LLM generated args to the users of HITL. I talked with @julian-risch offline and we agreed this was okay to do for now and that if a requirement came up later of needing to see the final args we can tackle that as a new feature.

I decided to omit the entry to MIGRATION.md for now and will add a full entry on the follow up PR that will fully resolve issue https://github.com/deepset-ai/haystack-private/issues/445

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Preview Jun 30, 2026 6:05am

Request Review

@sjrl sjrl self-assigned this Jun 29, 2026
@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Jun 29, 2026
Comment on lines +242 to +243
class TestConfirmationStrategyToolArgPrep:
def test_confirmed_dependent_tool_runs_with_fresh_state(self):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the regression test that would have previously failed without the changes in this PR

@sjrl sjrl marked this pull request as ready for review June 30, 2026 06:08
@sjrl sjrl requested a review from a team as a code owner June 30, 2026 06:08
@sjrl sjrl requested review from julian-risch and removed request for a team June 30, 2026 06:08
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/agents
  agent.py
  haystack/human_in_the_loop
  strategies.py
Project Total  

This report was generated by python-coverage-comment-action

@sjrl sjrl merged commit 7847023 into v3 Jun 30, 2026
28 checks passed
@sjrl sjrl deleted the fix-hitl-tool-arg-prep branch June 30, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants