fix: create new conversation when no stored conversation ID exists (#245) (#250)

When an agent ID is configured but no conversation ID is stored, LettaBot
previously tried to resume the agent's default conversation via resumeSession().
If that default conversation was deleted or never created (e.g., after
migrations), the CLI exited with "Conversation default not found" and the bot
never replied to messages.

The fix changes getSession() to call createSession() instead of resumeSession()
when there's no stored conversation ID, ensuring a new conversation is always
created in this case.

👾 Generated with [Letta Code](https://letta.com)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Ari Webb
2026-02-10 10:29:06 -08:00
committed by GitHub
parent 9c0228d414
commit d52ea4e855

View File

@@ -199,7 +199,10 @@ export class LettaBot implements AgentSession {
}
if (this.store.agentId) {
process.env.LETTA_AGENT_ID = this.store.agentId;
return resumeSession(this.store.agentId, opts);
// Create a new conversation instead of resuming the default.
// This handles the case where the default conversation was deleted
// or never created (e.g., after migrations).
return createSession(this.store.agentId, opts);
}
// Create new agent -- persist immediately so we don't orphan it on later failures