fix: isolate git snapshot errors per workspace in fetch_workspaces
A single workspace failing to load git data (e.g. empty repo, corrupt git state) was crashing the entire fetch_workspaces response, leaving all users with an unusable app. Now errors are caught per-workspace and logged as warnings, returning the workspace without git data.
This commit is contained in:
@@ -5443,7 +5443,17 @@ export class Session {
|
|||||||
projectRecord?: PersistedProjectRecord | null,
|
projectRecord?: PersistedProjectRecord | null,
|
||||||
): Promise<WorkspaceDescriptorPayload> {
|
): Promise<WorkspaceDescriptorPayload> {
|
||||||
const base = await this.describeWorkspaceRecord(workspace, projectRecord);
|
const base = await this.describeWorkspaceRecord(workspace, projectRecord);
|
||||||
const snapshot = await this.workspaceGitService.getSnapshot(workspace.cwd);
|
|
||||||
|
let snapshot: WorkspaceGitRuntimeSnapshot;
|
||||||
|
try {
|
||||||
|
snapshot = await this.workspaceGitService.getSnapshot(workspace.cwd);
|
||||||
|
} catch (error) {
|
||||||
|
this.sessionLogger.warn(
|
||||||
|
{ err: error, cwd: workspace.cwd },
|
||||||
|
"Failed to load git snapshot for workspace",
|
||||||
|
);
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
const checkout = checkoutLiteFromGitSnapshot(workspace.cwd, snapshot.git);
|
const checkout = checkoutLiteFromGitSnapshot(workspace.cwd, snapshot.git);
|
||||||
const displayName = deriveWorkspaceDisplayName({ cwd: workspace.cwd, checkout });
|
const displayName = deriveWorkspaceDisplayName({ cwd: workspace.cwd, checkout });
|
||||||
|
|||||||
Reference in New Issue
Block a user