Prevent home-directory settings path collisions - #706
Merged
TheGreatAxios merged 8 commits intoAug 28, 2026
Conversation
TheGreatAxios
commented
Aug 28, 2026
TheGreatAxios
left a comment
Collaborator
Author
There was a problem hiding this comment.
Review · Approve
Home and aliased settings paths no longer clobber global provider configuration.
No findings.
TheGreatAxios
commented
Aug 28, 2026
TheGreatAxios
left a comment
Collaborator
Author
There was a problem hiding this comment.
Review · Comment
Local settings resolve to null when <cwd>/.corbits/settings.json is the same physical file as the global target; a global file clobbered with a {provider, model} document is rewritten back to a real settings shape from the OAuth profile store; OAuth provider/model selections persist as credential-free entries in global settings.
Findings
src/config/settings.ts:409—physicalPathIdentityrethrows anything that is not ENOENT, andresolveLocalSettingsPathnow runs ahead of every fail-open local loader (loadConfig,runExec,runTUI). A stray regular file at<cwd>/.corbitsmakesrealpathSync.nativethrow ENOTDIR and startup dies before the "never crash startup" path inloadLocalSettingsResultgets a chance (reproduced withtouch $D/.corbits; resolveLocalSettingsPath($D, ~/.corbits/settings.json)→ throws ENOTDIR). Could the catch fall back toresolve(path)on any error, so an unresolvable path just means "not an alias"?src/tui/provider-setup-submit.ts:79/src/config/settings.ts:246— OAuth providers are now written tosettings.json(defaultProvider+ a keyless entry with noapiKey). When the profile is later removed from the auth store, the entry stays:mergeOAuthCatalogfilters it out of the catalog, butresolveProviderstill selects it viadefaultProviderand fails withmissing: apiKey, so the next start lands in onboarding with a misleadingproviderErrorinstead of a clean prompt. Worth either pruningcodex//xai/entries whose profile no longer exists during load, or letting resolution skip an OAuth-named provider that has no projected profile.
Notes
loadSettingsRecoveringClobberedOAuthSelectionalso runs for--config <path>. A--configfile shaped{provider, model}with no matching profile is rewritten on disk to{"providers":{}}where it used to fail with a schema error. Fine if intended; flagging because it mutates a user-supplied file.- Checks run:
bun run typecheck,bun run lint,bun test src/settings.test.ts src/tui/provider-setup-submit.test.ts src/tui/runner-exit-code.test.ts tests/unit/config.test.ts(128 pass). Commit subjects/bodies pass the length and prefix audit; each commit's file list matches its subject.
TheGreatAxios
force-pushed
the
cl-7114-corbits-fails-after-openai-setup-writes-legacy-settings
branch
from
August 28, 2026 19:07
abc9003 to
af0db0f
Compare
TheGreatAxios
changed the base branch from
main
to
cl-7116-preserve-oauth-profile-projection-after-setup-with-config
August 28, 2026 19:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
bun run checkpasses.Fixes CL-7114
Fixes #703