Skip to content

fix: honor zero thresholds when realizing agent graphs - #39

Closed
liuzhengyang699 wants to merge 1 commit into
metauto-ai:mainfrom
liuzhengyang699:fix/zero-edge-threshold
Closed

liuzhengyang699 wants to merge 1 commit into
metauto-ai:mainfrom
liuzhengyang699:fix/zero-edge-threshold

Conversation

@liuzhengyang699

Copy link
Copy Markdown

Passing threshold=0.0 to EdgeWiseDistribution.realize currently takes the stochastic branch because the threshold is checked for truthiness. A positive-probability edge can therefore disappear even though its probability is above the requested threshold. Learned node ordering already treats zero as an explicit threshold, making the two decisions inconsistent.

Check for None explicitly so zero uses the same thresholding logic as other values.

Validation: 6 focused offline tests cover thresholds zero, one, and None, with and without learned ordering. The two zero-threshold cases fail before the fix. Tests are marked mock_llm and were run with python -m pytest -m mock_llm test/swarm/optimizer/test_edge_threshold.py -q. git diff --check passed.

@liuzhengyang699 liuzhengyang699 closed this by deleting the head repository Oct 27, 2026
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.

1 participant