chore: send standard identity headers on cy-prompt/studio session requests - #34039
Merged
Merged
Conversation
…uests The cy-prompt and studio session requests sent only Content-Type, x-os-name, and x-cypress-version, so cloud-side telemetry on these endpoints could not attribute traffic by machine (x-machine-id was absent from the spans). Add a shared getStandardHeaders() helper that returns the standard cloud identity headers (x-os-name, x-cypress-version, x-machine-id) and use it in both session helpers. Headers are resolved once before the retry loop so the machine id is not re-read on each attempt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jennifer-shehane
approved these changes
Jun 9, 2026
Contributor
|
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
The cloud
recording-serviceattributes traffic on its Honeycomb request spans using headers the client sends (x-cypress-version,x-os-name,x-machine-id, …). Thecy-promptandstudiosession requests (which resolve the app bundle URLs) only sentContent-Type,x-os-name, andx-cypress-version— sox-machine-idwas missing on those spans and per-machine attribution wasn't possible.We're investigating a volume spike on
/cy-prompt/session; machine id lets the backend tell "same machines calling repeatedly" apart from "more machines."What
packages/server/lib/cloud/api/get_standard_headers.ts— a small shared helper returning the standard cloud identity headers (x-os-name,x-cypress-version,x-machine-id).x-machine-idfalls back to''when unavailable, matchingCloudDataSource/VersionsDataSource.post_cy_prompt_session.tsandpost_studio_session.ts(previously each constructed headers inline; logic is now shared). The studio session response also carries the protocol bundle URL, so this covers capture-protocol bundle resolution too.Notes
x-machine-idautomatically once it arrives (it's already in the recording-service header allowlist).Testing
packages/serverunit specs:get_standard_headers_spec.ts(new),post_cy_prompt_session_spec.ts,post_studio_session_spec.ts— 6 passing.🤖 Generated with Claude Code
Note
Low Risk
Header-only change for observability/attribution on session endpoints; no auth or request-body behavior changes.
Overview
Introduces shared
getStandardHeaders()so cy-prompt and studio session POSTs send the same cloud identity headers as other requests, includingx-machine-id(empty string when unavailable).post_cy_prompt_sessionandpost_studio_sessiondrop inlineos/pkgheader construction and mergeContent-Typewith the helper output. Headers are resolved once before the retry loop so machine id is not re-fetched on each attempt.Unit tests cover the helper and stub
getStandardHeadersin the session specs.Reviewed by Cursor Bugbot for commit a256ea1. Bugbot is set up for automated code reviews on this repo. Configure here.