Skip to content

[codex] fix coding agent model switching#1725

Merged
EKKOLearnAI merged 1 commit into
mainfrom
fix/coding-agent-session-model-switch
Jun 22, 2026
Merged

[codex] fix coding agent model switching#1725
EKKOLearnAI merged 1 commit into
mainfrom
fix/coding-agent-session-model-switch

Conversation

@EKKOLearnAI

Copy link
Copy Markdown
Owner

Summary

Fixes coding agent session model switching so Claude/Codex sessions can switch provider/model without carrying stale runtime configuration from the previous provider.

Changes

  • Enables model switching for coding agent sessions and adds a second protocol selection step before applying the switch.
  • Persists default workspace paths for Hermes bridge sessions and preserves stored coding agent workspaces when switching models.
  • Avoids notifying the Hermes bridge for coding agent model switches and clears stale native session ids when model/provider changes.
  • Prevents stale baseUrl/apiKey from being reused after coding agent provider changes, with a backend guard for mismatched builtin provider endpoints.
  • Uses stored session model/provider when deciding whether an existing coding agent run is still compatible, so stale runs are restarted with the new configuration.

Root Cause

Coding agent sessions stored provider runtime fields such as baseUrl and apiKey in frontend session memory. After switching provider/model, continuing without a page refresh could still send the previous provider endpoint, for example provider=deepseek with a Xiaomi base URL. The backend then generated a new Codex home for DeepSeek but registered the proxy against the stale upstream endpoint.

Validation

  • npm exec -- vitest run tests/client/chat-store-reasoning-tool-boundary.test.ts tests/client/chat-panel-session-click.test.ts tests/server/coding-agent-resume-config.test.ts tests/server/handle-coding-agent-run.test.ts tests/server/sessions-controller.test.ts
  • npm exec -- vitest run tests/client/chat-panel-session-click.test.ts tests/server/sessions-controller.test.ts tests/server/coding-agent-resume-config.test.ts tests/server/run-chat-bridge-final-context.test.ts
  • npm run harness:check
  • npm run build

@EKKOLearnAI EKKOLearnAI marked this pull request as ready for review June 22, 2026 02:25
@EKKOLearnAI EKKOLearnAI merged commit af07ed0 into main Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant