Commit daec1b3
committed
Prevent profile from being overridden by defaults
Previously, when loading a custom profile via --profile, its settings
could be overridden by defaults from the initial Profile() instance
because argparse was initialized with those defaults, and
only None-valued arguments would be updated from the custom profile.
This caused issues like custom model settings being reset to the default
claude-3-5-sonnet-20241022.
This change:
- Creates a fresh Profile instance when loading custom profiles
- Tracks which arguments were explicitly provided via CLI
- Updates args from profile unless explicitly set via CLI
This ensures profile settings take precedence over defaults while
still allowing CLI arguments to override profile settings.
Example:
Before: Custom profile with model="gpt-4o-mini" would be overridden
by default model="claude-3-5-sonnet-20241022" unless --model was
explicitly set on command line.
After: Custom profile settings are preserved unless explicitly
overridden by command line arguments.
The provider auto-detection still works as expected:
- If profile sets both model and provider: uses those values
- If profile sets only model: provider=None allows auto-detection1 parent dec7faa commit daec1b3
1 file changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
273 | 274 | | |
274 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
275 | 281 | | |
276 | | - | |
| 282 | + | |
277 | 283 | | |
278 | 284 | | |
279 | 285 | | |
| |||
0 commit comments