fix: restore chat workflow run header#35
Draft
cursor[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes a regression in WEBVITALS-2W.
/api/chatreturned a UI stream response and then mutated theResponseheaders afterward. With the current workflow transport stack,WorkflowChatTransportneedsx-workflow-run-idon the initial response immediately; when that header is missing, the client later fails during stream continuation withTypeError: Failed to fetch.mainstill had the pre-fixapp/api/chat/route.tsimplementation 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.checkBotId()guard with exception tolerance and passx-workflow-run-iddirectly viacreateUIMessageStreamResponse({ headers, stream }).Type of Change
Checklist
pnpm check-types)pnpm lint)Sentry Context
3dad06a481817bc715ba83934de828125c64fb2cfix: restore chat workflow response headers); Sentry MCP did not expose issue activity history with a direct resolution marker for WEBVITALS-2W.Verification
Direct browser automation and screenshot capture were not available in this environment, so verification was done at the HTTP stream layer instead.
pnpm devPOST /api/chatpayload shape the frontend uses200 OKwithcontent-type: text/event-streamx-workflow-run-id: wrun_01KPFXDVSGS7M5G2TVB05R5QGPstart,start-step, tool input/output events) instead of failing before resume metadata was availablepnpm check-typessuccessfullyTest plan
pnpm lintstill 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).