fix(desktop): let a relay's model catalog answer for itself - #3443
Open
Joob1n wants to merge 1 commit into
Open
Conversation
Adding a custom relay asked for a model id before the connection existed, made it required, then fetched the catalog moments later and threw away any error from doing so. The user typed a model they had no way to know, and if the fetch then failed they were told nothing. The field's own help text already said what was supposed to happen — "保存后仍会自动拉取模型目录" / "Maka still fetches the model catalog after saving" — so the requirement contradicted the copy printed beside it. Two changes, and the second is the one that matters: - The model id is no longer required. Every provider in the registry either ships fallback models (55) or answers discovery (55 of them, 4 exclusively — the relays); none is left with no way to name a model, so nothing is lost by not demanding one up front. - A failed fetch is now reported for relays too. It was swallowed on the reasoning that a relay might not implement discovery, but a relay is the endpoint most likely to be pointed somewhere wrong, and silence left the user with an empty picker and no explanation. The toast and the endpoint troubleshooting hint already existed for every other provider. The placeholder now says the field can be left empty, and the help text says a model id is only needed when the endpoint serves no catalog. Fetching before the connection is created — so the field can be a picker rather than free text — needs a probe operation that does not exist yet, and is filed separately. Claude-Session: https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J Generated-by: Claude Code (Claude Opus 5)
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
Adding a custom relay asked for a model id before the connection existed, made it required, then fetched the endpoint's catalog moments later and discarded any error from doing so. The user typed a model they had no way to know, and if the fetch then failed they were told nothing — an empty picker and no explanation.
The field's own help text already described the intended behaviour:
So the requirement contradicted the copy printed directly beneath it.
Two changes:
The model id is no longer required. Checked against the registry rather than assumed: of 59 providers, 55 ship fallback models and 55 answer discovery — 4 exclusively, which are the relays. None is left with no way to name a model, so demanding one up front buys nothing.
A failed fetch is reported for relays too. It was swallowed on the reasoning that a relay might not implement discovery. But a relay is the endpoint most likely to be pointed somewhere wrong, and the toast plus endpoint-troubleshooting hint already existed for every other provider — relays were the one case excluded from the diagnostic they needed most.
The placeholder now says the field can be left empty; the help text says a model id is needed only when the endpoint serves no catalog.
What this deliberately does not do
Fetch the catalog before the connection is created, so the field could be a picker instead of free text.
fetchModelstakes a connection slug, so discovery cannot run until the connection exists — a pre-create probe is a new Runtime Host operation, a new IPC surface, and a compatibility epoch bump. Filed as #3442 with the decisions it needs settled first.Verification
npm run build,lint,format:check,typecheck. Suites:@maka/desktop1034,@maka/core587.Registry claim verified by enumerating
PROVIDER_REGISTRYrather than reasoning about it:The "neither" count is what makes the requirement safe to drop — I added a
providerRequiresHandTypedModelpredicate first, found it returned false for every provider in the registry, and removed it rather than ship a branch that can never be taken.Not run: Windows and Linux. This is renderer-only.
Review focus
Whether reporting relay discovery failures is right. It is a behaviour change for the noisier direction: a relay that genuinely serves no catalog now shows an error toast on creation where it previously showed nothing. My reading is that this is correct — the connection is still created, the message names the endpoint, and silence was indistinguishable from success. If the project would rather relays stay quiet, the alternative is a softer notice rather than restoring the swallow.
AI use
Select exactly one:
Tool(s) and scope: Claude Code — traced the existing discovery path, made the change, and ran the verification above.
Generated-byis on the commit. Reviewed and submitted by the contributor of record.Checklist
Does this PR entail a change in behavior?