perf: complete history bootstrap in one streaming phase

This commit is contained in:
CoolBoy
2026-09-04 11:35:43 +08:00
parent 54ed4351a0
commit 2c748dcec2
6 changed files with 183 additions and 298 deletions

View File

@@ -485,6 +485,7 @@ class OutcomeTracker:
task_contexts: dict[str, dict[str, Any]] | None = None,
enrichment_limit: int = 0,
enrichment_workers: int = 8,
enrichment_batch_size: int = 200,
log: Any = None,
) -> dict[str, int]:
"""Import terminal history and classify every usable historical failure."""
@@ -556,7 +557,7 @@ class OutcomeTracker:
enrichment_attempts = 0
classified_total = 0
errors_total = 0
batch_size = 200
batch_size = max(1, int(enrichment_batch_size))
total_candidates = len(candidates)
for offset in range(0, total_candidates, batch_size):
# Keep direct references until classification completes. Calling