mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
feat: add app status tracking to the backend (#17163)
This does ~95% of the backend work required to integrate the AI work. Most left to integrate from the tasks branch is just frontend, which will be a lot smaller I believe. The real difference between this branch and that one is the abstraction -- this now attaches statuses to apps, and returns the latest status reported as part of a workspace. This change enables us to have a similar UX to in the tasks branch, but for agents other than Claude Code as well. Any app can report status now.
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
DROP TABLE workspace_app_statuses;
|
||||
|
||||
DROP TYPE workspace_app_status_state;
|
@ -0,0 +1,28 @@
|
||||
CREATE TYPE workspace_app_status_state AS ENUM ('working', 'complete', 'failure');
|
||||
|
||||
-- Workspace app statuses allow agents to report statuses per-app in the UI.
|
||||
CREATE TABLE workspace_app_statuses (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
-- The agent that the status is for.
|
||||
agent_id UUID NOT NULL REFERENCES workspace_agents(id),
|
||||
-- The slug of the app that the status is for. This will be used
|
||||
-- to reference the app in the UI - with an icon.
|
||||
app_id UUID NOT NULL REFERENCES workspace_apps(id),
|
||||
-- workspace_id is the workspace that the status is for.
|
||||
workspace_id UUID NOT NULL REFERENCES workspaces(id),
|
||||
-- The status determines how the status is displayed in the UI.
|
||||
state workspace_app_status_state NOT NULL,
|
||||
-- Whether the status needs user attention.
|
||||
needs_user_attention BOOLEAN NOT NULL,
|
||||
-- The message is the main text that will be displayed in the UI.
|
||||
message TEXT NOT NULL,
|
||||
-- The URI of the resource that the status is for.
|
||||
-- e.g. https://github.com/org/repo/pull/123
|
||||
-- e.g. file:///path/to/file
|
||||
uri TEXT,
|
||||
-- Icon is an external URL to an icon that will be rendered in the UI.
|
||||
icon TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX idx_workspace_app_statuses_workspace_id_created_at ON workspace_app_statuses(workspace_id, created_at DESC);
|
19
coderd/database/migrations/testdata/fixtures/000313_workspace_app_statuses.up.sql
vendored
Normal file
19
coderd/database/migrations/testdata/fixtures/000313_workspace_app_statuses.up.sql
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
INSERT INTO workspace_app_statuses (
|
||||
id,
|
||||
created_at,
|
||||
agent_id,
|
||||
app_id,
|
||||
workspace_id,
|
||||
state,
|
||||
needs_user_attention,
|
||||
message
|
||||
) VALUES (
|
||||
gen_random_uuid(),
|
||||
NOW(),
|
||||
'7a1ce5f8-8d00-431c-ad1b-97a846512804',
|
||||
'36b65d0c-042b-4653-863a-655ee739861c',
|
||||
'3a9a1feb-e89d-457c-9d53-ac751b198ebe',
|
||||
'working',
|
||||
false,
|
||||
'Creating SQL queries for test data!'
|
||||
);
|
Reference in New Issue
Block a user