Vote for your favorite SkillMD. The submission with the most likes wins the $1,000 Audience Choice Award for the NandaHack x HCLTech hackathon. Voting is open through September 25.Vote now →
in reviewhumanPR #194Transport

Fix dashboard: render all panels on file load, and correct >100% success rate

Two independent bug fixes in apps/dashboard/index.html, both affecting any scenario opened via nest dashboard <trace.jsonl> (not specific to any one scenario). No behavior change to scenarios, plugins, or the CLI — this is display-only.

Author

Status
In review
Opened on
Jul 11
Branch
fix/dashboard-render-and-success-rate

Description

The pitch.

Two independent bug fixes in `apps/dashboard/index.html`, both affecting any scenario opened via `nest dashboard <trace.jsonl>` (not specific to any one scenario). No behavior change to scenarios, plugins, or the CLI — this is display-only.

## 1. Agent Stats / Metrics / Benchmark / Leaderboard render blank on the `nest dashboard <file>` path

**Symptom:** launching `nest dashboard traces/<something>.jsonl` shows the Timeline and (after a tab click) the Message Flow graph, but the **Agent Stats, Metrics, Benchmark, and Leaderboard tabs stay permanently empty**. Uploading the same file via drag-and-drop works.

**Cause:** the CLI injects the trace and calls `parseAndRender()` from the middle of the IIFE, *before* the module-level `const var_red` and `let sortCol`/`sortAsc` declarations execute. `renderGraph` and `renderTable` throw a temporal-dead-zone `ReferenceError`, and because `renderAll` runs the panels back-to-back with no isolation, every panel after the throw never renders. Only the graph recovers, via its render-on-tab-click hook.

**Fix:**
- Defer the injected-trace auto-load to the end of the IIFE, after all declarations are initialized.
- Isolate each step in `renderAll` with try/catch so one panel's failure can't blank the others.
- Re-render any panel on tab-click (not just the graph), so a panel always reflects the current trace when opened.

## 2. Success Rate can exceed 100%

**Symptom:** scenarios whose agents self-schedule messages (timer wake-ups via `ctx.schedule`) or fan out show a **Success Rate above 100%** (e.g. 185.5%) and an inflated composite Score.

**Cause:** `successRate = receives / (sends + broadcasts)`. Self-scheduled and fan-out receives have no matching send, so `receives` can exceed `sends`, pushing the ratio over 100%.

**Fix:** derive success rate from the send↔receive **correlation pairs** the dashboard already builds for latency — `delivered = corr groups having both a send and a matching receive`, over sends that carry a corr id. This is always ≤100%, and correctly *lowers* the rate when a send has no delivery (message loss). Falls back to a clamped `receives/sends` only for traces with no correlation ids. The "X of Y delivered" caption is updated to the matching denominator.

## Verification

- A scenario with self-scheduled agents: Success Rate 185.5% → **100.0%** (55 of 55 delivered); all four previously-blank tabs now populate at load.
- Built-in `marketplace`: Success Rate unchanged at **100%** (1000/1000) — no regression to existing scenarios.
- The existing package test suite is unaffected (the dashboard is a static asset under `apps/`, not covered by `packages/*` tests).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/194/head:pr-194
git checkout pr-194