Skip to content

fix: show only the current runner status in freeform WELCOME.txt - #265

Merged
rfay merged 1 commit into
mainfrom
20261124_rfay_runner_welcome_dedup
Nov 24, 2026
Merged

rfay merged 1 commit into
mainfrom
20261124_rfay_runner_welcome_dedup

Conversation

@rfay

@rfay rfay commented Nov 24, 2026

Copy link
Copy Markdown
Member

Short Summary (TL;DR)

The freeform self-hosted runner status no longer piles up in ~/WELCOME.txt. Each workspace start now replaces the previous status line, so a stale "NOT started" line from the first boot goes away too.

The Issue

Freeform copies ~/WELCOME.txt once and keeps it across restarts. The runner startup snippet appended its status line on every start. After many restarts, the file showed one "✓ N Claude Code self-hosted runner(s) started" line per start. It also kept the "✗ … NOT started: save your environment secret" line from the first boot, when no secret existed yet.

How This PR Solves The Issue

Before it writes the status, the startup snippet deletes every line in ~/WELCOME.txt that contains "Claude Code self-hosted runner". The deletion runs even when the runner is disabled, so turning the runner off also removes its old line. Existing workspaces lose their accumulated lines on the next start.

Manual Testing Instructions

Push the template as an inactive version:

make push-template-freeform ACTIVATE=false
coder templates versions list freeform

Create a workspace from that version with the runner on:

coder create --template freeform --template-version <version> runnertest --yes --use-parameter-defaults --parameter enable_claude_runner=true --parameter claude_runner_capacity=1
coder ssh runnertest -- "grep 'self-hosted runner' ~/WELCOME.txt"
# Expect one "✗ ... NOT started" line

Add a secret and restart twice:

coder ssh runnertest -- "echo dummy > ~/.claude-runner/environment-secret && chmod 600 ~/.claude-runner/environment-secret"
coder restart runnertest --yes
coder restart runnertest --yes
coder ssh runnertest -- "grep 'self-hosted runner' ~/WELCOME.txt"
# Expect exactly one "✓ 1 Claude Code self-hosted runner(s) started" line, and no "NOT started" line

Clean up:

coder delete runnertest --yes

Automated Testing Overview

Claude Code ran terraform fmt -check -recursive, make validate, and make test-templates on Linux, and all passed. Claude Code ran the manual steps above on staging-coder.ddev.com. WELCOME.txt stayed at one runner line and 19 lines total after two restarts. No new Terraform tests: the mock tests don't run the startup script.

Release/Deployment Notes

The Claude Code remote control banner in modules/claude-remote-control also appends to ~/WELCOME.txt on every start, so it piles up in freeform the same way. This PR does not change it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UrTUMvZiSTQq4KvnwqNQTo

## Short Summary (TL;DR)

The freeform self-hosted runner status no longer piles up in `~/WELCOME.txt`. Each workspace start now replaces the previous status line, so a stale "NOT started" line from the first boot goes away too.

## The Issue

Freeform copies `~/WELCOME.txt` once and keeps it across restarts. The runner startup snippet appended its status line on every start. After many restarts, the file showed one "✓ N Claude Code self-hosted runner(s) started" line per start. It also kept the "✗ … NOT started: save your environment secret" line from the first boot, when no secret existed yet.

## How This PR Solves The Issue

Before it writes the status, the startup snippet deletes every line in `~/WELCOME.txt` that contains "Claude Code self-hosted runner". The deletion runs even when the runner is disabled, so turning the runner off also removes its old line. Existing workspaces lose their accumulated lines on the next start.

## Manual Testing Instructions

Push the template as an inactive version:

```bash
make push-template-freeform ACTIVATE=false
coder templates versions list freeform
```

Create a workspace from that version with the runner on:

```bash
coder create --template freeform --template-version <version> runnertest --yes --use-parameter-defaults --parameter enable_claude_runner=true --parameter claude_runner_capacity=1
coder ssh runnertest -- "grep 'self-hosted runner' ~/WELCOME.txt"
# Expect one "✗ ... NOT started" line
```

Add a secret and restart twice:

```bash
coder ssh runnertest -- "echo dummy > ~/.claude-runner/environment-secret && chmod 600 ~/.claude-runner/environment-secret"
coder restart runnertest --yes
coder restart runnertest --yes
coder ssh runnertest -- "grep 'self-hosted runner' ~/WELCOME.txt"
# Expect exactly one "✓ 1 Claude Code self-hosted runner(s) started" line, and no "NOT started" line
```

Clean up:

```bash
coder delete runnertest --yes
```

## Automated Testing Overview

Claude Code ran `terraform fmt -check -recursive`, `make validate`, and `make test-templates` on Linux, and all passed. Claude Code ran the manual steps above on staging-coder.ddev.com. `WELCOME.txt` stayed at one runner line and 19 lines total after two restarts. No new Terraform tests: the mock tests don't run the startup script.

## Release/Deployment Notes

The Claude Code remote control banner in `modules/claude-remote-control` also appends to `~/WELCOME.txt` on every start, so it piles up in freeform the same way. This PR does not change it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01UrTUMvZiSTQq4KvnwqNQTo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UrTUMvZiSTQq4KvnwqNQTo
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Previews

The start.coder.ddev.com landing-page preview has been removed. Read the Docs keeps or removes its own docs preview.

@rfay
rfay merged commit 2ba6a09 into main Nov 24, 2026
21 checks passed
@rfay
rfay deleted the 20261124_rfay_runner_welcome_dedup branch November 24, 2026 21:17
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.

2 participants