Skip to content

controller: remember last latency in patience_s and clarify cooldown draining cap - #141

Merged
davanstrien merged 2 commits into
mainfrom
fix-patience-latency-fallback
Dec 3, 2026
Merged

davanstrien merged 2 commits into
mainfrom
fix-patience-latency-fallback

Conversation

@davanstrien

Copy link
Copy Markdown
Owner

Fixes Auto.patience_s ignoring remembered state.latency_s when silent ticks report obs.latency_s=None (consistent with settle()), and clarifies the cooldown draining-cap wording in docstrings and docs/design.md:

  • saturate/controller.py: patience_s(self, obs, latency_s=None) falls back to latency_s when obs.latency_s is None; _observe (Settling draining cap) and stalled() pass state.latency_s.
  • saturate/controller.py & docs/design.md: clarify that the extra draining hold (oldest_s > age) is what is capped at stall patience, keeping the 2–3 tick minimum cooldown floor explicit even when stall_ticks < 3.
  • tests/test_controller.py: add regression tests covering remembered latency in both cut:stall and Settling draining.

Verification & perf smoke tests

  • ruff check ., ruff format --check ., ty check saturate tests, blacken-docs --check docs/design.md: passed
  • pytest tests/test_controller.py tests/test_controller_properties.py tests/test_controller_perf.py -q: 158 passed
  • bench/controller_sim.py origin/main .: identical across all 44 scenarios (mean 98% / 85% / 4.2x / 0.3% / 15, worst best 75%, median ramp 7)
  • bench/ab.py --base origin/main --head . --suite smoke --reps 2: no regression (peak_rss_mib 1.003x / 0.998x, rows_per_s within normal local noise floor)

@davanstrien
davanstrien merged commit 82be659 into main Dec 3, 2026
18 checks passed
@davanstrien
davanstrien deleted the fix-patience-latency-fallback branch December 3, 2026 10:36
@davanstrien davanstrien mentioned this pull request Dec 3, 2026
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