Repository navigation
feat(providers): named provider instances (#1512 I1, #453) - #1516
Conversation
settings.providerInstances holds extra configs of claude and codex, each with its own config folder (CLAUDE_CONFIG_DIR / CODEX_HOME) and env. Threads keep the base provider id and gain providerInstance; places that store a provider as one string use the ref <provider>:<instance>. Instance env values are sealed at rest like MCP env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spawn env: claude and codex children get the instance overlay per spawn, never via process.env; the kept-alive claude key includes it, so switching instance respawns. A removed instance or a remote project fails the send instead of running on the default account. Also: the codex guardrail overlay drops links into a previous home (a thread moving instance kept the old auth.json), session resume and the eject command use the instance's folder, forks keep the instance, spend is recorded per instance, the failover chain and project defaults take refs, sign-in probes and quota fetches run under each instance's env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings › Agents › Providers lists each instance under its base with its own sign-in state, plus Add instance / Edit / Delete: provider, name, config folder, and env rows with masked values. The model picker shows an instance as its own group; the thread's current pick is its ref, so the fresh-session warning covers switching accounts too. Marks and colours follow the base provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#453) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c00e3064f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // patch config + provenance. sessionId stays null (fresh session). | ||
| const forkPatch = { | ||
| provider: nextProvider, | ||
| ...(nextInstance ? { providerInstance: nextInstance } : {}), |
There was a problem hiding this comment.
Clear the default instance when forking to a base provider
Always include providerInstance in this patch, even when nextInstance is null. If the global default is a named instance, createThread() initially assigns that instance; a fork from a base-provider thread, or an explicit handoff to another base provider, then omits this field and retains the default instance. The fork can consequently run on the wrong account or fail because its base provider and retained instance do not match.
Useful? React with 👍 / 👎.
| if (Object.prototype.hasOwnProperty.call(patch, "providerInstances")) { | ||
| this.data.settings.providerInstances = validateProviderInstances( | ||
| patch.providerInstances, | ||
| ); |
There was a problem hiding this comment.
Invalidate sessions when an instance configuration changes
When an existing instance's config directory or account-related environment is edited, this replacement leaves every thread on that instance with its old sessionId. The next run respawns the CLI under the new configuration but passes the session ID from the previous account/config directory, causing resume failures or potentially attaching to an unrelated session with the same ID. Treat execution-affecting edits like an instance switch by clearing affected sessions, or make those fields immutable while the instance ID is retained.
Useful? React with 👍 / 👎.
# Conflicts: # electron/test/auto-settle-settings.test.js # electron/test/budget-spend.test.js
|
Merged main into this branch (now includes #1513, #1514 and #1515). Resolved the expected-settings fixtures in Verified on the merged tree:
|
Item I1 of #1512, also #453.
What changed: you can add named instances of claude and codex, such as "Claude (work)" or "Codex (personal)", each with its own config dir (
CLAUDE_CONFIG_DIR/CODEX_HOME, both verified against the real CLIs) and extra env. Instances can be picked anywhere a provider can: the model picker, Settings › Agents, agent profiles, per-project defaults (#1503) and failover chains.How it works: a thread keeps
provider(the base id) and gainsproviderInstance; single-string refs useclaude:<id>. Every provider path resolves through the instance:process.envis never touched, and a test proves a plain thread running beside an instance thread gets none of it.auth.jsonlink on instance switch, which would have run the next turn on the old account (tested).Not covered yet:
CLAUDE_CODE_PROJECT_DIR_NAME, deliberately skipped because it would break session import.Verified independently, on main merged with this branch:
vite buildpasses.Merge note: conflicts with #1513 (I3); I'll merge main and resolve after it lands.
🤖 Generated with Claude Code