📝 Walkthrough
The server selects a usage host ID from
T3CODE_HOST_ID, a saved ID in T3 home, or the current hostname. It saves the hostname when neither an override nor a saved ID exists. Tests and documentation cover persistence and the override.Changes: Usage Host Identity
Layer / File(s) Summary Resolve and use the usage host ID
apps/server/src/usage/UsageService.tsUsageService.makeselects a trimmedT3CODE_HOST_ID, a saved ID, or the current hostname. When neither an override nor a saved ID exists, it attempts to save the hostname. Usage sources use the selected ID.Test and document host identity
apps/server/src/usage/UsageService.test.ts,docs/user/usage.mdTests verify that the hostname-derived ID persists across hostname changes and that T3CODE_HOST_IDoverrides it. Documentation describes the saved ID and the override.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
Merge Risk: 🔵 Low · up to e0125
Simultaneous servers sharing T3 home may temporarily attribute usage to different hosts. The change is otherwise mergeable with this concurrency risk understood or corrected.
Security architecture risk: 🔵 Low · up to e0125
The change is limited to usage-source identification and does not establish a new authentication or authorization path. However, concurrent processes can select different identities for the same newly initialized home directory. Storage failures and rollback can also change the identity used for reporting.
Retained concerns
- Low · architecture · inferred: If processes with different hostnames concurrently initialize the same home directory without a saved identity, each can retain its own hostname while atomic replacement leaves the last writer's identity on disk. Atomic publication prevents torn contents but does not establish first-writer ownership. Consequently, running instances and later restarts can disagree about the identity of the same usage source. Shared-directory deployment frequency is unverified; this affects usage attribution, not an established security principal.
Security review details
Security Blast Radius
- inferred — The confirmed effect is bounded to source attribution for servers using the configured identity and clients merging their summaries. Shared-home identity disagreement can affect duplicate suppression; the inspected flow does not establish tenant access, credential authority, or infrastructure privilege changes.
Trust Boundaries and Controls
- observed — The new read trusts trimmed contents of baseDir/usage-host-id. The existing write helper resolves symlink targets before replacement, so it does not enforce confinement to that directory. Exploitation would require control over relevant local filesystem state; no lower-trust writer or new remote path to that state was established by this review.
Resilience and Maintainability Implications
- inferred — Persistence outages favor availability over stable attribution. Because every read failure becomes an absent identity, recovery can attempt replacement using the current hostname rather than preserving the previously established owner. This is an identity-lifecycle limitation, not an observed authorization bypass.
Hardening Proposals
- proposed — Establish first-writer ownership with exclusive publication and have competing initializers adopt the persisted winner. Distinguish an absent identity from an unreadable existing identity so recovery does not silently replace established ownership.
Pre-merge checks: Passed 6
Check name Status Explanation Linked Issues check Passed The description links and closes issue #11849and identifies the maintainer-approved suggested fix that guides the implementation.Out of Scope Changes check Passed The service logic, tests, and documentation directly support stable usage host identity across container recreates. No unrelated changes are described. Linked Issues check Passed Issue #11849requires one stable usage identity when the persisted T3 home survives a container recreate.UsageService.makereadsconfig.baseDir/usage-host-id, writes the first hostname through `w…Out of Scope Changes check Passed The changes are limited to UsageService.ts, its tests, anddocs/user/usage.md. The implementation, tests, and documentation directly support the stable usage identity required by issue#11849. No …Title check Passed The title clearly and concisely describes the main change: persisting usage host fingerprints across container recreations. Description check Passed The description provides the problem, implementation details, approval and issue references, focused verification results, limitations, and agent attribution. It does not use the template headings, bu… Full details: Linked Issues check
Explanation
Issue
#11849requires one stable usage identity when the persisted T3 home survives a container recreate.UsageService.makereadsconfig.baseDir/usage-host-id, writes the first hostname throughwriteFileStringAtomically, and reuses the saved value. A trimmedT3CODE_HOST_IDtakes precedence without changing the saved value. Read or write failures fall back to the current hostname. The new service test covers changing hostnames and override behavior. The documentation records the persistence path and override.
Full details: Out of Scope Changes check
Explanation
The changes are limited to
UsageService.ts, its tests, anddocs/user/usage.md. The implementation, tests, and documentation directly support the stable usage identity required by issue#11849. No unrelated change is shown.
Full details: Description check
Explanation
The description provides the problem, implementation details, approval and issue references, focused verification results, limitations, and agent attribution. It does not use the template headings, but the required information is present and sufficiently complete.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.