KEMBAR78
Codespace state tracking has a bug which leads to infinite polling · Issue #10218 · cli/cli · GitHub
Skip to content

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

@cmbrose

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodespacesgh-codespacerelating to the gh codespace commandp3Affects 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