Skip to content

bug: ui: workspace build logs duplicated during build process #16355

Closed
@johnstcn

Description

@johnstcn

Problem

Coder version 2.18.5

When building a template that uses an external log source (e.g. envbuilder), we can observe the following:

  • During build process, logs increment normally to $LAST_LOG_ID up until the build completes.
  • When build process complete, logs increment to a multiple of $LAST_LOG_ID, giving the mistaken impression that the build is occurring multiple times. It appears as a large "dump" of logs all at once in the UI.
Image
  • If you hit the workspace agent build logs endpoint directly (http://$CODER/api/v2/workspaceagents/$AGENT_ID/logs), the correct number of logs is shown, with no duplicate entries.

First log ID:
Image

Last log ID:
Image

  • After a refresh of the page, the build logs drawer shows the correct number of logs:
Image
  • It appears that the UI is performing multiple WS requests for the build logs and simply appending them to the log panel:
Image Image Image

Steps to reproduce:

  • Either use docker-compose or lima to set up a fresh Coder instance
  • Import the Devcontainers (Docker) template and use the defaults.
  • Create a new workspace and select one of the pre-defined options (reproduced using home-assistant repo)
    • Important: before starting the build, open the DevTools, switch to "Network", and filter "all requests" by "logs".
  • Wait for build to complete without refreshing the UI, and observe the last number in the build logs.

Proposed Solution

Each log entry has a unique identifier (id) that can be used to de-duplicate in the logs pane.
If it's not possible to avoid the multiple requests, maybe this could be used to de-duplicate?

Metadata

Metadata

Assignees

Labels

s3Bugs that confuse, annoy, or are purely cosmeticsiteArea: frontend dashboard

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions