feat(tui): show tool and MCP schema costs (#5603) - #5611
Conversation
Add bounded per-tool catalog estimates and per-server MCP announcement totals to the context inspector without changing prompt assembly or cache behavior. Cover ordering, truncation, and empty-server cases for #5553.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Claude finished @Hmbown's task in 3m 10s —— View job Review: feat(tui): show tool and MCP schema costs (#5611)
SummaryThis PR (a rebase of #5603 onto current Findings1. Duplicate/misleading section header (correctness — posted as inline comment on 2. Provider/model/route safety — N/A. This change is purely a debug/inspector text view; it doesn't touch provider selection, model routing, or prompt/tool-catalog assembly sent to the model (the CHANGELOG entry correctly notes "without changing prompt assembly or cache behavior"). 3. Reuse/simplification — Good reuse: 4. Tests — The new 5. Security — No secret handling, shell/exec, or input-validation surface touched. VerdictOne real (non-blocking, cosmetic-but-user-facing) issue: the duplicated "Recent Tools" header / missing separator between the two sections. Everything else — the estimation approach, MCP-vs-built-in classification, row bounding, and test coverage — looks correct and consistent with existing codebase conventions. |
| }; | ||
|
|
||
| let tokens = tr(locale, MessageId::CtxInspTokens); | ||
| let tools_label = tr(locale, MessageId::CtxInspRecentTools); |
There was a problem hiding this comment.
The new Tool Schema Costs section reuses MessageId::CtxInspRecentTools ("Recent Tools") as its own header, and push_tool_schema_costs is called right after push_tools at crates/tui/src/tui/context_inspector.rs:231 with no writeln!(out) separator (every other section in build_context_inspector_text gets a blank line before it, e.g. lines 224-230).
The result: the rendered text shows two back-to-back sections both titled "Recent Tools", with the schema-cost breakdown appearing to be a continuation of the tool-activity list rather than its own section. Given the whole point of this PR is a clearly labeled schema-cost view, this undermines it.
Fix: add a new MessageId (e.g. CtxInspToolSchemaCosts) with an entry in every crates/tui/locales/*.json file, and insert a blank-line writeln!(out) before the push_tool_schema_costs call at line 231, matching the spacing convention used for the other sections.
Both red checks here are inherited from
|
|
Closing as already integrated: every hunk of this display-only #5553 slice is byte-identical on the v0.9.12 integration branch — push_tool_schema_costs/tool_schema_tokens at crates/tui/src/tui/context_inspector.rs:648-706 wired into build_context_inspector_text, MAX_SCHEMA_COST_ROWS/SCHEMA_TOKEN_DIVISOR constants, the inspector_reports_catalog_and_mcp_schema_costs_with_bounded_rows test, and both changelog bullets (CHANGELOG.md:302-304, crates/tui/CHANGELOG.md:270-272). No action needed from this PR; the rebase goal is already met. |
Rebase of @wuisabel-gif's #5603 onto current
mainafter #5604. Authorship preserved (Isabel Wu). The original fork PR conflicted on CHANGELOG after #5604 merged; this keeps both changelog bullets.Original: #5603
Verified locally:
cargo test -p codewhale-tui --lib 'tui::context_inspector' --locked→ 14 passed.No-Issue: Landing the already-reviewed #5603 slice; the display-only #5553 work is not closed by this rebase PR.