feat: Sprint 23 -- profile/workspace/model coherence
Fix five coherence bugs in profile switching: 1. Model picker ignored profile default (localStorage stale key) 2. Workspace list was global (not profile-scoped) 3. DEFAULT_WORKSPACE was a boot-time singleton 4. Session list showed all profiles (no filtering) 5. switchToProfile() didn't refresh workspaces or sessions Backend: workspace storage is now profile-local for named profiles, switch_profile() returns default_model and default_workspace. Frontend: switchToProfile() clears stale model pref, refreshes workspace list and session list, sessions.js filters by active profile with 'Show N from other profiles' toggle. 8 new tests. 400 pass / 23 fail (identical to baseline). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,7 +148,23 @@ def switch_profile(name: str) -> dict:
|
||||
# Reload config.yaml from the new profile
|
||||
reload_config()
|
||||
|
||||
return {'profiles': list_profiles_api(), 'active': name}
|
||||
# Return profile-specific defaults so frontend can apply them
|
||||
from api.workspace import get_last_workspace, _profile_default_workspace
|
||||
from api.config import get_config
|
||||
cfg = get_config()
|
||||
model_cfg = cfg.get('model', {})
|
||||
default_model = None
|
||||
if isinstance(model_cfg, str):
|
||||
default_model = model_cfg
|
||||
elif isinstance(model_cfg, dict):
|
||||
default_model = model_cfg.get('default')
|
||||
|
||||
return {
|
||||
'profiles': list_profiles_api(),
|
||||
'active': name,
|
||||
'default_model': default_model,
|
||||
'default_workspace': get_last_workspace(),
|
||||
}
|
||||
|
||||
|
||||
def list_profiles_api() -> list:
|
||||
|
||||
Reference in New Issue
Block a user