Skip to content

fix: pass inputs_from_state values to ComponentTool components without conversion - #13812

Merged
sjrl merged 2 commits into
mainfrom
fix/component-tool-state-inputs-unconverted
Nov 19, 2026
Merged

sjrl merged 2 commits into
mainfrom
fix/component-tool-state-inputs-unconverted

Conversation

@sjrl

@sjrl sjrl commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

  • ComponentTool ran values mapped through inputs_from_state through _convert_param, which uses Pydantic's TypeAdapter. Pydantic can't build a schema for Secret, so a component input typed str | Secret failed whether State held a str or a Secret.
  • State-mapped inputs are now passed to the component as-is. Arguments the LLM fills in are still converted.
  • Documents passing credentials through State as a Secret, since State values appear in the Agent result, content traces and tool error messages. A Secret shows as <redacted> in all of them.

How did you test it?

New parametrized unit test (str and Secret State values), plus manual Agent runs with state_schema={"access_token": {"type": Secret}} checking the token never appears in tool errors, logs or content traces.

Notes for the reviewer

The skip applies to every parameter mapped from State, so if custom parameters also show that parameter to the LLM and the LLM fills it in, that value isn't converted either.

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 Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
haystack-docs Ready Ready Preview Nov 19, 2026 7:41am UTC

Request Review

@github-actions github-actions Bot added P1 High priority, add to the next sprint topic:tests labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/tools
  component_tool.py
Project Total  

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

@sjrl
sjrl marked this pull request as ready for review November 19, 2026 07:52
@sjrl
sjrl requested a review from a team as a code owner November 19, 2026 07:52
@sjrl
sjrl requested review from anakin87 and removed request for a team November 19, 2026 07:52

@anakin87 anakin87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good

I haven't found a realistic use case where this change could cause problems.

@sjrl
sjrl merged commit c2160bf into main Nov 19, 2026
33 checks passed
@sjrl
sjrl deleted the fix/component-tool-state-inputs-unconverted branch November 19, 2026 09:47

This branch was successfully deployed

1 active deployment
Preview — 000f26fa Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High priority, add to the next sprint topic:tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hidden state values can appear in Agent tool-error messages and logs Support Secret as a State type passed to ComponentTool via inputs_from_state

2 participants