feat: wire the tier through the transport and keep each tier's warning distinct
The transport now hands back the tier it actually sent, and that tier rides TransportResult into LLMResponse. It is not the requested one: under EFFORT_FALLBACK=nearest a medium request goes out as low, and telemetry grouping by the requested tier would file the row under a tier that never left the process. Reconciliation judges the same tier instead of the old enable_thinking bool, and the warning throttle keys on it. Keyed on the bool, every tier of one model shared a single key, so the second contradiction was silenced for the lifetime of the transport. The predicate is an identity check against Effort.NONE on purpose -- the member's value is the non-empty string "none", so any truthiness test would send every strength tier down the "asked to disable" branch and invert the alarm.
This commit is contained in:
@@ -288,6 +288,33 @@ class TestObservabilityPassthrough:
|
||||
resp = await mw(_REQ)
|
||||
assert resp.thinking_observation is ThinkingObservation.UNKNOWN
|
||||
|
||||
async def test_applied_tier_reaches_the_response(self):
|
||||
"""issue #20: 实际发出的档由 transport 裁定,本层只搬运。
|
||||
|
||||
搬运这一步漏掉,`LLMResponse.applied_effort` 恒为 None,而遥测正是从这个
|
||||
字段取"这一行跑在哪档"——整列会静默地全是 NULL。
|
||||
"""
|
||||
result = TransportResult(
|
||||
content="ok",
|
||||
thinking="",
|
||||
prompt_tokens=10,
|
||||
completion_tokens=5,
|
||||
usage_source="measured",
|
||||
ttft_ms=12.0,
|
||||
max_inter_token_ms=3.0,
|
||||
raw={},
|
||||
applied_effort=Effort.HIGH,
|
||||
)
|
||||
mw, *_ = _harness([_src("a")], [result])
|
||||
resp = await mw(_REQ)
|
||||
assert resp.applied_effort is Effort.HIGH
|
||||
|
||||
async def test_unstated_tier_stays_none(self):
|
||||
"""不表态的调用不得被填成某个档: 那等于替调用方声称它做过一个选择。"""
|
||||
mw, *_ = _harness([_src("a")], [_ok()])
|
||||
resp = await mw(_REQ)
|
||||
assert resp.applied_effort is None
|
||||
|
||||
|
||||
class TestRetryAndFailover:
|
||||
async def test_transient_switches_source_then_succeeds(self):
|
||||
|
||||
Reference in New Issue
Block a user