You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getWorkspace: return a lazy client synchronously #254
getWorkspace(stub) is async, so it can't be assigned to a class field. Think's workspace is a class field, which is why @cloudflare/think 0.21.0 briefly shipped a lazyWorkspace(async () => getWorkspace(stub)) wrapper. We're removing that from Think in a patch; the laziness belongs here.
Today the remote path awaits __getWorkspaceStub(), then useThink, runtime.backends() and hasAssets, before returning a client. Callers often have a promise of the stub too (agents' parentAgent() is async).
Proposal:
getWorkspace(handle) returns a WorkspaceClient synchronously and accepts handle | Promise<handle>. The remote stub is fetched on first use; RPC promise pipelining means fs calls don't need to wait for it.
The metadata that's fetched up front becomes lazy. runtime.backends() is the one that matters: createAITools reads it synchronously to build exec, so a lazy client gets no exec today. Making backends() async (and createAITools await it, or build tools from an async factory) would give shared workspaces exec too.
await getWorkspace(...) keeps working, since awaiting a non-thenable returns it.
Triage summary: this proposes making getWorkspace return a WorkspaceClient synchronously, accepting a handle or a promise of one. The remote stub and metadata would load lazily. runtime.backends() would become async, so createAITools could build exec for shared workspaces. The work is likely in the workspace client, runtime backends and createAITools. No similar open issues were found.
Activity
github-actions commentedon Oct 20, 2026
Triage summary: this proposes making
getWorkspacereturn aWorkspaceClientsynchronously, accepting a handle or a promise of one. The remote stub and metadata would load lazily.runtime.backends()would become async, socreateAIToolscould buildexecfor shared workspaces. The work is likely in the workspace client, runtime backends andcreateAITools. No similar open issues were found.computer: Return a lazy client from getWorkspace (cloudflare#255)