Skip to content

fix: centralize hardcoded ring thresholds and constants (#171)#188

Merged
imran-siddique merged 6 commits intomicrosoft:mainfrom
Ricky-G:main
Mar 12, 2026
Merged

fix: centralize hardcoded ring thresholds and constants (#171)#188
imran-siddique merged 6 commits intomicrosoft:mainfrom
Ricky-G:main

Conversation

@Ricky-G
Copy link
Copy Markdown
Contributor

@Ricky-G Ricky-G commented Mar 11, 2026

Description

Centralize hardcoded ring thresholds and constants into a single hypervisor/constants.py module. Values were previously duplicated across rate_limiter.py, enforcer.py, models.py, vouching.py, and orchestrator.py.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Maintenance (dependency updates, CI/CD, refactoring)
  • Security fix

Package(s) Affected

  • agent-os-kernel
  • agent-mesh
  • agent-hypervisor
  • agent-sre
  • agent-governance
  • docs / root

Checklist

  • My code follows the project style guidelines (ruff check)
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (pytest)
  • I have updated documentation as needed
  • I have signed the Microsoft CLA

Related Issues

Fixes #171
Fixes #171

@Ricky-G Ricky-G requested a review from imran-siddique as a code owner March 11, 2026 23:23
@github-actions
Copy link
Copy Markdown

Welcome to the Agent Governance Toolkit! Thanks for your first pull request.
Please ensure tests pass, code follows style (ruff check), and you have signed the CLA.
See our Contributing Guide.

@github-actions github-actions bot added tests agent-hypervisor agent-hypervisor package security Security-related issues size/XL Extra large PR (500+ lines) labels Mar 11, 2026
…s.py

Fixes microsoft#171

Ring thresholds and constants were hardcoded with duplicate values across
multiple files (rate_limiter.py, enforcer.py, models.py, vouching.py,
orchestrator.py). This commit introduces a single constants.py module
under hypervisor/ and updates all source files to import from it.

Constants centralized:
- Ring trust-score thresholds (0.95, 0.70, 0.60)
- Rate-limiter defaults per ring (req/s and burst capacity)
- Vouching/sponsorship thresholds (score scale, bond pct, max exposure)
- Saga orchestrator defaults (retries, delay, step timeout)
- Validation limits (agent ID, name, API path, participants, duration)
- Risk-weight ranges by reversibility level
- Session default min_eff_score

All 562 existing tests pass with zero failures.
@github-actions github-actions bot added the size/L Large PR (< 500 lines) label Mar 12, 2026
@github-actions github-actions bot added the agent-mesh agent-mesh package label Mar 12, 2026
@github-actions github-actions bot added the agent-sre agent-sre package label Mar 12, 2026
@imran-siddique imran-siddique merged commit 861240a into microsoft:main Mar 12, 2026
22 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-hypervisor agent-hypervisor package agent-mesh agent-mesh package agent-sre agent-sre package security Security-related issues size/L Large PR (< 500 lines) size/XL Extra large PR (500+ lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent-hypervisor: magic numbers scattered across codebase

2 participants