Skip to content

feat(tasks): warm cloud sandbox while composing, reuse on submit#2869

Merged
tatoalo merged 1 commit into
mainfrom
faster-sandboxes-spinups
Jun 24, 2026
Merged

feat(tasks): warm cloud sandbox while composing, reuse on submit#2869
tatoalo merged 1 commit into
mainfrom
faster-sandboxes-spinups

Conversation

@tatoalo

@tatoalo tatoalo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem

spawning a cloud task feels slow: the sandbox boot, repo clone, branch checkout, and the agent start all happen after the user hits submit. The user waits through provisioning before the agent does anything, we can try to optimize this lifecycle a bit

Changes

while the user composes a cloud task, fire an idempotent, debounced warm(repo, branch) request so the backend can provision an idling Run ahead of submit. On submit, nothing special happens client-side

  • useWarmTask: a fire-and-forget trigger
  • the create call now sends the selected branch so the backend can match an idling warm Run for the exact selection

@tatoalo tatoalo self-assigned this Jun 23, 2026
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(tasks): warm cloud sandbox while co..." | Re-trigger Greptile

Comment thread packages/ui/src/features/task-detail/components/TaskInput.tsx
Comment thread packages/ui/src/features/task-detail/hooks/useWarmTask.test.tsx Outdated
@tatoalo tatoalo force-pushed the faster-sandboxes-spinups branch from 30105a3 to 59d7630 Compare June 23, 2026 17:03
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit f0eff4e.

Speculatively warm a full idling Run while the user composes a cloud task (the
backend boots a sandbox, clones, checks out the branch, and starts the agent,
then idles awaiting the first message). On submit the normal create+run path
transparently reuses and activates that Run, so the user does not pay the agent
start latency at submit time.

The warm pool is backend-owned: useWarmTask just fires an idempotent, debounced
warm request on typing (gated behind the tasks-prewarm-sandbox flag), and the
create call sends the selected branch so the backend can match an idling warm
Run. No client-side handle, dedup, or release — the backend dedups and reaps.
@tatoalo tatoalo force-pushed the faster-sandboxes-spinups branch from 59d7630 to f0eff4e Compare June 23, 2026 17:11
@tatoalo tatoalo marked this pull request as ready for review June 23, 2026 17:11
@tatoalo tatoalo requested a review from a team June 23, 2026 17:11
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "feat(tasks): warm cloud sandbox while co..." | Re-trigger Greptile

@skoob13 skoob13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lastWarmedKeyRef.current = null;
log.warn("Failed to warm task", { error });
});
}, WARM_DEBOUNCE_MS);

@skoob13 skoob13 Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need to kill them when someone leaves the page/app? There is no task killing pre-warmed, unused sandboxes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it backend-owned, so we do kill them after 10 minutes of no message reaching the sandbox, so we don't need client-side logic for this

@tatoalo tatoalo merged commit 6b4c730 into main Jun 24, 2026
26 of 27 checks passed
@tatoalo tatoalo deleted the faster-sandboxes-spinups branch June 24, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants