Description
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.

- 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.
- After a refresh of the page, the build logs drawer shows the correct number of logs:

- It appears that the UI is performing multiple WS requests for the build logs and simply appending them to the log panel:



Steps to reproduce:
- Either use
docker-compose
orlima
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?