fix(hub): add PATCH to CORS allowMethods so session rename works#391
Merged
tiann merged 1 commit intotiann:mainfrom Apr 5, 2026
Merged
fix(hub): add PATCH to CORS allowMethods so session rename works#391tiann merged 1 commit intotiann:mainfrom
tiann merged 1 commit intotiann:mainfrom
Conversation
The rename endpoint uses PATCH /api/sessions/:id, but the CORS middleware only allowed GET, POST, DELETE, OPTIONS. Browsers send a preflight OPTIONS request for PATCH; without it in allowMethods the preflight fails and the request never reaches the handler, causing "Failed to rename" in the web UI every time. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
There was a problem hiding this comment.
Findings
- No issues identified in the added/modified lines.
Summary
- Review mode: initial
- No issues found in the diff. Residual risk: automated coverage for the browser-facing CORS preflight and rename flow was not found in repo/docs; existing session route tests in
hub/src/web/routes/sessions.test.ts:1cover other endpoints, notPATCH /api/sessions/:id.
Testing
- Not run (automation):
bunis unavailable in this runner (bun: command not found).
HAPI Bot
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.
Problem
The "Rename Session" dialog in the web UI always fails with "Failed to rename. Please try again."
Root cause
The rename endpoint uses
PATCH /api/sessions/:id, but the CORS middleware inhub/src/web/server.tsonly allows:PATCHis missing. Browsers send a preflightOPTIONSrequest before anyPATCHrequest. The server's preflight response doesn't includePATCHinAccess-Control-Allow-Methods, so the browser blocks the actual request — it never reaches the route handler.Fix
Add
'PATCH'toallowMethods:Test plan