Repository navigation
feat: Add /models add hot-reload model registration - #70211
Conversation
Greptile SummaryThis PR adds
Confidence Score: 4/5Safe to merge after fixing the unguarded issues[0] access in addModelToConfig. One P1 null-dereference in the add command handler (validated.issues[0] without a guard) that would crash the handler if the issues array is ever empty. The rest of the change is well-structured with good test coverage, correct auth layering, and a clean hot-reload integration. src/auto-reply/reply/models-add.ts — the validateConfigObjectWithPlugins error-handling block around line 419–425. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/models-add.ts
Line: 419-425
Comment:
**Potential crash: unguarded access on `validated.issues[0]`**
If `validateConfigObjectWithPlugins` returns `{ ok: false, issues: [] }` (an empty issues array, which the type permits), `issue` is `undefined` and accessing `issue.path` / `issue.message` throws a `TypeError` — crashing the `/models add` command handler with no user-visible error message.
```suggestion
const validated = validateConfigObjectWithPlugins(allowlisted.nextConfig);
if (!validated.ok) {
const issue = validated.issues[0];
const detail = issue ? `${issue.path}: ${issue.message}` : "unknown validation error";
return {
ok: false,
error: `Config invalid after /models add (${detail}).`,
};
}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: CHANGELOG.md
Line: 13
Comment:
**`(#PR)` placeholder not replaced**
The PR number placeholder `(#PR)` was never substituted with the actual pull request number before merging.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/auto-reply/reply/commands-models.ts
Line: 284-298
Comment:
**`lmstudio` missing from hardcoded add-examples**
`buildAddExamples` generates copy-friendly examples for `ollama`, `codex`, and `openai-codex`, but not for `lmstudio`, even though `lmstudio` is a fully supported provider in `MODEL_ADD_ADAPTERS`. Users on LM Studio will only see the generic `/models add <provider> <modelId>` fallback when `lmstudio` is actually in their `addableProviders` list.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "docs(changelog): add models entry for pr..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 507190141b
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d62a767c10
ℹ️ 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".
|
Addressed the actionable bot review items in
I left the overall feature scope unchanged: |
|
Addressed the remaining safe Aisle findings in
I did not widen the feature scope or change the hot-reload behavior; this keeps the add flow intact while tightening correctness and log safety. |
|
Follow-up on the Aisle summary:
That means the remaining Aisle point is documented, but it is not being treated as a blocker for the narrow |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8357b96c11
ℹ️ 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".
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 SSRF via Ollama model metadata detection in /models add
DescriptionThe new
This introduces an SSRF/internal network probing primitive reachable via the command flow (even if owner/admin-gated, SSRF still matters in multi-tenant deployments, compromised accounts, or overly broad admin roles). Vulnerable code (call site): const info = (await queryOllamaModelShowInfo(providerConfig.baseUrl, modelId)) ?? {};Network sink (Ollama extension): const { response, release } = await fetchWithSsrFGuard({
url: `${normalizedApiBase}/api/show`,
...,
policy: buildOllamaBaseUrlSsrFPolicy(normalizedApiBase),
});RecommendationRestrict or harden Ollama metadata detection so it cannot be used for arbitrary outbound/internal requests. Options (choose one or combine):
if (!isLoopbackOrLocalhost(providerConfig.baseUrl)) {
return { found: false, warnings: ["Ollama metadata detection is limited to local baseUrl values; using defaults."] };
}
These measures prevent Analyzed PR: #70211 at commit Last updated on: 2026-04-22T16:50:19Z |
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
* feat(models): add chat model registration with hot reload * docs(changelog): add models entry for pr 70211 * fix(models): harden add flow follow-ups * fix models add review follow-ups * harden models add config writes * tighten plugin boundary invariant * move models add adapters behind sdk facades * avoid ollama-specific core facade
Summary
This change adds a chat-driven model registration flow so operators can add configured models from
/models add <provider> <modelId>and use them right away without restarting the gateway.It keeps
/modelssimple as a provider browser, adds lightweight guidance for the add flow, and improves the Telegram menu so the add path is discoverable without reintroducing a larger CRUD-style model manager.What changed
/models add <provider> <modelId>with config writes plus gateway-visible hot reload behavior/modelsas a lightweight provider list while adding a small add entrypoint and copy-friendly add examplesAdd modelaffordances for the top-level menu and callback-driven provider pickerUser benefit