fix(vscode): keep agent view metadata on snapshot errors#2848
Conversation
There was a problem hiding this comment.
Hmbown has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function refreshAgentViewDetails in the VS Code extension to refresh the Agent View and snapshots independently, ensuring that a failure in one does not clear the metadata of the other. The reviewer suggested running these two independent refresh operations concurrently using Promise.all instead of sequentially to reduce latency and improve responsiveness.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| 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); | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
The functions refreshAgentView() and refreshSnapshots() are executed sequentially with await. Since these operations are independent, running them sequentially introduces unnecessary latency, especially if one of the network requests is slow or times out. Running them concurrently using Promise.all would improve the responsiveness of the Agent View.
const refreshAgentViewDetails = async (showWarning: boolean): Promise<void> => {
const agentViewPromise = 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);
}
});
const snapshotsPromise = 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);
}
});
await Promise.all([agentViewPromise, snapshotsPromise]);
};
Summary\n- refresh Agent View thread summaries and restore points independently in the VS Code extension\n- keep branch/workspace thread metadata available when snapshot listing fails\n- update committed extension output and changelogs\n\n## Stewardship notes\n- Read-only extension-side resilience only: no runtime mutation endpoint, no restore/retry/undo behavior, no thread/file state mutation.\n- Preserves the #2580 Agent View lane while keeping #2808's mutating endpoints deferred until atomicity tests exist.\n\n## Verification\n- npm run check (extensions/vscode)\n- cmp -s CHANGELOG.md crates/tui/CHANGELOG.md && echo changelogs-match\n- git diff --check\n- ./scripts/release/check-versions.sh\n- ./scripts/release/check-ohos-deps.sh