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

Open
#1,246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
kotlin
Domain
ai

Research direction

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.

Written by the indexing model from the issue text.

Description

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

Dominant language
Kotlin
Stars
1.9k
Forks
401
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from carlrobertoh/ProxyAI

All issues in carlrobertoh/ProxyAI

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.