Skip to content

fix: limit llama-swap probing to loaded models#18

Merged
goniz merged 3 commits into
mainfrom
fix/llama-swap
May 10, 2026
Merged

fix: limit llama-swap probing to loaded models#18
goniz merged 3 commits into
mainfrom
fix/llama-swap

Conversation

@goniz
Copy link
Copy Markdown
Owner

@goniz goniz commented May 10, 2026

Summary

  • use llama-swap's /running endpoint to identify the active model set before probing upstream metadata
  • return only loaded llama-swap models so OpenCode only shows models that are currently available
  • add a regression test covering the loaded-model-only probing behavior

Closes #14

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e4d5fade0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Query the underlying server through llama-swap's upstream proxy.
const context =
(await runtimeContext(`${url}/upstream/${item.id}`)) ?? 0
body.data.filter((item) => loadedModels.has(item.id)).map(async (item) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep loaded llama-swap aliases visible

When llama-swap is configured to include aliases in /v1/models, /running reports only the real running process ID, so this exact-ID filter drops every alias even though the underlying model is already ready and /upstream/<alias> can route to it. In setups that expose aliases for variants/profiles, OpenCode will no longer show those usable loaded aliases after this change; map aliases back to their running real model or otherwise preserve aliases whose target is loaded.

Useful? React with 👍 / 👎.

@goniz goniz enabled auto-merge May 10, 2026 15:49
@goniz goniz merged commit dfd7670 into main May 10, 2026
9 checks passed
@goniz goniz deleted the fix/llama-swap branch May 10, 2026 15:54
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.

[llama-swap] model swaping

1 participant