Skip to content

fix(core): stop double-prefixing step names in stats output#177

Open
abhay-codes07 wants to merge 1 commit into
rajudandigam:mainfrom
abhay-codes07:fix/stats-step-name-prefix
Open

fix(core): stop double-prefixing step names in stats output#177
abhay-codes07 wants to merge 1 commit into
rajudandigam:mainfrom
abhay-codes07:fix/stats-step-name-prefix

Conversation

@abhay-codes07

Copy link
Copy Markdown
Contributor

Summary

Fixes #172: stats printed step names with a doubled type prefix (tool:tool:retrieve-policy, llm:llm:generate-answer) while list/view showed the correct single prefix for the same run.

Root cause is in renderTraceStats (packages/core/src/stats.ts), which formatted the "Slowest steps" rows as ${stepType}:${stepName}. step.tool/step.llm already store the step name with its type prefix (tool:retrieve-policy, llm:generate-answer), so prepending the type again doubled it. Plain step() names carry no prefix, which is why logic:plan looked right. list/view render the stored name as-is, so they were unaffected.

Fix adds the type prefix only when the name does not already start with it. Tool/llm steps now show a single prefix and bare logic steps still get one.

How I verified

Repro from the issue, "Slowest steps" section, before vs after:

tool:tool:retrieve-policy   ->  tool:retrieve-policy
llm:llm:generate-answer     ->  llm:generate-answer
logic:plan                  ->  logic:plan (unchanged)

Type of change

  • Bug fix (non-breaking)
  • Documentation only
  • Example / recipe / fixture
  • Feature or enhancement (scoped)
  • Breaking change (requires major version plan)

Product boundaries

  • Local-first only, no network upload added
  • No new vendor sinks
  • No SaaS / dashboard scope added
  • schemaVersion "0.1" manual traces remain compatible
  • No step_failed event introduced
  • inspectRun default tracing behavior unchanged

Packages touched

  • @agent-inspect/core

Validation

pnpm typecheck  # pass
pnpm --filter @agent-inspect/core test -- stats  # 9 pass (incl. new render label test)

Checklist

  • Tests added or updated (renderTraceStats label test)
  • Docs updated (n/a, output formatting fix)
  • No new runtime dependencies
  • No version bump in this PR
  • No secrets, production logs, or real PII in commits

renderTraceStats printed "Slowest steps" as `${stepType}:${stepName}`,
but step.tool/step.llm already store the name with its type prefix
(e.g. "tool:retrieve-policy"), so the type was added twice:
"tool:tool:retrieve-policy". Plain step() names have no prefix, so
those were correct. list/view render the stored name as-is and were
unaffected.

Add the type prefix only when the name does not already start with it,
so tool/llm steps show a single prefix and bare logic steps still get
one, matching what list/view show for the same run.

Fixes rajudandigam#172
Copilot AI review requested due to automatic review settings July 18, 2026 07:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
agent-inspect-website Skipped Skipped Jul 18, 2026 7:59am

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.

[bug] stats double-prefixes step names in output

2 participants