Skip to content

fix: route forward skip-layer edges around intermediate boxes#9

Merged
cristipufu merged 1 commit intomainfrom
fix/forward-skip-layer-edge-collision
Feb 9, 2026
Merged

fix: route forward skip-layer edges around intermediate boxes#9
cristipufu merged 1 commit intomainfrom
fix/forward-skip-layer-edge-collision

Conversation

@cristipufu
Copy link
Member

Summary

  • Forward edges that skip layers (e.g. parse_agent_output__end__ skipping call_tool and aggregate_tool_results) were drawing straight vertical lines through intermediate boxes, corrupting node text and overlapping labels
  • Add right-side corridor routing for colliding forward edges, matching the existing backward edge corridor pattern
  • Uses direct array access for drawing (no performance regression — ~5.2ms total across 9 samples)
  • Accounts for label width in corridor margin calculation so labels aren't truncated at canvas edge

Before

Forward skip-layer edges cut straight through intermediate node boxes, overwriting their text.

After

function-agent

Changes

  • src/graphtty/renderer.py — Add _forward_skip_corridors() detection + _draw_forward_corridor() drawing, merge into corridor map, pass route_x/all_boxes to forward edge dispatch
  • tests/test_renderer.py — 3 new tests (skip edge collision, skip edge labels, function-agent sample)
  • samples/function-agent/ — New sample graph with skip-layer edges
  • scripts/generate_screenshots.py — Add function-agent screenshot generation
  • screenshots/function-agent.png — New screenshot
  • README.md — Updated benchmark table (8 → 9 samples)

Test plan

  • All 82 tests pass (uv run pytest tests/ -v)
  • Type checks pass (uv run ty check)
  • Linting passes (uv run ruff format . && uv run ruff check --fix .)
  • Benchmark shows no regression (~5.2ms total across 9 samples)
  • Visual verification of function-agent render

🤖 Generated with Claude Code

Forward edges that skip layers (e.g. parse_agent_output → __end__) were
drawing straight vertical lines through intermediate boxes, corrupting
node text. Add right-side corridor routing for colliding forward edges,
matching the existing backward edge corridor pattern.

- Add _forward_skip_corridors() to detect collisions and assign corridors
- Add _draw_forward_corridor() with direct array access for performance
- Account for label width in corridor margin calculation
- Add function-agent sample, screenshot, and benchmark entry
- Add tests for skip-layer collision avoidance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cristipufu cristipufu merged commit e114e9e into main Feb 9, 2026
7 checks passed
@cristipufu cristipufu deleted the fix/forward-skip-layer-edge-collision branch February 9, 2026 11:51
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