Memory sidecar backend is hardcoded to OpenAI/Claude, ignoring user's active provider
Problem
The memory sidecar auto-selects its LLM backend with this priority: OpenAI (if Codex credentials exist) > Claude > active provider. When Codex OAuth tokens are present but expired, the sidecar picks the OpenAI backend and every call fails with "OpenAI SSE error: unknown error". Memory extraction stops silently. No new memories are created. The user gets no warning.
This happens on any non-OpenAI provider (custom OpenAI-compatible gateways, Copilot, Gemini, Cursor, etc.) because the sidecar prefers stale Codex tokens over the user's actual working provider.
Root cause
In crates/jcode-base/src/sidecar.rs, auto_select_backend() checks auth::codex::load_credentials().is_ok() first. If Codex tokens exist (even expired), it picks OpenAI. The memory_model config only routes to OpenAI or Claude models. Any other model value falls back to auto_select_backend(), which still picks OpenAI.
There is no way to force the sidecar to use the active provider when Codex or Claude credentials exist.
Solution
Add a memory_sidecar_backend config option to [agents] in config.toml:
"auto" (default): current behavior, auto-select OpenAI > Claude > provider
"openai": force OpenAI Responses API
"claude": force Claude Messages API
"provider": dispatch through the active agent provider via complete_simple
This lets users on custom gateways (or any non-OpenAI/Claude provider) use their own model for memory extraction and relevance judging.
Config example
[agents]
memory_sidecar_backend = "provider"
Env override: JCODE_MEMORY_SIDECAR_BACKEND
Implementation
Available at: https://github.com/alecuba16/jcode/tree/feature/memory-sidecar-provider
Files changed (6 files, +132/-18):
crates/jcode-config-types/src/lib.rs - new memory_sidecar_backend field in AgentsConfig
crates/jcode-base/src/sidecar.rs - backend selection logic respects config override
crates/jcode-base/src/config/env_overrides.rs - JCODE_MEMORY_SIDECAR_BACKEND env var
crates/jcode-base/src/config/default_file.rs - documented in default config template
crates/jcode-base/src/config/display_summary.rs - shows backend in config summary
README.md - new ### Memory sidecar backend section with config table and examples
Memory sidecar backend is hardcoded to OpenAI/Claude, ignoring user's active provider
Problem
The memory sidecar auto-selects its LLM backend with this priority: OpenAI (if Codex credentials exist) > Claude > active provider. When Codex OAuth tokens are present but expired, the sidecar picks the OpenAI backend and every call fails with "OpenAI SSE error: unknown error". Memory extraction stops silently. No new memories are created. The user gets no warning.
This happens on any non-OpenAI provider (custom OpenAI-compatible gateways, Copilot, Gemini, Cursor, etc.) because the sidecar prefers stale Codex tokens over the user's actual working provider.
Root cause
In
crates/jcode-base/src/sidecar.rs,auto_select_backend()checksauth::codex::load_credentials().is_ok()first. If Codex tokens exist (even expired), it picks OpenAI. Thememory_modelconfig only routes to OpenAI or Claude models. Any other model value falls back toauto_select_backend(), which still picks OpenAI.There is no way to force the sidecar to use the active provider when Codex or Claude credentials exist.
Solution
Add a
memory_sidecar_backendconfig option to[agents]in config.toml:"auto"(default): current behavior, auto-select OpenAI > Claude > provider"openai": force OpenAI Responses API"claude": force Claude Messages API"provider": dispatch through the active agent provider viacomplete_simpleThis lets users on custom gateways (or any non-OpenAI/Claude provider) use their own model for memory extraction and relevance judging.
Config example
Env override:
JCODE_MEMORY_SIDECAR_BACKENDImplementation
Available at: https://github.com/alecuba16/jcode/tree/feature/memory-sidecar-provider
Files changed (6 files, +132/-18):
crates/jcode-config-types/src/lib.rs- newmemory_sidecar_backendfield inAgentsConfigcrates/jcode-base/src/sidecar.rs- backend selection logic respects config overridecrates/jcode-base/src/config/env_overrides.rs-JCODE_MEMORY_SIDECAR_BACKENDenv varcrates/jcode-base/src/config/default_file.rs- documented in default config templatecrates/jcode-base/src/config/display_summary.rs- shows backend in config summaryREADME.md- new### Memory sidecar backendsection with config table and examples