fix: unify status-bar field keys, docs, and tests for salvaged cluster
Follow-up to the cherry-picked #41909/#92696 + #39760 + #97970 cluster: - single field-key namespace (display.status_bar.fields) instead of the second tui_statusbar_fields list; cache_hit/latency/tps/stash/battery/ title join the existing key set - cache-hit % prefers the baseline-delta regime (resets on model switch and compression) and hides on zero cache reads instead of alarming 0% - latency/tps segments added to the styled fragment renderer too - docs updated in website/docs/user-guide/configuration.md - 7 new tests: rolling latency/t/s, NaN/negative guard, field filtering, baseline resets, title badge gating
This commit is contained in:
@@ -6546,16 +6546,17 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
|
||||
base_read = cur_read
|
||||
delta_prompt = cur_prompt - base_prompt
|
||||
delta_read = cur_read - base_read
|
||||
if delta_prompt > 0 and delta_read >= 0:
|
||||
pct = int(round((delta_read / delta_prompt) * 100))
|
||||
pct = max(0, min(100, pct))
|
||||
# A zero-read regime hides the segment entirely (no cache data
|
||||
# is not the same as a 0% hit worth alarming about), and the pct
|
||||
# stays a float so renderers control their own precision.
|
||||
if delta_prompt > 0 and delta_read > 0:
|
||||
pct = max(0.0, min(100.0, (delta_read / delta_prompt) * 100))
|
||||
snapshot["cache_hit_pct"] = pct
|
||||
snapshot["cache_hit_label"] = f"{pct}%"
|
||||
elif cur_prompt > 0 and cur_read >= 0 and base_prompt == 0 and base_read == 0:
|
||||
pct = int(round((cur_read / cur_prompt) * 100)) if cur_prompt else 0
|
||||
pct = max(0, min(100, pct))
|
||||
snapshot["cache_hit_label"] = f"{pct:.0f}%"
|
||||
elif cur_prompt > 0 and cur_read > 0 and base_prompt == 0 and base_read == 0:
|
||||
pct = max(0.0, min(100.0, (cur_read / cur_prompt) * 100))
|
||||
snapshot["cache_hit_pct"] = pct
|
||||
snapshot["cache_hit_label"] = f"{pct}%"
|
||||
snapshot["cache_hit_label"] = f"{pct:.0f}%"
|
||||
else:
|
||||
snapshot["cache_hit_pct"] = None
|
||||
snapshot["cache_hit_label"] = ""
|
||||
|
||||
Reference in New Issue
Block a user