fix: deterministic provider selection + error logging for Party Mode#175
Open
duhd-vnpay wants to merge 2 commits intonextlevelbuilder:feat/party-modefrom
Open
fix: deterministic provider selection + error logging for Party Mode#175duhd-vnpay wants to merge 2 commits intonextlevelbuilder:feat/party-modefrom
duhd-vnpay wants to merge 2 commits intonextlevelbuilder:feat/party-modefrom
Conversation
- gateway_providers: read default_model from provider settings JSONB instead of passing empty string (caused proxy 502 for empty model) - party.go getEngine(): prefer providers with DefaultModel set, alphabetical fallback to avoid Go map random iteration order - party.go handleRound: log slog.Error before sending error to client (round failures were silently swallowed server-side) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Frontend was dropping history/summary from backend response and resetting messages to empty on session select. Also aligned all RPC params/events with snake_case wire format (Go json tags). - transformSession: preserve _history/_summary from backend - hydrateMessages: convert RoundResult[] to PartyMessage[] - selectSession: hydrate messages instead of resetting to [] - All WS calls use snake_case field names matching Go structs Co-Authored-By: Claude Opus 4.6 <[email protected]>
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
Fixes two bugs in Party Mode that caused silent round failures:
Empty model string → proxy 502:
registerProvidersFromDBdefault case createdNewOpenAIProvider(..., "")without readingdefault_modelfrom the provider'ssettingsJSONB. When Party Mode'sllmCallsets no model,resolveModel("")returns"", and the upstream proxy returns 502 for an empty model field.Non-deterministic provider selection:
getEngine()usednames[0]fromproviderReg.List(), which returns Go map keys in random iteration order. With multiple providers registered (e.g.cli-proxy-apifrom DB +geminifrom config), the wrong provider could be selected on each request.Silent error swallowing:
handleRoundsent errors to the WebSocket client but never logged them server-side, making debugging impossible.Changes
cmd/gateway_providers.goextractDefaultModel(settings json.RawMessage)helper that readsdefault_modelfrom provider settings JSONBdefaultModeltoNewOpenAIProviderinstead of""internal/gateway/methods/party.gogetEngine()now prefers providers with non-emptyDefaultModel(), breaks ties alphabetically for determinismhandleRoundlogsslog.Error("party: round failed", ...)before sending error responseTest plan
wgetwith"model":""→ 502; with"model":"claude-sonnet-4-6"→ 200🤖 Generated with Claude Code