Skip to content

Commit 27ea423

Browse files
improv: error handling
1 parent db3203a commit 27ea423

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

core/control-plane/client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import fetch, { RequestInit, Response } from "node-fetch";
1212

1313
import { OrganizationDescription } from "../config/ProfileLifecycleManager.js";
1414
import {
15+
BaseSessionMetadata,
1516
IDE,
1617
ModelDescription,
1718
Session,
18-
BaseSessionMetadata,
1919
} from "../index.js";
2020
import { Logger } from "../util/Logger.js";
2121

@@ -614,6 +614,7 @@ export class ControlPlaneClient {
614614
messageQueueLength: number;
615615
pendingPermission: any;
616616
} | null> {
617+
debugger;
617618
if (!(await this.isSignedIn())) {
618619
return null;
619620
}
@@ -626,12 +627,13 @@ export class ControlPlaneClient {
626627
},
627628
);
628629

629-
return (await resp.json()) as {
630+
const result = (await resp.json()) as {
630631
session: Session;
631632
isProcessing: boolean;
632633
messageQueueLength: number;
633634
pendingPermission: any;
634635
};
636+
return result;
635637
} catch (e) {
636638
Logger.error(e, {
637639
context: "control_plane_get_agent_state",

extensions/vscode/src/extension/VsCodeMessenger.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,26 @@ export class VsCodeMessenger {
632632
// Fetch the agent state
633633
const agentState =
634634
await configHandler.controlPlaneClient.getAgentState(agentSessionId);
635-
if (!agentState || !agentState.session) {
636-
vscode.window.showErrorMessage("Failed to load agent session state.");
635+
636+
// Debug what we got back
637+
debugger;
638+
console.log("Agent state response:", agentState);
639+
640+
if (!agentState) {
641+
vscode.window.showErrorMessage(
642+
"Failed to fetch agent state from API. The agent may not exist or you may not have permission.",
643+
);
644+
return;
645+
}
646+
647+
if (!agentState.session) {
648+
console.error(
649+
"Agent state is missing session field. Full response:",
650+
agentState,
651+
);
652+
vscode.window.showErrorMessage(
653+
"Agent state returned but missing session data. This may be a backend issue.",
654+
);
637655
return;
638656
}
639657

0 commit comments

Comments
 (0)