Skip to content

Populate launch metrics on early region-determination failures#4993

Merged
clouvet merged 3 commits into
masterfrom
fix-launch-metrics-empty-payload
Jul 9, 2026
Merged

Populate launch metrics on early region-determination failures#4993
clouvet merged 3 commits into
masterfrom
fix-launch-metrics-empty-payload

Conversation

@clouvet

@clouvet clouvet commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When determineRegion fails in non-interactive mode (e.g. org suspended, machine count exceeded), buildManifest returned nil, causing the deferred metrics event to have empty org="", app="", region="", flyctl="" fields — making it impossible to identify who was generating the failures.
  • buildManifest now returns a partial LaunchManifest with 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 determineRegion instead of later during deploy. Because determineRegion runs after org and app name are already known but before the LaunchPlan is constructed, the metrics event was losing all identifying context.

Test plan

  • fly launch with a suspended org in non-interactive mode → metrics event should now carry org= and app= values
  • fly launch with an org at machine limit in non-interactive mode → same
  • fly launch happy path (interactive and non-interactive) → no change in behavior
  • fly launch with --manifest flag → no change in behavior

🤖 Generated with Claude Code

Sprite and others added 2 commits July 9, 2026 16:46
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>
@clouvet clouvet requested a review from dangra July 9, 2026 17:08
@dangra dangra requested a review from Copilot July 9, 2026 17:10

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

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:

  • buildManifest now returns a partial LaunchManifest (with Plan populated with org/app/flyctl version and optional scanner family) when determineRegion fails 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.

Comment thread internal/command/launch/plan_builder.go
Co-authored-by: Daniel Graña <dangra@gmail.com>
@clouvet clouvet merged commit 324951d into master Jul 9, 2026
20 of 24 checks passed
@clouvet clouvet deleted the fix-launch-metrics-empty-payload branch July 9, 2026 19:17
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.

3 participants