Repository navigation
fix(core): keep local provider integration registered after discovery - #67192
harmehak0173 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Thanks for the fix. I ran the reproduction from #67137 from source against a stand-in LM Studio server (not a real one), on the base branch and on this PR:
- Base:
GET /api/integration/lmstudio,auth login lmstudioandconnect/keyall returnIntegration not found: lmstudiowhile the local model is auto-detected. - This PR: the integration is returned with its key and
LMSTUDIO_API_KEYmethods, andconnect/keysucceeds. Discovery then sendsAuthorization: Bearer <key>, and the integration shows the saved key.
The lmstudio, vllm and ollama plugin tests pass, and packages/core type-checks (with typecheck:tsc). I couldn't check the desktop app's "searching for integrations" state mentioned in the issue.
Public API: unchanged. /api/integration/lmstudio (and the vllm and ollama equivalents) now answer while the local server is detected, where they used to return 404.
The flipped toBeDefined() checks in the existing lmstudio and vllm tests already cover the fix. The new 70-line live-server test in provider-lmstudio.test.ts can be dropped to keep this small fix minimal.
Related: #63266
|
@opencodejr Thanks for reviewing and verifying this! I removed the redundant 70-line live-server test from \packages/core/test/plugin/provider-lmstudio.test.ts\ in \e2cb5828\ to keep the PR minimal, since the existing LM Studio and vLLM discovery tests already cover the fix. |
|
@harmehak01 73 ... harmehaak ... ty :o i lookd in so nothing new to chek. pr is very smol now. smol is goood. i love smol ༼ つ ◕_◕ ༽つ |
There was a problem hiding this comment.
The last review's one point is addressed: the extra live-server test is gone, and the change is now the fix in local.ts plus the two flipped toBeDefined() checks. The fix is the same one I verified before against a stand-in LM Studio server: on the base branch the integration returns 404, and with this PR a key connects while LM Studio is detected and is sent during discovery. At the new head, the lmstudio, vllm and ollama plugin tests pass. Public API: unchanged. No new concerns.
Issue for this PR
Closes #67137
Type of change
What does this PR do?
Local provider plugins (
lmstudio,vllm,ollama) removed their integration entry fromIntegration.Servicewhenever unauthenticated local discovery found models. BecauseProvider.Service.available()already exposes providers whose activation is"enabled", deleting the integration broke adding a token credential viaopencode auth login lmstudioor the UI/API whenever a local server was already running (Integration not found: lmstudio).I removed the
integrations.remove(input.providerID)transform and the redundantctx.integration.reload()calls frompackages/core/src/plugin/provider/local.ts. Unauthenticated discovery still setsprovider.activation = "enabled"and clearsprovider.integrationIDwhileloaded.connectedis false, so local discovery works as before while keeping the integration registered for credential setup.How did you verify your code works?
packages/core/test/plugin/provider-lmstudio.test.tsandpackages/core/test/plugin/provider-vllm.test.ts, and added a regression test verifyingintegrations.get("lmstudio")stays defined during unauthenticated discovery and restoresprovider.integrationIDonce a key credential is added.bun test test/plugin/provider-lmstudio.test.ts test/plugin/provider-vllm.test.ts test/plugin/provider-ollama.test.tsinpackages/core(19 passed, 0 failed).bun run lint && bun run typecheckacross the workspace (37/37 packages passed).Checklist
Added by the opencode bot (AI-generated).
Related: #63266