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:
get-reply.ts:44 → provider = "unknown"
agent-runner.ts:414 → providerUsed = "unknown"
session-usage.ts:22 → setCliSessionId(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-127 — resolveDefaultModel() stub
src/auto-reply/reply/agent-runner.ts:441-442 — providerUsed derivation
src/auto-reply/reply/session-usage.ts:22 — setCliSessionId call
Summary
CLI session IDs are stored under
cliSessionIds["unknown"]but looked up viacliSessionIds["claude"](or whichever runtime). This mismatch means--resumeis never called, causing all CLI sessions to collapse into a single Claude project session.Root Cause
resolveDefaultModel()indirective-handling.persist.ts:126returnsdefaultProvider: "unknown"(model system was gutted). This flows through:get-reply.ts:44→provider = "unknown"agent-runner.ts:414→providerUsed = "unknown"session-usage.ts:22→setCliSessionId(entry, "unknown", cliSessionId)Read side uses
resolveAgentRuntimeOrThrow()→"claude", so the lookup always misses.Fix
Replace
resolveDefaultModel()stub with runtime-based resolution. UseresolveAgentRuntimeOrThrow()(orresolveAgentRuntime()) 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
cliSessionIdsis 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 CLIGiven 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-127—resolveDefaultModel()stubsrc/auto-reply/reply/agent-runner.ts:441-442—providerUsedderivationsrc/auto-reply/reply/session-usage.ts:22—setCliSessionIdcall