diff --git a/apps/web/src/git-fetch.ts b/apps/web/src/git-fetch.ts index 3c02024cc..ce8988d0d 100644 --- a/apps/web/src/git-fetch.ts +++ b/apps/web/src/git-fetch.ts @@ -30,8 +30,9 @@ export async function fetchSourceFile(args: { dir, url: args.url, ref: MAIN_REF, + // The hub's git server advertises no `shallow` capability, so a + // depth-limited fetch is rejected outright; fetch the full branch. singleBranch: true, - depth: 1, tags: false, headers: { Authorization: `Bearer ${args.token}` }, }); diff --git a/apps/web/src/pages/new-workbench-picker.tsx b/apps/web/src/pages/new-workbench-picker.tsx index 1abb90cef..3dbd8bbf1 100644 --- a/apps/web/src/pages/new-workbench-picker.tsx +++ b/apps/web/src/pages/new-workbench-picker.tsx @@ -123,12 +123,20 @@ export function NewWorkbenchPickerRoute() { }); navigate(workbenchPath(tenantId)); }, - onError: (cause: unknown) => { + onError: (cause: unknown, variables) => { const refId = reportError(cause, { operation: "workbench_create", ...(selectedTenantId !== null ? { tenantId: selectedTenantId } : {}), }); toast(describeWorkbenchCreateFailure(cause, refId)); + // The room exists once a later stage fails; the toast says to retry + // from the room, so go there. + if (cause instanceof WorkbenchCreateError && cause.tenantId !== undefined) { + void queryClient.invalidateQueries({ + queryKey: chatKeys.childTenants(variables.benchTenantId), + }); + navigate(workbenchPath(cause.tenantId)); + } }, }); diff --git a/apps/web/src/workbench-create.ts b/apps/web/src/workbench-create.ts index b06cc1281..65842658c 100644 --- a/apps/web/src/workbench-create.ts +++ b/apps/web/src/workbench-create.ts @@ -15,6 +15,9 @@ export class WorkbenchCreateError extends Error { constructor( message: string, readonly stage: "create" | "deploy" | "opening-message", + /** Set once the room tenant exists, so a later-stage failure can + * still land the person in the room it created. */ + readonly tenantId?: string, ) { super(message); this.name = "WorkbenchCreateError"; @@ -32,8 +35,16 @@ function workbenchSlug(name: string): string { return `${base === "" ? "workbench" : base}-${Date.now().toString(36)}`; } -function failure(cause: unknown, stage: WorkbenchCreateError["stage"]): WorkbenchCreateError { - return new WorkbenchCreateError(cause instanceof Error ? cause.message : String(cause), stage); +function failure( + cause: unknown, + stage: WorkbenchCreateError["stage"], + tenantId?: string, +): WorkbenchCreateError { + return new WorkbenchCreateError( + cause instanceof Error ? cause.message : String(cause), + stage, + tenantId, + ); } export type CreateWorkbenchInput = { @@ -92,7 +103,7 @@ export async function createWorkbench(input: CreateWorkbenchInput): Promise