Repository navigation
Conversation
…the same tool Closes OpenBMB#584.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opened together with #584 so the change can be discussed on the actual diff, as
docs/CONTRIBUTING.mdasks for discussion before a change. Happy to adjust it or close it if you'd rather fix it another way.Summary
UltraData.get_datamerges a step'sinput:mapping intoself.io[concated]["input"]in place.self.iois keyed by tool, not by step and is built once in_extract_io, so the mapping outlives its step: every later call of the same tool without aninput:block of its own silently receives the earlier step's variable instead of the variable the tool declares._extract_ioalready merges the override into a copy before validating it; the runtime line contradicted that.Merge into a copy, one line:
Closes #584: a step's mapping no longer affects any later step.
Reproduction
End to end, with
ultrarag build pipeline.yaml --no-mcpthenultrarag run pipeline.yaml --no-mcpon the three-file fixture in the linked issue:genemitsq_ls = ["Ada"];echo.answerdeclaresprompt_lswith default["Default", "Value"]and logs what it receives; pipelinegen.emit,{"echo.answer": {"input": {"prompt_ls": "q_ls"}}},echo.answer. Both commands exit 0;echo/calls.jsonlholds one line per call.Unmodified
5f48fff03c74:With this PR:
The regression test drives the same three-step shape through
build(..., no_mcp=True)/run(..., no_mcp=True, return_all=True)and asserts bothfinal_resultand the logged call arguments.Behaviour change
Exactly one, plus a pre-existing error that becomes visible:
input:mapping of its own no longer inherits an earlier call's mapping; it gets its tool's declared inputs as the pipeline author wrote them.branch, a step whose declared default has a different cardinality from the routed items previously had that mismatch masked by the leaked list (which had the right length). With the fix the call gets the declared default andsave_data's pre-existingRouter ... length > global_varserror surfaces. That is a misconfigured branch being reported, not a valid pipeline being rejected; the mapping step itself still works in that pipeline.No shipped example changes behaviour: all 42 pipelines in
examples/experiments/and the documentedDeepResearchpipeline indocs/llms.txthave no unmapped call after a mapped call (loops expanded two iterations, branches enumerated as paths), so they resolve as before.ultrarag build+ultrarag run examples/experiments/sayhello.yaml --no-mcpstill exit 0.Tests
New test
test_step_input_mapping_does_not_leak_into_later_calls, appended totests/test_no_mcp_execution.py(reuses that file's_serverhelper): builds the same three-step shape with the single-element default[Default]and asserts bothfinal_resultand the logged call arguments.On Windows 11 (Python 3.12.16, editable install from source with
uv sync --frozen, nomcpextra, one worker — pytest-xdist is not installed):5f48fff03c74(with only the test added):pytest tests/test_no_mcp_execution.py -k step_input_mapping -q→1 failed, 12 deselected, failing withAssertionError: assert {'ans_ls': ['Ada']} == {'ans_ls': ['Default']}pytest tests/test_no_mcp_execution.py -k step_input_mapping -q→1 passed, 12 deselectedpytest tests/test_no_mcp_execution.py -k "leak or local_pipeline" -q -rs→2 passed, 1 skipped, 10 deselected, the skip beingtests/test_no_mcp_execution.py:521: MCP extra not installed(the pre-existingtest_mcp_and_local_pipeline_agreeneeds themcpextra, so that selection's count is environment-dependent; the added test is thestep_input_mappingone, and it runs either way)pytest tests servers/generation/tests servers/retriever/tests -q, with this PR:3 failed, 203 passed, 2 skipped in 335.60smain:3 failed, 202 passed, 2 skipped in 344.53sOSError: [WinError 1314] A required privilege is not held by the clientwhere tests create symlinks (test_builder_agent.py::test_prompt_tools_block_traversal_and_symlinks,...::test_pipeline_reads_reject_symlink_escape_before_loading,test_workspace_access.py::test_admin_access_and_prompt_writes_are_preserved) — environment, in files this patch does not touch203 vs 202 passed, the new regression testCI's other guards on the patched tree:
uv lock --check,uv sync --frozen, the no-MCP import assert, sayhello build+run--no-mcp,ruff check src/ultrarag tests/test_no_mcp_execution.py(All checks passed!) andruff format --check(17 files already formatted) all exit 0. No.pre-commit-config.yamland no gitleaks step exist in the repo.Not run, not claimed: CI itself (Python 3.11 and 3.12 on ubuntu-latest); only Python 3.12.16 on Windows here. MCP-over-stdio behaviour was not exercised separately.
servers/*/testsoutside the CI command were not run. Real-world impact count (how many live pipelines hit the leak) is unknown.Found and validated with AI assistance (DeepSeek V4.1 Flash via Oh My Pi).