feat: default two structured re-asks and sharper AIMD cut

Round 5 left three residual failure classes; ladder exhaustion (3.2%
of structured calls with a single re-ask) and 429 leakage (5.8%, AIMD
oscillating above the sustainable point) are addressable: re-ask
default goes 1 to 2 (conservative vs instructor's 3) and the AIMD cut
factor drops to 0.5.
This commit is contained in:
2026-07-21 12:52:32 -04:00
parent dcd386d4aa
commit 6b98a89bb3
7 changed files with 18 additions and 6 deletions
+7
View File
@@ -148,6 +148,13 @@ class TestResilienceKeys:
class TestAssemblyGuards:
def test_structured_retries_default_two(self):
# M2.5 迭代 4: 缺省重问 1→2(instructor 缺省 3 的保守版;P6 阶梯死亡 3.2% 实证)
s = GatewaySettings.from_env("LLM", env=_env())
assert s.structured_max_retries == 2
s2 = GatewaySettings.from_env("LLM", env=_env(PGW_STRUCTURED_MAX_RETRIES="0"))
assert s2.structured_max_retries == 0
def test_cache_requires_namespace_and_ttl(self):
env = _env(PGW_CACHE_BACKEND="memory")
with pytest.raises(ValueError, match="NAMESPACE"):