Skip to content

fix: restore chat workflow response headers#33

Draft
cursor[bot] wants to merge 2 commits intomainfrom
cursor/sentry-issue-regression-0f1e
Draft

fix: restore chat workflow response headers#33
cursor[bot] wants to merge 2 commits intomainfrom
cursor/sentry-issue-regression-0f1e

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 14, 2026

Description

Fixes a regression in WEBVITALS-2Y.

  • Root cause: /api/chat relied on mutating the Response after createUIMessageStreamResponse(...) returned, but the current streaming stack requires the workflow resume header to be present on the initial response. WorkflowChatTransport hard-fails when x-workflow-run-id is missing, so the client threw before it could continue streaming. The same route had also regressed the earlier BotID hardening and could return false-positive 403s when BotID verification headers were missing.
  • Regression vector: The workflow migration in f47826b introduced the header contract, and 9fd107e later simplified /api/chat in a way that removed the safer BotID exception handling from PR Improve robustness of BotID check by handling exceptions #9 / commit cd8bf49d55ca1b89ed96b8422c6afc30ebe74751.
  • Fix: Restore the Vercel-only checkBotId() guard with exception handling in /api/chat, and pass x-workflow-run-id directly via createUIMessageStreamResponse({ headers, stream }) so the header is present when the transport inspects the response.

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring

Checklist

  • Tested locally
  • Types pass (pnpm check-types)
  • Linting passes (pnpm lint)

Sentry Context

Verification

Manual browser/replay validation and screenshot capture were not available in this automation environment. Verified locally by:

  • starting pnpm dev
  • requesting POST /api/chat with the same payload shape the frontend sends
  • confirming a 200 OK streaming response with x-workflow-run-id: wrun_01KP6P7R9NEQQF53QFAW9WHK8S
  • confirming the body streamed UI message chunks normally

Test plan

  • Type checker passes
  • Linter passes
  • Affected code path manually verified in browser

Note: pnpm lint still fails on unrelated pre-existing Biome issues elsewhere in the repo (broken symlink under .claude/skills, existing noExplicitAny, noNonNullAssertion, import-order, and formatting findings outside this patch).

Open in Web View Automation 

cursoragent and others added 2 commits April 14, 2026 19:05
Restore the safer BotID handling in /api/chat so missing verification headers do not block legitimate browsers. Pass x-workflow-run-id when creating the streaming response so WorkflowChatTransport consistently receives the workflow resume header it requires.

Fixes WEBVITALS-2Y
Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Sergiy Dybskiy <s@serg.tech>
Apply the repository formatter to the /api/chat regression fix so lint output reflects only pre-existing repository issues.

Refs WEBVITALS-2Y
Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Sergiy Dybskiy <s@serg.tech>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webvitals-com Ready Ready Preview, Comment Apr 14, 2026 7:09pm

Request Review

@cursor cursor Bot mentioned this pull request Apr 18, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant