Skip to content

Improve local target setup for default and custom backends#1

Merged
goniz merged 6 commits intomainfrom
feat/local-default-targets-cli-custom-targets
Apr 19, 2026
Merged

Improve local target setup for default and custom backends#1
goniz merged 6 commits intomainfrom
feat/local-default-targets-cli-custom-targets

Conversation

@goniz
Copy link
Copy Markdown
Owner

@goniz goniz commented Apr 10, 2026

Summary

  • enable built-in localhost targets at runtime by default without persisting them into config
  • add a CLI auth login method for saving custom local targets without editing config manually
  • fix false failure reporting when a custom target is saved successfully

Verification

  • bun run typecheck
  • bun test tests/config.test.ts tests/providers.real.test.ts

goniz added 3 commits April 8, 2026 20:16
Let the plugin discover supported local providers on their default URLs so setup can succeed without manual target entry. Update the OpenCode plugin dependencies to 1.4.0 and expose the Exo test port for the provider suite.
Make built-in localhost targets available by default at runtime and add a CLI auth flow for saving custom targets without editing config manually.
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: ccb21cc931

ℹ️ 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".

Comment thread src/plugin.ts Outdated
const key = next === "none" ? "" : next || prev
const saveKey = next === "none" ? "" : next || undefined
const prev = cur.targets[id]
if (prev && prev.url !== baseURL(raw)) return { type: "failed" as const }
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 Allow custom target URL updates for existing IDs

Remove this guard or change it to permit updates, because it makes the new CLI custom-target flow unable to correct an existing target ID when the URL changes (or was entered incorrectly). With the current early return, authorize fails before probing/saving whenever the same target already exists with a different URL, so users cannot fix the target through CLI and must manually edit config, which contradicts the intended "CLI only" custom-target workflow.

Useful? React with 👍 / 👎.

Comment thread README.md Outdated
"provider": {
"local": {
"name": "Local Provider",
"npm": "@ai-sdk/openai-compatible",
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Remove this explicit npm, the plugin adds it dynamically to each model definition

Comment thread src/providers/index.ts
Comment thread src/plugin.ts Outdated
Comment on lines +134 to +139
try {
await saveProviderTarget(ctx.serverUrl, ctx.client, id, raw, kind)
} catch {
const now = await getCurrentProviderConfig(ctx.serverUrl, ctx.client).catch(() => undefined)
if (now?.targets[id]?.url !== baseURL(raw)) return { type: "failed" as const }
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This error handling is bizarre, why?

@goniz goniz merged commit 0a0c17b into main Apr 19, 2026
6 checks passed
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.

1 participant