Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[pull] main from coder:main #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/exp_mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,10 @@ func (s *mcpServer) startWatcher(ctx context.Context, inv *serpent.Invocation) {
case event := <-eventsCh:
switch ev := event.(type) {
case agentapi.EventStatusChange:
// If the screen is stable, assume complete.
// If the screen is stable, report idle.
state := codersdk.WorkspaceAppStatusStateWorking
if ev.Status == agentapi.StatusStable {
state = codersdk.WorkspaceAppStatusStateComplete
state = codersdk.WorkspaceAppStatusStateIdle
}
err := s.queue.Push(taskReport{
state: state,
Expand Down
4 changes: 2 additions & 2 deletions cli/exp_mcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ func TestExpMcpReporter(t *testing.T) {
{
event: makeStatusEvent(agentapi.StatusStable),
expected: &codersdk.WorkspaceAppStatus{
State: codersdk.WorkspaceAppStatusStateComplete,
State: codersdk.WorkspaceAppStatusStateIdle,
Message: "doing work",
URI: "https://dev.coder.com",
},
Expand Down Expand Up @@ -948,7 +948,7 @@ func TestExpMcpReporter(t *testing.T) {
{
event: makeStatusEvent(agentapi.StatusStable),
expected: &codersdk.WorkspaceAppStatus{
State: codersdk.WorkspaceAppStatusStateComplete,
State: codersdk.WorkspaceAppStatusStateIdle,
Message: "oops",
URI: "",
},
Expand Down
2 changes: 2 additions & 0 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- It is not possible to delete a value from an enum, so we have to recreate it.
CREATE TYPE old_workspace_app_status_state AS ENUM ('working', 'complete', 'failure');

-- Convert the new "idle" state into "complete". This means we lose some
-- information when downgrading, but this is necessary to swap to the old enum.
UPDATE workspace_app_statuses SET state = 'complete' WHERE state = 'idle';

-- Swap to the old enum.
ALTER TABLE workspace_app_statuses
ALTER COLUMN state TYPE old_workspace_app_status_state
USING (state::text::old_workspace_app_status_state);

-- Drop the new enum and rename the old one to the final name.
DROP TYPE workspace_app_status_state;
ALTER TYPE old_workspace_app_status_state RENAME TO workspace_app_status_state;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE workspace_app_status_state ADD VALUE IF NOT EXISTS 'idle';
5 changes: 4 additions & 1 deletion coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion coderd/dynamicparameters/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package dynamicparameters

import (
"context"
"database/sql"
"io/fs"
"log/slog"
"sync"
"time"

"github.com/google/uuid"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -105,9 +107,24 @@ func (r *loader) loadData(ctx context.Context, db database.Store) error {

if r.terraformValues == nil {
values, err := db.GetTemplateVersionTerraformValues(ctx, r.templateVersion.ID)
if err != nil {
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
return xerrors.Errorf("template version terraform values: %w", err)
}

if xerrors.Is(err, sql.ErrNoRows) {
// If the row does not exist, return zero values.
//
// Older template versions (prior to dynamic parameters) will be missing
// this row, and we can assume the 'ProvisionerdVersion' "" (unknown).
values = database.TemplateVersionTerraformValue{
TemplateVersionID: r.templateVersionID,
UpdatedAt: time.Time{},
CachedPlan: nil,
CachedModuleFiles: uuid.NullUUID{},
ProvisionerdVersion: "",
}
}

r.terraformValues = &values
}

Expand Down
5 changes: 4 additions & 1 deletion coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req
}

switch req.State {
case codersdk.WorkspaceAppStatusStateComplete, codersdk.WorkspaceAppStatusStateFailure, codersdk.WorkspaceAppStatusStateWorking: // valid states
case codersdk.WorkspaceAppStatusStateComplete,
codersdk.WorkspaceAppStatusStateFailure,
codersdk.WorkspaceAppStatusStateWorking,
codersdk.WorkspaceAppStatusStateIdle: // valid states
default:
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "Invalid state provided.",
Expand Down
6 changes: 3 additions & 3 deletions codersdk/toolsdk/toolsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Bad Tasks
Use the "state" field to indicate your progress. Periodically report
progress with state "working" to keep the user updated. It is not possible to send too many updates!

ONLY report a "complete" or "failure" state if you have FULLY completed the task.
ONLY report an "idle" or "failure" state if you have FULLY completed the task.
`,
Schema: aisdk.Schema{
Properties: map[string]any{
Expand All @@ -205,10 +205,10 @@ ONLY report a "complete" or "failure" state if you have FULLY completed the task
},
"state": map[string]any{
"type": "string",
"description": "The state of your task. This can be one of the following: working, complete, or failure. Select the state that best represents your current progress.",
"description": "The state of your task. This can be one of the following: working, idle, or failure. Select the state that best represents your current progress.",
"enum": []string{
string(codersdk.WorkspaceAppStatusStateWorking),
string(codersdk.WorkspaceAppStatusStateComplete),
string(codersdk.WorkspaceAppStatusStateIdle),
string(codersdk.WorkspaceAppStatusStateFailure),
},
},
Expand Down
1 change: 1 addition & 0 deletions codersdk/workspaceapps.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type WorkspaceAppStatusState string

const (
WorkspaceAppStatusStateWorking WorkspaceAppStatusState = "working"
WorkspaceAppStatusStateIdle WorkspaceAppStatusState = "idle"
WorkspaceAppStatusStateComplete WorkspaceAppStatusState = "complete"
WorkspaceAppStatusStateFailure WorkspaceAppStatusState = "failure"
)
Expand Down
87 changes: 87 additions & 0 deletions docs/admin/integrations/dx-data-cloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# DX Data Cloud

[DX](https://getdx.com) is a developer intelligence platform used by engineering
leaders and platform engineers.

DX uses metadata attributes to assign information to individual users.
While it's common to segment users by `role`, `level`, or `geo`, it’s become increasingly
common to use DX attributes to better understand usage and adoption of tools.

You can create a `Coder` attribute in DX to segment and analyze the impact of Coder usage on a developer’s work, including:

- Understanding the needs of power users or low Coder usage across the org
- Correlate Coder usage with qualitative and quantitative engineering metrics,
such as PR throughput, deployment frequency, deep work, dev environment toil, and more.
- Personalize user experiences

## Requirements

- A DX subscription
- Access to Coder user data through the Coder CLI, Coder API, an IdP, or an existing Coder-DX integration
- Coordination with your DX Customer Success Manager

## Extract Your Coder User List

<div class="tabs">

You can use the Coder CLI, Coder API, or your Identity Provider (IdP) to extract your list of users.

If your organization already uses the Coder-DX integration, you can find a list of active Coder users directly within DX.

### CLI

Use `users list` to export the list of users to a CSV file:

```shell
coder users list > users.csv
```

Visit the [users list](../../reference/cli/users_list.md) documentation for more options.

### API

Use [get users](../../reference/api/users.md#get-users):

```bash
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

To export the results to a CSV file, you can use the `jq` tool to process the JSON response:

```bash
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY' | \
jq -r '.users | (map(keys) | add | unique) as $cols | $cols, (.[] | [.[$cols[]]] | @csv)' > users.csv
```

Visit the [get users](../../reference/api/users.md#get-users) documentation for more options.

### IdP

If your organization uses a centralized IdP to manage user accounts, you can extract user data directly from your IdP.

This is particularly useful if you need additional user attributes managed within your IdP.

</div>

## Contact your DX Customer Success Manager

Provide the file to your dedicated DX Customer Success Manager (CSM).

Your CSM will import the CSV of individuals using Coder, as well as usage frequency (if applicable) into DX to create a `Coder` attribute.

After the attribute is uploaded, you'll have a Coder filter option within your DX reports allowing you to:

- Perform cohort analysis (Coder user vs non-user)
- Understand unique behaviors and patterns across your Coder users
- Run a [study](https://getdx.com/studies/) or setup a [PlatformX](https://getdx.com/platformx/) event for deeper analysis

## Related Resources

- [DX Data Cloud Documentation](https://help.getdx.com/en/)
- [Coder CLI](../../reference/cli/users.md)
- [Coder API](../../reference/api/users.md)
- [PlatformX Integration](./platformx.md)
4 changes: 2 additions & 2 deletions docs/install/other/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Alternate install methods

Coder has a number of alternate unofficial install methods. Contributions are
Coder has a number of alternate unofficial installation methods. Contributions are
welcome!

| Platform Name | Status | Documentation |
Expand All @@ -9,7 +9,7 @@ welcome!
| Terraform (GKE, AKS, LKE, DOKS, IBMCloud K8s, OVHCloud K8s, Scaleway K8s Kapsule) | Unofficial | [GitHub: coder-oss-terraform](https://github.com/ElliotG/coder-oss-tf) |
| Fly.io | Unofficial | [Blog: Run Coder on Fly.io](https://coder.com/blog/remote-developer-environments-on-fly-io) |
| Garden.io | Unofficial | [GitHub: garden-coder-example](https://github.com/garden-io/garden-coder-example) |
| Railway.app | Unofficial | [Blog: Run Coder on Railway.app](https://coder.com/blog/deploy-coder-on-railway-app) |
| Railway.com | Unofficial | [Run Coder on Railway.com](https://railway.com/deploy/coder) |
| Heroku | Unofficial | [Docs: Deploy Coder on Heroku](https://github.com/coder/packages/blob/main/heroku/README.md) |
| Render | Unofficial | [Docs: Deploy Coder on Render](https://github.com/coder/packages/blob/main/render/README.md) |
| Snapcraft | Unofficial | [Get it from the Snap Store](https://snapcraft.io/coder) |
5 changes: 5 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@
"description": "Integrate Coder with DX PlatformX",
"path": "./admin/integrations/platformx.md"
},
{
"title": "DX Data Cloud",
"description": "Tag Coder Users with DX Data Cloud",
"path": "./admin/integrations/dx-data-cloud.md"
},
{
"title": "Hashicorp Vault",
"description": "Integrate Coder with Hashicorp Vault",
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/api/builds.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/reference/api/schemas.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/reference/api/templates.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions site/src/modules/apps/AppStatusStateIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CircleAlertIcon,
CircleCheckIcon,
HourglassIcon,
SquareIcon,
TriangleAlertIcon,
} from "lucide-react";
import type { FC } from "react";
Expand All @@ -26,6 +27,10 @@ export const AppStatusStateIcon: FC<AppStatusStateIconProps> = ({
const className = cn(["size-4 shrink-0", customClassName]);

switch (state) {
case "idle":
return (
<SquareIcon className={cn(["text-content-secondary", className])} />
);
case "complete":
return (
<CircleCheckIcon className={cn(["text-content-success", className])} />
Expand Down
Loading
Loading