Repository navigation
feat: support a sampling seed for built-in Ollama requests - #4168
oleksii-tumanov wants to merge 1 commit into
Conversation
AI-Assistance: OpenAI Codex
|
Thanks for the pull request, @oleksii-tumanov. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. PR-changed functions: 0/2 verified (0 proven, 0 may-equivalent, 0 distinguished) · 2 not verified (1 vacuous, 1 error).
Not verified on this run: \_call\_llm (vacuous: never exercised), \_call\_openai\_compat (error).
Graphify review — findings
Adds an opt-in GRAPHIFY_OLLAMA_SEED env var whose value both _call_openai_compat and _call_llm send as a top-level seed on every built-in ollama request, leaving extra_body untouched; other backends and custom providers pointed at an Ollama URL ignore it. _resolve_ollama_seed accepts only ASCII integers in 0..9223372036854775807, treats blank as off, and raises ValueError before any client construction or API-key lookup. The semantic cache isn't keyed by seed, so the README tells users to run with --force after setting or changing it.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 978 functions depend on the 350 functions this change touches.
Health — this change adds coupling hotspots:
- new:
deduplicate_entities()— 82 callers, 26 callees - new:
build_merge()— 85 callers, 14 callees - new:
extract_files_direct()— 17 callers, 20 callees - new:
build()— 56 callers, 6 callees - new:
main()— 102 callers, 3 callees - new:
_call_claude_cli()— 33 callers, 9 callees - new:
extract_corpus_parallel()— 26 callers, 11 callees - new:
_call_llm()— 14 callers, 19 callees - …and 19 more — each is listed as a finding
Verification — 978 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 615 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
334 of 334 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/test_affected_cli.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_analyze.py— full-run-safetytests/test_anthropic_custom_endpoint.py— full-run-safetytests/test_antigravity_install.py— full-run-safetytests/test_apm_fallback_version.py— full-run-safetytests/test_architecture_doc.py— full-run-safetytests/test_astro_extraction.py— full-run-safetytests/test_astro_import_ids.py— full-run-safetytests/test_atomic_canvas_export.py— full-run-safetytests/test_atomic_version_stamp.py— full-run-safetytests/test_atomic_writes.py— full-run-safetytests/test_backend_env_isolation.py— impact, full-run-safetytests/test_backend_extras.py— impact, full-run-safetytests/test_benchmark.py— full-run-safetytests/test_benchmark_raw_graph.py— full-run-safetytests/test_blade_extractor.py— full-run-safetytests/test_build.py— impact, full-run-safetytests/test_build_located_semantic_identity.py— impact, full-run-safetytests/test_build_merge_dedup_scope.py— impact, full-run-safetytests/test_build_merge_hyperedges_and_prune.py— impact, full-run-safetytests/test_build_merge_shrink_guard.py— impact, full-run-safetytests/test_builtin_global_type_refs.py— full-run-safetytests/test_cache.py— full-run-safetytests/test_callflow_html.py— full-run-safetytests/test_cargo_introspect.py— full-run-safetytests/test_cargo_missing_manifest.py— full-run-safetytests/test_carried_hyperedge_remap.py— impact, full-run-safetytests/test_case_sensitive_resolution.py— full-run-safetytests/test_charmap_encoding.py— impact, full-run-safetytests/test_chunking.py— impact, full-run-safetytests/test_cjs_module_extension.py— full-run-safetytests/test_claude_cli_backend.py— impact, full-run-safetytests/test_claude_md.py— full-run-safetytests/test_cli_broken_pipe.py— full-run-safetytests/test_cli_export.py— full-run-safetytests/test_cli_help.py— full-run-safetytests/test_cluster.py— full-run-safetytests/test_cluster_exclude_hubs.py— full-run-safetytests/test_cobol_extractor.py— full-run-safetytests/test_codebuddy.py— full-run-safetytests/test_community_hub_labels.py— full-run-safetytests/test_community_labels_skill.py— full-run-safetytests/test_confidence.py— full-run-safetytests/test_corrupt_graph_json.py— impact, full-run-safetytests/test_cpp_method_declarations.py— full-run-safetytests/test_cpp_nested_and_cli.py— full-run-safetytests/test_cpp_objc_cross_file_calls.py— full-run-safetytests/test_cpp_preprocess.py— full-run-safety- … and 284 more
non-code file(s) changed (
README.md) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
README.md) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
CHANGELOG.md§ 0.9.77 (2026-10-05) (lines 5-24): references changed symbols__init__CHANGELOG.md§ 0.9.58 (2026-09-10) (lines 257-274): references changed symbols__init__CHANGELOG.md§ 0.9.42 (2026-08-13) (lines 476-494): references changed symbols__init__CHANGELOG.md§ 0.9.23 (2026-07-21) (lines 689-698): references changed symbols__init__CHANGELOG.md§ 0.9.22 (2026-07-20) (lines 699-708): references changed symbols__init__docs/superpowers/plans/2026-05-04-incremental-updates-dedup.md§ Task 2: Create graphify/dedup.py — entropy gate + MinHash/LSH + Jaro-Winkler (lines 71-468): references changed symbols__init__graphify/extractors/MIGRATION.md§ Steps (lines 79-101): references changed symbols__init__worked/karpathy-repos/GRAPH_REPORT.md§ Knowledge Gaps (lines 250-327): references changed symbols__init__worked/karpathy-repos/GRAPH_REPORT.md§ Suggested Questions (lines 328-344): references changed symbols__init__worked/karpathy-repos/review.md§ Communities detected (major) (lines 53-72): references changed symbols__init__
Formal verification
Could not verify: Could not verify \_call\_llm.
The verifier did not have enough to check \_call\_llm, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 40 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly TypeError — names the real obstacle, not a sampling gap)
Verification did not run: Verification did not run for \_call\_openai\_compat.
The verification could not execute (an environment/toolchain issue, not a statement about the code).
Guarantee: No guarantee, the check itself did not complete.
Note: Detail: harness produced no verdict (rc=124): timeout after 30s
· 27 more finding(s) on lines outside this diff (see the check run).
|
Landed in 0.9.86 (now on PyPI), authorship preserved. The code applied cleanly; the README doc hunks were dropped because that section moved to docs.graphify.com in the README trim — worth adding the Ollama seed note to the config docs there. Thank you, @oleksii-tumanov! |
What does this PR do?
Refs #3988
Add an optional validated GRAPHIFY_OLLAMA_SEED for every built-in Ollama request while preserving the default request shape when it is disabled.
Keep custom providers and non-Ollama backends isolated, and document the semantic-cache and repeatability limits.
The setting accepts ASCII decimal values from 0 through 9223372036854775807. Both structured extraction and plain-text built-in Ollama calls send the value as a top-level seed without changing the existing extra_body behavior.
Type of change
Verification & Invariants
When the setting is disabled, built-in Ollama requests keep their existing shape. When enabled, both request paths send the validated seed while custom aliases and other backends remain unchanged.
How was this tested?
22 seed regressions and all 132 backend tests passed.
Full offline all-extras suite: 6,639 passed and 15 skipped; Ruff and graph update checks passed.
Pyright introduced no diagnostics relative to the exact base.
Limitations
No live Ollama or other provider/model call was made; request shape was verified with mocked clients.
A fixed seed improves repeatability but does not guarantee identical output across runtime, model, hardware, or concurrency changes.
Semantic cache identity remains unchanged; users need one --force run after enabling or changing the seed when fresh semantic output is required.
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (Not applicable: no generated skill sources changed; generation guards passed.)AI assistance is disclosed separately in the commit's
AI-Assistancemetadata.