Skip to content

fix(agent-os): make supervisor hierarchy gap scan O(n) - #3796

Open
mehmet turac (mturac) wants to merge 1 commit into
microsoft:mainfrom
mturac:fix/issue-3788
Open

fix(agent-os): make supervisor hierarchy gap scan O(n)#3796
mehmet turac (mturac) wants to merge 1 commit into
microsoft:mainfrom
mturac:fix/issue-3788

Conversation

@mturac

Copy link
Copy Markdown

Summary

  • SupervisorHierarchy.validate_hierarchy() no longer walks range(1, max_level + 1).
  • Gaps are derived from the sorted set of registered non-negative levels (O(n log n)).
  • Small gaps still emit per-level Level N has no registered supervisor messages; huge gaps collapse to one summary so a pathological level like 10**100 cannot hang validation.

Fixes #3788

Test plan

  • Added test_hierarchy_gap_scan_reports_missing_middle_levels
  • Added test_pathological_supervisor_level_does_not_hang_validation (level=10**100 finishes immediately)
  • Hermetic import of supervisor.py confirmed small-gap messages and sub-millisecond pathological validation

validate_hierarchy walked range(1, max_level+1), so a pathological level
like 10**100 hung validation. Derive gaps from sorted registered levels
and collapse huge gaps into one summary (microsoft#3788).
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added tests size/M Medium PR (< 200 lines) labels Aug 20, 2026
@github-actions

Copy link
Copy Markdown

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AGT Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Aug 20, 2026
@github-actions

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk size/M Medium PR (< 200 lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

supervisor.validate_hierarchy is O(max_level): a huge integer level hangs validation

1 participant