Skip to content

iOS can orphan a billed cube when New Session is dismissed during provisioning #312

Closed

Description

@yxlyx

Summary

Dismissing the New Session sheet while cube provisioning is in progress does not cancel the provisioning task or roll back a sandbox it has created. Provisioning can continue after the UI disappears, incur a full spin-up, and finish without handing the resulting session back to the Sessions list.

Reproduction

  1. Sign in and open New Session.
  2. Enter a valid prompt and tap Start building.
  3. While the UI is in the launching phase, dismiss the sheet.
  4. Observe gateway activity/sandbox inventory: the untracked launch continues and can create/start/configure a cube.
  5. Return to the Sessions list; no session is handed off because dismissal occurred before .chat.

Root cause

  • The Start button creates an untracked Task { await launch() } (apps/ios/Graff/Sources/NewSessionView.swift:46-51).
  • The task is not retained for cancellation.
  • .onDisappear { finish() } runs on dismissal, but finish() only calls onCreated when phase == .chat (NewSessionView.swift:111-121). During .launching it simply dismisses.
  • CubeBroker.launch can continue creating, starting, installing, provisioning, and launching services after the view is gone.

Expected behavior

  • Retain and cancel the provisioning task when the user cancels/dismisses.
  • Make the launching UI's cancellation behavior explicit.
  • If this flow created a new sandbox, stop/delete or otherwise record it on cancellation.
  • If cancellation arrives after a usable connection exists, persist/hand off a recoverable session rather than orphaning it.
  • Add a delayed-provisioning dismissal test.

Activity

  1. justrach commented on Jul 31, 2026

    @justrach
    Owner

    Fixed in v0.0.226 (PR #328).

    Provisioning is now cancellable with rollback, so dismissing the New Session sheet mid-spin-up no longer orphans a billed cube. The task was unstructured, so view teardown did not cancel it.

    Tests went 449 -> 575 on this release; every Zig fix carries a pinning test that was falsified independently (revert the production change, confirm the test goes red naming itself, restore).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions