Files
AutoGPT/autogpt_platform/backend
Otto 6cb794cbf8 fix(builder): auto-cleanup invalid/orphan edges during graph operations
Fixes graph desync issues where edge deletions don't persist, causing
stale connections that users cannot remove.

Frontend changes:
- edgeStore: Validate links during addLinks() - skip edges referencing
  non-existent nodes
- edgeStore: Filter invalid edges in getBackendLinks() before save
- useSaveGraph: Sync edge store with authoritative backend state after
  save to prevent desync

Backend changes:
- graph.py: Add prune_invalid_links() method that removes:
  - Links referencing non-existent nodes
  - Links with invalid block IDs
- Called during graph validation to auto-cleanup orphan edges

This ensures:
1. Invalid edges are filtered out when loading a graph
2. Invalid edges are not sent to backend during save
3. Frontend syncs with backend state after save
4. Backend cleans up any orphan edges that slip through

Closes: SECRT-1959
2026-02-14 12:42:23 +00:00
..