Skip to content

Commit 030cdf0

Browse files
committed
Try to reconnect to the session in the task logs panel
1 parent 5201333 commit 030cdf0

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Auto-import all IPC service types for declaration merging
3+
* This file is auto-generated by vite-plugin-auto-services.ts
4+
*/
5+
6+

apps/array/src/renderer/features/task-detail/components/TaskLogsPanel.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
4040
const events = session?.events ?? [];
4141
const isPromptPending = session?.isPromptPending ?? false;
4242

43-
const hasAttemptedConnect = useRef(false);
43+
const isConnecting = useRef(false);
44+
4445
useEffect(() => {
45-
if (hasAttemptedConnect.current) return;
4646
if (!repoPath) return;
47-
if (session) return;
47+
if (isConnecting.current) return;
48+
49+
if (session?.status === "connected" || session?.status === "connecting") {
50+
return;
51+
}
4852

49-
hasAttemptedConnect.current = true;
53+
isConnecting.current = true;
5054

5155
const isNewSession = !task.latest_run?.id;
5256
const hasInitialPrompt = isNewSession && task.description;
@@ -55,12 +59,20 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
5559
markActivity(task.id);
5660
}
5761

62+
log.info("Connecting to task session", {
63+
taskId: task.id,
64+
hasLatestRun: !!task.latest_run,
65+
sessionStatus: session?.status ?? "none",
66+
});
67+
5868
connectToTask({
5969
task,
6070
repoPath,
6171
initialPrompt: hasInitialPrompt
6272
? [{ type: "text", text: task.description }]
6373
: undefined,
74+
}).finally(() => {
75+
isConnecting.current = false;
6476
});
6577
}, [task, repoPath, session, connectToTask, markActivity]);
6678

0 commit comments

Comments
 (0)