Address PR-review findings for Cost View and Copilot prompt parsing#94
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add Cost view for token spend and context buildup in Copilot Chat sessions
Add Cost view: token spend & context buildup for Copilot Chat sessions
May 11, 2026
Copilot
AI
changed the title
Add Cost view: token spend & context buildup for Copilot Chat sessions
Add Cost view mockup screenshot for PR review
May 11, 2026
Copilot
AI
changed the title
Refine Cost view mockup styling
Add Cost view for Copilot prompt token spend
May 11, 2026
Copilot
AI
changed the title
Add Cost view for Copilot prompt token spend
Add cost pricing for GPT 5.x and Claude model aliases
May 11, 2026
Copilot
AI
changed the title
Add cost pricing for GPT 5.x and Claude model aliases
Fix PR review findings for Cost view
May 11, 2026
Copilot
AI
changed the title
Fix PR review findings for Cost view
Address PR-review findings for Cost View and Copilot prompt parsing
May 13, 2026
jayparikh
approved these changes
May 15, 2026
There was a problem hiding this comment.
Pull request overview
This PR closes prior review findings around the new Cost View and Copilot prompt-export parsing by tightening cost/token accounting, improving copy/format support strings, expanding model pricing coverage, and adding regression tests.
Changes:
- Adds Cost View UI + supporting aggregation logic (per-call spend, cache miss heuristics, context composition).
- Adds VS Code Copilot prompt-export parsing (“copilot-prompts”) with display-safe truncation + metadata totals.
- Expands pricing support to OpenAI/Copilot models and improves model-name normalization; adds targeted tests and docs updates.
Show a summary per file
| File | Description |
|---|---|
| src/lib/sessionTypes.ts | Extends SessionFormat with copilot-prompts. |
| src/lib/sessionParsing.ts | Updates parse failure “supported formats” message. |
| src/lib/pricing.js | Adds OpenAI/Copilot pricing, normalizes model names, adjusts cached-input cost calculation. |
| src/lib/pricing.d.ts | Adds TS declarations for pricing.js exports. |
| src/lib/parseSession.ts | Routes detection/parsing for Copilot prompt-export JSON. |
| src/lib/costAnalysis.js | Adds per-call cost/context/cache-miss aggregation helpers for Cost View. |
| src/lib/copilotCostParser.ts | Implements prompt-export parser, usage extraction, context breakdown, truncation behavior. |
| src/lib/commandPalette.js | Registers “Cost View” in the command palette. |
| src/hooks/useKeyboardShortcuts.js | Adds keyboard shortcut 6 for Cost View and shifts Coach to 7. |
| src/components/ShortcutsModal.jsx | Updates shortcuts legend to match new view ordering. |
| src/components/CostView.jsx | Adds Cost View UI (summary cards + cost/context bars + cache miss annotations). |
| src/components/app/constants.js | Registers cost in APP_VIEWS. |
| src/App.jsx | Lazy-loads and renders Cost View for activeView === "cost". |
| src/tests/pricing.test.js | Updates pricing expectations and adds cached-input + normalization + GPT pricing tests. |
| src/tests/keyboardShortcuts.test.js | Verifies new view shortcut mapping (6=cost, 7=coach). |
| src/tests/costView.test.jsx | Adds Cost View rendering coverage (empty + cache-miss annotation). |
| src/tests/costAnalysis.test.js | Adds unit tests for cost analysis aggregation + cache miss detection. |
| src/tests/copilotCostParser.test.ts | Adds parser routing/normalization tests + truncation regression coverage. |
| src/tests/autonomyMetrics.test.js | Adjusts cost estimation expectations for priced vs unpriced non-Claude models. |
| README.md | Updates feature description, view list, shortcuts, formats table, and adds Cost View section. |
| CLAUDE.md | Updates architecture/file tree references for Cost View and prompt-export parser. |
Copilot's findings
- Files reviewed: 20/21 changed files
- Comments generated: 7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Bug Fix
What was the bug?
This branch still had unresolved review findings after introducing Cost View and Copilot prompt-export parsing. The follow-up request was to run PR review and close all actionable issues.
How did you fix it?
Dead-code cleanup in cost analysis
Removed unused recommit constants/fields fromsrc/lib/costAnalysis.jsso analysis output only contains consumed fields.Cost View copy aligned to actual behavior
Updated Cost View helper text insrc/components/CostView.jsxto consistently describe cache misses.Parser truncation correctness + clarity
Refined truncation logic insrc/lib/copilotCostParser.tsto guarantee display strings cap at the intended length (including ellipsis), and renamed constants/helpers for display-specific intent.Missing coverage added
Addedsrc/__tests__/costView.test.jsxand extendedsrc/__tests__/copilotCostParser.test.tswith a long-prompt truncation regression case.Testing
Scope includes targeted regression coverage for: