Skip to content

feat(code-server): title the browser tab with the sandbox name - #164

Open
cmrigney wants to merge 1 commit into
docker:mainfrom
cmrigney:code-server-tab-title
Open

feat(code-server): title the browser tab with the sandbox name#164
cmrigney wants to merge 1 commit into
docker:mainfrom
cmrigney:code-server-tab-title

Conversation

@cmrigney

@cmrigney cmrigney commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Every code-server tab was titled <workspace> - code-server, so a user with
several code-server sandboxes open at once could not tell the tabs apart. The
startup wrapper now passes the sandbox name to code-server --app-name, so the
tab reads <workspace> - <sandbox name>.

name=$SANDBOX_VM_ID
[ -n "$name" ] || name=$(hostname)
exec code-server --bind-addr 0.0.0.0:8080 --auth none \
  --app-name "$name" "${WORKDIR}"

--app-name replaces VS Code's branding string (nameShort/nameLong) and the
default window.title template ends in the app name, so nothing in the shipped
settings.json changes.

Origin

In-repo kit; no new upstream source.

Test plan

  • sbx kit validate ./code-server/
  • ./scripts/test-kit.sh code-server passes (the TCK).
  • ./scripts/test-kit-e2e.sh code-server
  • Manual smoke

🤖 Generated with Claude Code

@cmrigney
cmrigney requested a review from a team as a code owner July 28, 2026 19:37
Every code-server tab was titled "<workspace> - code-server", so a user
with several sandboxes open at once could not tell them apart. Pass the
sandbox name to --app-name in the startup wrapper: it replaces VS Code's
branding string, and the default window.title template ends in the app
name, so the tab becomes "<workspace> - <sandbox name>" with no
settings.json change.

The name is resolved at sandbox start from $SANDBOX_VM_ID, falling back
to the container hostname (same value) if the variable isn't in the
startup command's environment. Braces are omitted around the variable
because initFiles content may not contain any ${...} placeholder other
than ${WORKDIR} -- the validator scans the whole string, comments
included.

Also add a #!/bin/sh shebang: the single-line wrapper worked only via
glibc's execvp ENOEXEC-to-shell fallback, which is a thin reed now that
the script has more than one statement.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Cody Rigney <cody.rigney@docker.com>
@cmrigney
cmrigney force-pushed the code-server-tab-title branch from 8eae178 to 72012b3 Compare July 28, 2026 19:44
@mdelapenya

Copy link
Copy Markdown
Member

Hi @cmrigney could you please rebase and resolve conflicts? 🙏 We can merge it as soon it's green again

Comment thread code-server/spec.yaml
Comment on lines +50 to +51
# around SANDBOX_VM_ID: only WORKDIR may be brace-interpolated here.
name=$SANDBOX_VM_ID

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable was renamed in v0.39.0

Suggested change
# around SANDBOX_VM_ID: only WORKDIR may be brace-interpolated here.
name=$SANDBOX_VM_ID
# around SANDBOX_NAME: only WORKDIR may be brace-interpolated here.
name=$SANDBOX_NAME

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.

3 participants