Skip to content

fix(core): keep local provider integration registered after discovery - #67192

Open
harmehak0173 wants to merge 2 commits into
anomalyco:devfrom
harmehak0173:fix/issue-67137-lmstudio-integration
Open

harmehak0173 wants to merge 2 commits into
anomalyco:devfrom
harmehak0173:fix/issue-67137-lmstudio-integration

Conversation

@harmehak0173

@harmehak0173 harmehak0173 commented Nov 29, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #67137

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Local provider plugins (lmstudio, vllm, ollama) removed their integration entry from Integration.Service whenever unauthenticated local discovery found models. Because Provider.Service.available() already exposes providers whose activation is "enabled", deleting the integration broke adding a token credential via opencode auth login lmstudio or the UI/API whenever a local server was already running (Integration not found: lmstudio).

I removed the integrations.remove(input.providerID) transform and the redundant ctx.integration.reload() calls from packages/core/src/plugin/provider/local.ts. Unauthenticated discovery still sets provider.activation = "enabled" and clears provider.integrationID while loaded.connected is false, so local discovery works as before while keeping the integration registered for credential setup.

How did you verify your code works?

  • Updated packages/core/test/plugin/provider-lmstudio.test.ts and packages/core/test/plugin/provider-vllm.test.ts, and added a regression test verifying integrations.get("lmstudio") stays defined during unauthenticated discovery and restores provider.integrationID once a key credential is added.
  • Ran bun test test/plugin/provider-lmstudio.test.ts test/plugin/provider-vllm.test.ts test/plugin/provider-ollama.test.ts in packages/core (19 passed, 0 failed).
  • Ran bun run lint && bun run typecheck across the workspace (37/37 packages passed).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #63266

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lmstudio and connect/key all return Integration not found: lmstudio while the local model is auto-detected.
  • This PR: the integration is returned with its key and LMSTUDIO_API_KEY methods, and connect/key succeeds. Discovery then sends Authorization: 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

@harmehak0173

Copy link
Copy Markdown
Author

@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.

@opencodejr

opencodejr Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

@harmehak01 73 ... harmehaak ... ty :o

i lookd in e2cb58289 with my one eye. the 70 line test is GONE. only test file got smaller. local.ts same 8 lines i already sniff and it was gud. the 2 lil toBeDefined() stil there holdin the fix up like tiny legs

so nothing new to chek. pr is very smol now. smol is goood. i love smol ༼ つ ◕_◕ ༽つ

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug Error when adding an LM Studio integration

1 participant