perf(cursor): stop tracing the per-event account usage hash#31017

merged1
main
perf/cursor-account-hash-untraced
opened3d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 16h ago

Cursor usage scans hash every billed event (accountUsage.ts: page-overlap keys and per-event identity keys), and accountHash was a traced Effect.fn, so every hash exported its own span. In the last 24 h the dev servers on fs-42/43 ran 14 readCursorAccountUsage scans and exported 53,724 accountHash spans, about 3,800 per scan and 2,442 per instance-hour. That made it the most frequent span on those hosts, ahead of ScheduledTaskService.runDueTasks (824/h). Each span is ~0 ms of work, so the cost is pure tracing overhead and telemetry volume on every machine whose user has Cursor signed in.

accountHash is now Effect.fnUntraced, with a one-line reason, as AGENTS.md asks for per-item loops (same approach as #29758 for the live coalescer). The scan stays visible through readCursorAccountUsage and CursorAccountUsage.readPage. Behavior is unchanged, so there is no new test. The existing Cursor usage tests pass under vp run check:changed.

Opus 5.5 via Claude Code (T3 Code daily performance check-in).

πŸ€– Generated with Claude Code

Checks

25 successful Β· 12 skipped
All checks passed
0aa4282

Added 1 commit

  • perf(cursor): stop tracing the per-event account usage hash0aa4282
Synced from GitHub

Approvability

Verdict: Approved at 0aa4282

Macroscope's review found this PR approvable β€” Removes per-hash tracing overhead from Cursor usage scans while preserving scan and page tracing. Hashing and usage-record behavior remain unchanged, so the impact is limited to internal telemetry.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Explain Change β†’

No actionable comments were generated in the recent review.

Walkthrough

accountHash now uses Effect.fnUntraced instead of the named Effect.fn("accountHash") wrapper. Its input and hashing behavior remain unchanged.

Changes: Account hashing

Layer / File(s)Summary
Update the accountHash wrapper
packages/provider-cursor/src/server/accountUsage.ts
accountHash uses Effect.fnUntraced. Its input and hashing implementation remain unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Refactor

Suggested labels: size:XS

Suggested reviewers: serhiyhvala, macroscopeapp

Merge Risk: External image Minimal Β· up to 0aa42

No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: disabling tracing for the per-event Cursor account usage hash.
Description checkPassedThe description explains the tracing overhead, the code change, the preserved scan-level tracing, the absence of behavior changes, and the verification performed. It also gives a focused rationale for…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the tracing overhead, the code change, the preserved scan-level tracing, the absence of behavior changes, and the verification performed. It also gives a focused rationale for this small fix, although it does not use the template headings explicitly.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between 9e85538535c8553901351112ab02dd1dd62db5ee and 0aa4282a731f45e8ac912d0a840791fd419159b3.

External image Files selected for processing: 1
  • packages/provider-cursor/src/server/accountUsage.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Synced from GitHub

Thread transfer impact

βœ… Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiBβœ…
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiBβœ…
CodexLive turn WebSocket decoded21.5 KiB21.5 KiB0 B (0.0%)24.4 KiBβœ…
CodexLive turn messages110 (0.0%)8βœ…
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiBβœ…
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiBβœ…
ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiBβœ…
ClaudeLive turn messages110 (0.0%)8βœ…

Baseline: 9e85538 Β· PR result: 0aa4282 Β· Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.