Skip to content

fix(session): CLI session key mismatch — provider 'unknown' vs runtime name#2124

Merged
alexey-pelykh merged 2 commits intomainfrom
fix/session-key-mismatch-2105
Apr 8, 2026
Merged

fix(session): CLI session key mismatch — provider 'unknown' vs runtime name#2124
alexey-pelykh merged 2 commits intomainfrom
fix/session-key-mismatch-2105

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Fixes #2105.

  • resolveDefaultModel() now returns the configured agent runtime (e.g. "claude") as defaultProvider instead of the hardcoded "unknown" — this flows through to providerUsed in the session usage pipeline
  • isCliProvider() recognizes the four agent runtime names (claude, gemini, codex, opencode) as CLI providers, so CLI session IDs are correctly extracted and persisted
  • The cron isolated-agent path uses the same runtime-based provider resolution

Root cause: The gutted resolveDefaultModel() stub returned "unknown", causing isCliProvider("unknown") to return false, which meant CLI session IDs were never persisted — --resume was never passed on subsequent messages in the same thread.

Test plan

  • New unit tests for isCliProvider() runtime name recognition
  • New unit tests for resolveDefaultModel() runtime-based resolution
  • Updated cron test mocks to include resolveAgentRuntime
  • Updated cron test assertion (provider/model now reflect runtime)
  • pnpm check passes (format + typecheck + lint)
  • CI green

🤖 Generated with Claude Code

@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 8, 2026 09:38
…provider (#2105)

The gutted resolveDefaultModel() stub returned defaultProvider: "unknown",
which flowed through to providerUsed. Since isCliProvider("unknown") returned
false, CLI session IDs were never persisted — preventing --resume from being
passed on subsequent messages in the same thread.

Three changes fix the pipeline:

1. resolveDefaultModel() now uses resolveAgentRuntime() to return the actual
   runtime name (e.g. "claude") as the default provider.

2. isCliProvider() recognizes the four agent runtime names (claude, gemini,
   codex, opencode) as CLI providers, independent of cliBackends config.

3. The cron isolated-agent path uses the same runtime-based provider
   resolution instead of hardcoded "unknown".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh force-pushed the fix/session-key-mismatch-2105 branch from ea94db7 to 5d1d41b Compare April 8, 2026 09:41
The upstream #2121 re-enabled these tests which now need the
resolveAgentRuntime mock and updated default assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 146c958 into main Apr 8, 2026
9 checks passed
@alexey-pelykh alexey-pelykh deleted the fix/session-key-mismatch-2105 branch April 8, 2026 10:06
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.

fix(session): CLI session key mismatch — provider 'unknown' vs runtime name

1 participant