Skip to content

fix(insights): hide cache read/write and cost metrics from display#11477

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-7c91386d
Apr 17, 2026
Merged

fix(insights): hide cache read/write and cost metrics from display#11477
teknium1 merged 1 commit into
mainfrom
hermes/hermes-7c91386d

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

The /insights output was showing three metrics that were unreliable:

  • Cache read tokens and Cache write tokens (overview row)
  • Est. cost (overview + gateway)
  • The per-model Cost column in the Models Used table (same pricing engine)

This PR hides all of them from the display layer only. The underlying data
is preserved — cache_read_tokens, cache_write_tokens, and
estimated_cost_usd continue to be stored per-session, and other surfaces
that read those fields (web server dashboard, /usage command, status bar,
state DB) are untouched.

Changes

agent/insights.py:

  • format_terminal: drop the Cache read / Cache write row, drop Est. cost
    from the Total tokens line, drop the per-model Cost column, drop the
    * Cost N/A for custom/self-hosted footnote.
  • format_gateway: drop the cache-token breakdown from the Tokens line, drop
    the Est. cost line, drop the per-model cost suffix.

tests/agent/test_insights.py:

  • Flip three display assertions to not in, renamed accordingly
    (test_terminal_format_hides_cost_for_custom_models,
    test_gateway_format_hides_cost).

Test plan

  • pytest tests/agent/test_insights.py — 54/54 pass
  • E2E rendered a mixed-model report (Opus + GPT + custom); confirmed no
    Cache read, no Cache write, no $, no Est. cost, no Cost column
    appear in either terminal or gateway output. Tokens / models / platforms /
    activity sections all still render.

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
@teknium1 teknium1 merged commit e33cb65 into main Apr 17, 2026
5 checks passed
@teknium1 teknium1 deleted the hermes/hermes-7c91386d branch April 17, 2026 08:02
francip added a commit to kortexa-ai/hermes-agent that referenced this pull request Apr 20, 2026
- test_insights.TestGatewayFormatting.test_gateway_format_hides_cost:
  PR NousResearch#11477 hid cost/cache from format_gateway but only updated the
  terminal-formatting test. The gateway test was renamed (``hides_cost``)
  but its assertions still required ``$`` and ``Est. cost`` to be present.
  Flip them to match the new behavior.

- test_config.TestCustomProviderCompatibility: PR NousResearch#9332 re-ordered the
  provider URL-field priority to ``base_url > url > api`` (was api first).
  Rename to ``_prefers_base_url_then_url_then_api`` and flip the expected
  URL.

- test_browser_camofox_state.test_config_version_matches_current_schema:
  ``DEFAULT_CONFIG["_config_version"]`` was bumped 20 → 21 (as the test's
  own comment anticipates). Bump the expected value.

- test_interrupt_propagation._make_bare_agent: bare agents constructed via
  ``__new__`` were missing attrs now read by ``_compute_stale_timeout`` →
  ``_interruptible_api_call``. Add ``provider``, ``model``, ``_base_url``,
  ``_base_url_lower``.
Scorpion1221 pushed a commit to Scorpion1221/hermes-agent that referenced this pull request Apr 24, 2026
* merge-upstream-2026-04-17: (243 commits)
  fix(feishu): reduce CardKit streaming frequency and add backoff on errors
  fix(feishu): refine CardKit streaming card polish
  fix(feishu): prevent double finalize and add loading spinner icon
  fix(feishu): fix /stop regression and streaming card finalization
  feat(feishu): add CardKit streaming card output
  feat(feishu): split inbound policy and comment flow
  fix(feishu): fetch merge-forward submessages eagerly
  feat(feishu): add drive comment routing
  feat(feishu): add sender cache and rollout sync
  fix(feishu): hide opaque sender ids in merge forwards
  fix(feishu): prefer embedded sender names
  feat(feishu): add inbound bridge and media index
  refactor(feishu): extract inbound parse module
  feat(feishu): preserve merge-forward media context
  feat(feishu): hydrate quoted merge forwards
  fix(gateway): persist canonical quoted context
  feat(feishu): add inbound quoted context pipeline
  fix(feishu): render outbound messages as Card 2.0 for full markdown support
  test: remove 169 change-detector tests across 21 files (NousResearch#11472)
  fix(insights): hide cache read/write and cost metrics from display (NousResearch#11477)
  ...
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…ousResearch#11477)

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…ousResearch#11477)

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ousResearch#11477)

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ousResearch#11477)

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ousResearch#11477)

The cache-read, cache-write, and total estimated-cost values shown in
/insights (and the per-model Cost column) were unreliable. Hide them from
both terminal and gateway renderings.

The underlying data pipeline is untouched — sessions still store
cache_read_tokens, cache_write_tokens, and estimated_cost_usd; the web
server, /usage command, and status bar are unaffected. Only the
InsightsEngine display layer is trimmed.

Changes:
- format_terminal: drop 'Cache read / Cache write' line, drop 'Est. cost'
  from the Total tokens row, drop per-model 'Cost' column, drop the
  '* Cost N/A for custom/self-hosted' footnote.
- format_gateway: drop cache breakdown from Tokens line, drop 'Est. cost'
  line, drop per-model cost suffix.
- Tests updated to assert these strings are now absent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant