Skip to content

Conversation

@nmlemus
Copy link
Owner

@nmlemus nmlemus commented Feb 4, 2026

Summary

  • Create centralized config.py module with get_default_model() function
  • Fix session creation to resolve model before saving to database (was saving None)
  • Remove hardcoded gpt-4o defaults from all agent files
  • Support both DSAGENT_DEFAULT_MODEL and LLM_MODEL env vars for backward compatibility

Problem

When deploying to Cloud Run with DSAGENT_DEFAULT_MODEL set, sessions were still defaulting to gpt-4o because:

  1. session.model was saved as None when not explicitly provided
  2. Hardcoded "gpt-4o" defaults in agent configs took precedence

Solution

Model resolution cascade (highest to lowest priority):

  1. Explicit parameter (API request, CLI --model flag)
  2. Session-stored model (from DB)
  3. DSAGENT_DEFAULT_MODEL env var
  4. LLM_MODEL env var (legacy/CLI compatibility)
  5. Fallback: gpt-4o

Test plan

  • Local Docker test: new sessions get correct model from env var
  • Cloud Run deployment verification

🤖 Generated with Claude Code

- Create centralized config.py module with get_default_model() function
- Model resolution cascade: explicit param > session > DSAGENT_DEFAULT_MODEL > LLM_MODEL > fallback
- Fix session creation to resolve model before saving to database
- Remove hardcoded "gpt-4o" defaults from all agent files
- Support both DSAGENT_DEFAULT_MODEL and LLM_MODEL env vars for backward compatibility
- Update .env.example with configuration documentation

This fixes the issue where DSAGENT_DEFAULT_MODEL was ignored in Cloud Run
deployments because sessions were saved with model=None.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
session_backend: str = Field(default="sqlite")

# ─── Server Settings ──────────────────────────────────────────────────────
host: str = Field(default="0.0.0.0")

Check warning

Code scanning / Bandit

Possible binding to all interfaces. Warning

Possible binding to all interfaces.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nmlemus nmlemus merged commit 40d2da4 into main Feb 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant