Hive Hive
Sign in

fix(cli): forward client feature flags to the Xcode cache daemon

GitHub issue · Closed

Metadata
Source
tuist/tuist #11481
Updated
Jun 24, 2026
Domains
CLI Cache
Details

What

Forward the client feature flags (TUIST_FEATURE_FLAG_*) into the Xcode compilation cache (CAS) daemon’s launchd-agent environment, so it resolves cache endpoints the same way the rest of the CLI does.

Why

tuist setup cache starts the CAS daemon (cache-start) as a launchd agent, which does not inherit the caller’s environment. Setup only forwarded TUIST_TOKEN, so ClientFeatureFlags was always empty inside the daemon.

Endpoint resolution (CacheURLStore then getCacheEndpoints) relies on the server’s technology selection, which keys off the x-tuist-feature-flags request header (auto-injected from ClientFeatureFlags). With the kura flag the server returns the private-network (kura) endpoint; without it, the default (public) endpoint. Because the daemon never saw the flags, it always resolved the public endpoint, even on runners that can reach a private-network cache.

The binary module cache is unaffected because the server dispatches its endpoint directly, so only the CAS round-tripped every compilation unit to a public endpoint over the WAN, which makes the Xcode cache net-negative on a full compile.

Fix

Forward TUIST_FEATURE_FLAG_* into the agent environment via a new ClientFeatureFlags.environmentVariables() helper. A client flagged for kura now has its CAS daemon request the kura endpoints and resolve the private-network cache.

Validation

  • New unit test asserts the feature flags are forwarded into the agent environment.
  • Existing tests (token-only and no-token) are unaffected, since the forward only adds flags that are set.
  • Built and tested in CI.

Note

This is the client half. For a runner to actually use the private-network CAS, TUIST_FEATURE_FLAG_KURA must be set on the runner job (server/dispatch), which nothing does today. That runner-side change is tracked separately.

Replaces #11480, which forwarded a TUIST_CACHE_ENDPOINT override instead.

🤖 Generated with Claude Code

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
T
tuist[bot] Jun 24, 2026

🛠️ Tuist Run Report 🛠️

Tests 🧪
Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistAcceptanceTests 90 % 28 0 28 d060a9299
TuistUnitTests 91 % 3657 6 3651 d060a9299
Flaky Tests ⚠️
  • TuistAcceptanceTests: 1 flaky test (View all)
  • TuistUnitTests: 3 flaky tests (View all)
Test case Module Suite
app_with_plugins() TuistKitAcceptanceTests PluginAcceptanceTests
parseTestStatuses_returnsCorrectStatuses() TuistXCResultServiceTests XCResultServiceTests
parseTestWithCustomLabelXCResult() TuistXCResultServiceTests XCResultServiceTests
parseTestXCResult() TuistXCResultServiceTests XCResultServiceTests
Builds 🔨
Scheme Status Duration Commit
TuistAcceptanceTests 1m 4s d060a9299
TuistUnitTests 2m 37s d060a9299