Skip to content
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

feat: add app status tracking to the backend #17163

Merged
merged 7 commits into from
Mar 31, 2025
Merged

feat: add app status tracking to the backend #17163

merged 7 commits into from
Mar 31, 2025

Conversation

kylecarbs
Copy link
Member

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.

@kylecarbs kylecarbs requested a review from johnstcn March 28, 2025 20:02
@kylecarbs kylecarbs self-assigned this Mar 28, 2025
defer q.mutex.Unlock()

status := database.WorkspaceAppStatus{
ID: arg.ID,
Copy link
Member

Choose a reason for hiding this comment

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

Given that we generate the UUID in the database, we should avoid inserting UUIDs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

Comment on lines +47 to +49
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message, needs_user_attention, uri, icon)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
RETURNING *;
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: drop the ID here in the inputs and just return the auto-generated value from the DB.

Comment on lines +347 to +348
client, db := coderdtest.NewWithDatabase(t, nil)
user := coderdtest.CreateFirstUser(t, client)
Copy link
Member

Choose a reason for hiding this comment

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

Testing with the owner can mask authz issues.
Instead, create another member user/client and then test with that client.

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Aside from the dbauthz stuff (which, after discussion, is outside of the scope of this issue to fix), nothing blocking.

@kylecarbs kylecarbs merged commit 8ea956f into main Mar 31, 2025
40 checks passed
@kylecarbs kylecarbs deleted the statuses branch March 31, 2025 14:55
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2025
@stirby
Copy link
Collaborator

stirby commented Apr 1, 2025

/cherry-pick release/2.21

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants