[Bug]: graphify query prints a different answer on each run (BFS walks a set in hash order)
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read _bfs in graphify/serve.py and trace how its traversal order affects graphify query output and the token budget. Reproduce with the issue’s PYTHONHASHSEED loop, then check the same query across seeds; done when the output and retained edges are stable across runs. No test file is named in the issue.
Written by the indexing model from the issue text.
Description
Pre-flight checks
- I have checked the Troubleshooting section in the README
What happened?
graphify query prints a different answer on every run, on the same graph. _bfs in graphify/serve.py walks each level as a set of node ids (frontier = set(start_nodes), for n in frontier:), so the EDGE lines come out in string-hash order, which Python randomizes per process. query is not in _HASHSEED_PINNED_COMMANDS, and the MCP server runs the same traversal in a long-running process, so nothing pins it. The order also decides which edges survive the token budget.
Distinct outputs over 10 runs (PYTHONHASHSEED 1 to 10):
| repo | query | budget | distinct outputs |
|---|---|---|---|
| flask | how does url_for work | 50k | 10 |
| click | how does echo work | 50k | 10 |
| django | how does slugify work | default | 10 |
| django | how does the queryset build sql | 50k | 10 |
On a FastAPI template repo, graphify query 'how does cn() work' run 6 times gave 5 different outputs.
Steps to reproduce
cd flask && graphify update .
for s in 1 2 3; do PYTHONHASHSEED=$s graphify query "how does url_for work" --budget 50000 | md5sum; done
Three different hashes.
Error output or graph output
Example, first 3 contains EDGE lines on a tiny graph (one seed, 60 neighbours), seeds 1 / 2 / 3:
helper_7, helper_17, helper_6 | helper_1, helper_13, helper_17 | helper_18, helper_17, helper_8
Graphify version
0.9.105 (v8 at 5eedffa8)
Operating System
Windows (also seen on Linux)
Python Version
3.12
Installation Method
uv tool install (recommended)
Additional context
_dfs uses a list stack and is already stable. Related but different: #2817 and #1667 (cluster order), #3743 (hash seed pinned for other commands).
- Dominant language
- Python
- Stars
- 124k
- Forks
- 11.9k
- Avg merge
- 2h 35m
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Graphify-Labs/graphify
-
[Bug]: Python mod.Box[T] annotation gets a false generic_arg edge that replaces the parameter_type one ('is' on tree-sitter nodes)Possibly taken @rohit-jsfreaky claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Graphify-Labs/graphify#5110 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Graphify-Labs/graphify#5006 · 2 comments ·
Maintainers usually reply within 2 days
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Graphify-Labs/graphify#4831 · 3 comments ·
Maintainers usually reply within 2 days
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Possibly taken @Deepjyoti-Sarmah claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Graphify-Labs/graphify#4563 · 2 comments ·
Maintainers usually reply within 2 days
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncatesPossibly taken @bercedev claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Graphify-Labs/graphify#4546 · 1 comment ·
Maintainers usually reply within 2 days
All issues in Graphify-Labs/graphify
Similar issues
-
`destroy` sans terminal répond « Aborted. » au lieu de réclamer `--yes` comme `clean` et `reset`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
stephrobert/dsoxlab#354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
jasonacox/pypowerwall#472 ·
Maintainers usually reply within 1 day
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex failsPossibly taken @vrjdev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DoubleML/doubleml-for-py#455 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
assafelovic/gpt-researcher#2277 ·
Maintainers usually reply within 10 days
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)Possibly taken @lukepolson claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
PyTomography/PyTomography#435 ·
Maintainers usually reply within 1 day