Skip to content

feat(sandbox): forward provisioning progress via ensureWorkspaceSandbox onProgress#161

Merged
drewstone merged 1 commit into
mainfrom
feat/sandbox-onprogress
Jul 1, 2026
Merged

feat(sandbox): forward provisioning progress via ensureWorkspaceSandbox onProgress#161
drewstone merged 1 commit into
mainfrom
feat/sandbox-onprogress

Conversation

@vutuanlinh2k2

Copy link
Copy Markdown
Contributor

Summary

Adds an optional onProgress callback to EnsureWorkspaceSandboxOptions, threaded into the waitFor('running') calls on both provisioning paths — stopped-box resume (resumeStoppedBox) and cold create. The SDK's waitFor emits real provisioning sub-steps as ProvisionEvent { step, status, message, percent } over SSE; today the substrate discards them by calling waitFor('running', { timeoutMs }) with no onProgress. This forwards them to callers so they can surface live "warming up" status instead of an opaque silent wait.

Why

A box coming up cold is silent for however long provisioning takes. Consumers (e.g. the GTM agent's graceful slow-chat work) want to show honest progress — "Pulling image…", "Starting container…", "Health check…" — rather than a blank spinner or a false timeout. This exposes the data the SDK already produces.

What changed

  • EnsureWorkspaceSandboxOptions gains onProgress?: (event: ProvisionEvent) => void.
  • ensureWorkspaceSandbox destructures onProgress and passes it into:
    • resumeStoppedBox(...)match.waitFor('running', { timeoutMs, onProgress })
    • cold-create box.waitFor('running', { timeoutMs: 120_000, onProgress })
  • Import ProvisionEvent from @tangle-network/sandbox.

Compatibility

Purely additive. A caller that passes no onProgress behaves exactly as before, and a reused running box (which skips waitFor) emits nothing. onProgress is spread conditionally, so waitFor options are byte-identical to today when it's absent.

Testing

  • tsc --noEmit clean.
  • vitest run src/sandbox — 106 passing; the 3 failing deferred profile files transport-retry tests are pre-existing and fail identically on main without this change (verified by stashing the diff). They are unrelated to this change (retry/auth-refresh timing, not waitFor/provisioning).

…ox onProgress

Add an optional onProgress callback to EnsureWorkspaceSandboxOptions,
threaded into the waitFor('running') calls on both the stopped-box resume
and cold-create paths. Surfaces the SDK's real provisioning sub-steps
(ProvisionEvent { step, status, message, percent }) to callers, which
previously discarded them by calling waitFor without onProgress.

Purely additive: a caller that passes no onProgress is unchanged, and a
reused running box (no waitFor) emits nothing.
@vutuanlinh2k2 vutuanlinh2k2 requested a review from tangletools July 1, 2026 14:26
@drewstone drewstone merged commit 28fc81c into main Jul 1, 2026
1 check passed
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