{
  "slug": "flyctl-mpg-attach-tracks-app-attachments-to-mpg-clusters-e56e363cb016",
  "title": "flyctl mpg attach tracks app attachments to MPG clusters",
  "tools": [
    "flyctl"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-01-08T19:11:00.000Z",
  "announced_at": "2026-01-08T19:11:00.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When connecting an app to a Managed Postgres cluster, run `fly mpg attach` to add a connection secret and create the attachment record. Use `fly mpg attach list` to verify attached app names; use `fly mpg detach` to remove the attachment while retaining the secret.",
    "examples": [
      "fly mpg attach <CLUSTER_ID> --app <APP_NAME>",
      "fly mpg detach <CLUSTER_ID> --app <APP_NAME>"
    ],
    "gotchas": [
      "Version: v0.4.2",
      "<CLUSTER_ID>: Managed Postgres cluster ID; when omitted, the command prompts for a cluster.",
      "--app <APP_NAME> (required): Select the app to attach or detach; the command requires an app name.",
      "--variable-name <NAME>: Secret environment variable name to add to the app; defaults to `DATABASE_URL`.",
      "--database, -d <NAME>: Database to connect to; when omitted, an interactive session prompts for selection.",
      "--username, -u <NAME>: Database user to connect as; when omitted, an interactive session prompts for selection.",
      "Prerequisite: A Fly.io authenticated session is required.",
      "Prerequisite: The app and cluster must belong to the same organization.",
      "`mpg detach` removes the attachment but does not remove the secret."
    ]
  },
  "why_it_matters": "When connecting an app to a managed Postgres cluster, attach the cluster to the app and verify its attachments.",
  "before": "Previously `mpg attach` created a secret and deployed; it did not create an explicit database connection record between the cluster and app.",
  "sources": [
    "https://github.com/superfly/flyctl/releases/tag/v0.4.2",
    "https://github.com/superfly/flyctl/pull/4717",
    "https://github.com/superfly/flyctl/blob/v0.4.2/internal/command/mpg/attach.go",
    "https://github.com/superfly/flyctl/blob/v0.4.2/internal/command/mpg/detach.go"
  ],
  "rank": 0.95034,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1b-20261016",
    "verdict_id": "wave1b-20261016:wave1b-20261016-7c4fe75f149e91c9-0:gate",
    "evidence_hash": "aaa7fb084439df06a3c8dbcdfffa1c50a57587bd9162983198d6e0e91b652199"
  },
  "review": {
    "draft_hash": "479fcd47d6e24863613e7bf7f8d5e4dedf4907a3a7d7ee6d657dd7838be0e82f",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1b-20261016:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.95 >= 0.9; 2 needed) and Jev gave 0.76 (>= 0.6 needed)."
  }
}
