Populate launch metrics on early region-determination failures#4993
Merged
Conversation
When determineRegion fails in non-interactive mode, buildManifest returned nil, causing the deferred metrics event to have empty org/app/region/flyctl-version fields. Now buildManifest returns a partial manifest with the org/app info that was already determined, and run() populates the metrics status from it before returning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR ensures fly launch metrics retain identifying context (org/app/flyctl version, and scanner family when available) when launch fails early during region determination in non-interactive scenarios.
Changes:
buildManifestnow returns a partialLaunchManifest(withPlanpopulated with org/app/flyctl version and optional scanner family) whendetermineRegionfails and cannot be recovered.run()now copies fields from a partial manifest into the launch metrics status payload before returning on early, non-UI-recoverable failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/command/launch/plan_builder.go | Returns a partial manifest on unrecoverable determineRegion errors so org/app/version context is preserved. |
| internal/command/launch/cmd.go | Populates metrics status from the (possibly partial) manifest before early returns so metrics events include identifying fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dangra
reviewed
Jul 9, 2026
Co-authored-by: Daniel Graña <dangra@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
determineRegionfails in non-interactive mode (e.g. org suspended, machine count exceeded),buildManifestreturnednil, causing the deferred metrics event to have emptyorg="",app="",region="",flyctl=""fields — making it impossible to identify who was generating the failures.buildManifestnow returns a partialLaunchManifestwith the org/app/flyctl-version info that was already determined before the region error.run()populates the metrics status from this partial manifest before the early return.Context
After #4830 switched region determination to the placements API, org-level errors (suspension, machine limits) started surfacing during
determineRegioninstead of later during deploy. BecausedetermineRegionruns after org and app name are already known but before theLaunchPlanis constructed, the metrics event was losing all identifying context.Test plan
fly launchwith a suspended org in non-interactive mode → metrics event should now carryorg=andapp=valuesfly launchwith an org at machine limit in non-interactive mode → samefly launchhappy path (interactive and non-interactive) → no change in behaviorfly launchwith--manifestflag → no change in behavior🤖 Generated with Claude Code