Skip to content

Codespace state tracking has a bug which leads to infinite polling #10218

Closed

Description

@cmbrose

Describe the bug

There's some faulty logic in waitUntilCodespaceConnectionReady where it initially checks if the codespace is not ready and attempts to start it once if it's not.

The problem is: if the codespace is currently shutting down, rebuilding, or some other non-shutdown state, this start call will silently no-op and we won't try it again later - so the CLI will just poll until it eventually times out.

Steps to reproduce the behavior

  1. Create a codespace
  2. gh cs stop -c <name>
  3. Immediately gh cs ssh -c <name>
  4. Observe CLI waits for the codespace to become ready
  5. gh cs ls in another terminal
  6. Observe that codespace eventually becomes Shutdown
  7. The original gh cs ssh is still polling, but does not attempt to start the codespace and the codespace remains Shutdown

Expected vs actual behavior

The state polling should properly handle waiting for the Shutdown state before attempting to restart

Activity

  1. cmbrose commented on Jan 10, 2025

    @cmbrose
    MemberAuthor

    I got ahead of myself and already took a stab at it here: #10198

  2. added
    priority-3Affects a small number of users or is largely cosmetic
    gh-codespacerelating to the gh codespace command
    and removed on Jan 11, 2025
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

    bugSomething isn't workingcodespacesgh-codespacerelating to the gh codespace commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions