fix(#172): bridge pricing fallback + dashboard filter for agent_turn spans#173
Merged
fix(#172): bridge pricing fallback + dashboard filter for agent_turn spans#173
Conversation
…spans Two compounding bugs caused MiniMax calls to show 0 in the dashboard Total Cost / LLM Calls cards even after #171 added MiniMax to the Python pricing table: 1. openclaw-agentweave-bridge copied OpenClaw's model.usage.costUsd verbatim. OpenClaw doesn't know MiniMax pricing and reports 0, so spans landed in Tempo with cost.usd=0. The Python compute_cost() is never in the bridge's code path. 2. dashboard tempoSearchQuery filtered on prov.activity.type = "llm_call", but bridge-emitted spans have activity.type = "agent_turn". Those spans were excluded from traceRows even though the Prometheus chart (using span metrics, no activity filter) still showed them. Adds plugins/openclaw-agentweave-bridge/src/pricing.ts mirroring the Python table (MiniMax + Anthropic + OpenAI + Codex aliases). resolveCost() prefers a positive upstream value and falls back to the local table when upstream is 0 / negative / NaN. Widens the dashboard filter to also match agent_turn spans with a non-empty prov.llm.model. Closes #172 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plugins/openclaw-agentweave-bridge/src/pricing.tsmirroringsdk/python/agentweave/pricing.py, with aresolveCost()that falls back to the local table when OpenClaw returnscostUsd=0(e.g. MiniMax).dashboard/src/lib/queries.ts::tempoSearchQueryto includeagent_turnspans that carryprov.llm.model, so bridge-routed calls show up in the LLM Calls and Total Cost StatCards.Closes #172
Test plan
npm testin the plugin → 19 passed (11 new pricing tests + 8 existing).tsc --noEmitin dashboard → clean (pre-existing unrelated error in pluginindex.tsconfirmed on main, not introduced here).llm_call(claude-opus-4-7) andagent_turn(MiniMax) traces.cost.usd > 0and the Total Cost card reflects it.🤖 Generated with Claude Code