Skip to content

feat(server): allow explicit environment display labels - #32333

Open
zeroknots wants to merge 1 commit into
pingdotgg:mainfrom
zeroknots:feat/environment-label-override
Open

zeroknots wants to merge 1 commit into
pingdotgg:mainfrom
zeroknots:feat/environment-label-override

Conversation

@zeroknots

Copy link
Copy Markdown

Problem

Several T3 servers can run on the same machine, each with a different account, data directory, or purpose. They currently derive their display label from the same host, making otherwise distinct environments difficult to tell apart. Container hostnames can also be opaque or change when a container is recreated even though its persisted T3 identity remains the same.

A server-side label is useful for headless services, containers, and declaratively managed hosts: the operator can name each environment alongside its existing process configuration, without changing the machine's hostname or relying on a manual client-side rename.

Change

Honor optional T3CODE_ENVIRONMENT_LABEL in the existing server label resolver:

  • Trim surrounding whitespace and use a nonblank value before host probes.
  • Preserve the existing friendly-host, hostname, directory, and default fallbacks when unset or blank.
  • Keep the persistent environment ID, network configuration, other descriptor fields, and saved client aliases unchanged.

The background-service guide includes service.env and manual-launch examples. No new CLI flag, wire contract, persistence mechanism, or UI control is introduced.

Scope and approval

This is focused configuration of the established environment-label capability, submitted under the configuration-option route in CONTRIBUTING.md. It does not change product defaults or introduce a new connection or authorization workflow. No separate maintainer feature approval is claimed.

Earlier proposals established the same need. This independently implemented change includes executed tests and the tooling disclosure requested in their closure feedback:

#13985

#12559

Verification

vp test run apps/server/src/environment/ServerEnvironmentLabel.test.ts apps/server/src/environment/ServerEnvironment.test.ts
vp run check:changed origin/main --concurrency 1
  • Focused resolver/environment suite: 42 passed. Covers absent, empty, ASCII/Unicode-whitespace values, all fallback tiers, Unicode labels, distinct accounts sharing one host, and overrides avoiding host probes.
  • The restart test changes the label and verifies that every other descriptor field, including the persistent environment ID, stays equal.
  • Before implementation and with the override deliberately removed: 7 failed / 35 passed. Restoring it returns the suite to green.
  • Final branch-specific changed-file check: 44 tests across three files passed, plus formatting, lint, both knip phases, generated GraphQL validation, and affected-package typechecks. Duration: 41.362 seconds. Valid repository task-cache results were reused for typechecking.

Verified on Linux with Node 26.13.0, pnpm 12.14.0, and project-pinned Vite+ 1.4.0. The exact Node 26.12.1 runtime and live client/server activation were not exercised. Fork CI remains queued for unassigned inherited Blacksmith runners and is not presented as passing CI. No live T3 instance or credentials were changed.

Model: GPT-6.1 Sol. Harness: Claude Code.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 7, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d4a995a

Macroscope's review found this PR approvable — Adds an optional environment display label while preserving automatic naming when unset or blank. The change affects display metadata, not environment identity or network configuration.

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

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The server now accepts T3CODE_ENVIRONMENT_LABEL as a display-label override. It trims the value and uses the existing fallback sequence when the value is unset or blank. Tests and background-service documentation cover the behavior.

Changes: Environment label resolution

Layer / File(s) Summary
Override resolution and verification
apps/server/src/environment/ServerEnvironmentLabel.ts, apps/server/src/environment/ServerEnvironmentLabel.test.ts, apps/server/src/environment/ServerEnvironment.test.ts, docs/user/background-service.md
The resolver returns a trimmed, nonblank T3CODE_ENVIRONMENT_LABEL before running host probes. Tests cover override and fallback behavior and confirm that changing the label does not change other descriptor fields. The documentation explains how to configure the label and how it differs from other environment identifiers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

  • pingdotgg/t3code#25505 proposes a custom environment label that overrides the macOS ComputerName. This change adds an environment-variable override, but does not address the issue’s separate proposal to add the OS username to the default label.

Possibly related PRs

  • pingdotgg/t3code#27950: This PR also changes resolveServerEnvironmentLabel and adds label-related tests. Both changes add a label source before host probes.

Suggested reviewers: t3dotgg, macroscopeapp, juliusmarminge

Merge Risk: Minimal · up to d4a99

The documented restart instruction is clear in context, and no merge-blocking issue is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(server): allow explicit environment display labels" matches the main change. The PR adds optional T3CODE_ENVIRONMENT_LABEL support to the server label resolver, so an operator can set …
Description check Passed The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections. The Problem and Change sections clearly describe the feature, the fallback behav…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(server): allow explicit environment display labels" matches the main change. The PR adds optional T3CODE_ENVIRONMENT_LABEL support to the server label resolver, so an operator can set a display label for each server environment. The title is short, follows conventional commit style, and names the primary change.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections. The Problem and Change sections clearly describe the feature, the fallback behavior, and what stays unchanged. The Scope section explains why the change is focused configuration under the CONTRIBUTING.md configuration-option route, and it links earlier proposals. The Verification section lists focused test commands, results (42 passed, 7 failed before the fix, 44 tests across three files), environments tested, and what was not checked. The model and harness are named at the end, as the template asks. The template's optional comment about the Conventional Commit title is not repeated, but the title itself meets that requirement.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

@coderabbitai coderabbitai Bot left a comment

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.

Additional comments: 1

docs/user/background-service.md-93-94: 1

93-94: Minor · Maintainability & Code Quality · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Fix the broken sentence in the restart instruction.

The sentence "restart the service after running agent work has finished" is ambiguous. It can be read as "after running agent work". Rewrite it so the restart timing is clear. Restarting interrupts running agent turns, as the earlier text in this file states.

📝 Proposed fix

-service, put the variable in `service.env` and restart the service after running
-agent work has finished. For a server in a terminal:
+service, put the variable in `service.env`, then restart the service after any
+running agent work has finished. For a server in a terminal:
Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 006d7e3 and d4a995a.

Files selected for processing: 4

  • apps/server/src/environment/ServerEnvironment.test.ts
  • apps/server/src/environment/ServerEnvironmentLabel.test.ts
  • apps/server/src/environment/ServerEnvironmentLabel.ts
  • docs/user/background-service.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant