fix: project-only provider_access must not hide user-level providers - #6601
fix: project-only provider_access must not hide user-level providers#6601ttmouse wants to merge 2 commits into
Conversation
When the user config does not declare desktop.provider_access (implicit 'allow all'), a project-level provider_access restriction should not override it. The mergeTOMLProviderAccess function now tracks whether the user config explicitly declares the list; if only the project config does, the restriction is skipped so account-level providers remain visible in the desktop model switcher. Fixes: project-level reasonix.toml with provider_access hiding user-configured providers that are not in the project's access list.
Add four unit tests for mergeTOMLProviderAccess:
1. TestMergeTOMLProviderAccessProjectOnlyDoesNotRestrictWhenUserUndefined
— core scenario: user has no provider_access (implicit allow all),
project declares a restricted list. Must return ok=false.
2. TestMergeTOMLProviderAccessUserAndProjectMergeAsUnion
— both user and project declare provider_access: union merged.
3. TestMergeTOMLProviderAccessNoDeclarations
— neither declares: ok=false, no restriction.
4. TestMergeTOMLProviderAccessUserDeclaresEmptyList
— user explicitly declares [] (allow all but declared), project
has a list: ok=true, project restriction takes effect.
|
Thanks — the diagnosis is right and the fix is the correct shape. An undeclared user-level I've landed it as #7395 rather than merging this branch: One semantic call I made on top of your version: Closing this in favour of #7395. Thanks for the careful root-cause write-up — it made the port trivial. |
Summary
When the user config (
~/.reasonix/config.toml) does not declaredesktop.provider_access(implicit "allow all"), a project-levelreasonix.tomlthat definesprovider_accesscurrently restricts the desktop model switcher to only those listed providers — hiding the user-level providers that exist outside the project-scoped access list.Root cause:
mergeTOMLProviderAccessmergesprovider_accessas a union across config sources. When only the project config declares it (user config does not), the union equals the project's list alone. The user's default "allow all" is lost.Fix: Track whether the user-level config explicitly declared
provider_access. If only the project declares it (user did not), skip the restriction so all configured providers remain visible in the model switcher.Verification
TestMergeTOMLProviderAccessProjectOnlyDoesNotRestrictWhenUserUndefined— NEW: project-only restriction is correctly skippedTestMergeTOMLProviderAccessUserAndProjectMergeAsUnion— NEW: both user and project declare → union merge unchangedTestMergeTOMLProviderAccessNoDeclarations— NEW: neither declares → no restrictionTestMergeTOMLProviderAccessUserDeclaresEmptyList— NEW: user declares[], project has list → project list takes effect (user explicitly opted into per-project control)TestModelsForTabKeepsUserProvidersWithProjectConfig— EXISTING PASS: user + project both declare → union unchangedgo test ./internal/config/...— all passgo build ./...— all passCache impact
Cache-impact: none — only a small logic change in config loading, no system prompt or provider changes
Cache-guard: existing config tests and desktop ModelsForTab tests cover the behavior
System-prompt-review: N/A
Related PRs
mergeTOMLProviderAccesswith union logic, but left the gap when only the project declares the list.desktop/app.go, does not overlap with this fix.🤖 This contribution was prepared with Reasonix (DeepSeek fork of Claude Code), no additional plugins installed.