openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Bug]: Sandbox modal close is coupled to session open and can appear frozen

Open benjaminshafii opened this issue 8 months ago • 1 comments

User report

A user reported sandbox setup looked frozen even after the worker was created.

Validation / research

The modal close happens only after optional onReady completes:

  • packages/app/src/app/context/workspace.ts:1661 runs input.onReady().
  • Modal close/clear happens later at packages/app/src/app/context/workspace.ts:1671.

In the current wiring, onReady is createSessionAndOpen():

  • packages/app/src/app/app.tsx:6180 passes onReady: async () => { await createSessionAndOpen(); }.

So if session-open hangs/fails after worker connection succeeds, the create-worker modal stays up and looks like provisioning is still blocked.

Expected behavior

Worker provisioning completion should not be held hostage by downstream session-open latency.

Suggested fix direction

  1. Decouple modal lifecycle from onReady/session opening.
  2. Mark sandbox creation done once worker connect succeeds.
  3. If session opening fails, surface a secondary non-blocking error/retry path.

Acceptance criteria

  • With a successful worker connect and failed/stalled session-open, modal does not remain in creating state.
  • User sees worker as connected and can retry opening a session independently.
  • No regression for happy path where session opens immediately.

benjaminshafii avatar Mar 06 '26 07:03 benjaminshafii

This looks fixed on current dev.

I traced the regression to 70795eba (fix(sandbox): stabilize worker creation flow and add debug cleanup tools), where createSandboxFlow waited for an onReady() callback and kept the flow in an "Opening session" phase before finishing the modal lifecycle.

That coupling was removed in a2f5d1df / PR #841 (fix(app): keep app and worker opens on new session screen). On current dev:

  • apps/app/src/app/app.tsx calls workspaceStore.createSandboxFlow(preset, folder) directly, without passing a session-open callback.
  • apps/app/src/app/context/workspace.ts now completes the sandbox flow as soon as the remote worker connection succeeds, marks the connect step done, and clears the create flow.
  • The remote workspace modal closes independently of downstream session opening.

So the right resolution here is to close this as fixed by #841. If someone can still reproduce it on an older shipped build, we should reopen or backport that fix to the affected release branch.

src-opn avatar Mar 22 '26 20:03 src-opn