Skip to content

chore(deps): bump fly-go to client-signals commit#4964

Merged
dangra merged 12 commits into
masterfrom
use-fly-go-client-signals
Jul 3, 2026
Merged

chore(deps): bump fly-go to client-signals commit#4964
dangra merged 12 commits into
masterfrom
use-fly-go-client-signals

Conversation

@dangra

@dangra dangra commented Jul 1, 2026

Copy link
Copy Markdown
Member

Bumps the fly-go dependency to v0.6.0, pulling in Fly-Client-* headers and a matching User-Agent suffix that flyctl now emits on outbound GraphQL, Machines API, and uiex requests. These headers are gated behind a LaunchDarkly flag (flyctl-client-signals-enabled, default off) rather than shipping enabled unconditionally.

Context

These headers attach coarse, privacy-safe signals (terminal attachment, bucketed parent-process type, cooperative agent marker, CI detection) so Fly can estimate the human-vs-agent split of API traffic for capacity planning and abuse policy, without any per-request certainty or gating. fly-go computes the signals once via clientsignals.DetectOnce() and exposes a *clientsignals.Signals option on fly.ClientOptions, flaps.NewClientOpts, and now (via this PR) uiex.NewClientOpts — a nil value disables the headers entirely, so the wrapping http.RoundTripper only gets attached when the flag is on.

Gating behind LaunchDarkly, rather than shipping this on unconditionally, lets Fly turn it on gradually or kill it centrally without a flyctl release. InitClient builds all the shared clients before any org or user is known, so this uses the anonymous launchdarkly.NewServiceClient() (a global, non-targeted flag) rather than the org-scoped client used elsewhere — that adds one LaunchDarkly network round-trip to every command's startup, which is a real (if typically fast) cost worth calling out in review.

Details

  • internal/launchdarkly/launchdarkly.go: adds ClientSignalsEnabled(), reading the flyctl-client-signals-enabled flag, defaulting to false.
  • internal/cmdutil/preparers/preparers.go: InitClient fetches the flag via launchdarkly.NewServiceClient(), computes clientsignals.DetectOnce() once when enabled, and threads the resulting *clientsignals.Signals through to the fly-go, flaps, uiex, and mpg (v1/v2) client constructors.
  • internal/uiex/client.go: adds a ClientSignals option to uiex.NewClientOpts, wrapping the outbound transport the same way fly-go's own client does. mpgv1/mpgv2 inherit this for free since they wrap uiex.Client with the same options struct.

dangra added 11 commits July 1, 2026 20:15
Points at superfly/fly-go#249 (client-signals branch) to pull in the
Fly-Client-* headers and User-Agent suffix that distinguish human vs.
AI-agent traffic on outbound GraphQL/Machines API requests.
Add ClientSignalsEnabled() to the LaunchDarkly client and check it
(via the anonymous NewServiceClient, since InitClient runs before any
org/user context exists) when constructing the fly-go and flaps
clients, defaulting to disabled until the flyctl-client-signals-enabled
flag is turned on.
…name

superfly/fly-go#249 flipped the option polarity to opt-in
(EnableClientSignals) on both fly.ClientOptions and
flaps.NewClientOpts. Update flyctl's call sites to match and bump the
pinned commit to 9135798.
logger.Debug doesn't do printf-style formatting; both NewClient and
NewServiceClient were passing a %s directive to it. go vet flags this.
superfly/fly-go#249 replaced the EnableClientSignals bool with a
ClientSignals *clientsignals.Signals field on both fly.ClientOptions
and flaps.NewClientOpts: nil disables the headers, a detected Signals
value enables them. Compute clientsignals.DetectOnce() once when the
feature flag is on and share the pointer between both clients. Bumps
the pinned commit to 8e02b35.
uiex.NewClientOpts gains a ClientSignals field, wired into the
transport the same way fly-go's own client does. mpgv1 and mpgv2
inherit this for free since they wrap uiex.Client with the same
options struct. InitClient now passes the LD-gated signals to all
three (uiexutil, mpgv1, mpgv2) alongside the fly-go/flaps clients.
superfly/fly-go#249 merged and shipped in v0.6.0. Switch off the
pinned pre-release commit now that a real release is available.
@dangra dangra marked this pull request as ready for review July 3, 2026 00:19
Copilot AI review requested due to automatic review settings July 3, 2026 00:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates flyctl to fly-go v0.6.0 and wires optional “client signals” (Fly-Client-* headers + UA suffix) through the GraphQL, Machines (flaps), and UIEx/MPG HTTP clients, gated behind a LaunchDarkly flag so it can be enabled/disabled centrally.

Changes:

  • Bump github.com/superfly/fly-go to v0.6.0.
  • Add ClientSignalsEnabled() flag accessor and use a service-scoped LaunchDarkly client during startup to decide whether to attach client-signal headers.
  • Extend uiex.NewClientOpts with ClientSignals and wrap the HTTP transport when enabled.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/uiex/client.go Adds ClientSignals option and wraps outbound transport to attach Fly-Client-* headers/UA suffix.
internal/launchdarkly/launchdarkly.go Adds ClientSignalsEnabled() and changes startup flag refresh logging behavior.
internal/cmdutil/preparers/preparers.go Evaluates the service flag at startup, runs clientsignals.DetectOnce(), and threads signals into multiple client constructors.
go.mod Bumps fly-go to v0.6.0.
go.sum Updates checksums for fly-go v0.6.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/uiex/client.go Outdated
Comment thread internal/launchdarkly/launchdarkly.go
Comment thread internal/launchdarkly/launchdarkly.go
golangci-lint (staticcheck ST1023) flagged the explicit
http.RoundTripper annotation as redundant since it's already the
inferred type of httptracing.NewTransport's return value.
@dangra dangra merged commit 47db924 into master Jul 3, 2026
20 of 24 checks passed
@dangra dangra deleted the use-fly-go-client-signals branch July 3, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants