Repository navigation
fix(ci): Only post the token cost comment when the MCP surface changes - #2533
Merged
Merged
Conversation
The Token Cost workflow runs on any pnpm-lock.yaml change, and since #2413 it comments on every run, so CLI-only PRs that touch the lockfile get an MCP token cost report. Move the comment step into scripts/token-cost-comment.mjs. It now comments only when token-stats.json or ui-stats.json differ from main's last artifact, which also catches view-only changes. An existing comment is still updated on each run so it never shows stale numbers. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2b9d19c. Configure here.
The download step matches the artifact name by regex, so it unpacks main's stats into main-stats/token-stats-<sha>/. The comment script read main-stats/ directly, never found a baseline, and so never created a comment.
BYK
approved these changes
Nov 26, 2026
BYK
pushed a commit
that referenced
this pull request
Nov 26, 2026
…ript (#2535) Follow-up to review feedback on #2533. `scripts/token-cost-comment.mjs` now reads the stats files and lists main's artifact folder directly, and treats `ENOENT` as missing instead of checking `existsSync` first. This skips the separate existence check and its check-then-read race, and any other read error still throws. Nothing else changes. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A2c41e4487a01112f529e2132 --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3A2c41e4487a01112f529e2132) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A2c41e4487a01112f529e2132/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
This was referenced Nov 26, 2026
This branch was successfully deployed
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.

token-cost.ymlruns on any change to the rootpnpm-lock.yaml,package.json, orpnpm-workspace.yaml. Since #2413 removed the "token count changed" guard, the workflow also comments on every run, so CLI-only PRs that touch the lockfile (such as #2507) get an MCP token cost report.This PR moves the comment step into
scripts/token-cost-comment.mjs, which decides what to do:token-stats.jsonorui-stats.jsondiffer from main's last artifact. Checkingui-stats.jsonkeeps what feat(mcp): Render Sentry time series charts inline in MCP Apps hosts #2413 wanted: a view change still gets reported even when the tool token count stays the same. Per-tool changes that keep the same total also count now.It also paginates
listComments. The old step read only the first 30 comments, so on busy PRs it could post a duplicate report.The path filters are unchanged. A real dependency bump can still change the MCP output, so lockfile changes should keep triggering the measurement and the
Token Costcheck run. They just stay quiet when the measurement matches main.via @BYK.
--
View Session [Sentry]