INSERT INTO chat_debug_runs (
    id,
    chat_id,
    model_config_id,
    history_tip_message_id,
    kind,
    status,
    provider,
    model,
    summary,
    started_at,
    updated_at,
    finished_at
) VALUES (
    'c98518f8-9fb3-458b-a642-57552af1db63',
    '72c0438a-18eb-4688-ab80-e4c6a126ef96',
    '9af5f8d5-6a57-4505-8a69-3d6c787b95fd',
    (SELECT MAX(id) FROM chat_messages WHERE chat_id = '72c0438a-18eb-4688-ab80-e4c6a126ef96'),
    'chat_turn',
    'completed',
    'openai',
    'gpt-5.2',
    '{"step_count":1,"has_error":false}'::jsonb,
    '2024-01-01 00:00:00+00',
    '2024-01-01 00:00:01+00',
    '2024-01-01 00:00:01+00'
);

INSERT INTO chat_debug_steps (
    id,
    run_id,
    chat_id,
    step_number,
    operation,
    status,
    history_tip_message_id,
    assistant_message_id,
    normalized_request,
    normalized_response,
    usage,
    attempts,
    error,
    metadata,
    started_at,
    updated_at,
    finished_at
) VALUES (
    '59471c60-7851-4fa6-bf05-e21dd939721f',
    'c98518f8-9fb3-458b-a642-57552af1db63',
    '72c0438a-18eb-4688-ab80-e4c6a126ef96',
    1,
    'stream',
    'completed',
    (SELECT MAX(id) FROM chat_messages WHERE chat_id = '72c0438a-18eb-4688-ab80-e4c6a126ef96'),
    (SELECT MAX(id) FROM chat_messages WHERE chat_id = '72c0438a-18eb-4688-ab80-e4c6a126ef96'),
    '{"messages":[]}'::jsonb,
    '{"finish_reason":"stop"}'::jsonb,
    '{"input_tokens":1,"output_tokens":1}'::jsonb,
    '[]'::jsonb,
    NULL,
    '{"provider":"openai"}'::jsonb,
    '2024-01-01 00:00:00+00',
    '2024-01-01 00:00:01+00',
    '2024-01-01 00:00:01+00'
);
