Skip to content

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

@alexey-pelykh

Description

@alexey-pelykh

Summary

CLI session IDs are stored under cliSessionIds["unknown"] but looked up via cliSessionIds["claude"] (or whichever runtime). This mismatch means --resume is never called, causing all CLI sessions to collapse into a single Claude project session.

Root Cause

resolveDefaultModel() in directive-handling.persist.ts:126 returns defaultProvider: "unknown" (model system was gutted). This flows through:

  1. get-reply.ts:44provider = "unknown"
  2. agent-runner.ts:414providerUsed = "unknown"
  3. session-usage.ts:22setCliSessionId(entry, "unknown", cliSessionId)

Read side uses resolveAgentRuntimeOrThrow()"claude", so the lookup always misses.

Fix

Replace resolveDefaultModel() stub with runtime-based resolution. Use resolveAgentRuntimeOrThrow() (or resolveAgentRuntime()) as the provider identifier throughout the session usage pipeline. This is the first step of gutting the vestigial model/provider plumbing.

Acceptance Criteria

  • Given a thread session runs with Claude runtime
    When the CLI session ID is persisted
    Then cliSessionIds is keyed by "claude" (not "unknown")

  • Given a thread session has a stored CLI session ID
    When a second message arrives in the same thread
    Then --resume <sessionId> is passed to the Claude CLI

  • Given two different Slack threads
    When each receives a message
    Then each gets a separate Claude CLI session (different session IDs)

Files

  • src/auto-reply/reply/directive-handling.persist.ts:119-127resolveDefaultModel() stub
  • src/auto-reply/reply/agent-runner.ts:441-442providerUsed derivation
  • src/auto-reply/reply/session-usage.ts:22setCliSessionId call

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions