fix: correct multiple server-side bugs in handlers and model client#330
Open
wishhyt wants to merge 1 commit into
Open
fix: correct multiple server-side bugs in handlers and model client#330wishhyt wants to merge 1 commit into
wishhyt wants to merge 1 commit into
Conversation
- InviteUserHandler: fix pointer comparison of org.Domain (compared addresses instead of string values) and add missing return after http.Error - client_stream.go: add suffix check before appending :nitro to OpenRouter model names, matching the existing check in client.go (prevents invalid model names like "model:free:nitro") - plan_helpers.go: add missing return after sending error to errCh, preventing a second write that would block the goroutine permanently (goroutine leak) - ListPlansRunningHandler: use branch Id for map lookups in sort function instead of composite key (PlanId|Name), matching the keys used when populating StreamFinishedAtByBranchId and StreamStartedAtByBranchId Made-with: Cursor
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.
Summary
Fix 4 server-side bugs:
invites.go:81-86): Two bugs in domain check: (1) comparedpointer addresses instead of string values (
org.Domain == domainwhere both are*string), making the check always fail; (2) missingreturnafterhttp.Error(),allowing execution to continue and potentially create duplicate invites.
client_stream.go:43-44): Unconditionallyappended
:nitroto OpenRouter model names without checking for existing suffixes.The non-streaming
CreateChatCompletionStreaminclient.gocorrectly checks for:nitro,:free, and:floorsuffixes. Added the same check to prevent invalidmodel names like
model:free:nitro.plan_helpers.go:178-182): Missingreturnafter sendingerror to
errCh. WhenExecfailed, both an error and a nil were sent (2 writes),but combined with the first goroutine's write (1 write), that's 3 writes to a channel
read only 2 times — the third write blocks forever, leaking the goroutine.
plans_crud.go:544-549): Sort function used compositekey
PlanId + "|" + Nameto look upStreamFinishedAtByBranchIdmap, but the mapwas keyed by
branch.Id. Lookups always missed, making the sort ineffective.Test plan
:freeor:floorsuffix work in streaming mode