fix(vscode): keep agent view metadata on snapshot errors

This commit is contained in:
Hunter Bown
2026-06-06 01:49:32 -07:00
committed by GitHub
parent cd9a044387
commit 23a188e8fd
5 changed files with 63 additions and 45 deletions
+5 -2
View File
@@ -126,8 +126,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the VS Code Agent View can show when a thread or agent lane is on another
branch. Agent View and restore-point data now auto-refresh on a configurable
read-only interval so branch/workspace changes become visible without a
manual refresh. This answers the VS Code GUI lane without exposing chat
webviews, inline edits, or retry/undo/restore runtime mutation endpoints yet
manual refresh. Agent View refreshes keep thread branch/workspace rows
independent from restore-point loading, so a snapshot-listing failure no
longer clears already-available thread metadata. This answers the VS Code GUI
lane without exposing chat webviews, inline edits, or retry/undo/restore
runtime mutation endpoints yet
(#461, #462, #480, #1217, #2341, #1584, #2327, #2580, #2808). Thanks @AiurArtanis
for the Agent View prompt, @lbcheng888 for the earlier scaffold, @gaord for
the GUI runtime API direction, @douglarek, @caeserchen, and @nightt5879 for
+5 -2
View File
@@ -126,8 +126,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the VS Code Agent View can show when a thread or agent lane is on another
branch. Agent View and restore-point data now auto-refresh on a configurable
read-only interval so branch/workspace changes become visible without a
manual refresh. This answers the VS Code GUI lane without exposing chat
webviews, inline edits, or retry/undo/restore runtime mutation endpoints yet
manual refresh. Agent View refreshes keep thread branch/workspace rows
independent from restore-point loading, so a snapshot-listing failure no
longer clears already-available thread metadata. This answers the VS Code GUI
lane without exposing chat webviews, inline edits, or retry/undo/restore
runtime mutation endpoints yet
(#461, #462, #480, #1217, #2341, #1584, #2327, #2580, #2808). Thanks @AiurArtanis
for the Agent View prompt, @lbcheng888 for the earlier scaffold, @gaord for
the GUI runtime API direction, @douglarek, @caeserchen, and @nightt5879 for
+26 -21
View File
@@ -59,6 +59,30 @@ function activate(context) {
statusView.updateSnapshots(snapshots, "Showing recent restore points.");
output.appendLine(`Loaded ${snapshots.length} runtime restore points.`);
};
const refreshAgentViewDetails = async (showWarning) => {
try {
await refreshAgentView();
}
catch (error) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
output.appendLine(`Runtime thread summaries unavailable: ${detail}`);
if (showWarning) {
void vscode.window.showWarningMessage(detail);
}
}
try {
await refreshSnapshots();
}
catch (error) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime restore points unavailable: ${detail}`);
if (showWarning) {
void vscode.window.showWarningMessage(detail);
}
}
};
const updateStatus = (text, tooltip) => {
status.text = text;
status.tooltip = tooltip;
@@ -74,16 +98,7 @@ function activate(context) {
switch (state.kind) {
case "connected":
updateStatus("$(check) CodeWhale", state.detail);
try {
await refreshAgentView();
await refreshSnapshots();
}
catch (error) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime Agent View details unavailable: ${detail}`);
}
await refreshAgentViewDetails(false);
break;
case "auth-required":
updateStatus("$(lock) CodeWhale", state.detail);
@@ -157,17 +172,7 @@ function activate(context) {
return await checkAndRefreshRuntime(true, true);
}));
context.subscriptions.push(vscode.commands.registerCommand("codewhale.refreshAgentView", async () => {
try {
await refreshAgentView();
await refreshSnapshots();
}
catch (error) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime Agent View details unavailable: ${detail}`);
void vscode.window.showWarningMessage(detail);
}
await refreshAgentViewDetails(true);
}));
context.subscriptions.push(vscode.commands.registerCommand("codewhale.refreshSnapshots", async () => {
try {
File diff suppressed because one or more lines are too long
+26 -19
View File
@@ -38,6 +38,30 @@ export function activate(context: vscode.ExtensionContext): void {
output.appendLine(`Loaded ${snapshots.length} runtime restore points.`);
};
const refreshAgentViewDetails = async (showWarning: boolean): Promise<void> => {
try {
await refreshAgentView();
} catch (error: unknown) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
output.appendLine(`Runtime thread summaries unavailable: ${detail}`);
if (showWarning) {
void vscode.window.showWarningMessage(detail);
}
}
try {
await refreshSnapshots();
} catch (error: unknown) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime restore points unavailable: ${detail}`);
if (showWarning) {
void vscode.window.showWarningMessage(detail);
}
}
};
const updateStatus = (text: string, tooltip: string): void => {
status.text = text;
status.tooltip = tooltip;
@@ -59,15 +83,7 @@ export function activate(context: vscode.ExtensionContext): void {
switch (state.kind) {
case "connected":
updateStatus("$(check) CodeWhale", state.detail);
try {
await refreshAgentView();
await refreshSnapshots();
} catch (error: unknown) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime Agent View details unavailable: ${detail}`);
}
await refreshAgentViewDetails(false);
break;
case "auth-required":
updateStatus("$(lock) CodeWhale", state.detail);
@@ -161,16 +177,7 @@ export function activate(context: vscode.ExtensionContext): void {
context.subscriptions.push(
vscode.commands.registerCommand("codewhale.refreshAgentView", async () => {
try {
await refreshAgentView();
await refreshSnapshots();
} catch (error: unknown) {
const detail = error instanceof Error ? error.message : String(error);
statusView.updateThreads([], "Runtime thread summaries unavailable.");
statusView.updateSnapshots([], detail);
output.appendLine(`Runtime Agent View details unavailable: ${detail}`);
void vscode.window.showWarningMessage(detail);
}
await refreshAgentViewDetails(true);
}),
);