The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(display): preserve localized estimate markers and headroom labels
Teknium9da8c63b1aae
diff --git a/evals/token_accounting/display_provenance.py b/evals/token_accounting/display_provenance.pyindex 391872b5781..527412a9291 100644--- a/evals/token_accounting/display_provenance.py+++ b/evals/token_accounting/display_provenance.py@@ -77,8 +77,10 @@ def child(out: Path) -> None:cli.conversation_history = result["messages"]else:cli.conversation_history.append({"role": "user", "content": "new unpriced question"})+ agent._session_messages = cli.conversation_historyprint(f"\n=== {scenario}: CLI /context ===", flush=True)cli.process_command("/context")+ print("CLI status bar:", cli._build_status_bar_text(width=120), flush=True)usage = _get_usage(agent)session = {"agent": agent, "history": cli.conversation_history, "history_lock": threading.RLock()}print("=== TUI/Desktop live /context ===", flush=True)@@ -89,6 +91,8 @@ def child(out: Path) -> None:print(asyncio.run(runner._handle_status_command(MessageEvent(text="/status", source=source, message_id="fixture"))), flush=True)print("=== gateway /context ===", flush=True)print(asyncio.run(runner._handle_context_command(MessageEvent(text="/context", source=source, message_id="fixture"))), flush=True)+ print("=== gateway /usage category block ===", flush=True)+ print("\n".join(runner._context_breakdown_lines(agent, source)), flush=True)results[scenario] = {"breakdown": compute_session_context_breakdown(agent, cli.conversation_history), "usage": usage}(out / "payloads.json").write_text(json.dumps(results, indent=2))server.omit_usage = Truediff --git a/gateway/slash_commands_status.py b/gateway/slash_commands_status.pyindex e4f85a39950..e449018c233 100644--- a/gateway/slash_commands_status.py+++ b/gateway/slash_commands_status.py@@ -118,6 +118,8 @@ def _context_compressor_lines(agent, ctx, used: int) -> list[str]:"""/context full view: auto-compression threshold/headroom, compression count + last savings,and cumulative throughput (labelled as throughput, NOT context size)."""lines: list[str] = []+ from agent.context_breakdown import context_display_source+ mark = "~" if context_display_source(ctx) != "provider_usage" else ""threshold = _n(ctx, "threshold_tokens")threshold_pct = f"{_n(ctx, 'threshold_percent') * 100:.0f}"if threshold > 0:@@ -126,7 +128,7 @@ def _context_compressor_lines(agent, ctx, used: int) -> list[str]:threshold_pct=threshold_pct))else:lines.append(t("gateway.context.threshold", threshold=_fmt(threshold),- threshold_pct=threshold_pct, to_go=_fmt(threshold - used)))+ threshold_pct=threshold_pct, to_go=mark + _fmt(threshold - used)))compressions = _n(ctx, "compression_count")lines.append(t("gateway.context.compressions", count=compressions))savings = getattr(ctx, "_last_compression_savings_pct", None) if compressions else None@@ -501,7 +503,7 @@ class GatewayStatusCommandsMixin:if label.endswith(f"breakdown_cat_{cat_id}"): # missing key: t() echoes it backlabel = str(cat.get("label") or cat_id)pct = round(tokens / total * 100) if total else 0- out.append(t("gateway.usage.breakdown_line", label=label, count="~" + _fmt(tokens), pct=f"~{pct}"))+ out.append(t("gateway.usage.breakdown_line", label=label, count=_fmt(tokens), pct=f"~{pct}"))return out if len(out) > 1 else []except Exception:return []