      r = Route(args.route)
      lr = LogReader(r.log_paths()[args.seg])
      fr = FrameReader(r.camera_paths()[args.seg])
    else:
      lr = LogReader(f"cd:/{route.replace('|', '/')}/{sidx}/rlog")
      fr = FrameReader(f"cd:/{route.replace('|', '/')}/{sidx}/fcamera.hevc")
    rpath = regen_segment(lr, {'roadCameraState': fr})
  
    lr = LogReader(os.path.join(rpath, 'rlog2'))
    controls_state_active = [m.controlsState.active for m in lr if m.which() == 'controlsState']
 
</s> remove   lr = LogReader(os.path.join(rpath, 'rlog2'))
 </s> add   # compress raw rlog before uploading
  with open(os.path.join(rpath, "rlog"), "rb") as f:
    data = bz2.compress(f.read())
  with open(os.path.join(rpath, "rlog.bz2"), "wb") as f:
    f.write(data)
  os.remove(os.path.join(rpath, "rlog"))

  lr = LogReader(os.path.join(rpath, 'rlog.bz2')) </s> remove     ensure_running(managed_processes.values(), started=True, not_run=ignore)
 </s> add     ensure_running(managed_processes.values(), started=True, params=Params(), CP=car.CarParams(), not_run=ignore)
    lr = LogReader(f"cd:/{route.replace('|', '/')}/{sidx}/rlog.bz2")
      r = Route(args.route)
      lr = LogReader(r.log_paths()[args.seg])
      fr = FrameReader(r.camera_paths()[args.seg])
    else:
    lr = LogReader(f"cd:/{route.replace('|', '/')}/{sidx}/rlog.bz2")
      fr = FrameReader(f"cd:/{route.replace('|', '/')}/{sidx}/fcamera.hevc")
    rpath = regen_segment(lr, {'roadCameraState': fr})
  
    lr = LogReader(os.path.join(rpath, 'rlog2'))
    controls_state_active = [m.controlsState.active for m in lr if m.which() == 'controlsState']
keep keep keep keep replace keep keep keep keep keep
 Fix process replay regen (#24517)

* fix regen issues

* compress like uploader 
selfdrive/test/process_replay/regen.py