hunk.code_window:             if self.config["kl_coeff"] > 0.0:
                   total_loss += self.kl_coeff * mean_kl_loss
               # Store stats in policy for stats_fn.
               self._total_loss = total_loss
               self._mean_policy_loss = mean_policy_loss
               self._mean_vf_loss = mean_vf_loss
               self._mean_entropy = mean_entropy
               # Backward compatibility: Deprecate self._mean_kl.
               self._mean_kl_loss = self._mean_kl = mean_kl_loss
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:             self._mean_policy_loss = reduce_mean_valid(-surrogate_loss)
  
hunk.file_path: rllib/algorithms/ppo/ppo_tf_policy.py
hunk.type: replace
file: #!/bin/bash
  # This script is executed by Buildkite on the host machine.
  # In contrast, our build jobs are run in Docker containers.
  # This means that even though our build jobs write to
  # `/artifact-mount`, the directory on the host machine is
  # actually `/tmp/artifacts`.
  # Here, we cat all text files in artifact-mount/test-summaries
  # and upload them as a Buildkite annotation.
  # These files contain a condensed summary of all failing pytest
  # tests to make it easy for users to see which tests are failing.
  # Because we upload them to Buildkite, we don't need to
  # upload them as artifacts and delete them afterwards.
  set -e
  if [ -d "/tmp/artifacts/test-summaries" ] && [ "$(ls -A /tmp/artifacts/test-summaries)" ]; then
      # Only upload annotations if there are at least 2 files in the directory:
      # 1 header and 1 failed test.
      if [ "$(find /tmp/artifacts/test-summaries -maxdepth 1 -name '*.txt' | wc -l)" -ge 2 ]; then
        cat /tmp/artifacts/test-summaries/*.txt | buildkite-agent annotate --job "${BUILDKITE_JOB_ID}" --append --style error --context "${BUILDKITE_JOB_ID}"
      fi
  
      # Remove test summaries files (don't actually upload as artifacts)
      # This has to be done with docker to avoid permission issues
      echo "--- Cleaning up"
      docker run --rm -v /tmp/artifacts:/artifact-mount alpine:latest /bin/sh -c 'rm -rf /artifact-mount/test-summaries' || true
  fi
  