File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,6 +162,10 @@ async function purge(wrIds: number[]): Promise<void> {
162162 SELECT DISTINCT server_log_id AS id FROM benchmark_results
163163 WHERE workflow_run_id = ANY(${ wrIds } ) AND server_log_id IS NOT NULL
164164 ` ;
165+ const traceRows = await tx `
166+ SELECT DISTINCT trace_replay_id AS id FROM benchmark_results
167+ WHERE workflow_run_id = ANY(${ wrIds } ) AND trace_replay_id IS NOT NULL
168+ ` ;
165169
166170 // Children first
167171 await tx `DELETE FROM benchmark_results WHERE workflow_run_id = ANY(${ wrIds } )` ;
@@ -181,6 +185,21 @@ async function purge(wrIds: number[]): Promise<void> {
181185 ` ;
182186 }
183187
188+ // Orphaned agentic_trace_replay sidecars (profile-export + server-metrics
189+ // blobs). benchmark_results.trace_replay_id has no ON DELETE cascade, so
190+ // deleting the run's rows above leaves these behind — clear any that are no
191+ // longer referenced by a surviving benchmark_results row.
192+ const trIds = traceRows . map ( ( r ) => r . id as number ) ;
193+ if ( trIds . length > 0 ) {
194+ await tx `
195+ DELETE FROM agentic_trace_replay
196+ WHERE id = ANY(${ trIds } )
197+ AND NOT EXISTS (
198+ SELECT 1 FROM benchmark_results br WHERE br.trace_replay_id = agentic_trace_replay.id
199+ )
200+ ` ;
201+ }
202+
184203 // Orphaned availability rows
185204 if ( availKeys . length > 0 ) {
186205 const models = availKeys . map ( ( r ) => r . model as string ) ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export const PURGED_RUNS: ReadonlySet<number> = new Set([
4545 25603981395 , // 2026-05-09 | Reason: not enough successful points on pareto
4646 28505258231 , // 2026-07-01 | Reason: cross-layer indexer top-k sharing (--hf-overrides index_topk_freq=4); skips FLOPs
4747 28507173993 , // 2026-07-01 | Reason: cross-layer indexer top-k sharing (--hf-overrides index_topk_freq=4); skips FLOPs
48+ 29089300938 , // 2026-07-10 | Reason: reverting due to rule to disallow any patching
4849] ) ;
4950
5051export const PURGED_RUN_ATTEMPTS : ReadonlyMap < number , ReadonlySet < number > > = new Map ( [
You can’t perform that action at this time.
0 commit comments