Comfy-Org / Comfy-Org/ComfyUI_frontend

endWorkspaceSession() discards prepareWorkflowWorkspaceTransition()'s resume closure — writes can stay permanently blocked

Open
#14,431 1 comment 0 reactions 1 assignee Assigned to @dante01yoon View on GitHub
area:auth Bug Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Context

Found while reviewing #14337 (https://github.com/Comfy-Org/ComfyUI_frontend/pull/14337#pullrequestreview-4824024471). Same lineage as #14300/#14306/#14337.

## Problem

`workspaceAuthStore.ts`'s `endWorkspaceSession()` calls `prepareWorkflowWorkspaceTransition()` but discards its return value:

```ts
function endWorkspaceSession(revokedWorkspaceId?: string): void {
const hadContext = currentWorkspace.value !== null
if (hadContext) prepareWorkflowWorkspaceTransition()
...
if (shouldReload) {
window.location.reload()
}
}
```

Since #14337, `prepareWorkflowWorkspaceTransition()` returns an owner-scoped resume closure instead of `void`. `endWorkspaceSession()` doesn't capture or call it.

When `shouldReload` evaluates `false` — which happens when `forgetRevokedActiveWorkspace(revokedWorkspaceId)` returns `true` for a `personal`-type revoked workspace (`teamWorkspaceStore.ts` ~419-429) — no reload occurs. Workflow writes stay blocked (`workflowStorageState` stuck in `'transitioning'`) with no path to resume.

This predates #14337 (previously `prepareWorkflowWorkspaceTransition()` set a permanent one-way `workflowWritesBlocked = true` with zero unblock mechanism at all, so this isn't a regression) but #14337 introduces the exact machinery that would fix it and doesn't wire it into this call site.

## Fix

Capture the returned resume closure in `endWorkspaceSession()` and call it once the new/fallback context is confirmed ready — same pattern `useWorkflowPersistenceV2.ts` uses for the logout path (`onUserResolved` + `whenever(...)` gated on `teamWorkspaceStore.initState === 'ready'`).

## References

- Found during review of #14337: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14337#pullrequestreview-4824024471
- Same lineage: #14300, #14306

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.