[Bug] GraphWorkflow.visualize sanitizes the workflow name in a branch that never runs (#1853 item 5) - #1863
Open
ayaangazali wants to merge 1 commit into
Open
Conversation
…ze actually uses]
|
Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap. |
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.
Addresses item 5 in #1853.
What
GraphWorkflow.visualizesanitized the workflow name in a branch that can never run, and used the raw name in the branch that always does.output_pathis assigned unconditionally at the top of the method:so the
if output_path is None:guard ~190 lines later — the only placesafe_namewas ever built — was unreachable. graphviz treats its argument as a filesystem path, so a workflow namedteam/alpharendered toteam/alpha_visualization_<uuid>, a directory that does not exist, and the call failed. The sanitization written to prevent exactly that was sitting in dead code.Fix
Moved the sanitization into the live assignment and deleted the unreachable branch (6 lines). Net effect is the behaviour the dead code intended, in the path that runs.
The
uuid4()suffix is kept — the dead branch omitted it, so had it ever run it would also have collided between two visualizations of the same workflow.Test
Appended to
tests/structs/test_graph_workflow.py— no new file. It asserts the dead branch is gone, thatsafe_nameis built in the live path, and that a name containing/maps toteam_alpha.Not included
The other items in #1853 are deliberately out of scope here, and two of them are already covered:
agent.py) is part of [Improvement] Defer litellm and mcp imports: import swarms drops 2.2s -> 0.3s and stops fetching the model-cost map (#1754) #1773_reinitialize_after_loadstoring a shut-down executor) is part of [Bug] self.executor is never assigned in __init__, so run(imgs=[...]) raises AttributeError (#1793) #1801aop.py, which [Bug] AOP: idle queue workers starve the lock, and a server that exits at once restarts forever #1861 is already changing — better done after that lands than as a conflicting parallel editThat leaves item 3 (the bogus
awaiton a sync_handle_run_error) genuinely unclaimed; happy to take it separately.The red checks are the repo-wide ones (
buildnever installs the package,test-main-featuresdies on Poetry 2.x--no-dev), both addressed in #1812.