Skip to content

fix: HierarchyResolver does not consume subordinate_id/supervisor_id from ReportingLine #746

@Aureliolo

Description

@Aureliolo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingspec:company-structureDESIGN_SPEC Section 4 - Company Structuretype:bugBug reporttype:fixBug fixes and correctionsv0.4Minor version v0.4v0.4.8Patch release v0.4.8

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions