Skip to content

feat(dashboard/agents): allow a custom model id when editing an agent (#6318)#6327

Merged
houko merged 1 commit into
mainfrom
agent-custom-model
Jun 26, 2026
Merged

feat(dashboard/agents): allow a custom model id when editing an agent (#6318)#6327
houko merged 1 commit into
mainfrom
agent-custom-model

Conversation

@houko

@houko houko commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #6318 (the "manually manage the base model" half). Lets you set a model id that isn't in the catalog when editing an existing agent, so an agent-type provider (codex-cli / claude-code / gemini-cli) pointed at a third-party base can be configured from the dashboard.

Background

  • The driver layer already passes any model through: each agent driver's model_flag (crates/librefang-llm-drivers/src/drivers/{codex_cli,claude_code,gemini_cli}.rs) falls through _ => Some(stripped.to_string()), so an unknown model id reaches the CLI verbatim. There is no hard rejection — this is not a backend bug.
  • The third-party base itself is selected via the CLI's own env (OPENAI_BASE_URL, ANTHROPIC_BASE_URL, …), which LibreFang doesn't manage.
  • The create form (AgentManifestForm) already drops to a free-text <input> when the provider has no catalog models, so custom ids were enterable there.
  • The gap was the agent detail drawer's model editor: a plain <select> populated only from catalog models, showing a disabled "No models" option for agent-type providers (whose catalog is empty) — so you could not change an existing agent to a custom / third-party model from the UI.

Change

crates/librefang-api/dashboard/src/pages/AgentsPage.tsx — the detail-drawer model field becomes an <input list=…> + <datalist> combobox. It still suggests the provider's catalog models, but now accepts a typed-in id. Provider-not-selected / loading states move to the input's placeholder; the disabled "No models" dead-end is gone. The existing auto-select-single-model effect (#5917) and the per-id save flow are unchanged.

Removed the now-unused agents.no_models i18n key from en/zh/uk (locale parity preserved; the dead-key coverage test enforces this).

Out of scope

The other half of #6318auto-detecting the model an agent CLI actually ran — is a separate enhancement. codex-cli already does this via parse_model_from_banner; claude-code's JSON output carries a model field that isn't parsed yet. Left for a follow-up so this UI fix can land independently.

Verification

In crates/librefang-api/dashboard/:

  • pnpm typecheck — clean
  • pnpm lint — 0 errors (warnings are pre-existing baseline)
  • pnpm test --run838 passed (85 files), including the locale dead-key + parity gates
  • pnpm build — succeeds

No render-test was added for the model editor: AgentsPage.test.tsx documents that the page has no render harness (~20 hooks) and tests the extracted SystemPromptSection directly. The change is a <select><input list> swap with identical value/onChange/disabled wiring, covered by typecheck + build.

…#6318)

The agent detail drawer's model editor was a plain `<select>` populated only from the provider's catalog models, so an agent-type provider (codex-cli / claude-code / gemini-cli) — which carries no catalog models — left the field stuck on a disabled "No models" option, and a provider pointed at a third-party base whose model the catalog doesn't list could not be set at all.

Driver-level pass-through already accepts any model id (each agent driver's `model_flag` falls through to the raw name), and the create form already drops to a free-text input when the catalog is empty; only the edit path blocked it.

Make the edit field an `<input list=…>` + `<datalist>` combobox: it still suggests the catalog models for the chosen provider, but now accepts a typed-in id, so a third-party base model is settable from the UI when editing an existing agent — matching the create form.

Drops the now-unused `agents.no_models` key from en/zh/uk (the disabled placeholder option it backed is gone).
@github-actions github-actions Bot added size/S 10-49 lines changed no-rust-required This task does not require Rust knowledge labels Jun 25, 2026
@houko
houko merged commit a811637 into main Jun 26, 2026
34 checks passed
@houko
houko deleted the agent-custom-model branch June 26, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-rust-required This task does not require Rust knowledge size/S 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant