Skip to content

fix(acp): use formatCompactTokenCount for subagent activity card toke… - #1165

Open
rohanshrma222 wants to merge 2 commits into
Nano-Collective:mainfrom
rohanshrma222:tokencount
Open

fix(acp): use formatCompactTokenCount for subagent activity card toke…#1165
rohanshrma222 wants to merge 2 commits into
Nano-Collective:mainfrom
rohanshrma222:tokencount

Conversation

@rohanshrma222

@rohanshrma222 rohanshrma222 commented Sep 3, 2026

Copy link
Copy Markdown

Description

Fixes the subagent activity card in the ACP (VS Code extension) integration showing imprecise token counts. It previously computed Math.floor(tokenCount / 1000) and appended k, so 1–999 tokens displayed as 0k and 1500–1999 all displayed as 1k. Now it reuses the existing formatCompactTokenCount formatter from source/usage/format.ts (already used for the per-response usage indicator), so e.g. 1900 tokens correctly shows 1.9k tokens.

Closes #1133.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:types, pnpm test:lint,ran locally, both clean)
  • Tests cover both success and error scenarios

No new test added — this is a one-line formatting fix reusing an already-tested formatter (formatCompactTokenCount, covered by existing source/usage/*.spec.ts). Verified the fix's output directly with a throwaway script against the token counts from the issue (500 → 500, 1900 → 1.9k, 12345 → 12.3k, vs. the old 0k/1k/12k).

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

This path only renders inside the ACP/VS Code extension subagent activity card and isn't reachable through the plain CLI providers above; verified via direct formatter comparison instead of a live ACP session (see Testing notes).

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed), not needed, no public API/doc surface changed
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md (../CONTRIBUTING.md#logging)) — n/a, no new logging needed for this change

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] acp-conversation.ts token count loses precision

1 participant