Skip to content

Handle variable MultiDiGraph out-edge tuple shapes in repo map#4921

Open
biefan wants to merge 1 commit intoAider-AI:mainfrom
biefan:fix-repomap-out-edges-shape
Open

Handle variable MultiDiGraph out-edge tuple shapes in repo map#4921
biefan wants to merge 1 commit intoAider-AI:mainfrom
biefan:fix-repomap-out-edges-shape

Conversation

@biefan
Copy link
Copy Markdown

@biefan biefan commented Mar 14, 2026

Summary

Handle repo map graph edge tuples without assuming a fixed tuple length.

Problem

get_ranked_tags() currently unpacks each MultiDiGraph.out_edges(..., data=True) item as (src, dst, data). In environments where the multiedge view includes an edge key, that assumption breaks and repo map generation crashes with a ValueError while distributing rank across outgoing edges.

Root cause

The code assumed a fixed edge tuple shape even though MultiDiGraph edge views can vary depending on how the view is produced. The actual logic only needs the destination node and the edge data, not the exact tuple layout.

Fix

  • materialize the outgoing edge view once per source node
  • read dst and data positionally so both 3-item and 4-item edge tuples work
  • add a regression test that patches networkx.MultiDiGraph to expose keyed out-edges and verifies repo map generation still succeeds

Validation

  • ./.venv311/bin/python -m pytest tests/basic/test_repomap.py -q
  • ./.venv311/bin/python -m flake8 aider/repomap.py tests/basic/test_repomap.py

Fixes #4917.

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.

Uncaught ValueError in repomap.py line 542

1 participant