capture_pending_artifacts
Backfills artifact files for legacy trials missing stored copies by scanning disk, saving gzip-compressed data to SQLite, and marking oversized or lost files. Dry runs preview pending IDs.
Instructions
Capture artifact files for trials that predate artifact capture.
Scans all trials with an artifact_path but no rows in trial_artifacts. Reads files from disk and stores them in SQLite (gzip-compressed). Files over 50MB are skipped and marked oversized. Files that no longer exist on disk are marked lost.
dry_run=true reports the pending trial ids without reading or storing anything.
cleanup: when True, staging files are deleted after successful capture (the SQLite copy becomes authoritative). Default False keeps the originals — conservative for migration of old trials.
Under normal operation this is a no-op — _finalize_trial already captures artifacts automatically. This tool only catches trials that slipped through (finalized before artifact capture was implemented).
Returns: {captured: [...], oversized: [...], lost: [...], trials_scanned: int, trials_with_existing: int}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cleanup | No | Delete staging files after successful capture (the SQLite copy becomes authoritative). | |
| dry_run | Yes | When true, report which trials would be captured without mutating. Required — pass false to apply. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lost | No | ||
| captured | No | ||
| oversized | No | ||
| trials_scanned | No | ||
| trials_with_existing | No |