Skip to content

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

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

Closed
johnstcn opened this issue Jan 31, 2025 · 1 comment · Fixed by #17806
Closed

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

johnstcn opened this issue Jan 31, 2025 · 1 comment · Fixed by #17806
Assignees
Labels
s3 Bugs that confuse, annoy, or are purely cosmetic site Area: frontend dashboard

Comments

@johnstcn
Copy link
Member

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?

@johnstcn johnstcn added s3 Bugs that confuse, annoy, or are purely cosmetic site Area: frontend dashboard labels Jan 31, 2025
@BrunoQuaresma
Copy link
Collaborator

Do we have a template we could use as an example in dev.coder.com?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s3 Bugs that confuse, annoy, or are purely cosmetic site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants