feat: clean up batch JSONL files after processing (spec 550)#684
Merged
Conversation
Batch JSONL files (input payloads and raw results) were written to disk
during provider upload/retrieval but never cleaned up, accumulating
across runs.
- Delete input JSONL immediately after successful provider upload
(batch_base.py submit_batch)
- Delete result JSONL immediately after parsing results back into
memory (batch_base.py retrieve_results)
- Delete remaining .jsonl/.json artifacts in target/{action}/batch/
during --fresh cleanup (coordinator.py _clear_for_fresh_run)
The CLI `batch retrieve` command's output file is NOT deleted — that's
the user-requested artifact from the command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.jsonl/.jsonbatch artifacts intarget/{action}/batch/during--freshcleanupbatch retrieveoutput file is NOT deleted — that's the user-requested artifactWhy
Batch JSONL files accumulate across runs. A 50-action workflow running daily produces ~100 files/run. After 30 days: ~3000 orphaned files. No code reads these files after the initial upload/retrieval call completes.
Files changed (2 production, 2 test)
llm/providers/batch_base.py_submit_to_provider_api, delete result JSONL after_read_jsonl_fileworkflow/coordinator.py_clear_for_fresh_runglobs and deletes.jsonl/.jsonintarget/{action}/batch/tests/unit/llm/test_batch_jsonl_cleanup.pytests/unit/workflow/test_fresh_run_cleanup.pyVerification
pytest→ 7488 passed, 2 skipped (+9 new tests)ruff check→ all checks passedruff format --check→ 954 files already formatted