Skip to content

fix(#172): bridge pricing fallback + dashboard filter for agent_turn spans#173

Merged
arniesaha merged 1 commit intomainfrom
fix/bridge-cost-fallback
Apr 17, 2026
Merged

fix(#172): bridge pricing fallback + dashboard filter for agent_turn spans#173
arniesaha merged 1 commit intomainfrom
fix/bridge-cost-fallback

Conversation

@arniesaha
Copy link
Copy Markdown
Owner

Summary

  • Adds a TS pricing table in plugins/openclaw-agentweave-bridge/src/pricing.ts mirroring sdk/python/agentweave/pricing.py, with a resolveCost() that falls back to the local table when OpenClaw returns costUsd=0 (e.g. MiniMax).
  • Widens dashboard/src/lib/queries.ts::tempoSearchQuery to include agent_turn spans that carry prov.llm.model, so bridge-routed calls show up in the LLM Calls and Total Cost StatCards.

Closes #172

Test plan

  • npm test in the plugin → 19 passed (11 new pricing tests + 8 existing).
  • tsc --noEmit in dashboard → clean (pre-existing unrelated error in plugin index.ts confirmed on main, not introduced here).
  • Widened Tempo filter verified live against the NAS Tempo, matches both llm_call (claude-opus-4-7) and agent_turn (MiniMax) traces.
  • After merge + bridge update + dashboard redeploy: confirm a new MiniMax span emits cost.usd > 0 and the Total Cost card reflects it.

🤖 Generated with Claude Code

…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>
@arniesaha arniesaha merged commit 24d2626 into main Apr 17, 2026
5 checks passed
@arniesaha arniesaha deleted the fix/bridge-cost-fallback branch April 17, 2026 11:34
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.

Dashboard Total Cost + LLM Calls miss bridge-routed models (MiniMax shows 0)

1 participant