open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Prevent profile file from being overridden by defaults

Open endolith opened this issue 10 months ago • 0 comments

Describe the changes you have made:

dependent on https://github.com/OpenInterpreter/open-interpreter/pull/1612

  1. Update profile.profile_path to the actual path

Previously it was keeping the default:

profile_path: ~/.openinterpreter\default_profile.py

because interpreter.profile_path is not an attribute that would be set within the profile file, but is a property of that file.

  1. 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-detection

Reference any relevant issues (e.g. "Fixes #000"):

Pre-Submission Checklist (optional but appreciated):

  • [ ] I have included relevant documentation updates (stored in /docs)
  • [x] I have read docs/CONTRIBUTING.md
  • [x] I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • [x] Tested on Windows
  • [ ] Tested on MacOS
  • [ ] Tested on Linux

endolith avatar Mar 30 '25 17:03 endolith