feat(connect): let hosts set their display name#4850

closed4
main
GitHub fork: pixpmusic/connect-host-name
openedJul 29, 2026byAAlex
View on GitHubTwo-way sync enabledPR last imported 14d ago

Continued in https://github.com/pingdotgg/t3code/pull/18924. This PR remains closed at its historical head because GitHub refuses to reopen it after the deleted branch was recreated. The rebased code and current verification are on the replacement draft.

Hosts currently inherit their operating system's computer name. This adds a host-local Host name setting in Settings → Connections on web and desktop, so remote machines can choose a useful display name without changing the OS hostname or restarting the server.

Connected clients use the live server descriptor, including native mobile environment lists, routing settings, and connection notices. Clearing the setting restores the detected computer name. The field requires a connected server, the advertised capability, and settings write permission.

The relay accepts names only from verified health responses and orders persistence by their timestamp. Each verified health response records that timestamp, including unchanged names, so an older response cannot restore a name after it is cleared. This adds one conditional database update per verified health response.

Rebased onto main at 540a3e89ed15a78129ff6bc91f561abddba8f6d8 and adapted to the current permission commands, descriptor services, and shared client projections.

Evidence

Actual client captures with synthetic showcase projects and threads, fresh test homes, and neutral computer-name fixtures. No local userdata was copied into the fixtures. The web comparison uses the baseline UI; native comparisons show the saved connection before and after the live rename.

Live rename reaching the connected iPhone.

Verification

  • 332 focused tests passed: vp test run packages/contracts/src/settings.test.ts packages/client-runtime/src/state/server.test.ts packages/client-runtime/src/state/presentation.test.ts packages/client-runtime/src/state/sharedSettings.test.ts packages/client-runtime/src/relay/discovery.test.ts infra/relay/src/environments/EnvironmentConnector.test.ts infra/relay/src/environments/EnvironmentLinks.test.ts apps/server/src/ws.test.ts apps/web/src/components/settings/settingsSearch.test.ts.
  • Eight ServerEnvironment tests passed. Excluded publishes proven install ownership only for manually updated servers, which also fails on baseline with the existing macOS /var versus /private/var prefix mismatch.
  • Mobile connection subscription/model/presentation regression pass: 12 tests. The CI fixture omitted the required descriptor; it now supplies the unchanged descriptor and preserves the subscription-stability assertion. WebSocket/FCM regression pass: 54 tests. Mobile remote environment projections: three tests. These include overlapping reruns and are not an aggregate test count.
  • Scoped lint and typechecks passed for contracts, client-runtime, server, web, mobile, and relay. Existing warnings remain on untouched lines. Desktop and native iOS/Android development clients built successfully.
  • Desktop web, macOS Electron, and native iPhone/Android: rename propagated without re-pairing; clearing restored the default; Android retained the name in folded and unfolded layouts. Reloading Electron retained its name. Restarting the isolated server preserved the setting and the Android connection reconnected with the saved name.
  • git diff --check passed. Evidence and fixture tooling are outside the code branch.

Remaining verification

  • Live T3 Connect has not been tested. A maintainer needs to enable 🚀 Mobile Continuous Deployment for a preview using the configured Connect environment; the workflow also needs an available EXPO_TOKEN. The preview does not deploy this PR's relay changes, so full relay persistence testing requires an updated relay deployment too.
  • An additional iPad simulator could not be opened: the Device tool returned The calling provider no longer owns an active thread run. No claim is made that every installed simulator model was tested; devices owned by other sessions were left alone.

Model: GPT-5.6 Sol & GPT-6.1 Sol | Harness: Codex in T3 Code

Note

Add environmentLabel to ServerSettings and let hosts set their display name

  • Adds environmentLabel to ServerSettings and ServerSettingsPatch schemas in settings.ts, defaulting to an empty trimmed string so legacy configs decode unchanged.
  • ServerEnvironment.getDescriptor now reads the current configured label at runtime (no restart), and the new getDescriptorForSettings returns a descriptor snapshot for a given settings object in ServerEnvironment.ts.
  • The settingsUpdated websocket event includes an environment descriptor in ws.ts, and clients project it into config state in server.ts.
  • Web users with orchestration-operate scope can edit the "Host name" field in ConnectionsSettings.tsx; mobile and web presentation utils now prefer the server-reported label.
  • The relay persists label updates from verified health responses via EnvironmentLinks.updateLabelForUser in EnvironmentConnector.ts, and client discovery updates labels from status descriptors in discovery.ts.
  • Behavioral Change: ServerEnvironment.getDescriptor now depends on ServerSettings; if settings cannot be read it logs a warning and falls back to defaultDescriptor. The ServerConfigSettingsUpdatedPayload schema gains an optional environment field that older clients will ignore.

Macroscope summarized 4ae38b7.


Note

Medium Risk Touches live server descriptors, WebSocket config events, and relay link persistence. Label updates are gated by verified health responses and a timestamp compare-and-set, but still change shared environment identity shown across clients.

Overview Hosts can now set a Host name in Settings → Connections. That override is stored as environmentLabel in server settings, applied live to the environment descriptor, and used as the default name for new manual connections. Clearing it falls back to the OS-detected computer name.

settingsUpdated WebSocket events now include the environment descriptor so web/mobile presentation tracks the live label without a restart. Relay health checks persist a renamed label onto the user’s environment link (updateLabelForUser) when the verified descriptor differs, so T3 Connect clients pick up the new name.

Reviewed by Cursor Bugbot for commit 4ae38b7f11cc6f7c7e19b0bf439f603d353bbbe5. Bugbot is set up for automated code reviews on this repo. Configure here.

Checks

1 failing · 14 successful · 4 skipped · 1 neutral
Some checks failed

Failing1

4ae38b7
Synced from GitHub

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d98afac-d0d6-468c-901e-773cd450170a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

apps/web/src/components/settings/ConnectionsSettings.tsxline 2559Outdated · cce557dOpen thread
……@@ -2538,6 +2544,23 @@ export function ConnectionsSettings() {
2556+ placeholder="Use this computer’s name"
2557+ aria-label="Host name"
2558+ disabled={!canEditEnvironmentLabel}
2559+ spellCheck={false}

Host name commit silently skipped

Low Severity

The Host name row commits via useUpdatePrimarySettings, which skips the server RPC when there is no primary environment id. The input stays enabled whenever orchestration scope is present, so a commit can appear to succeed while nothing is persisted.

Reviewed by Cursor Bugbot for commit cce557db7ebb7b3fa8eb32547f7078cd9f0940d8. Configure here.

Fixed in f7d7c281a by requiring primaryEnvironmentId !== null as part of canEditEnvironmentLabel. The field is now disabled while primary server discovery is incomplete, so DraftInput cannot invoke the no-op update path. Web typecheck, targeted lint/format, and an isolated UI pass all passed.

Synced from GitHub

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a new user-facing feature allowing hosts to customize their display name. The changes span server, relay, web, mobile, and contracts packages with new database operations and modified data flow for environment labels. New features of this scope warrant human review.

You can add or adjust custom eligibility rules. Learn more.

Ccursor[bot]reviewed · 1 inline threadAug 3, 2026
Synced from GitHub

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1b689f955fae75ffded96473ca0e13e695cabbcd. Configure here.

apps/server/src/ws.tsline 2018Outdated · 1b689f9Open thread
……@@ -2007,11 +2007,15 @@ const makeWsRpcLayer = (
2015+ payload: { settings, environment },
2016+ })),
2017+ ),
2018+ ),
Ccursor[bot]on line 2018Aug 3, 2026

Settings label descriptor mismatch

Medium Severity

Each settingsUpdated event builds payload.settings from one successful settings read, then calls getDescriptor, which reads settings again. If that second read fails, getDescriptor falls back to the OS default label while payload.settings can still carry a custom environmentLabel. Clients apply both fields, so the Host name control and Connect labels can disagree until a later snapshot.

Additional Locations (1)

Reviewed by Cursor Bugbot for commit 1b689f955fae75ffded96473ca0e13e695cabbcd. Configure here.

Synced from GitHub

Written by inayayousfi, typed by gpt-5.6-sol running in OpenCode. Every call here is inayayousfi's, and no agent acted on its own.

Thanks for working through the server-owned naming design. PR #7267 now implements the same core approach and extends it with authorized remote editing, a native mobile rename screen, duplicate-name confirmation, an explicit live label event, and direct environment-authenticated relay synchronization with bounded retries.

Would you be open to closing this PR in favor of #7267? The overlap is substantial, and keeping one implementation should reduce the review and integration burden for maintainers. The remote-access documentation added here is useful and could still be carried over separately.

Added 3 commits

  • feat(connect): let hosts set their display name03fc5eb
  • fix(connect): gate host name edits on server readiness1633551
  • fix(server): keep environment labels consistent1ef1fec
infra/relay/src/environments/EnvironmentConnector.tsline 535Outdated · 1ef1fecOpen thread
……@@ -530,6 +530,23 @@ const make = Effect.gen(function* () {
532532 }
533+ if (decoded.descriptor.label !== link.label) {
534+ yield* links
535+ .updateLabelForUser({
MmacroscopeappBoton line 535Aug 20, 2026

🟡 Medium environments/EnvironmentConnector.ts:535

Concurrent verified status requests can persist labels out of order: an older health response can complete after a newer rename and updateLabelForUser then overwrite the newer label with the stale descriptor. Because the write has no checkedAt/version compare-and-set, clients can show the old name until another health check repairs it. Add ordering protection to the persistence update.

Also found in 1 other location(s)

infra/relay/src/environments/EnvironmentLinks.ts:426

updateLabelForUser unconditionally sets environmentLabel, so concurrent verified health/status requests can persist labels out of order. If a request returning the old label completes after one returning a newer label, line 426 overwrites the newer value with the stale label, and clients continue seeing the old host name until another health refresh corrects it. The update needs ordering/version protection or a compare-and-set against the label observed before the request.

✅ Resolved in 4ae38b7f11cc6f7c7e19b0bf439f603d353bbbe5

Added 1 commit

  • fix(relay): order environment label updates4ae38b7