FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bug: coder_script log-file setup errors are not shown in the workspace dashboard · Issue #28217 · coder/coder · GitHub

/ coder Public

bug: coder_script log-file setup errors are not shown in the workspace dashboard #28217

Description

Is there an existing issue for this?

Current Behavior

When a coder_script fails while setting up its log file (resolving log_path, creating the log_path parent directory, or opening the log file), the failure happens in the agent's script runner ((*Runner).run in agent/agentscripts/agentscripts.go) before the script's log stream is connected to the dashboard.

As a result, the script's logs are not shown in the workspace dashboard at all:

  • the script's log source appears with zero lines, and
  • the only visible signal is the agent health badge "agent startup script exited with an error".

The real error is written only to the agent's local log file (/tmp/coder-agent.log), which workspace users normally can't access. This is the "fails silently without any trace" symptom from #21986.

Relevant Log Output

# Agent log file inside the workspace container (NOT shown in the UI):
[info] running agent script  log_path=/proc/coder_logpath_err/install.log
[warn] startup script(s) failed
       - create script log file directory "/proc/coder_logpath_err":
       - mkdir /proc/coder_logpath_err: no such file or directory

# Dashboard for the same agent:
#   - health badge: "agent startup script exited with an error"
#   - the script's log source has 0 lines (nothing shown)

Expected Behavior

When a script's log file can't be created or opened, the failing coder_script should still appear in the workspace dashboard the way a normal script does: its named tab should be present and marked with the existing failed-coder_script (error) styling. Instead of appearing empty or being omitted, that script's log panel should show a short message telling the user to check the relevant log file (e.g. the agent log) for the error details.

Steps to Reproduce

  1. Create a template whose agent has a coder_script with a log_path whose parent directory cannot be created (e.g. a read-only location):

    resource "coder_script" "logpath_err" {
      agent_id     = coder_agent.main.id
      display_name = "log_path error test"
      run_on_start = true
      log_path     = "/proc/coder_logpath_err/install.log"
      script       = "echo hello"
    }
  2. Create a workspace from the template and wait for the agent to start.

  3. In the dashboard, the agent health shows "agent startup script exited with an error" and the script's logs are empty.

  4. Exec into the workspace and inspect /tmp/coder-agent.log: the real error (create script log file directory ...) is only there.

Environment

  • Host OS: Linux (Docker workspace, codercom/example-base:ubuntu)
  • Coder version: v2.36.0-devel+57dc47dc42

Additional Context

  • The issue occurs consistently

Found while fixing #21986 (PR #28166). #28166 fixes the specific case where the log_path parent directory is missing (the agent now creates it), but the broader problem remains: if log-file setup fails for any reason, the error still is not shown in the workspace dashboard.


This issue was created by Coder Agents on behalf of @35C4n0r.

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


    Back | FazBrowse Home | New Git URL