Skip to content

bug: GetLatestWorkspaceAppStatusesByAppID returns an unbounded number of rows #20862

Closed

Description

@spikecurtis

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

GetLatestWorkspaceAppStatusesByAppID returns all app statuses ever written for the given app. This could be quite large for a long running AI task.

Only the first (most recent) status is ever used at present, to determine whether the WorkspaceAppStatusState is changing while inserting a new status update.

Relevant Log Output

Expected Behavior

No response

Steps to Reproduce

Run an AI task that updates status more than once.

Environment

  • Host OS:
  • Coder version:

Additional Context

No response

Activity

  1. added theissue type on Nov 21, 2025
  2. mafredri commented on Nov 21, 2025

    @mafredri
    Member

    Nice find, this seems like an easy win as the query only used in one place.

    1. Rename GetLatestWorkspaceAppStatusesByAppID -> GetLatestWorkspaceAppStatusByAppID and change :many -> :one
    2. Add LIMIT 1

    Slack thread for context: https://codercom.slack.com/archives/C05D8G51P8Q/p1763726141970759

  3. added a commit that references this issue on Nov 25, 2025
    37fc664
  4. added a commit that references this issue on Nov 25, 2025
    7c15cc6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions