Skip to main content

close_run

Function close_run 

Source
pub fn close_run(
    agent: &Agent,
    api_base: &str,
    token: &str,
    ctx: &RunContext,
    exit_code: Option<i32>,
    remaining_csv: Option<String>,
    uploaded_uris: &[String],
) -> Result<(), String>
Expand description

POST to /runs/{run_id}/finish to mark the run complete.

Dispatches to the correct schema variant based on whether S3 uploads occurred:

  • uploaded_uris non-empty → RunFinishS3 (data_source="s3", data_uris=[...]). The BatchUploader already flushed the final remaining samples to S3 on shutdown before this function is called, so uploaded_uris contains every batch. remaining_csv is ignored in this path.

  • uploaded_uris empty → RunFinishInline (data_source="inline", data_csv=...). Used for short runs or when all S3 uploads failed. remaining_csv is the raw CSV of all collected samples (never base64-encoded).