-
Notifications
You must be signed in to change notification settings - Fork 0
fix: HierarchyResolver does not consume subordinate_id/supervisor_id from ReportingLine #746
Description
Problem
HierarchyResolver.__init__ in src/synthorg/communication/delegation/hierarchy.py (lines 64-77) uses line.subordinate and line.supervisor directly as dictionary keys when building the hierarchy graph. It does not use the new subordinate_id/supervisor_id fields added in #719.
When templates define multiple agents with the same role name (e.g., 3x "Backend Developer" with different subordinate_id values), the hierarchy resolver collapses them into a single entry in the supervisor_of dict -- only the last-processed entry survives.
Expected behavior
The resolver should use subordinate_id (when present) as the dictionary key instead of subordinate, so that agents sharing a role name but having different IDs are properly represented in the hierarchy graph.
Suggested approach
Add subordinate_key/supervisor_key computed properties to ReportingLine that encapsulate the identity derivation logic (subordinate_id if present, else subordinate). Update HierarchyResolver to use these properties instead of bare line.subordinate/line.supervisor.
Context
Found during pre-PR review of #745 by the type-design-analyzer agent. The validation layer (self-report check, unique-subordinate check) correctly handles the ID fields, but the runtime consumer does not.