Browser tab title: '<hostname> ccserver' - #40
Merged
Conversation
The <title>Claude Code</title> in client/index.html was the sole source of the tab title. Replace it with '<hostname> ccserver', resolving the hostname server-side with the same precedence as the notify footer's _from: <host> (CCSERVER_HOSTNAME > notify.hostname > os.hostname()) so the tab matches what notifications claim to come from. - notify.js: export resolvedHostname() (refactored out of loadNotifyConfig, single resolution point). - routes/dirs.js: GET /dirs/home gains a hostname field (extra field, backward compatible); the client already fetches this endpoint on mount. - client/src/App.jsx: mount-time useEffect sets document.title = '<hostname> ccserver' (silent on failure, idempotent under StrictMode). - client/index.html: static fallback title is now 'ccserver' (never 'Claude Code'). Tests: resolvedHostname precedence unit test (env > config > os.hostname) and e2e tests/tab-title.spec.js asserting toHaveTitle(/^\S+ ccserver$/), which also covers the production-build delivery path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The browser tab title was the static
Claude Code(hardcoded inclient/index.html); this makes it<hostname> ccserver(e.g.ayaka ccserver).Root cause
client/index.html:7had<title>Claude Code</title>and nothing in the client ever rewritesdocument.title— the title was purely the static HTML, unrelated to the agent CLIs (they run inside xterm.js and never touch the document title).Changes
server/ws/notify.js: exportedresolvedHostname()— the existing attribution precedenceCCSERVER_HOSTNAME > notify.hostname > os.hostname()extracted so non-notify consumers share it;loadNotifyConfig()now uses it (behavior unchanged).server/routes/dirs.js:GET /api/dirs/homenow also returnshostname(additive field, backward compatible; the client already fetches this endpoint on mount).client/src/App.jsx: on mount, fetches/api/dirs/homeand setsdocument.title = \${hostname} ccserver``. Idempotent (StrictMode-safe), silent on failure — the static fallback stays.client/index.html: static fallback title changed toccserver(covers pre-JS / API-unreachable, e.g. token auth gate; no longer shows the misleadingClaude Code).Server-side HTML rewriting was deliberately not used: it would only work in production (vite serves index.html in dev), while the fetch-based approach works in both.
Tests
server/ws/notify.test.js: +1 precedence test forresolvedHostname()(env > notify.hostname > os.hostname()).tests/tab-title.spec.js(new): e2e assertspage.title()matches/^\S+ ccserver$/against the production build — verified passing locally (ayaka ccserver).npm test: 303 tests, 302 pass; the single failure (sandbox-resolve.test.js) is the known pre-existing environment-dependent failure.Out of scope: per-session/per-group dynamic titles.