Skip to content

fix(vscode): restore usage footers when reopening chats - #1098

Open
RRXXZZYY wants to merge 1 commit into
Nano-Collective:mainfrom
RRXXZZYY:fix/1097-persist-response-usage
Open

fix(vscode): restore usage footers when reopening chats#1098
RRXXZZYY wants to merge 1 commit into
Nano-Collective:mainfrom
RRXXZZYY:fix/1097-persist-response-usage

Conversation

@RRXXZZYY

Copy link
Copy Markdown

Description

Closes #1097.

Saved ACP messages now keep the completed turn's token usage and optional estimated cost on the matching assistant message. History replay emits that metadata after the response, and the VS Code panel reuses its existing usage-footer renderer, so reopening a chat restores the same token/cost line shown live.

The field is optional, so existing session files without usage metadata continue to load unchanged.

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 behavior includes passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover persistence, replay/rendering, and the no-new-assistant guard

Passed locally:

  • pnpm test:format
  • pnpm test:types
  • pnpm test:types:vscode
  • pnpm test:lint
  • pnpm test:knip (existing configuration hint only)
  • pnpm test:changesets
  • Five focused AVA regression tests
  • pnpm test:audit
  • pnpm run build
  • pnpm --dir plugins/vscode run build
  • git diff --check

The full AVA run was not green on this Windows checkout: it reported 20 hook failures, 80 test failures, 2 skipped tests, and 1 uncaught exception. The observed failures were in existing Windows path, IPC, permission, cross-device temp-file, and missing-built-CLI cases; all five new regression tests passed. Semgrep was not installed, so the repository script's documented optional security-scan fallback applies.

Manual Testing

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

No live provider was exercised; this change is limited to post-response session persistence and local history replay.

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (changeset added; no user documentation change needed)
  • No breaking changes
  • Logging considered; no new log path is needed for metadata persistence/replay

AI assistance

AI assistance was used for implementation and test drafting. I reviewed the final diff, ran the checks above, and verified that the PR contains only the scoped fix and regression coverage.

@RRXXZZYY
RRXXZZYY force-pushed the fix/1097-persist-response-usage branch from a03d38d to 039b3ae Compare August 31, 2026 19:33
@github-actions github-actions Bot added the area:vscode VS Code extension and host integration label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:vscode VS Code extension and host integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Token counts and costs are lost when loading chat history

1 participant