-- A seventh termination reason: GatewayFailure. -- -- 000006 chose a CHECK over an enum type so that "a new termination reason -- should be a migration, but not one that requires ALTER TYPE". This is that -- migration. -- -- Until now the model provider failing — rate limited, request rejected, key -- refused, unreachable — was recorded as ToolFailure, because the enum had no -- other place for it. On 2026-09-22 that was 131 of 318 production runs, of -- which not one was a tool failing. The distinction is the difference between -- "what did we break" and "what are we not paying for", and the column that -- every dashboard and eval groups by could not make it. -- -- Existing rows are left as they are. Rewriting history from the trajectory -- text would be guesswork against a message format that has changed twice; -- the trajectory entries still carry the gateway.* error code for anyone who -- needs to reclassify the past. ALTER TABLE agent_runs DROP CONSTRAINT agent_runs_termination_check; ALTER TABLE agent_runs ADD CONSTRAINT agent_runs_termination_check CHECK (termination IN ( 'Completed', 'BudgetExceeded', 'Deadline', 'ConfirmationPending', 'ToolFailure', 'Refused', 'GatewayFailure' ));