mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-03-18 11:23:08 +00:00
fix: propagate alternative API provider settings to agent subprocesses
When users configured GLM/Ollama/Kimi via the Settings UI, agents still used Claude because conflicting env vars leaked through subprocess env. Root cause: get_effective_sdk_env() set ANTHROPIC_AUTH_TOKEN for GLM but didn't clear ANTHROPIC_API_KEY, which leaked from os.environ. The CLI prioritized the wrong credential. Changes: - registry.py: Clear conflicting auth vars (API_KEY vs AUTH_TOKEN) and Vertex AI vars when building env for alternative providers - client.py: Replace manual os.getenv() loop with get_effective_sdk_env() so agent SDK reads provider settings from the database - autonomous_agent_demo.py: Apply UI-configured provider settings to process env so CLI-launched agents also respect Settings UI config - start.py: Pass --model from settings when launching agent subprocess - server/schemas.py: Allow non-Claude model names when an alternative provider is configured (prevents 422 errors for glm-4.7, etc.) - .env.example: Document env vars for GLM, Ollama, and Kimi providers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
7
start.py
7
start.py
@@ -390,8 +390,11 @@ def run_agent(project_name: str, project_dir: Path) -> None:
|
||||
print(f"Location: {project_dir}")
|
||||
print("-" * 50)
|
||||
|
||||
# Build the command - pass absolute path
|
||||
cmd = [sys.executable, "autonomous_agent_demo.py", "--project-dir", str(project_dir.resolve())]
|
||||
# Build the command - pass absolute path and model from settings
|
||||
from registry import DEFAULT_MODEL, get_all_settings
|
||||
settings = get_all_settings()
|
||||
model = settings.get("api_model") or settings.get("model", DEFAULT_MODEL)
|
||||
cmd = [sys.executable, "autonomous_agent_demo.py", "--project-dir", str(project_dir.resolve()), "--model", model]
|
||||
|
||||
# Run the agent with stderr capture to detect auth errors
|
||||
# stdout goes directly to terminal for real-time output
|
||||
|
||||
Reference in New Issue
Block a user