fix: pass session ID to TUI for proper session persistence

The TUI was only receiving sessionId when resuming/continuing,
but not for new sessions. This caused new sessions to use
different ID formats than the persistence system expects,
making them impossible to resume.

- Always pass session.id from initializeSession() to TUI
- Remove isResuming variable (no longer needed)
- Ensures new sessions use proper format: session_{timestamp}_{random}
- Allows --resume to find sessions correctly

Fixes: Session not found error when using --resume
This commit is contained in:
2026-02-16 01:22:06 -05:00
parent 60ba961429
commit 1435894033

View File

@@ -15,10 +15,7 @@ import type { ChatTUIOptions } from "@interfaces/ChatTUIOptions";
import type { AgentConfig } from "@/types/agent-config";
import { getConfig } from "@services/core/config";
import { getThinkingMessage } from "@constants/status-messages";
import {
enterFullscreen,
registerExitHandlers,
} from "@utils/core/terminal";
import { enterFullscreen, registerExitHandlers } from "@utils/core/terminal";
import { createCallbacks } from "@commands/chat-tui";
import { agentLoader } from "@services/agent-loader";
import { projectSetupService } from "@services/project-setup-service";
@@ -181,13 +178,10 @@ const execute = async (options: ChatTUIOptions): Promise<void> => {
const handleCommand = createHandleCommand(ctx, handleExit);
const handleSubmit = createHandleSubmit(ctx, handleCommand);
// Only pass sessionId if resuming/continuing - otherwise show Home view first
const isResuming = options.continueSession || options.resumeSession;
const savedCascadeEnabled = config.get("cascadeEnabled");
const renderProps: RenderAppProps = {
sessionId: isResuming ? session.id : undefined,
sessionId: session.id,
handleSubmit,
handleCommand,
handleModelSelect: handleModelSelectFn,