-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Users cannot change an existing session’s provider without creating a separate agent manually. Add a first-class Switch Provider action
that feels like hot-swap, but is implemented as a safe migration to a new session under the target provider.
Problem
Current behavior locks provider after session creation and provider identity is deeply coupled to runtime/session internals.
Code references:
src/renderer/components/NewInstanceModal.tsx:1190src/renderer/components/NewInstanceModal.tsx:1595src/renderer/App.tsx:5951src/renderer/App.tsx:6053src/main/utils/agent-args.ts:80src/main/ipc/handlers/agentSessions.ts:399
Goal
Provide a one-click workflow to switch an existing session to another provider with context continuity, without mutating the original
session’s toolType in place.
Non-Goals
- In-place mutation of
session.toolType. - Reuse of source provider session/thread IDs on target provider.
- Cross-provider normalization of every provider-specific config flag in v1.
Proposed Solution
- Add a new UI action:
Switch Provider...in Edit Agent modal and session quick actions. - Implement orchestration API:
switchProvider(sourceSessionId, targetProvider, options). - Internally reuse existing transfer pipeline from
useSendToAgentto create a new session withtoolType: targetProvider. - Preserve source session unchanged and link provenance metadata on the new session.
- Auto-focus new session after success and show clear success/failure toasts.
UX Requirements
- Entry points:
- Edit Agent modal near provider field (read-only stays read-only).
- Session context menu / quick actions.
- Confirmation modal includes:
- Source provider.
- Target provider.
- Option:
Groom context for target provider(default on). - Option:
Archive source session after successful switch(default off).
- Success behavior:
- Create new session.
- Navigate to new session.
- Add transfer notice in logs.
- Keep source session available unless archive option selected.
- Failure behavior:
- Source session unchanged.
- No partial mutation.
- Error toast with retry action.
Data Contract (v1)
New fields on Session:
migratedFromSessionId?: stringmigratedFromProvider?: ToolTypemigrationTimestamp?: number
Portable fields to copy:
name(or generated “(Provider)” variant if collision)projectRoot,cwdnudgeMessagesessionSshRemoteConfig- transfer context/logs
Fields not copied directly:
- provider-specific
agentSessionId - provider-specific command args/env where unsafe to map automatically
Acceptance Criteria
- User can trigger
Switch Provider...from Edit Agent and session menu. - Switching Claude -> Codex creates a new Codex session with transferred context.
- Switching Codex -> Claude creates a new Claude session with transferred context.
- Source session
toolTyperemains unchanged in all cases. - New session receives fresh target-provider session/thread ID on first run.
- Failure in target creation/spawn leaves source session fully intact.
- Optional archive setting archives source only after successful target creation.
- Provenance fields are persisted on the new session.
- Works for local and SSH-enabled sessions.
- Unit/integration tests cover happy path, failure path, and provenance persistence.
Task Breakdown
- UI wiring:
- Add
Switch Provider...action inNewInstanceModaland session actions. - Add switch confirmation modal with options.
- Orchestration:
- Add
switchProvider(...)service/hook. - Reuse
useSendToAgenttransfer logic instead of duplicating flow.
- Session metadata:
- Extend
Sessiontype with migration provenance fields. - Persist fields through existing session persistence.
- Config handling:
- Implement safe portable-copy function for session fields.
- Explicitly exclude provider-specific resume/session identifiers.
- Archive behavior:
- Add post-success optional archive operation on source session.
- Telemetry/logging:
- Add structured logs for start/success/failure of switch operations.
- Tests:
- Add renderer tests for modal/action behavior.
- Add orchestration tests for success/failure semantics.
- Add persistence tests for provenance fields.
Test Plan
- Manual:
- Start session with provider A, run conversation, switch to provider B, confirm context transfer and new provider execution.
- Repeat with grooming off.
- Repeat with SSH-enabled session.
- Automated:
- Unit tests for portable-copy mapper and provenance fields.
- Integration tests for orchestration success/failure rollback semantics.
- UI tests for action visibility and modal flow.
Rollout Plan
- Ship behind feature flag:
ENABLE_SWITCH_PROVIDER. - Dogfood in internal builds.
- Remove flag after stability + test coverage meets threshold.
Risks
- Context transfer quality variance across providers.
- Provider-specific config leakage if copy mapping is too permissive.
- User confusion if old and new sessions look identical.
Mitigations
- Clear transfer notice in new session logs.
- Conservative config copy policy in v1.
- Explicit success message: “New session created; original preserved.”
Definition of Done
- Acceptance criteria met.
- Tests added and passing.
- Feature flag enabled for internal testing.
- Docs updated in user-facing session management docs.
- Add labels if they exist:
- enhancement
- ux
- multi-provider
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request