Skip to content

fix: fix datahub loop result collation#978

Open
hwixley wants to merge 12 commits intodevfrom
bugfix/fix-datahub-loop-result-collation
Open

fix: fix datahub loop result collation#978
hwixley wants to merge 12 commits intodevfrom
bugfix/fix-datahub-loop-result-collation

Conversation

@hwixley
Copy link
Copy Markdown
Contributor

@hwixley hwixley commented Apr 15, 2026

Context

Fix datahub loop result collation - previously multiple results were not collated properly causing tool results to be lost

What

  • Fixes datahub tool result collation
  • Adds better exception handling on wrap_async
  • Deprecates wrap_async event loop to leverage existing one in parent caller run_with_timeout

Have you written unit tests?

  • Yes
  • No (add why you have not)

Are there any specific instructions on how to test this change?

  • Yes (if so provide more detail)
  • No

Relevant links

@github-actions
Copy link
Copy Markdown
Contributor

Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run pre-commit install --install-hooks --overwrite -t commit-msg -t pre-commit, however for more detailed help in setting up the pre-commit hooks, follow the instructions at https://github.com/uktrade/github-standards/blob/main/README.md#usage

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.40%. Comparing base (b7f1872) to head (f694c93).

Files with missing lines Patch % Lines
redbox/redbox/api/format.py 50.00% 2 Missing ⚠️
redbox/redbox/graph/nodes/processes.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #978      +/-   ##
==========================================
+ Coverage   82.20%   82.40%   +0.20%     
==========================================
  Files         197      197              
  Lines        8133     8152      +19     
==========================================
+ Hits         6686     6718      +32     
+ Misses       1447     1434      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hwixley hwixley marked this pull request as ready for review April 15, 2026 15:47
@hwixley hwixley requested a review from a team as a code owner April 15, 2026 15:47
Copy link
Copy Markdown
Contributor

@dougmills-DIT dougmills-DIT left a comment

Choose a reason for hiding this comment

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

Could you add unit tests to prove the bug is fixed?

Copy link
Copy Markdown

@lizzie-perry-dbt lizzie-perry-dbt left a comment

Choose a reason for hiding this comment

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

Looks good :)

else:
collated_result += f"<tool_result_{i}>{result_content}</tool_result_{i}>"

if success == "fail":
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this not bool? Should it be? Unsure if there is a non pass/fail hence why String

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.

yeah this is supposed to be string - this follows the same logic as build_agent_with_loop for datahub agent

think the initial reason it was set to string so could be put in AIMessage (which is what run_tools_parallel returns), however, in future want to refactor run_tools_parallel so can leverage more structured return types so dont need these poorly typed strings

Comment thread redbox/redbox/graph/nodes/processes.py Outdated
Comment on lines +707 to +708
log.warning("my-overall-result")
log.warning(current_result)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe unneeded as warning but unsure and super minor

Suggested change
log.warning("my-overall-result")
log.warning(current_result)
log.debug("my-overall-result")
log.debug(current_result)

@hwixley hwixley requested a review from dougmills-DIT April 17, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants