Pinned Custom OpenAI subagents use the global Agent service profile instead of their selected profile

Aperta
#1,246 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
kotlin
Ambito
ai

Direzione di ricerca

Start in the native agent factory, where createAgent() and createManualAgent() call createExecutor() without passing the subagent's ModelSelection, then follow it into LLMClientFactory.createClient(). Check where CustomServicesSettings.customServiceStateForFeatureType(AGENT) reads the global selection instead of the explicit serviceId. Run AgentProviderIntegrationTest to reproduce. Done means a pinned Custom OpenAI subagent uses its own profile while the parent keeps its Ollama or other global selection. The attached patch is a reference, not a verified fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
What happened?
Summary

A native subagent explicitly pinned to a Custom OpenAI model does not pass its full ModelSelection through to LLM client creation. The Custom OpenAI client resolves its service from the global Agent feature selection instead. This can fail when the parent uses Ollama, and can select the wrong endpoint/credentials when parent and child use different Custom OpenAI profiles.

Affected version and proposed fix

Base commit: 1c7a8569fe5e34bb64cbc10fa32e6918e8358d98
Upstream version: 3.8.2 / 3.8.2-261
Community build identifier: 3.8.3-subagent-fix.1-261
Declared IntelliJ Platform compatibility: 261–262.*

Root cause

The runtime resolver and Task tool already pass the resolved subagent selection into AgentFactory. However, both createAgent() and createManualAgent() call createExecutor() without forwarding that selection. LLMClientFactory.createClient() consequently resolves Custom OpenAI settings from the global feature rather than the selected subagent service ID.

Patch
  • Add an optional ModelSelection argument to createExecutor() and createClient();
  • Forward it from both native agent factory methods;
  • Resolve Custom OpenAI service settings by the explicit selection's serviceId when present;
  • Retain feature-based lookup for calls without an explicit selection;
  • Reject mismatched providers and missing/nonexistent selected services explicitly.

The patch also adds two regression test methods: one exercises manual and built-in agents under a global Ollama selection, and one exercises a separate Custom OpenAI child profile.

proxyai-subagent-fix.patch

ProxyAI_Subagent_Fix_Guide_EN.md

Validation

The accompanying build notes report successful compilation and plugin packaging, 18 passing AgentProviderIntegrationTest tests, ZIP checks, and a clean git diff --check.

A separate source review confirmed clean application to the pinned base commit and a passing git diff --check. It did not rerun compilation or tests and did not inspect the compiled binary. The added tests run the real agent executor against an HTTP mock harness; they do not cover the full parent-to-Task delegation flow or assert the outgoing authorization header. Real-server testing and full Plugin Verifier results are not included in the supplied build notes.

Scope

This fix concerns native subagent Custom OpenAI profile selection. It does not modify external ACP agents, context compaction, or the model's decision to call tools, and should not be treated as a universal fix for agent stalls.

Relevant log output or stack trace

Steps to reproduce
Reproduction: Ollama parent, Custom OpenAI child
  1. Configure the main Agent feature to use Ollama.
  2. Configure a valid Custom OpenAI service profile.
  3. Pin a native subagent to that Custom OpenAI profile/model rather than inheriting the parent's model.
  4. Invoke the subagent.

Expected: the subagent uses its own Custom OpenAI profile; the main agent remains configured for Ollama.
Actual code path: CustomServicesSettings.customServiceStateForFeatureType(AGENT) reads the global Ollama selection and throws an IllegalStateException because it is not CUSTOM_OPENAI.

Reproduction: different Custom OpenAI profiles
  1. Select Custom OpenAI profile A for the main Agent feature.
  2. Pin a native subagent to profile B.
  3. Invoke the subagent and inspect which server receives the request.

Expected: client configuration and credentials come from profile B.
Actual code path: client construction looks up profile A through the global Agent feature selection.

CodeGPT version

3.8.2

Operating System

macOS

Lingua principale
Kotlin
Stelle
1.9k
Fork
401
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di carlrobertoh/ProxyAI

Tutte le issue di carlrobertoh/ProxyAI

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.