Skip to content

Conversation

@OliverTrautvetter
Copy link
Member

@OliverTrautvetter OliverTrautvetter commented Jan 21, 2026

Adds the ability to wake up a workspace using the CLI.

Clickup

Adds the ability to send HTTP requests to my workspace's dev domain, so that I can test connectivity.

Clickup

Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
@OliverTrautvetter OliverTrautvetter changed the title feat: add wake-up command to manage on-demand workspaces and integrate tests feat: add wake-up command Jan 22, 2026
@OliverTrautvetter OliverTrautvetter changed the title feat: add wake-up command feat: add wake-up command and curl workspace Jan 22, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds CLI support for waking up on-demand workspaces and sending authenticated HTTP requests to a workspace’s dev domain, plus corresponding client APIs, tests, and documentation updates.

Changes:

  • Introduces a cs wake-up command with API support (ScaleWorkspace) and both unit and integration tests to start an on-demand workspace by scaling replicas and waiting until it is running.
  • Adds a cs curl command that constructs an authenticated URL to a workspace’s dev domain and shells out to curl, including comprehensive unit and integration tests and new documentation.
  • Updates client interfaces, mocks, and workflows (integration test cleanup and docs) to support the new commands and to slightly improve workspace readiness polling behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
int/util/workspace.go Adds a helper to call the new ScaleWorkspace API from integration utilities.
int/integration_test.go Adds integration suites for wake-up and curl commands, and extends generic error-handling coverage to the new commands.
docs/cs_wake-up.md Documents the new cs wake-up command, including usage, examples, and options.
docs/cs_list_workspaces.md Corrects the list-workspaces example to use the -t flag, aligning docs with the CLI.
docs/cs_curl.md Documents the new cs curl command, including path and curl-arg syntax, examples, and options.
docs/cs.md Adds links for the new curl and wake-up subcommands in the main cs docs index.
docs/README.md Mirrors the cs.md updates for the CLI command index in the docs README.
cli/cmd/wakeup_test.go Introduces unit tests for the WakeUpCmd.WakeUpWorkspace logic, covering normal, already-running, and error cases.
cli/cmd/wakeup.go Implements the cs wake-up command, wiring it into the root command and using the API client to scale and wait for workspace readiness.
cli/cmd/root.go Registers the new wake-up and curl subcommands with the root CLI.
cli/cmd/mocks.go Extends the CLI MockClient with ScaleWorkspace, WaitForWorkspaceRunning, and WorkspaceStatus methods to support new command tests.
cli/cmd/list_workspaces.go Updates the example string to use -t <team-id> for listing workspaces.
cli/cmd/curl_test.go Adds unit tests for CurlCmd.CurlWorkspace, covering URL construction, dev-domain absence, and workspace lookup errors.
cli/cmd/curl.go Implements the cs curl command, building an authenticated URL from the workspace dev domain and delegating the HTTP request to curl.
cli/cmd/client.go Extends the Client interface and NewClient to expose WorkspaceStatus, WaitForWorkspaceRunning, and ScaleWorkspace to CLI commands.
api/workspace.go Adds the ScaleWorkspace API wrapper and adjusts WaitForWorkspaceRunning to retry on transient errors until timeout.
api/openapi_client/mocks.go Regenerates/updates openapi client mocks with simpler type assertions in Run helpers.
.mockery.yml Adjusts mockery configuration for the openapi client package (removing include-auto-generated).
.github/workflows/integration-test.yml Extends orphaned workspace cleanup to include the new cli-wakeup-test-* and cli-curl-test-* workspace name prefixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

OliverTrautvetter and others added 5 commits January 28, 2026 14:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OliverTrautvetter OliverTrautvetter marked this pull request as ready for review January 28, 2026 16:15
@OliverTrautvetter OliverTrautvetter requested a review from a team as a code owner January 28, 2026 16:15
Copy link
Member

@siherrmann siherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, please revisit.

Comment on lines +78 to +80
curl.Port = curl.cmd.Flags().IntP("port", "p", 3000, "Port to connect to")
curl.Timeout = curl.cmd.Flags().DurationP("timeout", "", 30*time.Second, "Timeout for the request")
curl.cmd.Flags().BoolVar(&curl.Insecure, "insecure", false, "skip TLS certificate verification (for testing only)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our nornal way is the last (so curl.cmd.Flags().BoolVar). Please update the other flags to the same structure (IntVar and DurationVar)

Comment on lines +96 to +99
port := 3000
if c.Port != nil {
port = *c.Port
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be done purely with a flag that has a default, would be cleaner.

url = fmt.Sprintf("https://%s%s", devDomain, path)
}

fmt.Fprintf(os.Stderr, "Sending request to workspace %d (%s) at %s\n", wsId, workspace.Name, url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use log.Printf()?


fmt.Fprintf(os.Stderr, "Sending request to workspace %d (%s) at %s\n", wsId, workspace.Name, url)

timeout := 30 * time.Second
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again we could use a flag with a default, we should never have nil then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, they even have the default already, I think you could remove the nil check then.

Comment on lines +123 to +126
cmdArgs := []string{"curl"}

// Add authentication header
cmdArgs = append(cmdArgs, "-H", fmt.Sprintf("x-forward-security: %s", token))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fair to just do:
cmdArgs := []string{"curl", "-H", fmt.Sprintf("x-forward-security: %s", token)}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even:
cmdArgs := []string{"curl", "-H", fmt.Sprintf("x-forward-security: %s", token), curlArgs...}
Then you can remove the // Add user's curl arguments

Comment on lines +141 to +146
if err != nil {
if ctx.Err() == context.DeadlineExceeded {
return fmt.Errorf("timeout exceeded while requesting workspace %d", wsId)
}
return fmt.Errorf("curl command failed: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but wouldn't be the err itself be context.DeadlineExceeded?
If so we could do:

if err != nil && err == context.DeadlineExceeded {
...
} else if err != nil {
...
}

Would be a little bit cleaner I think (but please verify, I'm not sure, error could be wrapped)

Comment on lines +84 to +87
timeout := 120 * time.Second
if c.Timeout != nil {
timeout = *c.Timeout
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, if default in flag is set this value should never be nil as far as I know.

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.

3 participants