fix(core): /retry чистит postmortem-трассы — на новом прогоне постмортем запускается заново
Some checks failed
CI / test (push) Failing after 1m54s
CI / build-and-package (amd64, linux) (push) Failing after 1m21s
CI / build-and-package (amd64, windows) (push) Successful in 33s

This commit is contained in:
ki.sagidullin
2026-08-24 14:56:39 +05:00
parent 9cb174a5d3
commit ed13386612
3 changed files with 36 additions and 0 deletions

View File

@@ -107,6 +107,17 @@ func (s *Storage) GetLatestTrace(ctx context.Context, taskID int64, agent string
return tr, nil
}
// DeleteTracesByAgent удаляет все трассы задачи с заданным агентом
// (сброс маркера при /retry N: чистый перезапуск без наследия анализа).
func (s *Storage) DeleteTracesByAgent(ctx context.Context, taskID int64, agent string) error {
_, err := s.db.ExecContext(ctx,
`DELETE FROM traces WHERE task_id=? AND agent=?`, taskID, agent)
if err != nil {
return fmt.Errorf("%w: delete traces agent %s for task %d: %w", ErrDB, agent, taskID, err)
}
return nil
}
// DeleteTrace удаляет трассу. Только для тестов/админки.
func (s *Storage) DeleteTrace(ctx context.Context, id int64) error {
res, err := s.db.ExecContext(ctx, `DELETE FROM traces WHERE id = ?`, id)