-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Bug
When clicking "Create" in the create claw modal, the modal hangs for a long time waiting for the API to return. The modal eventually closes but drops back to the org page with stale cache — the new claw doesn't appear until several hard refreshes, at which point it shows in "provisioning" state.
Expected
Click "Create" → modal closes instantly → claw appears in the list with status "provisioning".
Root Cause (Initial Analysis)
createClawHandler in cloud/api/claws.handlers.ts does everything synchronously in one Effect pipeline:
- DB insert (fast)
- R2 bucket provisioning via
clawDeployment.provision()(slow — Cloudflare API) - Secret encryption + DB update (fast)
- Container warm-up via
clawDeployment.warmUp()(slow — cold start)
Steps 2 and 4 are the bottleneck. The API doesn't return until the entire pipeline completes, keeping the modal spinner alive.
Proposed Approach
Split into fast path (return immediately) and background work:
- Fast path: DB insert → return claw with status "provisioning" → modal closes
- Background: R2 provisioning → encrypt secrets → DB update → warm-up (fire-and-forget or via queue)
Also: the frontend should invalidate the claws query cache after creation so the new claw appears immediately.
Files
cloud/api/claws.handlers.ts—createClawHandlercloud/app/components/create-claw-modal.tsx— frontend modalcloud/claws/deployment/— provisioning service
Reported by Dandelion.