fix(vscode): restore usage footers when reopening chats - #1098
Merged
will-lamerton merged 3 commits intoSep 6, 2026
Merged
Conversation
RRXXZZYY
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
August 31, 2026 12:30
RRXXZZYY
force-pushed
the
fix/1097-persist-response-usage
branch
from
August 31, 2026 19:33
a03d38d to
039b3ae
Compare
Resolves the conflict in source/acp/acp-agent.ts against Nano-Collective#1071, which moved the turn claim (session.beginTurn()) and the try/catch above the async prompt setup. Keeps main's structure and re-applies this branch's two changes inside it: the previousAssistant snapshot before the user message is appended, and capturing the runAcpConversation response so attachResponseUsage can stamp it before the finally block persists the session.
The arrow-key test slept 20ms after each stdin.write and asserted on the next frame. A keypress reaches Ink through stdin, so the re-render lands on a later tick that a fixed sleep cannot bound, and on a loaded CI runner the second arrow press was still unrendered when the assertion ran: Value must match expression /\[all-time\]/ Range 7d | [3m] | all-time Poll for the expected frame instead, with a 2s ceiling that still fails loudly if the keypress never lands. Pre-existing flake from Nano-Collective#963, unrelated to this branch, but it blocked this PR's Unit Tests check.
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Passed locally:
pnpm test:formatpnpm test:typespnpm test:types:vscodepnpm test:lintpnpm test:knip(existing configuration hint only)pnpm test:changesetspnpm test:auditpnpm run buildpnpm --dir plugins/vscode run buildgit diff --checkThe 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
No live provider was exercised; this change is limited to post-response session persistence and local history replay.
Checklist
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.