Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
6 changes: 6 additions & 0 deletions apps/desktop/src/main/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, dialog, ipcMain, Menu, nativeImage, Notification, powerMonitor, protocol, safeStorage, shell } from "electron";

Check warning on line 1 in apps/desktop/src/main/main.ts

View workflow job for this annotation

GitHub Actions / lint-desktop

'shell' is defined but never used. Allowed unused vars must match /^_/u

if (app.isPackaged && process.env.ADE_RUNTIME_PACKAGED === undefined) {
process.env.ADE_RUNTIME_PACKAGED = "1";
Expand Down Expand Up @@ -210,7 +210,7 @@
import { localIpcListenOptions } from "../../../ade-cli/src/services/runtime/localIpcListenOptions";
import { normalizeProjectRootPath } from "../../../ade-cli/src/services/projects/projectRoots";
import {
ACCOUNT_SESSION_CREDENTIAL_KEY,

Check warning on line 213 in apps/desktop/src/main/main.ts

View workflow job for this annotation

GitHub Actions / lint-desktop

'ACCOUNT_SESSION_CREDENTIAL_KEY' is defined but never used. Allowed unused vars must match /^_/u
getSignedInAccountAccessToken,
} from "../../../ade-cli/src/services/account/accountAuthService";
import { createPushRelayClient } from "../../../ade-cli/src/services/push/pushRelayClient";
Expand Down Expand Up @@ -3589,6 +3589,12 @@
db,
sessionService,
emitEvent: emitPrEvent,
getChatLiveness: async (sessionId) => {
const summary = await agentChatService.getSessionSummary(sessionId);
return summary
? { status: summary.status, awaitingInput: summary.awaitingInput }
: null;
},
});
laneTeardownDeps.agentChatService = {
countActiveForLane: (laneId) => agentChatService.countActiveForLane(laneId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ describe("createCtoOperatorTools", () => {
...row,
})),
settleSession: vi.fn(() => true),
settleSessionReportingAbort: vi.fn(() => ({ found: true, settled: true })),
unsettleSession: vi.fn(() => true),
setSettleOverride: vi.fn(() => true),
snoozeSession: vi.fn(() => true),
Expand Down Expand Up @@ -548,7 +549,7 @@ describe("createCtoOperatorTools", () => {
sessionId: "chat-1",
outcome: "CI green",
})).resolves.toMatchObject({ success: true });
expect(sessionService.settleSession).toHaveBeenCalledWith("chat-1", {
expect(sessionService.settleSessionReportingAbort).toHaveBeenCalledWith("chat-1", {
outcome: "CI green",
source: "operator",
});
Expand Down
14 changes: 12 additions & 2 deletions apps/desktop/src/main/services/ai/tools/ctoOperatorTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface CtoOperatorToolDeps {
| "updateMeta"
| "get"
| "settleSession"
| "settleSessionReportingAbort"
| "unsettleSession"
| "setSettleOverride"
| "snoozeSession"
Expand Down Expand Up @@ -552,11 +553,20 @@ export function createCtoOperatorTools(deps: CtoOperatorToolDeps): Record<string
}),
execute: async ({ sessionId, outcome }) => {
try {
const ok = deps.sessionService.settleSession(sessionId, {
const result = deps.sessionService.settleSessionReportingAbort(sessionId, {
...(outcome ? { outcome } : {}),
source: "operator",
});
if (!ok) return { success: false, error: `Session not found: ${sessionId}` };
if (!result.found) return { success: false, error: `Session not found: ${sessionId}` };
if (!result.settled) {
// The session went active while the settle was in flight. Saying "not
// found" here would send the operator looking for a session that is
// sitting right there, working.
return {
success: false,
error: `Session is active again, so it was not settled: ${sessionId}`,
};
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
return { success: true, sessionId, ...readSessionLifecycle(deps, sessionId) };
} catch (error) {
return { success: false, error: getErrorMessage(error) };
Expand Down
Loading
Loading