Skip to content

test: reject unsupported quota-axi schema versions and duplicate rows in dispatch-resolve - #5199

Closed
tiago-peixoto wants to merge 1 commit into
kunchenguid:mainfrom
tiago-peixoto:fm/firstmate-quota-schema6-dispatch
Closed

tiago-peixoto wants to merge 1 commit into
kunchenguid:mainfrom
tiago-peixoto:fm/firstmate-quota-schema6-dispatch

Conversation

@tiago-peixoto

Copy link
Copy Markdown
Contributor

Intent

quota-axi now emits schemaVersion 6, but bin/fm-quota-axi-lib.sh accepts only schemaVersion 5. This makes fm-dispatch-resolve reject an otherwise valid 19 KB snapshot and blocks all profile-based launches, including no-mistakes-everywhere-research. Update the compatibility contract with tests and validate current schema semantics before widening acceptance.

What Changed

  • Added fm-dispatch-resolve end-to-end cases that turn a quota-axi snapshot with schemaVersion 4 or 7 into an error outcome, reported as quota-axi --json returned an invalid snapshot. This pins the accepted contract to exactly versions 5 and 6, not a range.
  • Added cases that treat duplicate identity rows as invalid snapshots under both accepted versions. Schema 6 rows must be unique on provider + accountKey, and schema 5 rows must be unique on provider.
  • Updated the test header comment to say the fake quota-axi serves either a schema-5 or a schema-6 fixture. The change touches only the test file, so resolver behavior stays the same.

Risk Assessment

✅ Low: The branch only adds tests that run fm-dispatch-resolve end to end, and each one passes because the validator in bin/fm-quota-axi-lib.sh:83-91 rejects that specific input: schemaVersion 4, schemaVersion 7, a duplicate provider+accountKey pair in schema 6, and a duplicate provider in schema 5.

Testing

I ran the real quota-axi 0.1.48 on this host to get a live schema 5 snapshot. With a lab Pi auth file listing two Codex accounts, it also produced a real schema 6 snapshot (about 16 KB) that includes the host's other providers. I fed both through the real fm-dispatch-resolve.sh with an isolated FM_HOME, faking only the typesafe.ai API call. Both snapshots resolved to status: clear. Under schema 6, each Pi lane was matched to its own account row, and none were matched by position. The pre-fix code (259a669^), given the same live schema 6 bytes, reproduced the original "invalid snapshot" error. Changed copies of the live snapshot (schemaVersion 4, 7, or the string "6", a duplicate row key, a row with no accountKey) were all rejected with a clean error and exit 0. The focused test file passes. A deliberately widened validator makes it fail at "schema 7 is an error outcome", so the new tests do guard the contract; that mutation check exercises the test suite rather than the live product, so it is recorded as untested in the live scenarios. There is no UI surface, so there are no screenshots; the evidence is CLI transcripts and the captured snapshots. Temporary lab directories were removed and the worktree is clean.

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
The real quota-axi 0.1.48 emits a schema 6 snapshot (Codex expanded to two accounts) and fm-dispatch-resolve accepts it, matching each Pi lane to its own account row and returning a clear profile ✅ pass live live-dispatch-schema6.txt, live-schema6-full-snapshot.json
A real single-account schema 5 snapshot from this host still resolves as before ✅ pass live live-dispatch-schema5.txt, live-snapshot.json
Regression repro: the pre-fix code rejects the same live schema 6 bytes that the current code accepts ✅ pass live live-dispatch-control-and-prefix-repro.txt
Adversarial: snapshots changed to schemaVersion 4, 7, or the string "6" are rejected as invalid snapshots, with exit 0 so a launch is never blocked ✅ pass live live-dispatch-adversarial.txt
Adversarial: a duplicate provider+accountKey (schema 6), a duplicate provider (schema 5), and a schema 6 row with no accountKey are all rejected ✅ pass live live-dispatch-adversarial.txt
The new regression tests fail if acceptance is widened past 5|6 ⏸️ untested no The prior payload did not establish a live result: this scenario checks the test suite itself (a mutation run of tests/fm-dispatch-resolve.test.sh, logged in mutation-accept-schema7.log), not the runn…
A real profile-based launch (for example no-mistakes-everywhere-research) goes through fm-spawn with the resolved profile against the live typesafe.ai API ⏸️ untested no It needs the production TYPESAFE_API_KEY and a real spawn. The runbook forbids touching production credentials and the live fleet. The resolver's quota gate, which was the actual blocker, was driven l…
Evidence: Live schema 6 snapshot from real quota-axi 0.1.48

Source: Live schema 6 snapshot from real quota-axi 0.1.48

{
  "generatedAt": "2026-09-21T22:05:22.190Z",
  "schemaVersion": 6,
  "providers": [
    {
      "provider": "claude",
      "plan": "max",
      "windows": [
        {
          "id": "five_hour",
          "label": "session",
          "kind": "session",
          "resetsAt": "2026-09-22T00:00:00.339609+00:00",
          "percentRemaining": 89,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 50.7881,
            "burnMultiple": 0.178
          }
        },
        {
          "id": "seven_day",
          "label": "week",
          "kind": "weekly",
          "resetsAt": "2026-09-23T17:00:00.339633+00:00",
          "percentRemaining": 35,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 9.458,
            "burnMultiple": 0.873
          }
        },
        {
          "id": "model:fable",
          "label": "Fable week",
          "kind": "model",
          "resetsAt": "2026-09-23T17:00:00.339864+00:00",
          "percentRemaining": 86,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 60.458,
            "burnMultiple": 0.188
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 35,
            "boundedBy": [
              "five_hour",
              "seven_day"
            ],
            "limitingWindowIds": [
              "seven_day"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 9.458,
              "worstReserveWindowId": "seven_day"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 0.5451
            }
          },
          {
            "scope": "model:fable",
            "status": "known",
            "effectivePercentRemaining": 35,
            "boundedBy": [
              "five_hour",
              "seven_day",
              "model:fable"
            ],
            "limitingWindowIds": [
              "seven_day"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 9.458,
              "worstReserveWindowId": "seven_day"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 1.8427
            }
          }
        ]
      },
      "accountKey": "default"
    },
    {
      "provider": "codex",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "Codex sign-in required"
      },
      "accountKey": "openai-codex",
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "codex",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "Codex sign-in required"
      },
      "accountKey": "openai-codex-work",
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "cursor",
      "plan": "Ultra",
      "windows": [
        {
          "id": "included_usage",
          "label": "included usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 80,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 14.3785,
            "burnMultiple": 0.5818
          }
        },
        {
          "id": "auto_usage",
          "label": "auto usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 79,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 13.3785,
            "burnMultiple": 0.6108
          }
        },
        {
          "id": "api_usage",
          "label": "API usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 86,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 20.3785,
            "burnMultiple": 0.4072
          }
        },
        {
          "id": "grok_bot",
          "label": "Grok Bot",
          "kind": "weekly",
          "resetsAt": "2026-09-23T20:54:25.780Z",
          "percentRemaining": 83,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 55.1323,
            "burnMultiple": 0.2357
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 79,
            "boundedBy": [
              "included_usage",
              "auto_usage",
              "api_usage"
            ],
            "limitingWindowIds": [
              "auto_usage"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 13.3785,
              "worstReserveWindowId": "auto_usage"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 0.7112
            }
          },
          {
            "scope": "grok_bot",
            "status": "known",
            "effectivePercentRemaining": 83,
            "boundedBy": [
              "grok_bot"
            ],
            "limitingWindowIds": [
              "grok_bot"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 55.1323,
              "worstReserveWindowId": "grok_bot"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 2.7427
            }
          }
        ]
      },
      "accountKey": "default"
    },
    {
      "provider": "copilot",
      "plan": "individual",
      "windows": [
        {
          "id": "chat",
          "label": "chat",
          "kind": "monthly",
          "percentRemaining": 100,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "completions",
          "label": "completions",
          "kind": "monthly",
          "percentRemaining": 100,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "premium_interactions",
          "label": "premium interactions",
          "kind": "monthly",
          "percentRemaining": 0,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": [
          "chat",
          "completions",
          "premium_interactions"
        ]
      },
      "accountKey": "default"
    },
    {
      "provider": "grok",
      "windows": [
        {
          "id": "credits",
          "label": "credits",
          "kind": "credits",
          "percentRemaining": 6,
          "resetsAt": "2026-09-25T19:29:09.000Z",
          "pace": {
            "status": "unknown",
            "reason": "stale"
          }
        },
        {
          "id": "product:grok_build",
          "label": "Grok Build",
          "kind": "credits",
          "percentRemaining": 6,
          "resetsAt": "2026-09-25T19:29:09.000Z",
          "pace": {
            "status": "unknown",
            "reason": "stale"
          }
        }
      ],
      "state": {
        "status": "stale",
        "stale": true,
        "error": "Grok sign-in required",
        "authStatus": "unusable"
      },
      "credits": {
        "remaining": 0,
        "unit": "credits"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [
          {
            "scope": "all_products",
            "status": "unknown",
            "boundedBy": [
              "credits"
            ],
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits"
              ]
            },
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "credits"
              ]
            }
          },
          {
            "scope": "product:grok_build",
            "status": "unknown",
            "boundedBy": [
              "credits",
              "product:grok_build"
            ],
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits",
                "product:grok_build"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits",
                "product:grok_build"
              ]
            },
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "credits",
                "product:grok_build"
              ]
            }
          }
        ]
      },
      "accountKey": "default"
    },
    {
      "provider": "kimi",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "kimi_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "zai",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "zai_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "agy",
      "windows": [],
      "state": {
        "status": "unavailable",
        "stale": false,
        "error": "Antigravity/agy is not running"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "alibaba",
      "windows": [],
      "state": {
        "status": "unavailable",
        "stale": false,
        "error": "bl_cli_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "opencode-go",
      "plan": "OpenCode Go",
      "windows": [
        {
          "id": "rolling",
          "label": "rolling",
          "kind": "unknown",
          "percentRemaining": 3,
          "resetsAt": "2026-09-22T00:46:52.707Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "weekly",
          "label": "weekly",
          "kind": "weekly",
          "percentRemaining": 48,
          "resetsAt": "2026-09-28T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "monthly",
          "label": "monthly",
          "kind": "monthly",
          "percentRemaining": 23,
          "resetsAt": "2026-10-06T22:25:15.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 3,
            "boundedBy": [
              "rolling",
              "weekly",
              "monthly"
            ],
            "limitingWindowIds": [
              "rolling"
            ],
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            },
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            }
          }
        ]
      },
      "accountKey": "default"
    },
    {
      "provider": "commandcode",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "commandcode_sign_in_required",
        "authStatus": "unusable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "minimax",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "minimax_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    },
    {
      "provider": "mimo",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "mimo_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      },
      "accountKey": "default"
    },
    {
      "provider": "deepseek",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "deepseek_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      },
      "accountKey": "default"
    },
    {
      "provider": "openrouter",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "openrouter_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      },
      "accountKey": "default"
    },
    {
      "provider": "elevenlabs",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "elevenlabs_credential_unavailable",
        "authStatus": "unusable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      },
      "accountKey": "default"
    }
  ]
}
Evidence: Live schema 5 snapshot from real quota-axi 0.1.48

Source: Live schema 5 snapshot from real quota-axi 0.1.48

{
  "generatedAt": "2026-09-21T22:02:59.978Z",
  "schemaVersion": 5,
  "providers": [
    {
      "provider": "claude",
      "plan": "max",
      "windows": [
        {
          "id": "five_hour",
          "label": "session",
          "kind": "session",
          "resetsAt": "2026-09-22T00:00:00.148697+00:00",
          "percentRemaining": 89,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 49.9991,
            "burnMultiple": 0.1803
          }
        },
        {
          "id": "seven_day",
          "label": "week",
          "kind": "weekly",
          "resetsAt": "2026-09-23T17:00:00.148714+00:00",
          "percentRemaining": 35,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 9.4345,
            "burnMultiple": 0.8733
          }
        },
        {
          "id": "model:fable",
          "label": "Fable week",
          "kind": "model",
          "resetsAt": "2026-09-23T17:00:00.148890+00:00",
          "percentRemaining": 86,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 60.4345,
            "burnMultiple": 0.1881
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 35,
            "boundedBy": [
              "five_hour",
              "seven_day"
            ],
            "limitingWindowIds": [
              "seven_day"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 9.4345,
              "worstReserveWindowId": "seven_day"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 0.5421
            }
          },
          {
            "scope": "model:fable",
            "status": "known",
            "effectivePercentRemaining": 35,
            "boundedBy": [
              "five_hour",
              "seven_day",
              "model:fable"
            ],
            "limitingWindowIds": [
              "seven_day"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 9.4345,
              "worstReserveWindowId": "seven_day"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 1.8397
            }
          }
        ]
      }
    },
    {
      "provider": "codex",
      "plan": "pro",
      "windows": [
        {
          "id": "weekly",
          "label": "week",
          "kind": "weekly",
          "resetsAt": "2026-09-26T19:16:28.000Z",
          "percentRemaining": 60,
          "pace": {
            "status": "ahead",
            "reservePercentPoints": -9.7765,
            "burnMultiple": 1.3235
          }
        }
      ],
      "credits": {
        "remaining": 0,
        "unlimited": false,
        "unit": "credits"
      },
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 60,
            "boundedBy": [
              "weekly"
            ],
            "limitingWindowIds": [
              "weekly"
            ],
            "pace": {
              "status": "ahead",
              "aheadWindowIds": [
                "weekly"
              ],
              "worstReservePercentPoints": -9.7765,
              "worstReserveWindowId": "weekly"
            },
            "runway": {
              "status": "projected_exhaustion",
              "usableRunwaySeconds": 274188,
              "projectedExhaustedAt": "2026-09-25T02:12:47.945Z",
              "limitingWindowId": "weekly",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": -0.4636
            }
          }
        ]
      }
    },
    {
      "provider": "cursor",
      "plan": "Ultra",
      "windows": [
        {
          "id": "included_usage",
          "label": "included usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 80,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 14.373,
            "burnMultiple": 0.5819
          }
        },
        {
          "id": "auto_usage",
          "label": "auto usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 79,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 13.373,
            "burnMultiple": 0.6109
          }
        },
        {
          "id": "api_usage",
          "label": "API usage",
          "kind": "monthly",
          "resetsAt": "2026-10-11T14:33:52.000Z",
          "percentRemaining": 86,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 20.373,
            "burnMultiple": 0.4073
          }
        },
        {
          "id": "grok_bot",
          "label": "Grok Bot",
          "kind": "weekly",
          "resetsAt": "2026-09-23T20:54:25.780Z",
          "percentRemaining": 83,
          "pace": {
            "status": "behind",
            "reservePercentPoints": 55.1088,
            "burnMultiple": 0.2358
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 79,
            "boundedBy": [
              "included_usage",
              "auto_usage",
              "api_usage"
            ],
            "limitingWindowIds": [
              "auto_usage"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 13.373,
              "worstReserveWindowId": "auto_usage"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 0.711
            }
          },
          {
            "scope": "grok_bot",
            "status": "known",
            "effectivePercentRemaining": 83,
            "boundedBy": [
              "grok_bot"
            ],
            "limitingWindowIds": [
              "grok_bot"
            ],
            "pace": {
              "status": "behind",
              "worstReservePercentPoints": 55.1088,
              "worstReserveWindowId": "grok_bot"
            },
            "runway": {
              "status": "through_reset",
              "projectionConfidence": "established"
            },
            "selection": {
              "status": "known",
              "spendPriority": 2.74
            }
          }
        ]
      }
    },
    {
      "provider": "copilot",
      "plan": "individual",
      "windows": [
        {
          "id": "chat",
          "label": "chat",
          "kind": "monthly",
          "percentRemaining": 100,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "completions",
          "label": "completions",
          "kind": "monthly",
          "percentRemaining": 100,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
   

... [167 bytes truncated] ...

: "monthly",
          "percentRemaining": 0,
          "resetsAt": "2026-10-01T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": [
          "chat",
          "completions",
          "premium_interactions"
        ]
      }
    },
    {
      "provider": "grok",
      "windows": [
        {
          "id": "credits",
          "label": "credits",
          "kind": "credits",
          "percentRemaining": 6,
          "resetsAt": "2026-09-25T19:29:09.000Z",
          "pace": {
            "status": "unknown",
            "reason": "stale"
          }
        },
        {
          "id": "product:grok_build",
          "label": "Grok Build",
          "kind": "credits",
          "percentRemaining": 6,
          "resetsAt": "2026-09-25T19:29:09.000Z",
          "pace": {
            "status": "unknown",
            "reason": "stale"
          }
        }
      ],
      "state": {
        "status": "stale",
        "stale": true,
        "error": "Grok sign-in required",
        "authStatus": "unusable"
      },
      "credits": {
        "remaining": 0,
        "unit": "credits"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [
          {
            "scope": "all_products",
            "status": "unknown",
            "boundedBy": [
              "credits"
            ],
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits"
              ]
            },
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "credits"
              ]
            }
          },
          {
            "scope": "product:grok_build",
            "status": "unknown",
            "boundedBy": [
              "credits",
              "product:grok_build"
            ],
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits",
                "product:grok_build"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "credits",
                "product:grok_build"
              ]
            },
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "credits",
                "product:grok_build"
              ]
            }
          }
        ]
      }
    },
    {
      "provider": "kimi",
      "windows": [],
      "state": {
        "status": "unavailable",
        "stale": false,
        "error": "pi_kimi_credential_expired",
        "authStatus": "expired_refreshable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "zai",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "zai_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "agy",
      "windows": [],
      "state": {
        "status": "unavailable",
        "stale": false,
        "error": "Antigravity/agy is not running"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "alibaba",
      "windows": [],
      "state": {
        "status": "unavailable",
        "stale": false,
        "error": "bl_cli_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "opencode-go",
      "plan": "OpenCode Go",
      "windows": [
        {
          "id": "rolling",
          "label": "rolling",
          "kind": "unknown",
          "percentRemaining": 3,
          "resetsAt": "2026-09-22T00:46:52.707Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "weekly",
          "label": "weekly",
          "kind": "weekly",
          "percentRemaining": 48,
          "resetsAt": "2026-09-28T00:00:00.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        },
        {
          "id": "monthly",
          "label": "monthly",
          "kind": "monthly",
          "percentRemaining": 23,
          "resetsAt": "2026-10-06T22:25:15.000Z",
          "pace": {
            "status": "unknown",
            "reason": "missing_cycle"
          }
        }
      ],
      "state": {
        "status": "fresh",
        "stale": false
      },
      "quotaSemantics": {
        "status": "known",
        "effectiveAvailability": [
          {
            "scope": "all_models",
            "status": "known",
            "effectivePercentRemaining": 3,
            "boundedBy": [
              "rolling",
              "weekly",
              "monthly"
            ],
            "limitingWindowIds": [
              "rolling"
            ],
            "pace": {
              "status": "unknown",
              "unknownWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            },
            "runway": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            },
            "selection": {
              "status": "unknown",
              "unmeasurableWindowIds": [
                "rolling",
                "weekly",
                "monthly"
              ]
            }
          }
        ]
      }
    },
    {
      "provider": "commandcode",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "commandcode_sign_in_required",
        "authStatus": "unusable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "minimax",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "minimax_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    },
    {
      "provider": "mimo",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "mimo_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      }
    },
    {
      "provider": "deepseek",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "deepseek_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      }
    },
    {
      "provider": "openrouter",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "openrouter_credential_unavailable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": [],
        "unresolvedWindowIds": []
      }
    },
    {
      "provider": "elevenlabs",
      "windows": [],
      "state": {
        "status": "auth_required",
        "stale": false,
        "error": "elevenlabs_credential_unavailable",
        "authStatus": "unusable"
      },
      "quotaSemantics": {
        "status": "unknown",
        "effectiveAvailability": []
      }
    }
  ]
}
Evidence: fm-dispatch-resolve accepting a live schema 6 snapshot

Source: fm-dispatch-resolve accepting a live schema 6 snapshot

status: clear
candidate: pi:openai-codex-work/gpt-5.6-terra provider=codex -> eligible, unranked: provider codex unmeasured (unknown)
candidate: claude:opus provider=claude remaining=35% ... -> eligible
candidate: cursor:cursor-grok-4.6-high remaining=79% spendPriority=0.7113 -> eligible
profile: --harness 'cursor' --model 'cursor-grok-4.6-high'
exit=0
Evidence: Control run and pre-fix repro on the same live schema 6 bytes

Source: Control run and pre-fix repro on the same live schema 6 bytes

## control (branch): status: clear, exit=0
## pre-fix bin/ (259a669^): status: error, reason: quota-axi --json returned an invalid snapshot, exit=0
Evidence: Mutation check: widening to schema 7 fails the new test

Source: Mutation check: widening to schema 7 fails the new test

not ok - schema 7 is an error outcome (missing: ' status: error')

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
The real quota-axi 0.1.48 emits a schema 6 snapshot (Codex expanded to two accounts) and fm-dispatch-resolve accepts it, matching each Pi lane to its own account row and returning a clear profile ✅ pass live live-dispatch-schema6.txt, live-schema6-full-snapshot.json
A real single-account schema 5 snapshot from this host still resolves as before ✅ pass live live-dispatch-schema5.txt, live-snapshot.json
Regression repro: the pre-fix code rejects the same live schema 6 bytes that the current code accepts ✅ pass live live-dispatch-control-and-prefix-repro.txt
Adversarial: snapshots changed to schemaVersion 4, 7, or the string "6" are rejected as invalid snapshots, with exit 0 so a launch is never blocked ✅ pass live live-dispatch-adversarial.txt
Adversarial: a duplicate provider+accountKey (schema 6), a duplicate provider (schema 5), and a schema 6 row with no accountKey are all rejected ✅ pass live live-dispatch-adversarial.txt
The new regression tests fail if acceptance is widened past 5|6 ⏸️ untested no The prior payload did not establish a live result: this scenario checks the test suite itself (a mutation run of tests/fm-dispatch-resolve.test.sh, logged in mutation-accept-schema7.log), not the runn…
A real profile-based launch (for example no-mistakes-everywhere-research) goes through fm-spawn with the resolved profile against the live typesafe.ai API ⏸️ untested no It needs the production TYPESAFE_API_KEY and a real spawn. The runbook forbids touching production credentials and the live fleet. The resolver's quota gate, which was the actual blocker, was driven l…
  • quota-axi --json (real 0.1.48, real HOME) -> 16.5 KB schemaVersion 5 snapshot, saved as live-snapshot.json
  • PI_CODING_AGENT_DIR=<lab dir with openai-codex + openai-codex-work entries> quota-axi --json --no-credential-refresh -> real 16 KB schemaVersion 6 snapshot, 17 rows (codex split across 2 accountKeys, others default), exit 0
  • live-harness.sh <worktree> schema6: real bin/fm-dispatch-resolve.sh calling the real quota-axi in schema 6 mode; only the typesafe.ai HTTP call is faked
  • live-harness.sh <worktree> schema5: same, with the real host's schema 5 snapshot
  • live-harness.sh <worktree> replay:<file> on the exact live schema 6 bytes (control) and on copies changed to schemaVersion 4, 7, the string "6", a duplicate provider+accountKey, a duplicate schema 5 provider, and a row with no accountKey
  • git archive 259a669^ bin + live-harness.sh <prefix-bin> replay:live-schema6-full-snapshot.json (pre-fix repro)
  • bash tests/fm-dispatch-resolve.test.sh
  • Mutation check: temporarily widened fm_quota_json_valid to accept schemaVersion 7, re-ran tests/fm-dispatch-resolve.test.sh, then restored the file with git checkout
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Schema 5 and 6 already resolve through the public interface. Pin that versions 4 and 7, duplicate schema-5 providers, and duplicate schema-6 account keys fail closed as invalid snapshots.
@tiago-peixoto

Copy link
Copy Markdown
Contributor Author

Closing without merge. Schema 6 acceptance already shipped in #4904 (fixes #4926). This PR only added extra rejection cases on an already-valid contract and should stay unshipped.

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.

1 participant