Repository navigation
Use model composition for runtime LLM and service selection - #2178
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0703e20bc
ℹ️ 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".
| composition := composedModel(opts) | ||
| if composition.LLM.Provider != "" { | ||
| p, k, id, base, err := model.ResolveLLM(composition.LLM, opts.Public) | ||
| return p, k, id, base, err == nil |
There was a problem hiding this comment.
Normalize explicit-provider base URLs before building the agent
When a composition explicitly selects openai and OPENAI_BASE_URL includes the documented /v1 suffix, ResolveLLM returns that URL unchanged, and buildNativeAgent passes it directly to gmagent.BaseURL. The provider appends /v1/chat/completions, producing /v1/v1/chat/completions and causing agent requests to fail. The existing nativeLLMFor paths already apply model.ProviderBaseURL for this reason (see internal/model/baseurl.go); apply the same conversion to this new path.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80bc5597f5
ℹ️ 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".
| func selectedServices(opts QueryOpts, available []string) []string { | ||
| available = composedModel(opts).SelectServices(available) | ||
| available = filterServices(available, opts.Tools) |
There was a problem hiding this comment.
Apply composition restrictions to management tools
For a signed-in account with opts.Tools unset, setting Definition.Services to an empty or restricted list only filters the discovered service tools. buildNativeAgent still appends managementTools(accountID, opts), whose guard in agent/manage.go checks only NoTools, Public, and opts.Tools. Consequently, an explicitly tool-free composition still exposes micro_agents and the mutating micro_create_agent, and scoped compositions receive management capabilities that existing scoped specialists do not. Make the management-tool guard honor composition restrictions as well.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
The model composition now drives agent and writing prompts, LLM selection and agent service availability. Callers can supply a Definition; existing run-level model IDs remain overrides. Explicit providers use runtime credentials and fail instead of silently switching providers. Both streaming and non-streaming writing use the same composition.
Service selection intersects the composition with permitted services and agent scopes; an explicit empty list disables tools, while nil inherits availability. Restricted compositions also retain restricted-caller guards. Named chats now carry the saved agent LLM choice, which was previously omitted.
Storage remains with agent records; internal/model composes definitions and does not add a model store. Knowledge references continue through existing retrieval services.
Validation includes real HTTP adapter tests for composed prompts and selected model IDs in Ask/AskStream, fail-closed provider selection, agent selection and service-scope tests, plus existing model and agent tests. Full CI covers backend, browser, race and release checks.