Skip to content

fix: restore chat workflow run header#35

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

fix: restore chat workflow run header#35
cursor[bot] wants to merge 2 commits intomainfrom
cursor/sentry-issue-regression-d433

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 18, 2026

Description

Fixes a regression in WEBVITALS-2W.

  • Root cause: /api/chat returned a UI stream response and then mutated the Response headers afterward. With the current workflow transport stack, WorkflowChatTransport needs x-workflow-run-id on the initial response immediately; when that header is missing, the client later fails during stream continuation with TypeError: Failed to fetch.
  • Regression vector: the workflow migration introduced the run-header contract, but main still had the pre-fix app/api/chat/route.ts implementation instead of the earlier repair shipped in PR fix: restore chat workflow response headers #33 for the same workflow/BotID bug family. This left the current release (3dad06a481817bc715ba83934de828125c64fb2c) without that fix.
  • Fix: restore the Vercel-only checkBotId() guard with exception tolerance and pass x-workflow-run-id directly via createUIMessageStreamResponse({ headers, stream }).

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring

Checklist

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

Sentry Context

Verification

Direct browser automation and screenshot capture were not available in this environment, so verification was done at the HTTP stream layer instead.

  • Started pnpm dev
  • Sent the same POST /api/chat payload shape the frontend uses
  • Confirmed 200 OK with content-type: text/event-stream
  • Confirmed the response now includes x-workflow-run-id: wrun_01KPFXDVSGS7M5G2TVB05R5QGP
  • Confirmed the body streamed UI message chunks (start, start-step, tool input/output events) instead of failing before resume metadata was available
  • Ran pnpm check-types successfully

Test plan

  • Type checker passes
  • Linter passes
  • Affected code path verified via local streaming request

pnpm lint still fails on unrelated baseline issues elsewhere in the repo (broken symlink under .claude/skills, existing import-order/formatting/test warnings, and pre-existing style findings outside this patch).

Open in Web View Automation 

cursoragent and others added 2 commits April 18, 2026 09:03
The chat API regressed to mutating the streaming response after creation, which left WorkflowChatTransport without the workflow resume header it expects on the initial response. Restore the earlier Vercel-only BotID guard and provide x-workflow-run-id when creating the stream response so reconnects can continue instead of failing with a client-side fetch error.

Fixes WEBVITALS-2W

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Sergiy Dybskiy <s@serg.tech>
Apply the repository formatter to the chat workflow regression fix so lint output reflects baseline repository issues instead of this patch.

Refs WEBVITALS-2W

Co-Authored-By: Claude <noreply@anthropic.com>

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

vercel Bot commented Apr 18, 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 18, 2026 9:09am
webvitals.com Ready Ready Preview, Comment Apr 18, 2026 9:09am

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