diff --git a/crates/antfarm-core/src/claude/backfill.rs b/crates/antfarm-core/src/claude/backfill.rs index 695b39c..4d77b3b 100644 --- a/crates/antfarm-core/src/claude/backfill.rs +++ b/crates/antfarm-core/src/claude/backfill.rs @@ -25,7 +25,7 @@ use super::line::{Block, UserContent}; use super::parse::{Parsed, RawLine, parse_batch}; use super::reduce::{line_delta, summarize}; use super::source::SourceStats; -use crate::input::{AgentRef, Input}; +use crate::input::{AgentRef, ForkLink, Input}; use crate::model::{ AgentId, CallRecord, FileTouch, LineRefs, ParseStats, ResultStatus, SessionId, Time, ToolCallId, }; @@ -88,13 +88,14 @@ fn run( sink: &mpsc::Sender, stats: &Mutex, ) -> Result<(), Closed> { - let send = |calls, files, read, done| { + let send = |(calls, files, forks), read, done| { sink.blocking_send(Input::Backfill { session: job.session.clone(), agent: job.agent.clone(), job: job.id, calls, files, + forks, read, total: job.boundary, done, @@ -112,7 +113,7 @@ fn run( Ok(f) => f, Err(e) => { fail(e); - return send(Vec::new(), Vec::new(), job.boundary, true); + return send(Decoded::default(), job.boundary, true); } }; let mut reader = BackReader::new(file, job.boundary, &TailConfig::default(), chunk); @@ -129,12 +130,12 @@ fn run( // The engine drops this job's batches once it hears of the truncation; // finishing here keeps a read error from showing as loading forever. fail(e); - return send(Vec::new(), Vec::new(), job.boundary, true); + return send(Decoded::default(), job.boundary, true); } }; - let (calls, files) = decoder.decode(lines); + let decoded = decoder.decode(lines); let read = job.boundary - reader.remaining(); - send(calls, files, read, reader.remaining() == 0)?; + send(decoded, read, reader.remaining() == 0)?; let mut s = stats.lock().unwrap(); s.bytes_read += read - reported; reported = read; @@ -147,13 +148,19 @@ fn run( } /// A result read before its call was. -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone)] struct Seen { at: Option