Skip to content

chore: send standard identity headers on cy-prompt/studio session requests - #34039

Merged
ryanthemanuel merged 1 commit into
developfrom
cy-prompt-studio-session-telemetry-headers
Jun 9, 2026
Merged

chore: send standard identity headers on cy-prompt/studio session requests#34039
ryanthemanuel merged 1 commit into
developfrom
cy-prompt-studio-session-telemetry-headers

Conversation

@ryanthemanuel

@ryanthemanuel ryanthemanuel commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Why

The cloud recording-service attributes traffic on its Honeycomb request spans using headers the client sends (x-cypress-version, x-os-name, x-machine-id, …). The cy-prompt and studio session requests (which resolve the app bundle URLs) only sent Content-Type, x-os-name, and x-cypress-version — so x-machine-id was 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

  • Add 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-id falls back to '' when unavailable, matching CloudDataSource/VersionsDataSource.
  • Use it in post_cy_prompt_session.ts and post_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.
  • Headers are resolved once before the retry loop, so the machine id isn't re-read on each attempt.

Notes

  • There is no separate capture-protocol session request — the protocol bundle URL is returned from the studio session — so no protocol-specific change is needed.
  • The companion cloud-side PR (cypress-services) reads x-machine-id automatically once it arrives (it's already in the recording-service header allowlist).

Testing

  • packages/server unit 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, including x-machine-id (empty string when unavailable).

post_cy_prompt_session and post_studio_session drop inline os/pkg header construction and merge Content-Type with 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 getStandardHeaders in the session specs.

Reviewed by Cursor Bugbot for commit a256ea1. Bugbot is set up for automated code reviews on this repo. Configure here.

…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>
@ryanthemanuel
ryanthemanuel merged commit ada42a7 into develop Jun 9, 2026
84 checks passed
@ryanthemanuel
ryanthemanuel deleted the cy-prompt-studio-session-telemetry-headers branch June 9, 2026 06:32
@cypress-bot

cypress-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Released in 15.17.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v15.17.0, please open a new issue.

@cypress-bot cypress-bot Bot locked as resolved and limited conversation to collaborators Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants