Skip to content

fix: stream logs for custom workers with underscores in their name - #1530

Open
geodro wants to merge 1 commit into
mainfrom
fix/1527-custom-worker-logs
Open

fix: stream logs for custom workers with underscores in their name#1530
geodro wants to merge 1 commit into
mainfrom
fix/1527-custom-worker-logs

Conversation

@geodro

@geodro geodro commented Aug 18, 2026

Copy link
Copy Markdown
Member

Logs for a custom worker declared in .lerd.yaml never connected when its name carried an underscore. The site log stream route validates the site and worker segments of /api/worker/{site}/{worker}/logs, and the pattern it used allowed only lowercase letters, digits and hyphens. A worker named all_queue failed that check, so the request 404'd before any stream opened, the pane fell back to "Disconnected", and Reconnect could only 404 again. The worker itself was healthy the whole time and kept processing jobs, which is why restarting it changed nothing.

Custom worker names are free-form in .lerd.yaml apart from whitespace, so the route now accepts underscores and capitals. The same gate covered the site segment, so a site handle with an underscore in it lost every worker log pane for the same reason, and that is fixed along with it.

Dots, slashes and shell metacharacters are still rejected, so a unit name resolved from a request path can never escape the log directory it is tailed from.

Refs #1527

The log stream route validated both the site and the worker segment of
/api/worker/{site}/{worker}/logs against a lowercase alphanumeric and hyphen
pattern, but custom worker names in .lerd.yaml are free-form apart from
whitespace. A worker declared as all_queue never matched, so the request 404'd
before any stream opened and the UI sat on "Disconnected" with a Reconnect
button that could only 404 again. The worker was running the whole time, only
its logs were unreachable.

The same gate applied to the site segment, so a site handle carrying an
underscore lost every worker log pane for the same reason.

Underscores and capitals now pass. Dots, slashes and shell metacharacters still
do not, so a unit name can never walk out of the log directory it is read from.
@geodro
geodro requested a review from a team as a code owner August 18, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant