Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface SessionViewProps {
onCancelPrompt: () => void;
repoPath?: string | null;
hasError?: boolean;
errorTitle?: string;
errorMessage?: string;
onRetry?: () => void;
onDelete?: () => void;
Expand All @@ -62,6 +63,7 @@ export function SessionView({
onCancelPrompt,
repoPath,
hasError = false,
errorTitle,
errorMessage = DEFAULT_ERROR_MESSAGE,
onRetry,
onDelete,
Expand Down Expand Up @@ -380,11 +382,16 @@ export function SessionView({
className="absolute inset-0 bg-gray-1"
>
<Warning size={32} weight="duotone" color="var(--red-9)" />
{errorTitle && (
<Text size="3" weight="bold" align="center" color="red">
{errorTitle}
</Text>
)}
<Text
size="3"
weight="medium"
size={errorTitle ? "2" : "3"}
weight={errorTitle ? "regular" : "medium"}
align="center"
color="red"
color={errorTitle ? "gray" : "red"}
className="max-w-md px-4"
>
{errorMessage}
Expand Down
7 changes: 4 additions & 3 deletions apps/twig/src/renderer/features/sessions/service/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ export class SessionService {
const taskRunId = latestRun?.id ?? `error-${taskId}`;
const session = this.createBaseSession(taskRunId, taskId, taskTitle);
session.status = "error";
session.errorMessage = `Failed to connect to the agent: ${message}`;
session.errorTitle = "Failed to connect";
session.errorMessage = message;

if (latestRun?.log_url) {
try {
Expand Down Expand Up @@ -487,9 +488,11 @@ export class SessionService {
taskRunId: string,
taskTitle: string,
errorMessage: string,
errorTitle?: string,
): void {
const session = this.createBaseSession(taskRunId, taskId, taskTitle);
session.status = "error";
session.errorTitle = errorTitle;
session.errorMessage = errorMessage;
sessionStoreSetters.setSession(session);
}
Expand Down Expand Up @@ -1365,8 +1368,6 @@ export class SessionService {
if (session) {
await this.teardownSession(session.taskRunId);
}
// Clear from connecting tasks as well
this.connectingTasks.delete(taskId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface AgentSession {
events: AcpMessage[];
startedAt: number;
status: "connecting" | "connected" | "disconnected" | "error";
errorTitle?: string;
errorMessage?: string;
isPromptPending: boolean;
logUrl?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
const isRunning =
session?.status === "connected" || session?.status === "connecting";
const hasError = session?.status === "error";
const errorTitle = session?.errorTitle;
const errorMessage = session?.errorMessage;

const events = session?.events ?? [];
Expand Down Expand Up @@ -236,8 +237,7 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
const handleRetry = useCallback(async () => {
if (!repoPath) return;
await getSessionService().clearSessionError(taskId);
getSessionService().connectToTask({ task, repoPath });
}, [taskId, repoPath, task]);
}, [taskId, repoPath]);

const handleDelete = useCallback(() => {
const hasWorktree = workspace?.mode === "worktree";
Expand Down Expand Up @@ -322,6 +322,7 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
onCancelPrompt={handleCancelPrompt}
repoPath={repoPath}
hasError={isCloud ? false : hasError}
errorTitle={isCloud ? undefined : errorTitle}
errorMessage={isCloud ? undefined : errorMessage}
onRetry={handleRetry}
onDelete={handleDelete}
Expand Down
Loading