Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ jobs:
uv run --all-extras --frozen pytest -q
tests/test_separate_verifier_container.py
tests/test_separate_verifier_harbor.py
tests/test_validate_fresh_stages_container.py
egress-controls:
name: Go/Rust solve-time egress controls
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions docs/pipelines/pr_runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ replace the validation container. This does **not** provide a new dependency ima
or container for every PR. Revision-aware dependencies and stronger per-candidate
isolation remain tracked in [#253](https://github.com/huggingface/Repo2RLEnv/issues/253).

### Fresh validation stages

Use `--pipeline-opt fresh_validation_stages=true` to snapshot the prepared
validation container once per candidate and run pre-fix, post-fix, stability
reruns and mutant checks in separate containers. Stage-written files and running
processes do not carry into the next stage. Containers and the temporary snapshot
are removed when validation finishes, including on early rejection or failure;
cleanup failures are logged without hiding the original error.

The default remains `false`. This adds snapshot/startup overhead and inherits the
prepared container's installed dependencies. It does not reinstall them at the
historical base revision, change validation networking, or isolate an existing
mounted volume (Docker snapshots exclude volume contents). Use images whose source
and dependencies live in the container filesystem. Published tasks are unchanged.

## Options

Pass each option with `--pipeline-opt key=value`.
Expand All @@ -136,6 +151,7 @@ Pass each option with `--pipeline-opt key=value`.
| `require_fail_to_pass` | `true` | Skip PRs with fewer than `min_fail_to_pass` F2P tests after validation |
| `min_fail_to_pass` | `1` | Minimum number of F2P tests |
| `validation_timeout_sec` | `600` | Whole-stage deadline; the test launcher reserves part of it for setup and cleanup |
| `fresh_validation_stages` | `false` | Run each validation stage in a new container from one prepared snapshot per candidate |
| `skip_validation` | `false` | Emit candidates without running tests. Tasks then have no F2P/P2P lists, a pass/fail exit-code reward and, with nothing measured, a 300 s per-run limit. For debugging |
| `require_new_test_funcs` | `true` | Require the test patch to add at least one test function or class |
| `skip_ci_only` | `true` | Skip PRs whose source changes are all under `.github/` |
Expand Down
9 changes: 7 additions & 2 deletions src/repo2rlenv/bootstrap/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,16 @@ def push(self, tag: str, *, timeout: int = 900) -> bool:
return False
return True

def cleanup(self) -> None:
def cleanup(self, *, strict: bool = False) -> None:
"""Remove the container; strict callers require confirmed removal."""
if not self._alive:
return
# `rm -f` stops + removes in one go
_run(["docker", "rm", "-f", self.container_id], timeout=30)
result = _run(["docker", "rm", "-f", self.container_id], timeout=30)
if strict and not result.ok:
raise DockerError(
f"could not remove {self.container_id}: {result.stderr.strip()[:400]}"
)
self._alive = False

def __enter__(self) -> DockerSandbox:
Expand Down
1 change: 1 addition & 0 deletions src/repo2rlenv/pipelines/pr_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ def run(self, out_dir: Path) -> PipelineResult:
test_cmds=targeted_cmds,
language=self.bootstrap.language.value,
timeout=self.options.validation_timeout_sec,
fresh_stages=self.options.fresh_validation_stages,
)
fail_to_pass = outcome.fail_to_pass
pass_to_pass = outcome.pass_to_pass
Expand Down
Loading