Skip to content

Commit 48fc317

Browse files
committed
review fixes
1 parent 20cfa8a commit 48fc317

4 files changed

Lines changed: 33 additions & 6 deletions

File tree

apps/code/src/main/services/agent/service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
821821
};
822822

823823
this.sessions.set(taskRunId, session);
824+
this.recordActivity(taskRunId);
824825
if (isRetry) {
825826
log.info("Session created after auth retry", { taskRunId });
826827
}

apps/code/src/renderer/features/sessions/service/service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ export class SessionService {
127127
this.idleKilledSubscription =
128128
trpcVanilla.agent.onSessionIdleKilled.subscribe(undefined, {
129129
onData: (event) => {
130-
const { taskRunId } = event as { taskRunId: string; taskId: string };
130+
const { taskRunId } = event;
131131
log.info("Session idle-killed by main process", { taskRunId });
132132
this.unsubscribeFromChannel(taskRunId);
133133
sessionStoreSetters.removeSession(taskRunId);
134-
removePersistedConfigOptions(taskRunId);
135134
},
136135
onError: (err) => {
137136
log.debug("Idle-killed subscription error", { error: err });
@@ -1617,9 +1616,7 @@ export class SessionService {
16171616
throw new Error("Unable to reach server. Please check your connection.");
16181617
}
16191618

1620-
const prefetchedLogs = logUrl
1621-
? await this.fetchSessionLogs(logUrl, taskRunId)
1622-
: { rawEntries: [] as StoredLogEntry[], adapter: undefined };
1619+
const prefetchedLogs = await this.fetchSessionLogs(logUrl, taskRunId);
16231620

16241621
// Determine sessionId: undefined = use from logs, null = strip (fresh), string = use as-is
16251622
const sessionId =

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,30 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
212212
});
213213
}, [task, repoPath, session, markActivity, isOnline, isCloud]);
214214

215+
// Safety net: reconnect disconnected local sessions when the window regains focus.
216+
useEffect(() => {
217+
if (isCloud) return;
218+
const handleFocus = () => {
219+
if (!repoPath || isConnecting.current) return;
220+
const currentSession = sessionStoreSetters.getSessionByTaskId(taskId);
221+
if (
222+
currentSession?.status === "connected" ||
223+
currentSession?.status === "connecting" ||
224+
currentSession?.status === "error"
225+
) {
226+
return;
227+
}
228+
isConnecting.current = true;
229+
getSessionService()
230+
.connectToTask({ task, repoPath })
231+
.finally(() => {
232+
isConnecting.current = false;
233+
});
234+
};
235+
window.addEventListener("focus", handleFocus);
236+
return () => window.removeEventListener("focus", handleFocus);
237+
}, [taskId, task, repoPath, isCloud]);
238+
215239
const handleSendPrompt = useCallback(
216240
async (text: string) => {
217241
const handled = await tryExecuteCodeCommand(text, {

packages/agent/src/adapters/claude/tools.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ export const SEARCH_TOOLS: Set<string> = new Set(["Glob", "Grep", "LS"]);
2626

2727
export const WEB_TOOLS: Set<string> = new Set(["WebSearch", "WebFetch"]);
2828

29-
export const AGENT_TOOLS: Set<string> = new Set(["Task", "TodoWrite", "Skill"]);
29+
export const AGENT_TOOLS: Set<string> = new Set([
30+
"Task",
31+
"Agent",
32+
"TodoWrite",
33+
"Skill",
34+
]);
3035

3136
const BASE_ALLOWED_TOOLS = [
3237
...READ_TOOLS,

0 commit comments

Comments
 (0)