Skip to content

fix: keep offloaded tool results from being overwritten by later runs - #13550

Merged
bogdankostic merged 5 commits into
deepset-ai:mainfrom
jaeminbird:fix/offload-keys-unique-across-runs
Dec 2, 2026
Merged

bogdankostic merged 5 commits into
deepset-ai:mainfrom
jaeminbird:fix/offload-keys-unique-across-runs

Conversation

@jaeminbird

Copy link
Copy Markdown
Contributor

Related Issues

No existing issue. This is the case @bogdankostic described on #12487; it was fixed there for ToolResultOffloadCompactor (uuid suffix) but not for ToolResultOffloadHook.

Proposed Changes:

ToolResultOffloadHook keys are {step}_{tool}_{id or call{index}}. step_count restarts at 0 on every Agent.run, so with a model that omits or repeats call ids (Ollama, Gemini, Kimi-style functions.search:0), the next turn writes to the same key in a shared store and turn 1's pointer reads turn 2's result. hooks.py now appends uuid4().hex to the key, like compaction/tool_result_offloading.py. Docs page examples updated.

How did you test it?

New parametrized test_later_run_does_not_overwrite_earlier_run_results fails 2/2 on main, passes with the fix. Also a two-turn Agent run with FileSystemToolResultStore: on main turn 1's pointer returned turn 2's output.

  • test/hooks + test/components/agents (Windows, py3.12): main 734 passed, fix 736 (7 RichConsoleUI failures on both, rich not installed)
  • ruff check, ruff format --check: clean

Notes for the reviewer

Providers with unique random call ids are unaffected; keys just get longer.

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.

AI use: this fix was written with AI assistance; the tests above were run before and after the change.

@jaeminbird
jaeminbird requested a review from a team as a code owner November 4, 2026 06:43
@jaeminbird
jaeminbird requested review from davidsbatista and removed request for a team November 4, 2026 06:43
@vercel

vercel Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@jaeminbird is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/core/pipeline
  pipeline.py
  haystack/hooks/tool_result_offloading
  hooks.py
Project Total  

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

@bogdankostic
bogdankostic requested a balanced review from Copilot November 17, 2026 14:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@bogdankostic
bogdankostic requested review from bogdankostic and removed request for davidsbatista November 17, 2026 14:22
@bogdankostic bogdankostic self-assigned this Nov 17, 2026
@jaeminbird

Copy link
Copy Markdown
Contributor Author

Merged main in (2fc8971), the offloading hook tests still pass. Anything else needed here?

@bogdankostic bogdankostic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks @jaeminbird!

@bogdankostic
bogdankostic enabled auto-merge (squash) December 2, 2026 13:02
@bogdankostic
bogdankostic merged commit 4767101 into deepset-ai:main Dec 2, 2026
25 of 26 checks passed
@jaeminbird
jaeminbird deleted the fix/offload-keys-unique-across-runs branch December 3, 2026 00:00
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.

4 participants