fix: restore chat workflow response headers#33
Draft
cursor[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
10 tasks
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-2Y.
/api/chatrelied on mutating theResponseaftercreateUIMessageStreamResponse(...)returned, but the current streaming stack requires the workflow resume header to be present on the initial response.WorkflowChatTransporthard-fails whenx-workflow-run-idis 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.f47826bintroduced the header contract, and9fd107elater simplified/api/chatin a way that removed the safer BotID exception handling from PR Improve robustness of BotID check by handling exceptions #9 / commitcd8bf49d55ca1b89ed96b8422c6afc30ebe74751.checkBotId()guard with exception handling in/api/chat, and passx-workflow-run-iddirectly viacreateUIMessageStreamResponse({ headers, stream })so the header is present when the transport inspects the response.Type of Change
Checklist
pnpm check-types)pnpm lint)Sentry Context
3dad06a481817bc715ba83934de828125c64fb2ccd8bf49d55ca1b89ed96b8422c6afc30ebe74751for the BotID false-positive branch; the MCP issue data did not expose a prior resolution marker for the missing header branch.Verification
Manual browser/replay validation and screenshot capture were not available in this automation environment. Verified locally by:
pnpm devPOST /api/chatwith the same payload shape the frontend sends200 OKstreaming response withx-workflow-run-id: wrun_01KP6P7R9NEQQF53QFAW9WHK8STest plan
Note:
pnpm lintstill fails on unrelated pre-existing Biome issues elsewhere in the repo (broken symlink under.claude/skills, existingnoExplicitAny,noNonNullAssertion, import-order, and formatting findings outside this patch).