Skip to content

fix(hermes): handle wrap-around weekday ranges, overnight hours, and zero occupancy in pool_sizing - #6

Open
Mohammed Lubbad (mlubbad) wants to merge 1 commit into
agent-substrate:mainfrom
mlubbad:fix/hermes-pool-sizing-wrap-ranges
Open

Mohammed Lubbad (mlubbad) wants to merge 1 commit into
agent-substrate:mainfrom
mlubbad:fix/hermes-pool-sizing-wrap-ranges

Conversation

@mlubbad

Copy link
Copy Markdown

Summary

Fixes four edge cases in hermes/deploy/pool_sizing.py so fleet sizing matches gateway/cron.py semantics and handles non-Mon-Fri workweeks and night shifts cleanly:

  1. Wrap-around active_days ranges (parse_days): Ranges such as Sun-Thu (standard across MENA/GCC teams) or Fri-Mon previously evaluated range(a, b + 1) with a > b, silently returning an empty set (set()) and dropping all workday traffic.
  2. Wrap-around cron weekday ranges & Sunday alias 7 (cron_minutes): gateway/cron.py supports wrap-around weekday ranges (e.g. 5-0 for Fri-Sun) and 7 as Sunday, whereas pool_sizing.py returned zero fires for 5-0 and did not validate out-of-range weekday numbers.
  3. Overnight active_hours and non-positive median_gap_minutes (agent_intervals): Overnight windows such as 22:00-06:00 produced a negative span (zero arrivals), and median_gap_minutes <= 0 caused an infinite loop in the exponential-gap generator.
  4. Zero-occupancy division guard (main): Guard worst / held when held == 0 so an idle/empty fleet does not raise ZeroDivisionError.

Verification

Added regression tests in hermes/deploy/test_pool_sizing.py covering Sun-Thu, Fri-Mon, cron 5-0, cron weekday 7, overnight 22:00-06:00, and median_gap_minutes <= 0.

python3 hermes/deploy/test_pool_sizing.py  -> 30/30 PASS
python3 hermes/tests/selftest.py           -> 184 passed, 0 failed
python3 hermes/actor/test_entrypoint.py    -> OK

…zero-hold in pool_sizing

Signed-off-by: Dr. Mohammed Lubbad <engmlubbad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant