Marquis03 commited on
Commit
e69c199
·
verified ·
1 Parent(s): c01a68e

Upload folder using huggingface_hub (part 13)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +58 -0
  2. containers--toolbox.0851179/instruction.md +98 -0
  3. containers--toolbox.0851179/solution/solve.sh +33 -0
  4. containers--toolbox.0851179/task.toml +69 -0
  5. containers--toolbox.0851179/tests/Dockerfile +66 -0
  6. containers--toolbox.0851179/tests/blobs/tests/generated_module_01.tar.gz +3 -0
  7. containers--toolbox.0851179/tests/blobs/tests/generated_module_02.tar.gz +3 -0
  8. containers--toolbox.0851179/tests/blobs/tests/generated_module_03.tar.gz +3 -0
  9. containers--toolbox.0851179/tests/blobs/tests/generated_module_04.tar.gz +3 -0
  10. containers--toolbox.0851179/tests/blobs/tests/generated_upstream.tar.gz +3 -0
  11. containers--toolbox.0851179/tests/download.sh +211 -0
  12. containers--toolbox.0851179/tests/executable +3 -0
  13. containers--toolbox.0851179/tests/programgym-go.tar.gz +3 -0
  14. containers--toolbox.0851179/tests/programgym_evaluator.py +1201 -0
  15. containers--toolbox.0851179/tests/programgym_task.json +1473 -0
  16. containers--toolbox.0851179/tests/test.sh +82 -0
  17. containers--toolbox.0851179/tests/workspace.tar.gz +3 -0
  18. contribsys--faktory_worker_go.dd/environment/Dockerfile +60 -0
  19. contribsys--faktory_worker_go.dd/environment/download.sh +171 -0
  20. contribsys--faktory_worker_go.dd/environment/executable +3 -0
  21. contribsys--faktory_worker_go.dd/environment/programgym-go.tar.gz +3 -0
  22. contribsys--faktory_worker_go.dd/environment/workspace.tar.gz +3 -0
  23. contribsys--faktory_worker_go.dd/instruction.md +98 -0
  24. contribsys--faktory_worker_go.dd/solution/solve.sh +33 -0
  25. contribsys--faktory_worker_go.dd/task.toml +69 -0
  26. contribsys--faktory_worker_go.dd/tests/Dockerfile +68 -0
  27. contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_01.tar.gz +3 -0
  28. contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_02.tar.gz +3 -0
  29. contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_03.tar.gz +3 -0
  30. contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_04.tar.gz +3 -0
  31. contribsys--faktory_worker_go.dd/tests/download.sh +171 -0
  32. contribsys--faktory_worker_go.dd/tests/executable +3 -0
  33. contribsys--faktory_worker_go.dd/tests/programgym-go.tar.gz +3 -0
  34. contribsys--faktory_worker_go.dd/tests/programgym_evaluator.py +1201 -0
  35. contribsys--faktory_worker_go.dd/tests/programgym_task.json +222 -0
  36. contribsys--faktory_worker_go.dd/tests/test.sh +82 -0
  37. contribsys--faktory_worker_go.dd/tests/workspace.tar.gz +3 -0
  38. corunb--dirscan.ca089be/environment/Dockerfile +60 -0
  39. corunb--dirscan.ca089be/environment/download.sh +73 -0
  40. corunb--dirscan.ca089be/environment/executable +3 -0
  41. corunb--dirscan.ca089be/environment/programgym-go.tar.gz +3 -0
  42. corunb--dirscan.ca089be/environment/workspace.tar.gz +3 -0
  43. corunb--dirscan.ca089be/instruction.md +98 -0
  44. corunb--dirscan.ca089be/solution/solve.sh +33 -0
  45. corunb--dirscan.ca089be/task.toml +69 -0
  46. corunb--dirscan.ca089be/tests/Dockerfile +68 -0
  47. corunb--dirscan.ca089be/tests/blobs/tests/generated_module_01.tar.gz +3 -0
  48. corunb--dirscan.ca089be/tests/blobs/tests/generated_module_02.tar.gz +3 -0
  49. corunb--dirscan.ca089be/tests/blobs/tests/generated_module_03.tar.gz +3 -0
  50. corunb--dirscan.ca089be/tests/blobs/tests/generated_module_04.tar.gz +3 -0
.gitattributes CHANGED
@@ -563,3 +563,61 @@ connormanning--entwine.e43b3df/tests/executable filter=lfs diff=lfs merge=lfs -t
563
  conradkleinespel--rpassword.1151/environment/executable filter=lfs diff=lfs merge=lfs -text
564
  conradkleinespel--rpassword.1151/tests/executable filter=lfs diff=lfs merge=lfs -text
565
  containers--toolbox.0851179/environment/executable filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  conradkleinespel--rpassword.1151/environment/executable filter=lfs diff=lfs merge=lfs -text
564
  conradkleinespel--rpassword.1151/tests/executable filter=lfs diff=lfs merge=lfs -text
565
  containers--toolbox.0851179/environment/executable filter=lfs diff=lfs merge=lfs -text
566
+ containers--toolbox.0851179/tests/executable filter=lfs diff=lfs merge=lfs -text
567
+ contribsys--faktory_worker_go.dd/environment/executable filter=lfs diff=lfs merge=lfs -text
568
+ contribsys--faktory_worker_go.dd/tests/executable filter=lfs diff=lfs merge=lfs -text
569
+ corunb--dirscan.ca089be/environment/executable filter=lfs diff=lfs merge=lfs -text
570
+ corunb--dirscan.ca089be/tests/executable filter=lfs diff=lfs merge=lfs -text
571
+ covenantsql--gnte.50eb300/environment/executable filter=lfs diff=lfs merge=lfs -text
572
+ covenantsql--gnte.50eb300/tests/executable filter=lfs diff=lfs merge=lfs -text
573
+ craigmccaskill--posthorn.3be36a2/environment/executable filter=lfs diff=lfs merge=lfs -text
574
+ craigmccaskill--posthorn.3be36a2/tests/executable filter=lfs diff=lfs merge=lfs -text
575
+ crillab--gophersat.14b4f8c/environment/executable filter=lfs diff=lfs merge=lfs -text
576
+ crillab--gophersat.14b4f8c/tests/executable filter=lfs diff=lfs merge=lfs -text
577
+ cross-platform--dspatch.df8fc55/environment/executable filter=lfs diff=lfs merge=lfs -text
578
+ cross-platform--dspatch.df8fc55/tests/executable filter=lfs diff=lfs merge=lfs -text
579
+ cross-platform--icloud-for-linux/environment/executable filter=lfs diff=lfs merge=lfs -text
580
+ cross-platform--icloud-for-linux/tests/executable filter=lfs diff=lfs merge=lfs -text
581
+ crunchydata--crunchy-proxy.64e94/environment/executable filter=lfs diff=lfs merge=lfs -text
582
+ crunchydata--crunchy-proxy.64e94/tests/executable filter=lfs diff=lfs merge=lfs -text
583
+ cryptix--git-remote-ipfs.241d124/environment/executable filter=lfs diff=lfs merge=lfs -text
584
+ cryptix--git-remote-ipfs.241d124/tests/executable filter=lfs diff=lfs merge=lfs -text
585
+ crypto-chassis--ccapi.5c3f32f/environment/executable filter=lfs diff=lfs merge=lfs -text
586
+ crypto-chassis--ccapi.5c3f32f/tests/executable filter=lfs diff=lfs merge=lfs -text
587
+ cunarist--rinf.9324f0f/environment/executable filter=lfs diff=lfs merge=lfs -text
588
+ cunarist--rinf.9324f0f/tests/executable filter=lfs diff=lfs merge=lfs -text
589
+ cuppar--rtd.2c49e1b/environment/executable filter=lfs diff=lfs merge=lfs -text
590
+ cuppar--rtd.2c49e1b/tests/executable filter=lfs diff=lfs merge=lfs -text
591
+ cursey--regenny.9a892c7/environment/executable filter=lfs diff=lfs merge=lfs -text
592
+ cursey--regenny.9a892c7/tests/executable filter=lfs diff=lfs merge=lfs -text
593
+ d-tsuji--awesome-go-orms.098e519/environment/executable filter=lfs diff=lfs merge=lfs -text
594
+ d-tsuji--awesome-go-orms.098e519/tests/executable filter=lfs diff=lfs merge=lfs -text
595
+ d6o--gorganizer.b5076c6/environment/executable filter=lfs diff=lfs merge=lfs -text
596
+ d6o--gorganizer.b5076c6/tests/executable filter=lfs diff=lfs merge=lfs -text
597
+ d99kris--rapidcsv.68f57cc/environment/executable filter=lfs diff=lfs merge=lfs -text
598
+ d99kris--rapidcsv.68f57cc/tests/executable filter=lfs diff=lfs merge=lfs -text
599
+ daac-tools--vaporetto.1d215b8/environment/executable filter=lfs diff=lfs merge=lfs -text
600
+ daac-tools--vaporetto.1d215b8/tests/executable filter=lfs diff=lfs merge=lfs -text
601
+ daancode--a-star.94779cb/environment/executable filter=lfs diff=lfs merge=lfs -text
602
+ daancode--a-star.94779cb/tests/executable filter=lfs diff=lfs merge=lfs -text
603
+ dacort--s3grep.2d19f82/environment/executable filter=lfs diff=lfs merge=lfs -text
604
+ dacort--s3grep.2d19f82/tests/executable filter=lfs diff=lfs merge=lfs -text
605
+ dafucoding--mtcnn_caffe.09c30c3/environment/executable filter=lfs diff=lfs merge=lfs -text
606
+ dafucoding--mtcnn_caffe.09c30c3/tests/executable filter=lfs diff=lfs merge=lfs -text
607
+ dalance--svls.2289d21/environment/executable filter=lfs diff=lfs merge=lfs -text
608
+ dalance--svls.2289d21/tests/executable filter=lfs diff=lfs merge=lfs -text
609
+ dalinvip--cw2vec.0f0dfb5/environment/executable filter=lfs diff=lfs merge=lfs -text
610
+ dalinvip--cw2vec.0f0dfb5/tests/executable filter=lfs diff=lfs merge=lfs -text
611
+ danicat--pacgo.1a96ba2/environment/executable filter=lfs diff=lfs merge=lfs -text
612
+ danicat--pacgo.1a96ba2/tests/executable filter=lfs diff=lfs merge=lfs -text
613
+ daniel-liu-c0deb0t--uwu.17475b1/environment/executable filter=lfs diff=lfs merge=lfs -text
614
+ daniel-liu-c0deb0t--uwu.17475b1/tests/executable filter=lfs diff=lfs merge=lfs -text
615
+ danielchappuis--reactphysics3d.7/environment/executable filter=lfs diff=lfs merge=lfs -text
616
+ danielchappuis--reactphysics3d.7/tests/executable filter=lfs diff=lfs merge=lfs -text
617
+ danielgatis--imgcat.f71d99d/environment/executable filter=lfs diff=lfs merge=lfs -text
618
+ danielgatis--imgcat.f71d99d/tests/executable filter=lfs diff=lfs merge=lfs -text
619
+ danog--php-tokio.006da31/environment/executable filter=lfs diff=lfs merge=lfs -text
620
+ danog--php-tokio.006da31/tests/executable filter=lfs diff=lfs merge=lfs -text
621
+ dapperdox--dapperdox.e343254/environment/executable filter=lfs diff=lfs merge=lfs -text
622
+ dapperdox--dapperdox.e343254/tests/executable filter=lfs diff=lfs merge=lfs -text
623
+ darakian--ddh.aac9046/environment/executable filter=lfs diff=lfs merge=lfs -text
containers--toolbox.0851179/instruction.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant that can interact with a computer.
2
+
3
+ This is a reverse-engineering benchmark. You are given a compiled binary and its documentation.
4
+ Your job is to write a new, original codebase from scratch that produces an executable with identical behavior.
5
+ You must figure out the behavior solely by running and interacting with the provided binary.
6
+ Writing original code based on observed behavior is the entire point of this benchmark.
7
+
8
+ Any approach that shortcuts this — finding existing source code, wrapping the binary,
9
+ or installing the original tool — does not count as a solution. It will be detected by an
10
+ automated judge, marked as a disqualification, and scored as a failure.
11
+ The trace will be posted to an online wall of shame.
12
+
13
+ <RULES>
14
+ ## What is not allowed
15
+
16
+ ### 1. Obtaining source code
17
+
18
+ The only source of truth about what the executable does is the executable itself and its
19
+ bundled documentation. You must not search the internet, package registries, or any external
20
+ source for information about this project's source code. Even if you recognize what the
21
+ executable is, you must reimplement it from behavioral observation alone.
22
+
23
+ This includes but is not limited to:
24
+ - Cloning or browsing the original GitHub repository, its forks, or mirrors
25
+ - Downloading the project from package registries: `cargo install <project>`, `go get github.com/<org>/<project>`, `pip install <project>`, `apt-get source <project>`, `npm install <project>`, etc.
26
+ - Fetching source tarballs from project websites (e.g., `curl https://lua.org/ftp/lua-5.5.0.tar.gz`)
27
+ - Using a package manager to download the project as a dependency and then reading its cached source (e.g., navigating into `~/.cargo/registry/src/` or `$(go env GOPATH)/pkg/mod/`)
28
+ - Searching the web for the project's source code or implementation details
29
+
30
+ ### 2. Wrapping or reusing the original binary
31
+
32
+ Your submission must be a genuine reimplementation. The provided `./executable` is for
33
+ observation only — your final solution must not depend on it or any other pre-built version
34
+ of the same tool at runtime.
35
+
36
+ This includes but is not limited to:
37
+ - Writing a wrapper script that delegates to the original binary (e.g., `exec zstd "$@"`)
38
+ - Installing the tool from a package manager and shimming to it (e.g., `apt-get install nnn && cp $(which nnn) ./executable`)
39
+ - Writing a `compile.sh` that simply makes the provided binary executable (`chmod +x ./executable`) or copies it (`cp ./executable ./executable`)
40
+ - Building a binary whose main function shells out to an external tool (e.g., `Command::new("miniserve").args(args).exec()`)
41
+ - Re-linking prebuilt `.o` object files found in the workspace without writing new source code
42
+
43
+ ### 3. Binary analysis of the provided executable
44
+
45
+ All information about the provided `./executable` must be obtained by interacting with it
46
+ through its normal user interface (CLI flags, stdin/stdout, etc.).
47
+ - You MUST NOT decompile `./executable` or use disassemblers (objdump, Ghidra, etc.) on it
48
+ - You MUST NOT use strace, ltrace, or similar tracing/instrumentation tools on `./executable`
49
+
50
+ Note: this restriction applies ONLY to the provided `./executable`. You are free to use any
51
+ analysis tools on binaries that you produce yourself during development.
52
+
53
+ ## What IS allowed
54
+
55
+ - Running the executable with any inputs, flags, and arguments to observe its behavior
56
+ - Reading any documentation files bundled in the workspace
57
+ </RULES>
58
+
59
+ ## Task context
60
+
61
+ We want to write the source code for a given executable.
62
+ The executable is located at `./executable` in the workspace root.
63
+
64
+ You also have access to the existing documentation.
65
+
66
+ ## Your task
67
+
68
+ Implement the source code to generate an executable of exactly identical behavior as the original.
69
+
70
+ No project-specific dependencies are pre-installed.
71
+ You do NOT have access to the internet.
72
+ **IMPORTANT**: Make sure that the executable(s) and everything else that is an artifact is not committed, i.e., is in your `.gitignore` file.
73
+ Finally, commit your changes.
74
+
75
+ Make sure that you have a `./compile.sh` file that produces an executable `./executable` in the workspace root.
76
+ `compile.sh` should be executable and should install any dependencies needed to compile the executable.
77
+ If your compile.sh fails to compile on a fresh checkout, your task has failed.
78
+
79
+ ## Important: This is a reverse-engineering benchmark
80
+
81
+ Your goal is to write original code from scratch that reproduces the executable's behavior.
82
+ The only way to learn what the executable does is to run it and read its bundled documentation.
83
+
84
+ Any attempt to obtain source code — whether successful or not — or to wrap/reuse the
85
+ provided binary will be detected by an automated judge, disqualified, and scored as zero.
86
+ See the full rules in the system prompt above. Key points:
87
+
88
+ - Do NOT search the internet, clone repos, or download the project from any package registry
89
+ - Do NOT wrap, shim, or delegate to the provided `./executable` or any installed version of the same tool
90
+ - Do NOT decompile the provided `./executable` or use strace/ltrace on it (analyzing your own binaries is fine)
91
+ - You SHOULD extensively test the executable to understand its behavior before writing code.
92
+ If you are dealing with a TUI, tmux/libtmux has been installed to help you test/inspect/it.
93
+
94
+ ## Recommended Workflow
95
+
96
+ 1. Explore all documentation files
97
+ 2. Play with the executable to understand its behavior (however, you MUST NOT decompile `./executable` or perform any other form of binary or strace/ltrace analysis on it)
98
+ 3. Write the source code to implement the behavior
containers--toolbox.0851179/solution/solve.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Oracle-only ceiling check. The reference is execute-only for normal agents;
3
+ # because the oracle runs as the owning `agent` user it can temporarily add read
4
+ # permission and encode the binary for Harbor's normal artifact handoff.
5
+ set -euo pipefail
6
+ test -f ./executable
7
+ chmod u+r ./executable
8
+ python3 - <<'PY'
9
+ import base64
10
+ from pathlib import Path
11
+
12
+ Path(".programgym_oracle_reference").write_bytes(
13
+ base64.b64encode(Path("executable").read_bytes())
14
+ )
15
+ PY
16
+ chmod u-r ./executable
17
+ cat > compile.sh <<'EOF'
18
+ #!/usr/bin/env bash
19
+ set -euo pipefail
20
+ if [ -f ./.programgym_oracle_reference ]; then
21
+ python3 - <<'PY'
22
+ import base64
23
+ from pathlib import Path
24
+
25
+ Path("executable").write_bytes(
26
+ base64.b64decode(Path(".programgym_oracle_reference").read_bytes())
27
+ )
28
+ PY
29
+ fi
30
+ test -f ./executable
31
+ chmod +x ./executable
32
+ EOF
33
+ chmod +x compile.sh
containers--toolbox.0851179/task.toml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ source = "ProgramGym"
3
+ artifacts = [
4
+ "/logs/verifier/programgym_eval.json",
5
+ "/logs/verifier/harbor_diagnostics.json",
6
+ "/logs/verifier/programgym_eval.log",
7
+ "/logs/verifier/reward.json",
8
+ "/logs/verifier/reward.txt",
9
+ # Keep agent/runtime state out of the submission handoff. In particular,
10
+ # Claude Code installs an absolute symlink under .local/bin; transferring it
11
+ # makes Python's safe tar extraction reject the entire workspace archive.
12
+ { source = "/workspace", exclude = [
13
+ "executable",
14
+ ".git",
15
+ ".bashrc",
16
+ ".cache",
17
+ ".cc-switch",
18
+ ".claude",
19
+ ".local",
20
+ ] },
21
+ ]
22
+
23
+ [task]
24
+ name = "programgym/containers--toolbox.0851179"
25
+ description = "Synthetic ProgramGym cleanroom reconstruction task for containers/toolbox"
26
+ authors = [{ name = "Harbor ProgramGym Synthetic Adapter" }]
27
+ keywords = ["programgym", "synthetic", "reverse-engineering", "cleanroom", "go"]
28
+
29
+ [metadata]
30
+ source = "ProgramGym"
31
+ instance_id = "containers__toolbox.0851179"
32
+ repository = "containers/toolbox"
33
+ commit = "08511795cc370c5b75b59ead7834d87ac9ce4579"
34
+ language = "go"
35
+ difficulty = "unknown"
36
+ difficulty_score = 0.0
37
+ test_branches = 5
38
+ test_count = 311
39
+
40
+ [agent]
41
+ timeout_sec = 14400
42
+ user = "agent"
43
+ network_mode = "allowlist"
44
+ allowed_hosts = ["api.anthropic.com", "api.openai.com"]
45
+
46
+ [verifier]
47
+ timeout_sec = 7200
48
+ user = "root"
49
+ environment_mode = "separate"
50
+
51
+ [verifier.env]
52
+ PROGRAMGYM_XDIST_WORKERS = "8"
53
+
54
+ [verifier.environment]
55
+ build_timeout_sec = 1800
56
+ cpus = 8
57
+ memory_mb = 16384
58
+ storage_mb = 30720
59
+ gpus = 0
60
+ workdir = "/workspace"
61
+
62
+ [environment]
63
+ network_mode = "public"
64
+ build_timeout_sec = 1800
65
+ cpus = 8
66
+ memory_mb = 16384
67
+ storage_mb = 30720
68
+ gpus = 0
69
+ workdir = "/workspace"
containers--toolbox.0851179/tests/Dockerfile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
15
+ ENV npm_config_registry="https://registry.npmjs.org/"
16
+ ENV npm_config_strict_ssl=false
17
+ ENV npm_config_cache=/workspace/.cache/npm
18
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
19
+ ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
20
+ ENV PIP_TRUSTED_HOST=""
21
+ ENV HOME=/workspace
22
+ ENV XDG_CACHE_HOME=/workspace/.cache
23
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
24
+ ENV PYTHONUSERBASE=/workspace/.local
25
+ ENV GOROOT=/usr/local/go
26
+ ENV GOPATH=/workspace/.go
27
+ ENV GOCACHE=/workspace/.cache/go-build
28
+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
29
+ ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+ ENV PAGER=cat
31
+ ENV MANPAGER=cat
32
+ ENV LESS=-R
33
+ ENV TQDM_DISABLE=1
34
+ ENV VIRTUAL_ENV=/opt/programgym-venv
35
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
36
+ COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
37
+ RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
38
+ RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
39
+ WORKDIR /workspace
40
+ ADD workspace.tar.gz /workspace/
41
+ COPY executable /workspace/executable
42
+ COPY download.sh /workspace/download.sh
43
+ RUN chmod 755 /workspace/download.sh
44
+ RUN ["bash","-lc","set -euo pipefail; cd /workspace; set -a; source /workspace/download.sh; set +a; python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh\nimport os\nimport re\nimport shlex\nignored = {\"OLDPWD\", \"PWD\", \"SHLVL\", \"_\"}\nvalid_name = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\nfor key in sorted(os.environ):\n if key in ignored or key.startswith(\"BASH_FUNC_\") or not valid_name.fullmatch(key):\n continue\n value = os.environ[key]\n if \"\\n\" in value:\n continue\n print(f\"export {key}={shlex.quote(value)}\")\nPY\n"]
45
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
46
+ RUN chmod 111 /workspace/executable
47
+ WORKDIR /workspace
48
+ # Harbor uses tests/ as the separate verifier build context. Start with the
49
+ # same toolchain as the agent, then remove every cleanroom workspace artifact.
50
+ RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
51
+ && mkdir -p /workspace /tests
52
+
53
+ # Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
54
+ # Installing a newer pytest alone leaves that apt package importable and creates
55
+ # an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
56
+ # Install and constrain the verifier test runner as one coherent pip toolchain.
57
+ RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
58
+ ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
59
+ RUN python3 -m pip install --no-cache-dir --disable-pip-version-check \
60
+ 'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout
61
+
62
+ COPY test.sh /tests/test.sh
63
+ COPY programgym_evaluator.py /tests/programgym_evaluator.py
64
+ COPY programgym_task.json /tests/programgym_task.json
65
+ COPY blobs/ /tests/blobs/
66
+ RUN chmod +x /tests/test.sh
containers--toolbox.0851179/tests/blobs/tests/generated_module_01.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5415ebbb09091df1fd4ef473e82da74742baa776c05a793e2208c2ffb7ed69a4
3
+ size 7367
containers--toolbox.0851179/tests/blobs/tests/generated_module_02.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a2e622a6021d4df34b2b32912fb9707189c85d42285778d278d9c868b3fea84
3
+ size 6926
containers--toolbox.0851179/tests/blobs/tests/generated_module_03.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2df52dd332b776e367e7325fb27baa18d71e46bfc1322def6f78f54c463a6cb
3
+ size 7781
containers--toolbox.0851179/tests/blobs/tests/generated_module_04.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42dc9249b5fa5588f3a975c59c51ef6298e5f65ac7df323d460c8a050ce3641d
3
+ size 6007
containers--toolbox.0851179/tests/blobs/tests/generated_upstream.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c703ebe3fac63c4bcf578eae623264e5b4ba4e624b6caf72746461db4492b93
3
+ size 2575
containers--toolbox.0851179/tests/download.sh ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROGRAMGYM-MANAGED-GO-DOWNLOAD: v1
3
+ # Generated deterministically from repository module metadata; do not edit.
4
+ set -u
5
+ export GOTOOLCHAIN=local
6
+ mkdir -p /workspace/.programgym_build_env/go-prefetch
7
+ cat > /workspace/.programgym_build_env/go-prefetch/go.mod <<'PROGRAMGYM_GO_MOD_EOF'
8
+ module github.com/containers/toolbox
9
+
10
+ go 1.22.0
11
+
12
+ require (
13
+ github.com/HarryMichal/go-version v1.0.1
14
+ github.com/NVIDIA/go-nvlib v0.7.2
15
+ github.com/NVIDIA/go-nvml v0.12.4-1
16
+ github.com/NVIDIA/nvidia-container-toolkit v1.17.8
17
+ github.com/acobaugh/osrelease v0.1.0
18
+ github.com/briandowns/spinner v1.23.2
19
+ github.com/docker/go-units v0.5.0
20
+ github.com/fsnotify/fsnotify v1.8.0
21
+ github.com/go-logfmt/logfmt v0.5.0
22
+ github.com/godbus/dbus/v5 v5.0.6
23
+ github.com/google/renameio/v2 v2.0.0
24
+ github.com/sirupsen/logrus v1.9.3
25
+ github.com/spf13/cobra v1.6.1
26
+ github.com/spf13/viper v1.20.1
27
+ github.com/stretchr/testify v1.10.0
28
+ golang.org/x/sys v0.29.0
29
+ tags.cncf.io/container-device-interface v0.8.1
30
+ tags.cncf.io/container-device-interface/specs-go v0.8.0
31
+ )
32
+
33
+ require (
34
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
35
+ github.com/fatih/color v1.14.1 // indirect
36
+ github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
37
+ github.com/google/uuid v1.6.0 // indirect
38
+ github.com/inconshreveable/mousetrap v1.0.1 // indirect
39
+ github.com/mattn/go-colorable v0.1.13 // indirect
40
+ github.com/mattn/go-isatty v0.0.17 // indirect
41
+ github.com/opencontainers/runtime-spec v1.2.1 // indirect
42
+ github.com/opencontainers/runtime-tools v0.9.1-0.20221107090550-2e043c6bd626 // indirect
43
+ github.com/pelletier/go-toml/v2 v2.2.3 // indirect
44
+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
45
+ github.com/rogpeppe/go-internal v1.12.0 // indirect
46
+ github.com/sagikazarmark/locafero v0.7.0 // indirect
47
+ github.com/sourcegraph/conc v0.3.0 // indirect
48
+ github.com/spf13/afero v1.12.0 // indirect
49
+ github.com/spf13/cast v1.7.1 // indirect
50
+ github.com/spf13/pflag v1.0.6 // indirect
51
+ github.com/subosito/gotenv v1.6.0 // indirect
52
+ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
53
+ go.uber.org/atomic v1.9.0 // indirect
54
+ go.uber.org/multierr v1.9.0 // indirect
55
+ golang.org/x/mod v0.20.0 // indirect
56
+ golang.org/x/term v0.1.0 // indirect
57
+ golang.org/x/text v0.21.0 // indirect
58
+ gopkg.in/yaml.v2 v2.4.0 // indirect
59
+ gopkg.in/yaml.v3 v3.0.1 // indirect
60
+ sigs.k8s.io/yaml v1.3.0 // indirect
61
+ )
62
+ PROGRAMGYM_GO_MOD_EOF
63
+ cat > /workspace/.programgym_build_env/go-prefetch/go.sum <<'PROGRAMGYM_GO_SUM_EOF'
64
+ github.com/HarryMichal/go-version v1.0.1 h1:Vgk1dPyHckkoUu0AED900+yO43+uwDuiNPsdpYe63KE=
65
+ github.com/HarryMichal/go-version v1.0.1/go.mod h1:UNoJ+GvCcmwu0F9Mu1u5y56lP5rWksgkiwLlGx3r+Pk=
66
+ github.com/NVIDIA/go-nvlib v0.7.2 h1:7sy/NVUa4sM9FLKwH6CjBfHSWrJUmv8emVyxLTzjfOA=
67
+ github.com/NVIDIA/go-nvlib v0.7.2/go.mod h1:2Kh2kYSP5IJ8EKf0/SYDzHiQKb9EJkwOf2LQzu6pXzY=
68
+ github.com/NVIDIA/go-nvml v0.12.4-1 h1:WKUvqshhWSNTfm47ETRhv0A0zJyr1ncCuHiXwoTrBEc=
69
+ github.com/NVIDIA/go-nvml v0.12.4-1/go.mod h1:8Llmj+1Rr+9VGGwZuRer5N/aCjxGuR5nPb/9ebBiIEQ=
70
+ github.com/NVIDIA/nvidia-container-toolkit v1.17.8 h1:ndE23TKvQBicsZT88mzZudygn6JNOe6+UsIgqk6gGvw=
71
+ github.com/NVIDIA/nvidia-container-toolkit v1.17.8/go.mod h1:khOgMW80+g8eX/1zPlO4demLShHht9I0YEm8ngcPgwk=
72
+ github.com/acobaugh/osrelease v0.1.0 h1:Yb59HQDGGNhCj4suHaFQQfBps5wyoKLSSX/J/+UifRE=
73
+ github.com/acobaugh/osrelease v0.1.0/go.mod h1:4bFEs0MtgHNHBrmHCt67gNisnabCRAlzdVasCEGHTWY=
74
+ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
75
+ github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
76
+ github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2FW8w=
77
+ github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM=
78
+ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
79
+ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
80
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
81
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
82
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
83
+ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
84
+ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
85
+ github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
86
+ github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
87
+ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
88
+ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
89
+ github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
90
+ github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
91
+ github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
92
+ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
93
+ github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
94
+ github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
95
+ github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
96
+ github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
97
+ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
98
+ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
99
+ github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
100
+ github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
101
+ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
102
+ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
103
+ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
104
+ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
105
+ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
106
+ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
107
+ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
108
+ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
109
+ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
110
+ github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
111
+ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
112
+ github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
113
+ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
114
+ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
115
+ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
116
+ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
117
+ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
118
+ github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
119
+ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
120
+ github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs=
121
+ github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
122
+ github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
123
+ github.com/opencontainers/runtime-spec v1.2.1 h1:S4k4ryNgEpxW1dzyqffOmhI1BHYcjzU8lpJfSlR0xww=
124
+ github.com/opencontainers/runtime-spec v1.2.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
125
+ github.com/opencontainers/runtime-tools v0.9.1-0.20221107090550-2e043c6bd626 h1:DmNGcqH3WDbV5k8OJ+esPWbqUOX5rMLR2PMvziDMJi0=
126
+ github.com/opencontainers/runtime-tools v0.9.1-0.20221107090550-2e043c6bd626/go.mod h1:BRHJJd0E+cx42OybVYSgUvZmU0B8P9gZuRXlZUP7TKI=
127
+ github.com/opencontainers/selinux v1.9.1 h1:b4VPEF3O5JLZgdTDBmGepaaIbAo0GqoF6EBRq5f/g3Y=
128
+ github.com/opencontainers/selinux v1.9.1/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
129
+ github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
130
+ github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
131
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
132
+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
133
+ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
134
+ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
135
+ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
136
+ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
137
+ github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
138
+ github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
139
+ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
140
+ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
141
+ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
142
+ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
143
+ github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
144
+ github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
145
+ github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
146
+ github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
147
+ github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
148
+ github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
149
+ github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
150
+ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
151
+ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
152
+ github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
153
+ github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
154
+ github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
155
+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
156
+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
157
+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
158
+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
159
+ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
160
+ github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
161
+ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
162
+ github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
163
+ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI=
164
+ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
165
+ github.com/urfave/cli v1.19.1/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
166
+ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
167
+ github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
168
+ github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
169
+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
170
+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
171
+ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
172
+ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
173
+ go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
174
+ go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
175
+ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
176
+ go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
177
+ golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
178
+ golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
179
+ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
180
+ golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
181
+ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
182
+ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
183
+ golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
184
+ golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
185
+ golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=
186
+ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
187
+ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
188
+ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
189
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
190
+ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
191
+ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
192
+ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
193
+ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
194
+ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
195
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
196
+ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
197
+ sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
198
+ sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
199
+ tags.cncf.io/container-device-interface v0.8.1 h1:c0jN4Mt6781jD67NdPajmZlD1qrqQyov/Xfoab37lj0=
200
+ tags.cncf.io/container-device-interface v0.8.1/go.mod h1:Apb7N4VdILW0EVdEMRYXIDVRZfNJZ+kmEUss2kRRQ6Y=
201
+ tags.cncf.io/container-device-interface/specs-go v0.8.0 h1:QYGFzGxvYK/ZLMrjhvY0RjpUavIn4KcmRmVP/JjdBTA=
202
+ tags.cncf.io/container-device-interface/specs-go v0.8.0/go.mod h1:BhJIkjjPh4qpys+qm4DAYtUyryaTDg9zris+AczXyws=
203
+ PROGRAMGYM_GO_SUM_EOF
204
+ if ! (cd /workspace/.programgym_build_env/go-prefetch && go mod download -modfile=/workspace/.programgym_build_env/go-prefetch/go.mod all); then
205
+ printf '%s\n' 'download.sh: Go dependency prefetch failed' >&2
206
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
207
+ return 1
208
+ else
209
+ exit 1
210
+ fi
211
+ fi
containers--toolbox.0851179/tests/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9e1951ce6e24154cfafad1a3cb6647e187a62d92137277ebd91c4e0e91a029b
3
+ size 15967224
containers--toolbox.0851179/tests/programgym-go.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39042a078ea9ceebe3ecda4a7188f0f5b96e14a071d27923ba7f40b456e85ae3
3
+ size 59908810
containers--toolbox.0851179/tests/programgym_evaluator.py ADDED
@@ -0,0 +1,1201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """In-place ProgramGym evaluator.
3
+
4
+ Mirrors ProgramGym's ``Evaluator`` pipeline as closely as a single-container,
5
+ no-Docker-in-Docker host allows. Run from ``tests/test.sh`` inside the agent's
6
+ cleanroom container after Harbor flips the verifier-phase network policy.
7
+
8
+ Differences from ``programgym.eval.eval.Evaluator`` that are structural to
9
+ running in one container:
10
+
11
+ * No fresh container per branch. ``snapshot_workspace`` / ``restore_workspace``
12
+ copy a post-compile workspace snapshot to a temp directory and restore it
13
+ before each branch; ``cleanup_lingering_processes`` kills leftover branch
14
+ processes between attempts to approximate the fresh-container boundary.
15
+ * No ``docker commit``. The post-compile workspace snapshot serves the same
16
+ role as the committed image upstream.
17
+ * Hidden test blobs are fetched on demand from HuggingFace via
18
+ ``huggingface_hub.snapshot_download`` (matching ``programgym.utils.blob_store``)
19
+ rather than being pre-staged into ``/tests/blobs/``. Override with
20
+ ``PROGRAMGYM_BLOB_DIR`` for offline reruns.
21
+
22
+ Everything else (eval_clean_hashes scrub, deterministic synthetic git seed,
23
+ ``compile.sh`` then stash + hash the executable, best-effort
24
+ ``pytest-rerunfailures``, per-branch test-tar overlay, executable hash
25
+ ``--max-worker-restart=4``, xdist worker-crash retry with serial fallback,
26
+ best-of-N attempt selection, active vs ignored test bookkeeping, scoring) is
27
+ preserved.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import hashlib
33
+ import json
34
+ import os
35
+ import re
36
+ import shlex
37
+ import shutil
38
+ import signal
39
+ import subprocess
40
+ import tempfile
41
+ import time
42
+ import traceback
43
+ import xml.etree.ElementTree as ET
44
+ from pathlib import Path
45
+ from typing import Any
46
+
47
+ WORKSPACE = Path(os.environ.get("PROGRAMGYM_WORKSPACE", "/workspace"))
48
+ STASHED_EXECUTABLE = Path("/opt/programgym-stashed-executable-do-not-modify")
49
+ METADATA_PATH = Path(
50
+ os.environ.get("PROGRAMGYM_METADATA", "/tests/programgym_task.json")
51
+ )
52
+ LOG_DIR = Path(os.environ.get("PROGRAMGYM_LOG_DIR", "/logs/verifier"))
53
+ WORKER_CRASH_PHRASE = "worker '"
54
+ XDIST_COLLAPSE_MARKERS = (
55
+ "maximum crashed workers reached",
56
+ "xdist: maximum crashed",
57
+ )
58
+
59
+ DEFAULT_HF_REPO_ID = "programgym/ProgramGym-Tests"
60
+ DEFAULT_HF_REVISION = "main"
61
+
62
+ # Oracle agent handoff files (see solution/solve.sh). Must not appear in the
63
+ # post-compile workspace snapshot or they pollute tree-scanning tests (dutree).
64
+ _ORACLE_HANDOFF_NAMES = (".programgym_oracle_reference",)
65
+
66
+ _TOOLCHAIN_BIN_DIR_CANDIDATES = (
67
+ "/usr/local/go/bin",
68
+ "/go/bin",
69
+ "/usr/local/cargo/bin",
70
+ "/root/.cargo/bin",
71
+ "/root/.ghcup/bin",
72
+ )
73
+
74
+
75
+ def toolchain_bin_dirs() -> list[str]:
76
+ """Return toolchain bin directories that exist on this image."""
77
+ candidates = list(_TOOLCHAIN_BIN_DIR_CANDIDATES)
78
+ candidates.extend(
79
+ str(path)
80
+ for path in sorted(Path("/usr/lib").glob("go-*/bin"))
81
+ if _is_accessible_dir(path)
82
+ )
83
+ seen: set[str] = set()
84
+ present: list[str] = []
85
+ for path in candidates:
86
+ if path in seen:
87
+ continue
88
+ seen.add(path)
89
+ if _is_accessible_dir(path):
90
+ present.append(path)
91
+ return present
92
+
93
+
94
+ def _is_accessible_dir(path: str | Path) -> bool:
95
+ """Return whether path is a directory without failing on protected homes."""
96
+ try:
97
+ return Path(path).is_dir()
98
+ except OSError:
99
+ return False
100
+
101
+
102
+ def bootstrap_toolchain_path() -> str:
103
+ """Prepend discovered toolchain dirs to PATH (idempotent)."""
104
+ prepend = toolchain_bin_dirs()
105
+ current_parts = [part for part in os.environ.get("PATH", "").split(":") if part]
106
+ merged: list[str] = []
107
+ for path in prepend + current_parts:
108
+ if path not in merged:
109
+ merged.append(path)
110
+ new_path = ":".join(merged)
111
+ os.environ["PATH"] = new_path
112
+ return new_path
113
+
114
+
115
+ def _bash_login_command(command: str) -> str:
116
+ """Run ``command`` under bash -lc with an explicit PATH export."""
117
+ path = bootstrap_toolchain_path()
118
+ return f"export PATH={shlex.quote(path)}; {command}"
119
+
120
+
121
+ def sha256(path: Path) -> str:
122
+ h = hashlib.sha256()
123
+ with path.open("rb") as f:
124
+ for chunk in iter(lambda: f.read(1024 * 1024), b""):
125
+ h.update(chunk)
126
+ return h.hexdigest()
127
+
128
+
129
+ def write_json(path: Path, data: dict[str, Any]) -> None:
130
+ tmp = path.with_suffix(path.suffix + ".tmp")
131
+ tmp.write_text(json.dumps(data, indent=2, sort_keys=True))
132
+ tmp.replace(path)
133
+
134
+
135
+ def _read_log_tail(path: Path | None, max_bytes: int = 65536) -> str:
136
+ if path is None or not path.exists():
137
+ return ""
138
+ data = path.read_bytes()
139
+ if len(data) <= max_bytes:
140
+ return data.decode(errors="replace")
141
+ return data[-max_bytes:].decode(errors="replace")
142
+
143
+
144
+ def _close_pipes(proc: subprocess.Popen[Any]) -> None:
145
+ for stream in (proc.stdout, proc.stderr):
146
+ if stream is not None:
147
+ try:
148
+ stream.close()
149
+ except OSError:
150
+ pass
151
+
152
+
153
+ def _terminate_process_tree(proc: subprocess.Popen[Any]) -> None:
154
+ try:
155
+ os.killpg(proc.pid, signal.SIGKILL)
156
+ except ProcessLookupError:
157
+ pass
158
+ try:
159
+ proc.kill()
160
+ except ProcessLookupError:
161
+ pass
162
+
163
+
164
+ _PKILL_PATTERNS = (
165
+ f"{WORKSPACE}/eval/",
166
+ f"{WORKSPACE}/tests/",
167
+ "tail -f",
168
+ "development.log",
169
+ " less ",
170
+ " less$",
171
+ "/less ",
172
+ )
173
+
174
+
175
+ def _pkill_aggressive() -> str:
176
+ """Best-effort kill of branch pytest/subprocess trees (Modal gVisor fallback)."""
177
+ notes: list[str] = []
178
+ workspace = str(WORKSPACE)
179
+ patterns = list(_PKILL_PATTERNS) + [
180
+ f"pytest.*{workspace}",
181
+ f"xdist.*{workspace}",
182
+ ]
183
+ for pattern in patterns:
184
+ result = subprocess.run(
185
+ ["pkill", "-9", "-f", pattern],
186
+ capture_output=True,
187
+ text=True,
188
+ )
189
+ notes.append(f"pkill -9 -f {pattern!r}: rc={result.returncode}")
190
+ return "\n".join(notes)
191
+
192
+
193
+ def run_step(
194
+ command: str,
195
+ cwd: Path,
196
+ *,
197
+ timeout: int,
198
+ env: dict[str, str] | None = None,
199
+ step: str,
200
+ accept_failure: bool = False,
201
+ log_output: bool | None = None,
202
+ max_output_bytes: int = 65536,
203
+ ) -> dict[str, Any]:
204
+ if log_output is None:
205
+ log_output = step == "run_tests" or timeout >= 60
206
+
207
+ started = time.monotonic()
208
+ stdout_path: Path | None = None
209
+ stderr_path: Path | None = None
210
+ stdout_f = None
211
+ stderr_f = None
212
+
213
+ if log_output:
214
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
215
+ log_id = f"{step}-{int(started * 1000)}"
216
+ stdout_path = LOG_DIR / f"run-step-{log_id}.stdout.log"
217
+ stderr_path = LOG_DIR / f"run-step-{log_id}.stderr.log"
218
+ stdout_f = stdout_path.open("w", encoding="utf-8")
219
+ stderr_f = stderr_path.open("w", encoding="utf-8")
220
+ popen_stdout: Any = stdout_f
221
+ popen_stderr: Any = stderr_f
222
+ else:
223
+ popen_stdout = subprocess.PIPE
224
+ popen_stderr = subprocess.PIPE
225
+
226
+ proc = subprocess.Popen(
227
+ ["bash", "-lc", _bash_login_command(command)],
228
+ cwd=cwd,
229
+ env={**os.environ, **(env or {})},
230
+ stdout=popen_stdout,
231
+ stderr=popen_stderr,
232
+ start_new_session=True,
233
+ text=True,
234
+ )
235
+ timed_out = False
236
+ stdout = ""
237
+ stderr = ""
238
+ try:
239
+ if log_output:
240
+ proc.wait(timeout=timeout)
241
+ else:
242
+ stdout, stderr = proc.communicate(timeout=timeout)
243
+ except subprocess.TimeoutExpired:
244
+ timed_out = True
245
+ _terminate_process_tree(proc)
246
+ cleanup_lingering_processes(aggressive=True)
247
+ try:
248
+ proc.wait(timeout=5)
249
+ except subprocess.TimeoutExpired:
250
+ proc.kill()
251
+ if not log_output:
252
+ _close_pipes(proc)
253
+ finally:
254
+ if stdout_f is not None:
255
+ stdout_f.close()
256
+ if stderr_f is not None:
257
+ stderr_f.close()
258
+
259
+ if timed_out:
260
+ if log_output:
261
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
262
+ stderr_path, max_output_bytes
263
+ )
264
+ else:
265
+ output = ""
266
+ entry = {
267
+ "step": step,
268
+ "command": command,
269
+ "wall_time": time.monotonic() - started,
270
+ "output": output,
271
+ "returncode": 124,
272
+ "exception_info": f"timed out after {timeout}s",
273
+ }
274
+ else:
275
+ if log_output:
276
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
277
+ stderr_path, max_output_bytes
278
+ )
279
+ else:
280
+ output = stdout + stderr
281
+ entry = {
282
+ "step": step,
283
+ "command": command,
284
+ "wall_time": time.monotonic() - started,
285
+ "output": output,
286
+ "returncode": proc.returncode,
287
+ "exception_info": "",
288
+ }
289
+ if entry["returncode"] and not accept_failure:
290
+ raise RuntimeError(
291
+ f"{step} failed: {entry['exception_info'] or entry['output']}"
292
+ )
293
+ return entry
294
+
295
+
296
+ def cleanup_lingering_processes(*, aggressive: bool = False) -> dict[str, Any]:
297
+ started = time.monotonic()
298
+ patterns = [
299
+ str(WORKSPACE / "executable"),
300
+ f"{WORKSPACE}/eval/",
301
+ f"{WORKSPACE}/tests/",
302
+ # lazygit --logs/-l tests spawn `tail -f` outside /workspace/.
303
+ "tail -f",
304
+ "development.log",
305
+ ]
306
+ killed: list[int] = []
307
+ proc_root = Path("/proc")
308
+ proc_available = proc_root.exists()
309
+ if proc_available:
310
+ for proc_dir in proc_root.iterdir():
311
+ if not proc_dir.name.isdigit():
312
+ continue
313
+ pid = int(proc_dir.name)
314
+ if pid in {os.getpid(), os.getppid()}:
315
+ continue
316
+ try:
317
+ raw = (proc_dir / "cmdline").read_bytes()
318
+ except (FileNotFoundError, PermissionError, ProcessLookupError):
319
+ continue
320
+ cmdline = raw.replace(b"\0", b" ").decode(errors="replace")
321
+ if not any(pattern in cmdline for pattern in patterns):
322
+ continue
323
+ try:
324
+ os.kill(pid, signal.SIGKILL)
325
+ except (PermissionError, ProcessLookupError):
326
+ continue
327
+ killed.append(pid)
328
+ pkill_output = ""
329
+ if aggressive or not proc_available:
330
+ pkill_output = _pkill_aggressive()
331
+ output_parts = []
332
+ if killed:
333
+ output_parts.append("\n".join(str(pid) for pid in killed))
334
+ if pkill_output:
335
+ output_parts.append(pkill_output)
336
+ return {
337
+ "step": "cleanup_lingering_processes",
338
+ "command": "kill leftover branch processes referencing the workspace",
339
+ "wall_time": time.monotonic() - started,
340
+ "output": "\n".join(output_parts),
341
+ "returncode": 0,
342
+ "exception_info": "",
343
+ }
344
+
345
+
346
+ def extract_trusted_blob(tar_path: Path, dest: Path) -> None:
347
+ import tarfile
348
+
349
+ with tarfile.open(tar_path, "r:gz") as tf:
350
+ try:
351
+ tf.extractall(dest, filter="fully_trusted")
352
+ except TypeError:
353
+ tf.extractall(dest)
354
+
355
+
356
+ def find_results_xml() -> Path | None:
357
+ """Return the junit xml path if pytest wrote one."""
358
+ for candidate in (WORKSPACE / "eval" / "results.xml", WORKSPACE / "results.xml"):
359
+ if candidate.exists():
360
+ return candidate
361
+ return None
362
+
363
+
364
+ def remove_oracle_handoff_artifacts() -> list[str]:
365
+ """Drop oracle-agent handoff files from /workspace before snapshot/restore."""
366
+ removed: list[str] = []
367
+ for name in _ORACLE_HANDOFF_NAMES:
368
+ path = WORKSPACE / name
369
+ if path.exists():
370
+ if path.is_dir():
371
+ shutil.rmtree(path)
372
+ else:
373
+ path.unlink()
374
+ removed.append(name)
375
+ return removed
376
+
377
+
378
+ def _remove_tree(path: Path) -> None:
379
+ """Remove a file or directory tree, with a shell fallback for overlay races."""
380
+ if path.is_symlink() or path.is_file():
381
+ path.unlink(missing_ok=True)
382
+ return
383
+ if not path.is_dir():
384
+ path.unlink(missing_ok=True)
385
+ return
386
+ for attempt in range(3):
387
+ try:
388
+ shutil.rmtree(path)
389
+ if not path.exists():
390
+ return
391
+ except OSError:
392
+ if attempt == 2:
393
+ run_step(
394
+ f"rm -rf {shlex.quote(str(path))}",
395
+ path.parent,
396
+ timeout=120,
397
+ step="clear_workspace_fallback",
398
+ accept_failure=True,
399
+ )
400
+ if not path.exists():
401
+ return
402
+ raise
403
+
404
+
405
+ def ensure_workspace_dir() -> None:
406
+ """Guarantee WORKSPACE exists as a writable directory (not a symlink/file)."""
407
+ if WORKSPACE.exists() and not WORKSPACE.is_dir():
408
+ if WORKSPACE.is_symlink() or WORKSPACE.is_file():
409
+ WORKSPACE.unlink()
410
+ else:
411
+ shutil.rmtree(WORKSPACE)
412
+ WORKSPACE.mkdir(parents=True, exist_ok=True)
413
+
414
+
415
+ def clear_workspace() -> None:
416
+ ensure_workspace_dir()
417
+ for path in list(WORKSPACE.iterdir()):
418
+ _remove_tree(path)
419
+
420
+
421
+ def restore_reference_executable() -> None:
422
+ """Write the stashed reference binary into /workspace after a branch overlay.
423
+
424
+ Branch blobs may ship ``executable`` as a dangling symlink into
425
+ ``target/release/...``; ``shutil.copy2`` would follow it and raise
426
+ ``FileNotFoundError``. Drop whatever the blob left and copy the stashed
427
+ reference as a regular file.
428
+ """
429
+ ensure_workspace_dir()
430
+ if not STASHED_EXECUTABLE.is_file():
431
+ raise FileNotFoundError(
432
+ f"missing stashed reference executable at {STASHED_EXECUTABLE}"
433
+ )
434
+ dest = WORKSPACE / "executable"
435
+ if dest.exists() or dest.is_symlink():
436
+ if dest.is_dir():
437
+ shutil.rmtree(dest)
438
+ else:
439
+ dest.unlink(missing_ok=True)
440
+ shutil.copy2(STASHED_EXECUTABLE, dest)
441
+ dest.chmod(0o755)
442
+
443
+
444
+ def snapshot_workspace(dest: Path) -> None:
445
+ if dest.exists():
446
+ shutil.rmtree(dest)
447
+ shutil.copytree(WORKSPACE, dest, symlinks=True)
448
+
449
+
450
+ def restore_workspace(source: Path) -> None:
451
+ clear_workspace()
452
+ shutil.copytree(source, WORKSPACE, dirs_exist_ok=True, symlinks=True)
453
+ ensure_workspace_dir()
454
+
455
+
456
+ def remove_hashed_files(root: Path, hashes: set[str]) -> list[str]:
457
+ removed: list[str] = []
458
+ for path in root.rglob("*"):
459
+ if path.is_file() and not path.is_symlink():
460
+ try:
461
+ if sha256(path) in hashes:
462
+ path.unlink()
463
+ removed.append(str(path.relative_to(root)))
464
+ except OSError:
465
+ continue
466
+ return removed
467
+
468
+
469
+ def branch_tests(branch_info: dict[str, Any]) -> list[str]:
470
+ ignored = {
471
+ item["name"] for item in branch_info.get("ignored_tests", []) if "name" in item
472
+ }
473
+ return [name for name in branch_info.get("tests", []) if name not in ignored]
474
+
475
+
476
+ def ignored_tests(metadata: dict[str, Any]) -> set[str]:
477
+ result: set[str] = set()
478
+ for branch, info in metadata.get("branches", {}).items():
479
+ result.update(
480
+ f"{branch}/{item['name']}"
481
+ for item in info.get("ignored_tests", [])
482
+ if "name" in item
483
+ )
484
+ return result
485
+
486
+
487
+ def active_tests(metadata: dict[str, Any]) -> set[str]:
488
+ active: set[str] = set()
489
+ for branch, info in metadata.get("branches", {}).items():
490
+ if info.get("ignored"):
491
+ continue
492
+ ignored = {
493
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
494
+ }
495
+ active.update(
496
+ f"{branch}/{name}" for name in info.get("tests", []) if name not in ignored
497
+ )
498
+ return active
499
+
500
+
501
+ def inject_not_run(
502
+ result: dict[str, Any], branch: str, tests: list[str], error_code: str
503
+ ) -> None:
504
+ result["test_results"].extend(
505
+ {
506
+ "name": name,
507
+ "branch": branch,
508
+ "status": "not_run",
509
+ "extra": {"error_code": error_code},
510
+ }
511
+ for name in tests
512
+ )
513
+
514
+
515
+ def testcase_name(case: ET.Element) -> str:
516
+ classname = case.attrib.get("classname", "")
517
+ name = case.attrib.get("name", "")
518
+ return f"{classname}.{name}" if classname else name
519
+
520
+
521
+ # Only these tags under <testcase> represent a result. <system-out> /
522
+ # <system-err> are stdout/stderr captures and must not be treated as results
523
+ # (a leading <system-out> followed by <failure> would otherwise be classified
524
+ # as a stdout-only "passed").
525
+ JUNIT_RESULT_TAGS = {"skipped", "failure", "error"}
526
+
527
+
528
+ def parse_junit(
529
+ raw_xml: str, branch: str, expected: list[str], ignored: set[str]
530
+ ) -> tuple[list[dict[str, Any]], list[str]]:
531
+ root = ET.fromstring(raw_xml)
532
+ got: set[str] = set()
533
+ results: list[dict[str, Any]] = []
534
+ for case in root.iter("testcase"):
535
+ name = testcase_name(case)
536
+ got.add(name)
537
+ extra: dict[str, Any] = {}
538
+ if "time" in case.attrib:
539
+ try:
540
+ extra["time"] = float(case.attrib["time"])
541
+ except ValueError:
542
+ extra["time"] = case.attrib["time"]
543
+ result_children = [c for c in case if c.tag in JUNIT_RESULT_TAGS]
544
+ # Collapse duplicate same-tag result children. Pytest's
545
+ # "pytest.internal" pseudo-test sometimes emits two identical <error>
546
+ # entries; treating that as a system_error would over-flag a real
547
+ # single failure. Mirrors upstream eval.py:816-820.
548
+ if len(result_children) > 1 and len({c.tag for c in result_children}) == 1:
549
+ result_children = [result_children[0]]
550
+ if not result_children:
551
+ status = "passed"
552
+ elif len(result_children) != 1:
553
+ status = "system_error"
554
+ extra["error_details"] = (
555
+ f"Expected 1 result for {name}, got {len(result_children)}: "
556
+ f"{[c.tag for c in result_children]}"
557
+ )
558
+ else:
559
+ first = result_children[0]
560
+ status = first.tag # "skipped" | "failure" | "error"
561
+ extra["message"] = first.attrib.get("message") or ""
562
+ if first.text:
563
+ extra["text"] = first.text
564
+ results.append(
565
+ {"name": name, "branch": branch, "status": status, "extra": extra}
566
+ )
567
+
568
+ active_expected = [name for name in expected if name not in ignored]
569
+ missing = [name for name in active_expected if name not in got]
570
+ results.extend(
571
+ {
572
+ "name": name,
573
+ "branch": branch,
574
+ "status": "not_run",
575
+ "extra": {"error_code": "missing_from_junit_xml"},
576
+ }
577
+ for name in missing
578
+ )
579
+ unexpected = got - set(expected) - ignored
580
+ warnings = (
581
+ [f"Branch {branch}: {len(unexpected)} test(s) in JUnit XML not in tests.json"]
582
+ if unexpected
583
+ else []
584
+ )
585
+ return results, warnings
586
+
587
+
588
+ def count_worker_crashes(raw_xml: str) -> int:
589
+ if WORKER_CRASH_PHRASE not in raw_xml:
590
+ return 0
591
+ try:
592
+ root = ET.fromstring(raw_xml)
593
+ except ET.ParseError:
594
+ return 0
595
+ crashes = 0
596
+ for case in root.iter("testcase"):
597
+ for child in case:
598
+ text = (child.get("message") or "") + " " + (child.text or "")
599
+ if (
600
+ child.tag in {"error", "failure"}
601
+ and WORKER_CRASH_PHRASE in text
602
+ and "crashed" in text
603
+ ):
604
+ crashes += 1
605
+ break
606
+ return crashes
607
+
608
+
609
+ def run_output_indicates_xdist_collapse(output: str) -> bool:
610
+ lower = output.lower()
611
+ return any(marker in lower for marker in XDIST_COLLAPSE_MARKERS)
612
+
613
+
614
+ def count_junit_failures(raw_xml: str) -> int:
615
+ try:
616
+ root = ET.fromstring(raw_xml)
617
+ except ET.ParseError:
618
+ return 0
619
+ failures = 0
620
+ for case in root.iter("testcase"):
621
+ for child in case:
622
+ if child.tag in {"failure", "error"}:
623
+ failures += 1
624
+ break
625
+ return failures
626
+
627
+
628
+ def count_junit_passed(raw_xml: str) -> int:
629
+ try:
630
+ root = ET.fromstring(raw_xml)
631
+ except ET.ParseError:
632
+ return 0
633
+ passed = 0
634
+ for case in root.iter("testcase"):
635
+ if not any(child.tag in JUNIT_RESULT_TAGS for child in case):
636
+ passed += 1
637
+ return passed
638
+
639
+
640
+ def branch_attempt_metrics(
641
+ raw_xml: str, *, run_output: str, expected_tests: int
642
+ ) -> tuple[int, int, int, int]:
643
+ """Return (crashes, n_testcases, failures, missing_from_xml)."""
644
+ crashes = count_worker_crashes(raw_xml)
645
+ if run_output_indicates_xdist_collapse(run_output):
646
+ crashes = max(crashes, 1)
647
+ n_tests = count_testcases(raw_xml)
648
+ failures = count_junit_failures(raw_xml)
649
+ missing = max(0, expected_tests - n_tests)
650
+ return crashes, n_tests, failures, missing
651
+
652
+
653
+ def needs_serial_retry(
654
+ *,
655
+ serial: bool,
656
+ crashes: int,
657
+ missing: int,
658
+ failures: int,
659
+ n_tests: int,
660
+ expected_tests: int,
661
+ run_output: str,
662
+ ) -> bool:
663
+ if serial:
664
+ return False
665
+ high_failure_rate = (
666
+ expected_tests > 0 and n_tests >= expected_tests and failures / n_tests >= 0.8
667
+ )
668
+ return (
669
+ crashes > 0
670
+ or missing > 0
671
+ or high_failure_rate
672
+ or run_output_indicates_xdist_collapse(run_output)
673
+ )
674
+
675
+
676
+ def count_testcases(raw_xml: str) -> int:
677
+ try:
678
+ return sum(1 for _ in ET.fromstring(raw_xml).iter("testcase"))
679
+ except ET.ParseError:
680
+ return 0
681
+
682
+
683
+ def scored_results(
684
+ result: dict[str, Any], metadata: dict[str, Any]
685
+ ) -> list[dict[str, Any]]:
686
+ active = active_tests(metadata)
687
+ by_key = {
688
+ f"{test['branch']}/{test['name']}": test
689
+ for test in result["test_results"]
690
+ if f"{test['branch']}/{test['name']}" in active
691
+ }
692
+ return [
693
+ by_key.get(
694
+ key,
695
+ {
696
+ "branch": key.split("/", 1)[0],
697
+ "name": key.split("/", 1)[1],
698
+ "status": "not_run",
699
+ "extra": {"error_code": "missing_from_results"},
700
+ },
701
+ )
702
+ for key in sorted(active)
703
+ ]
704
+
705
+
706
+ def summarize(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
707
+ scored = scored_results(result, metadata)
708
+ n_passed = sum(t["status"] == "passed" for t in scored)
709
+ n_tests = len(scored)
710
+ pass_rate = n_passed / n_tests if n_tests else 0.0
711
+ # Multi-key reward: Harbor's default Mean aggregates each key independently
712
+ # (see harbor.metrics.base.aggregate_reward_dicts), so mean("resolved") is
713
+ # the proportion of tasks scoring a perfect pass-rate and mean of
714
+ # "almost_resolved" is the proportion scoring >= 0.95. "reward" stays the
715
+ # per-task pass-rate whose mean is the overall mean reward.
716
+ return {
717
+ "reward": pass_rate,
718
+ "resolved": 1.0 if pass_rate >= 1.0 else 0.0,
719
+ "almost_resolved": 1.0 if pass_rate >= 0.95 else 0.0,
720
+ }
721
+
722
+
723
+ def diagnostics(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
724
+ scored = scored_results(result, metadata)
725
+ n_passed = sum(t["status"] == "passed" for t in scored)
726
+ n_tests = len(scored)
727
+ pass_rate = n_passed / n_tests if n_tests else 0.0
728
+ return {
729
+ "pass_rate": pass_rate,
730
+ "resolved": int(
731
+ bool(
732
+ n_tests
733
+ and n_passed == n_tests
734
+ and not result["test_branch_errors"]
735
+ and not result["error_code"]
736
+ )
737
+ ),
738
+ "n_passed": n_passed,
739
+ "n_tests": n_tests,
740
+ "n_branch_errors": len(result["test_branch_errors"]),
741
+ "infra_error": int(bool(result["error_code"] or result["test_branch_errors"])),
742
+ "executable_hash_present": int(bool(result.get("executable_hash"))),
743
+ }
744
+
745
+
746
+ def use_script_pty() -> bool:
747
+ return os.environ.get("PROGRAMGYM_SCRIPT_PTY", "").strip() == "1"
748
+
749
+
750
+ def script_pty_available() -> bool:
751
+ return shutil.which("script") is not None
752
+
753
+
754
+ def branch_env(
755
+ *,
756
+ serial: bool,
757
+ has_rerunfailures: bool,
758
+ extras: dict[str, str] | None = None,
759
+ ) -> dict[str, str]:
760
+ addopts = ["--max-worker-restart=4"]
761
+ # A serial fallback is already a complete second execution. Re-running each
762
+ # failing test two more times makes large, failure-heavy suites prohibitively
763
+ # slow and adds little signal.
764
+ if has_rerunfailures and not serial:
765
+ addopts.extend(["--reruns=2", "--reruns-delay=1"])
766
+ env = {
767
+ "PYTEST_ADDOPTS": " ".join(addopts),
768
+ # Match upstream non-TTY regression environments (dirble log format, etc.).
769
+ "NO_COLOR": "1",
770
+ "TERM": "dumb",
771
+ "CLICOLOR": "0",
772
+ "CLICOLOR_FORCE": "0",
773
+ "COLORTERM": "",
774
+ }
775
+ if extras:
776
+ env.update(extras)
777
+ xdist_workers = os.environ.get("PROGRAMGYM_XDIST_WORKERS")
778
+ if serial:
779
+ xdist_workers = "1"
780
+ if xdist_workers:
781
+ env["PYTEST_XDIST_AUTO_NUM_WORKERS"] = xdist_workers
782
+ return env
783
+
784
+
785
+ _SERIAL_RUN_SH = ".programgym_run_serial.sh"
786
+ # ``eval/run.sh`` usually passes ``-n auto`` on the command line, which overrides
787
+ # ``PYTEST_ADDOPTS``. Rewrite to ``-n 0`` in a verifier-local copy for retries.
788
+ _RUN_SH_XDIST_RE = re.compile(r"-n\s*(?:auto|\d+)")
789
+
790
+
791
+ def prepare_serial_run_sh(run_sh: Path) -> Path:
792
+ """Write a serial-only copy of ``eval/run.sh`` with xdist disabled."""
793
+ serial_sh = run_sh.with_name(_SERIAL_RUN_SH)
794
+ patched = _RUN_SH_XDIST_RE.sub("-n 0", run_sh.read_text())
795
+ serial_sh.write_text(patched)
796
+ serial_sh.chmod(0o755)
797
+ return serial_sh
798
+
799
+
800
+ def run_tests_command(*, serial: bool) -> str:
801
+ if serial:
802
+ inner = f"chmod +x ./eval/{_SERIAL_RUN_SH} && ./eval/{_SERIAL_RUN_SH}"
803
+ else:
804
+ inner = "chmod +x ./eval/run.sh && ./eval/run.sh"
805
+ if use_script_pty() and script_pty_available():
806
+ return f"script -q -c {shlex.quote(inner)} /dev/null"
807
+ return inner
808
+
809
+
810
+ BAKED_BLOB_DIR = Path(os.environ.get("PROGRAMGYM_BAKED_BLOB_DIR", "/tests/blobs"))
811
+
812
+
813
+ def resolve_blob_dir(instance_id: str, metadata: dict[str, Any]) -> Path:
814
+ """Locate the per-instance blob directory.
815
+
816
+ Resolution order:
817
+
818
+ 1. ``/tests/blobs/`` if pre-fetched into the task at generation time
819
+ (``programgym-adapter --download-blobs``). Verifier-only mount, so
820
+ agent never sees these.
821
+ 2. ``PROGRAMGYM_BLOB_DIR`` env override pointing at an HF-cache-shaped
822
+ tree on disk (``<dir>/<instance_id>/tests/<branch>.tar.gz``). Useful
823
+ for offline reruns sharing a cache across many tasks.
824
+ 3. ``huggingface_hub.snapshot_download`` from
825
+ ``programgym/ProgramGym-Tests`` (default repo, ``main`` revision).
826
+
827
+ The returned directory contains ``tests/<branch>.tar.gz`` per active
828
+ branch — same shape as ``programgym/ProgramGym-Tests/<instance_id>/``
829
+ on HF.
830
+ """
831
+ if BAKED_BLOB_DIR.exists() and (BAKED_BLOB_DIR / "tests").exists():
832
+ return BAKED_BLOB_DIR
833
+
834
+ local = os.environ.get("PROGRAMGYM_BLOB_DIR", "").strip()
835
+ if local:
836
+ candidate = Path(local) / instance_id
837
+ if candidate.exists():
838
+ return candidate
839
+ raise FileNotFoundError(
840
+ f"PROGRAMGYM_BLOB_DIR set but {candidate} does not exist"
841
+ )
842
+
843
+ repo_id = os.environ.get("PROGRAMGYM_HF_REPO") or metadata.get(
844
+ "hf_repo_id", DEFAULT_HF_REPO_ID
845
+ )
846
+ revision = os.environ.get("PROGRAMGYM_HF_REVISION") or metadata.get(
847
+ "hf_revision", DEFAULT_HF_REVISION
848
+ )
849
+
850
+ from huggingface_hub import snapshot_download
851
+
852
+ cache_root = Path(
853
+ snapshot_download(
854
+ repo_id,
855
+ repo_type="dataset",
856
+ revision=revision,
857
+ allow_patterns=f"{instance_id}/**",
858
+ )
859
+ )
860
+ blob_dir = cache_root / instance_id
861
+ if not blob_dir.exists():
862
+ raise FileNotFoundError(
863
+ f"HF blob directory missing for {instance_id} at {blob_dir}"
864
+ )
865
+ return blob_dir
866
+
867
+
868
+ def evaluate(metadata: dict[str, Any]) -> dict[str, Any]:
869
+ bootstrap_toolchain_path()
870
+ branches = metadata.get("branches", {})
871
+ active_branch_items = [
872
+ (name, info) for name, info in branches.items() if not info.get("ignored")
873
+ ]
874
+ result: dict[str, Any] = {
875
+ "test_results": [],
876
+ "error_code": None,
877
+ "error_details": None,
878
+ "log": [],
879
+ "solution_branch": "submission",
880
+ "test_branches": [name for name, _ in active_branch_items],
881
+ "test_branch_errors": {},
882
+ "executable_hash": None,
883
+ "warnings": [],
884
+ }
885
+
886
+ instance_id = metadata["instance_id"]
887
+
888
+ compile_timeout = int(os.environ.get("PROGRAMGYM_COMPILE_TIMEOUT", "900"))
889
+ branch_timeout = int(os.environ.get("PROGRAMGYM_BRANCH_TIMEOUT", "3600"))
890
+
891
+ def fail_all(error_code: str, details: str) -> dict[str, Any]:
892
+ result["error_code"] = error_code
893
+ result["error_details"] = details
894
+ for branch, info in active_branch_items:
895
+ inject_not_run(result, branch, branch_tests(info), error_code)
896
+ return result
897
+
898
+ with tempfile.TemporaryDirectory(prefix="programgym-eval-") as tmp:
899
+ compiled_snapshot = Path(tmp) / "compiled"
900
+
901
+ started = time.monotonic()
902
+ removed = remove_hashed_files(
903
+ WORKSPACE, set(metadata.get("eval_clean_hashes", []))
904
+ )
905
+ result["log"].append(
906
+ {
907
+ "step": "remove_hashed_files",
908
+ "command": "remove files matching eval_clean_hashes",
909
+ "wall_time": time.monotonic() - started,
910
+ "output": "".join(f"removed '{path}'\n" for path in removed),
911
+ "returncode": 0,
912
+ "exception_info": "",
913
+ }
914
+ )
915
+
916
+ compile_sh = WORKSPACE / "compile.sh"
917
+ if not compile_sh.exists():
918
+ return fail_all(
919
+ "missing_compile_sh", "submission did not contain compile.sh"
920
+ )
921
+
922
+ seed = (
923
+ "if [ ! -d .git ]; then "
924
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
925
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
926
+ "git -c init.defaultBranch=gold init -q && "
927
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false add -A && "
928
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
929
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
930
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false commit -q --allow-empty -m gold; "
931
+ "fi"
932
+ )
933
+ try:
934
+ result["log"].append(
935
+ run_step(seed, WORKSPACE, timeout=300, step="seed_git")
936
+ )
937
+ compile_log = run_step(
938
+ "chmod +x ./compile.sh && ./compile.sh",
939
+ WORKSPACE,
940
+ timeout=compile_timeout,
941
+ step="compile",
942
+ accept_failure=True,
943
+ )
944
+ result["log"].append(compile_log)
945
+ if compile_log["returncode"]:
946
+ return fail_all("compile_failed", compile_log["output"])
947
+ executable = WORKSPACE / "executable"
948
+ if not executable.exists():
949
+ return fail_all(
950
+ "missing_executable",
951
+ "compile.sh completed but did not create ./executable",
952
+ )
953
+ STASHED_EXECUTABLE.parent.mkdir(parents=True, exist_ok=True)
954
+ # `move` (not copy) so /workspace doesn't keep a parallel copy of
955
+ # the agent's executable during the stash→restore window. Mirrors
956
+ # upstream `mv ./executable {STASHED}` (eval.py:472).
957
+ shutil.move(str(executable), STASHED_EXECUTABLE)
958
+ result["executable_hash"] = sha256(STASHED_EXECUTABLE)
959
+ result["log"].append(
960
+ run_step(
961
+ "pip3 install -q --disable-pip-version-check pytest-rerunfailures",
962
+ WORKSPACE,
963
+ timeout=120,
964
+ step="install_rerunfailures",
965
+ accept_failure=True,
966
+ )
967
+ )
968
+ has_rerunfailures = result["log"][-1]["returncode"] == 0
969
+ handoff_removed = remove_oracle_handoff_artifacts()
970
+ if handoff_removed:
971
+ result["log"].append(
972
+ {
973
+ "step": "remove_oracle_handoff",
974
+ "command": "remove oracle handoff artifacts from workspace",
975
+ "wall_time": 0.0,
976
+ "output": "".join(
977
+ f"removed '{name}'\n" for name in handoff_removed
978
+ ),
979
+ "returncode": 0,
980
+ "exception_info": "",
981
+ }
982
+ )
983
+ snapshot_workspace(compiled_snapshot)
984
+ except Exception as exc:
985
+ return fail_all(type(exc).__name__, str(exc))
986
+
987
+ try:
988
+ blob_dir = resolve_blob_dir(instance_id, metadata)
989
+ except Exception as exc:
990
+ details = f"{type(exc).__name__}: {exc}"
991
+ for branch, info in active_branch_items:
992
+ result["test_branch_errors"][branch] = [
993
+ {
994
+ "error_code": "blob_resolution_failed",
995
+ "error_details": details,
996
+ }
997
+ ]
998
+ inject_not_run(
999
+ result, branch, branch_tests(info), "blob_resolution_failed"
1000
+ )
1001
+ return result
1002
+
1003
+ for branch, info in active_branch_items:
1004
+ tests = branch_tests(info)
1005
+ blob = blob_dir / "tests" / f"{branch}.tar.gz"
1006
+ if not blob.exists():
1007
+ result["test_branch_errors"][branch] = [
1008
+ {"error_code": "missing_test_blob", "error_details": blob.name}
1009
+ ]
1010
+ inject_not_run(result, branch, tests, "missing_test_blob")
1011
+ continue
1012
+
1013
+ best_xml = ""
1014
+ # Prefer a complete, clean XML result, then the result covering the
1015
+ # most expected tests, and only then the one with the most passes.
1016
+ # Pass-count-only ranking can retain a partial xdist result over a
1017
+ # complete serial result.
1018
+ best_quality = (-1, -1, -1)
1019
+ serial = bool(metadata.get("force_serial_branches"))
1020
+ branch_log: list[dict[str, Any]] = []
1021
+ branch_ignored = {
1022
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
1023
+ }
1024
+ n_expected = len([name for name in tests if name not in branch_ignored])
1025
+
1026
+ def merge_best_xml(raw_xml: str) -> None:
1027
+ try:
1028
+ parsed, warnings = parse_junit(
1029
+ raw_xml, branch, list(info.get("tests", [])), branch_ignored
1030
+ )
1031
+ except Exception as exc:
1032
+ result["test_branch_errors"][branch] = [
1033
+ {"error_code": "xml_parse_error", "error_details": str(exc)}
1034
+ ]
1035
+ inject_not_run(result, branch, tests, "xml_parse_error")
1036
+ else:
1037
+ result["test_results"].extend(parsed)
1038
+ result["warnings"].extend(warnings)
1039
+
1040
+ while True:
1041
+ branch_log.append(cleanup_lingering_processes())
1042
+ restore_workspace(compiled_snapshot)
1043
+ extract_trusted_blob(blob, WORKSPACE)
1044
+ restore_reference_executable()
1045
+ actual_hash = sha256(WORKSPACE / "executable")
1046
+ if actual_hash != result["executable_hash"]:
1047
+ result["test_branch_errors"][branch] = [
1048
+ {
1049
+ "error_code": "executable_hash_mismatch",
1050
+ "error_details": (
1051
+ f"expected {result['executable_hash']}, got {actual_hash}"
1052
+ ),
1053
+ }
1054
+ ]
1055
+ inject_not_run(result, branch, tests, "executable_hash_mismatch")
1056
+ break
1057
+ run_sh = WORKSPACE / "eval" / "run.sh"
1058
+ if not run_sh.exists():
1059
+ result["test_branch_errors"][branch] = [
1060
+ {
1061
+ "error_code": "missing_run_sh",
1062
+ "error_details": "eval/run.sh missing",
1063
+ }
1064
+ ]
1065
+ inject_not_run(result, branch, tests, "missing_run_sh")
1066
+ break
1067
+ # Upstream rewrites thread→signal so xdist workers fail cleanly
1068
+ # instead of os._exit(1) on timeout. That works in fresh
1069
+ # containers per branch; here we reuse one container and
1070
+ # signal timeouts leave TUI/log-watcher subprocesses alive
1071
+ # (e.g. lazygit --logs + tail -f), wedging pytest for up to
1072
+ # branch_timeout. Keep the blob's thread method and rely on
1073
+ # cleanup_lingering_processes + serial fallback after crashes.
1074
+ env = branch_env(
1075
+ serial=serial,
1076
+ has_rerunfailures=has_rerunfailures,
1077
+ extras=metadata.get("branch_env"),
1078
+ )
1079
+ branch_log.append(
1080
+ run_step(
1081
+ "rm -f eval/results.xml results.xml",
1082
+ WORKSPACE,
1083
+ timeout=120,
1084
+ step="clean_stale_results",
1085
+ accept_failure=True,
1086
+ )
1087
+ )
1088
+ if serial:
1089
+ prepare_serial_run_sh(run_sh)
1090
+ run_entry = run_step(
1091
+ run_tests_command(serial=serial),
1092
+ WORKSPACE,
1093
+ timeout=branch_timeout,
1094
+ env=env,
1095
+ step="run_tests",
1096
+ accept_failure=True,
1097
+ )
1098
+ branch_log.append(run_entry)
1099
+ branch_log.append(cleanup_lingering_processes())
1100
+ xml_path = find_results_xml()
1101
+ if xml_path is None:
1102
+ if best_xml:
1103
+ merge_best_xml(best_xml)
1104
+ break
1105
+ if serial:
1106
+ result["test_branch_errors"][branch] = [
1107
+ {
1108
+ "error_code": "missing_results_xml",
1109
+ "error_details": "eval/results.xml was not produced",
1110
+ }
1111
+ ]
1112
+ inject_not_run(result, branch, tests, "missing_results_xml")
1113
+ break
1114
+ serial = True
1115
+ continue
1116
+ raw_xml = xml_path.read_text(errors="replace")
1117
+ crashes, n_tests, failures, missing = branch_attempt_metrics(
1118
+ raw_xml,
1119
+ run_output=run_entry.get("output", ""),
1120
+ expected_tests=n_expected,
1121
+ )
1122
+ useful = count_junit_passed(raw_xml)
1123
+ quality = (
1124
+ int(crashes == 0 and missing == 0),
1125
+ n_tests,
1126
+ useful,
1127
+ )
1128
+ if quality > best_quality:
1129
+ best_xml = raw_xml
1130
+ best_quality = quality
1131
+ retry = needs_serial_retry(
1132
+ serial=serial,
1133
+ crashes=crashes,
1134
+ missing=missing,
1135
+ failures=failures,
1136
+ n_tests=n_tests,
1137
+ expected_tests=n_expected,
1138
+ run_output=run_entry.get("output", ""),
1139
+ )
1140
+ if not retry:
1141
+ merge_best_xml(best_xml)
1142
+ break
1143
+ serial = True
1144
+ for entry in branch_log:
1145
+ entry["branch"] = branch
1146
+ result["log"].extend(branch_log)
1147
+
1148
+ return result
1149
+
1150
+
1151
+ def write_outputs(result: dict[str, Any], metadata: dict[str, Any]) -> None:
1152
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1153
+ write_json(LOG_DIR / "programgym_eval.json", result)
1154
+ write_json(LOG_DIR / "harbor_diagnostics.json", diagnostics(result, metadata))
1155
+ rewards = summarize(result, metadata)
1156
+ write_json(LOG_DIR / "reward.json", rewards)
1157
+ (LOG_DIR / "reward.txt").write_text(str(rewards["reward"]))
1158
+
1159
+
1160
+ def main() -> None:
1161
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1162
+ log_path = LOG_DIR / "programgym_eval.log"
1163
+ metadata = json.loads(METADATA_PATH.read_text())
1164
+ branches = metadata.get("branches", {})
1165
+ try:
1166
+ result = evaluate(metadata)
1167
+ except Exception as exc:
1168
+ error_code = type(exc).__name__
1169
+ result = {
1170
+ "test_results": [],
1171
+ "error_code": error_code,
1172
+ "error_details": str(exc),
1173
+ "log": [
1174
+ {
1175
+ "step": "evaluator_exception",
1176
+ "exception_info": traceback.format_exc(),
1177
+ "returncode": 1,
1178
+ }
1179
+ ],
1180
+ "solution_branch": "submission",
1181
+ "test_branches": [
1182
+ name for name, info in branches.items() if not info.get("ignored")
1183
+ ],
1184
+ "test_branch_errors": {
1185
+ "__evaluator__": [{"error_code": error_code, "error_details": str(exc)}]
1186
+ },
1187
+ "executable_hash": None,
1188
+ "warnings": [],
1189
+ }
1190
+ for branch, info in branches.items():
1191
+ if info.get("ignored"):
1192
+ continue
1193
+ inject_not_run(result, branch, branch_tests(info), error_code)
1194
+ log_path.write_text(traceback.format_exc())
1195
+ else:
1196
+ log_path.write_text("")
1197
+ write_outputs(result, metadata)
1198
+
1199
+
1200
+ if __name__ == "__main__":
1201
+ main()
containers--toolbox.0851179/tests/programgym_task.json ADDED
@@ -0,0 +1,1473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "branches": {
3
+ "generated_module_01": {
4
+ "ignore_reason": "",
5
+ "ignored": false,
6
+ "ignored_tests": [
7
+ {
8
+ "name": "eval.tests.test_completion.test_completion_bash_generates_script",
9
+ "reasons": [
10
+ {
11
+ "id": "short_substring",
12
+ "message": "pytest test uses a too-short substring oracle",
13
+ "path": "eval/tests/test_completion.py",
14
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
15
+ "severity": "error",
16
+ "stage": "static_lint"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "name": "eval.tests.test_completion.test_completion_no_argument_is_rejected",
22
+ "reasons": [
23
+ {
24
+ "id": "generic_keyword_oracle",
25
+ "message": "pytest test uses a generic keyword oracle",
26
+ "path": "eval/tests/test_completion.py",
27
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
28
+ "severity": "error",
29
+ "stage": "static_lint"
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "name": "eval.tests.test_completion.test_completion_too_many_arguments_rejected",
35
+ "reasons": [
36
+ {
37
+ "id": "generic_keyword_oracle",
38
+ "message": "pytest test uses a generic keyword oracle",
39
+ "path": "eval/tests/test_completion.py",
40
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
41
+ "severity": "error",
42
+ "stage": "static_lint"
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "name": "eval.tests.test_completion.test_completion_unrecognized_shell_rejected",
48
+ "reasons": [
49
+ {
50
+ "id": "generic_keyword_oracle",
51
+ "message": "pytest test uses a generic keyword oracle",
52
+ "path": "eval/tests/test_completion.py",
53
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
54
+ "severity": "error",
55
+ "stage": "static_lint"
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "name": "eval.tests.test_completion.test_completion_valid_arg_surrounded_by_invalid",
61
+ "reasons": [
62
+ {
63
+ "id": "sole_returncode",
64
+ "message": "pytest test only asserts returncode == 0",
65
+ "path": "eval/tests/test_completion.py",
66
+ "repair_hint": "Check stdout, stderr, generated files, or structured output in addition to exit code.",
67
+ "severity": "error",
68
+ "stage": "static_lint"
69
+ },
70
+ {
71
+ "id": "all_assertions_weak",
72
+ "message": "pytest test uses only weak assertions",
73
+ "path": "eval/tests/test_completion.py",
74
+ "repair_hint": "Add at least one semantic oracle over concrete output, files, schema, or state.",
75
+ "severity": "error",
76
+ "stage": "static_lint"
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "name": "eval.tests.test_completion.test_completion_zsh_generates_script",
82
+ "reasons": [
83
+ {
84
+ "id": "short_substring",
85
+ "message": "pytest test uses a too-short substring oracle",
86
+ "path": "eval/tests/test_completion.py",
87
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
88
+ "severity": "error",
89
+ "stage": "static_lint"
90
+ },
91
+ {
92
+ "id": "generic_keyword_oracle",
93
+ "message": "pytest test uses a generic keyword oracle",
94
+ "path": "eval/tests/test_completion.py",
95
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
96
+ "severity": "error",
97
+ "stage": "static_lint"
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "name": "eval.tests.test_environment.test_empty_toolbox_path_does_not_break_precheck",
103
+ "reasons": [
104
+ {
105
+ "id": "generic_keyword_oracle",
106
+ "message": "pytest test uses a generic keyword oracle",
107
+ "path": "eval/tests/test_environment.py",
108
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
109
+ "severity": "error",
110
+ "stage": "static_lint"
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "name": "eval.tests.test_environment.test_env_handling_does_not_leak_other_vars",
116
+ "reasons": [
117
+ {
118
+ "id": "generic_keyword_oracle",
119
+ "message": "pytest test uses a generic keyword oracle",
120
+ "path": "eval/tests/test_environment.py",
121
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
122
+ "severity": "error",
123
+ "stage": "static_lint"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "name": "eval.tests.test_environment.test_fail_entry_point_is_logged",
129
+ "reasons": [
130
+ {
131
+ "id": "generic_keyword_oracle",
132
+ "message": "pytest test uses a generic keyword oracle",
133
+ "path": "eval/tests/test_environment.py",
134
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
135
+ "severity": "error",
136
+ "stage": "static_lint"
137
+ }
138
+ ]
139
+ },
140
+ {
141
+ "name": "eval.tests.test_environment.test_toolbox_path_missing_env_is_set_implicitly",
142
+ "reasons": [
143
+ {
144
+ "id": "short_substring",
145
+ "message": "pytest test uses a too-short substring oracle",
146
+ "path": "eval/tests/test_environment.py",
147
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
148
+ "severity": "error",
149
+ "stage": "static_lint"
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "name": "eval.tests.test_flag_errors.test_create_flag_needs_argument_long",
155
+ "reasons": [
156
+ {
157
+ "id": "no_assertions",
158
+ "message": "pytest test contains no assert statements",
159
+ "path": "eval/tests/test_flag_errors.py",
160
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
161
+ "severity": "error",
162
+ "stage": "static_lint"
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "name": "eval.tests.test_flag_errors.test_create_flag_needs_argument_shorthand",
168
+ "reasons": [
169
+ {
170
+ "id": "no_assertions",
171
+ "message": "pytest test contains no assert statements",
172
+ "path": "eval/tests/test_flag_errors.py",
173
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
174
+ "severity": "error",
175
+ "stage": "static_lint"
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ "name": "eval.tests.test_flag_errors.test_create_unknown_long_flag",
181
+ "reasons": [
182
+ {
183
+ "id": "no_assertions",
184
+ "message": "pytest test contains no assert statements",
185
+ "path": "eval/tests/test_flag_errors.py",
186
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
187
+ "severity": "error",
188
+ "stage": "static_lint"
189
+ }
190
+ ]
191
+ },
192
+ {
193
+ "name": "eval.tests.test_flag_errors.test_create_unknown_shorthand_flag",
194
+ "reasons": [
195
+ {
196
+ "id": "no_assertions",
197
+ "message": "pytest test contains no assert statements",
198
+ "path": "eval/tests/test_flag_errors.py",
199
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
200
+ "severity": "error",
201
+ "stage": "static_lint"
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ "name": "eval.tests.test_flag_errors.test_enter_unknown_flag",
207
+ "reasons": [
208
+ {
209
+ "id": "no_assertions",
210
+ "message": "pytest test contains no assert statements",
211
+ "path": "eval/tests/test_flag_errors.py",
212
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
213
+ "severity": "error",
214
+ "stage": "static_lint"
215
+ }
216
+ ]
217
+ },
218
+ {
219
+ "name": "eval.tests.test_flag_errors.test_init_container_unknown_flag",
220
+ "reasons": [
221
+ {
222
+ "id": "no_assertions",
223
+ "message": "pytest test contains no assert statements",
224
+ "path": "eval/tests/test_flag_errors.py",
225
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
226
+ "severity": "error",
227
+ "stage": "static_lint"
228
+ }
229
+ ]
230
+ },
231
+ {
232
+ "name": "eval.tests.test_flag_errors.test_list_unknown_flag",
233
+ "reasons": [
234
+ {
235
+ "id": "no_assertions",
236
+ "message": "pytest test contains no assert statements",
237
+ "path": "eval/tests/test_flag_errors.py",
238
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
239
+ "severity": "error",
240
+ "stage": "static_lint"
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "name": "eval.tests.test_flag_errors.test_rm_unknown_flag",
246
+ "reasons": [
247
+ {
248
+ "id": "no_assertions",
249
+ "message": "pytest test contains no assert statements",
250
+ "path": "eval/tests/test_flag_errors.py",
251
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
252
+ "severity": "error",
253
+ "stage": "static_lint"
254
+ }
255
+ ]
256
+ },
257
+ {
258
+ "name": "eval.tests.test_flag_errors.test_rmi_unknown_flag",
259
+ "reasons": [
260
+ {
261
+ "id": "no_assertions",
262
+ "message": "pytest test contains no assert statements",
263
+ "path": "eval/tests/test_flag_errors.py",
264
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
265
+ "severity": "error",
266
+ "stage": "static_lint"
267
+ }
268
+ ]
269
+ },
270
+ {
271
+ "name": "eval.tests.test_flag_errors.test_root_unknown_command",
272
+ "reasons": [
273
+ {
274
+ "id": "generic_keyword_oracle",
275
+ "message": "pytest test uses a generic keyword oracle",
276
+ "path": "eval/tests/test_flag_errors.py",
277
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
278
+ "severity": "error",
279
+ "stage": "static_lint"
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "name": "eval.tests.test_flag_errors.test_root_unknown_long_flag",
285
+ "reasons": [
286
+ {
287
+ "id": "no_assertions",
288
+ "message": "pytest test contains no assert statements",
289
+ "path": "eval/tests/test_flag_errors.py",
290
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
291
+ "severity": "error",
292
+ "stage": "static_lint"
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ "name": "eval.tests.test_flag_errors.test_run_unknown_flag",
298
+ "reasons": [
299
+ {
300
+ "id": "no_assertions",
301
+ "message": "pytest test contains no assert statements",
302
+ "path": "eval/tests/test_flag_errors.py",
303
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
304
+ "severity": "error",
305
+ "stage": "static_lint"
306
+ }
307
+ ]
308
+ },
309
+ {
310
+ "name": "eval.tests.test_help.test_completion_help",
311
+ "reasons": [
312
+ {
313
+ "id": "no_assertions",
314
+ "message": "pytest test contains no assert statements",
315
+ "path": "eval/tests/test_help.py",
316
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
317
+ "severity": "error",
318
+ "stage": "static_lint"
319
+ }
320
+ ]
321
+ },
322
+ {
323
+ "name": "eval.tests.test_help.test_create_help",
324
+ "reasons": [
325
+ {
326
+ "id": "no_assertions",
327
+ "message": "pytest test contains no assert statements",
328
+ "path": "eval/tests/test_help.py",
329
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
330
+ "severity": "error",
331
+ "stage": "static_lint"
332
+ }
333
+ ]
334
+ },
335
+ {
336
+ "name": "eval.tests.test_help.test_enter_help",
337
+ "reasons": [
338
+ {
339
+ "id": "no_assertions",
340
+ "message": "pytest test contains no assert statements",
341
+ "path": "eval/tests/test_help.py",
342
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
343
+ "severity": "error",
344
+ "stage": "static_lint"
345
+ }
346
+ ]
347
+ },
348
+ {
349
+ "name": "eval.tests.test_help.test_help_and_version_flags_cannot_combine_into_error",
350
+ "reasons": [
351
+ {
352
+ "id": "no_assertions",
353
+ "message": "pytest test contains no assert statements",
354
+ "path": "eval/tests/test_help.py",
355
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
356
+ "severity": "error",
357
+ "stage": "static_lint"
358
+ }
359
+ ]
360
+ },
361
+ {
362
+ "name": "eval.tests.test_help.test_help_command_help",
363
+ "reasons": [
364
+ {
365
+ "id": "no_assertions",
366
+ "message": "pytest test contains no assert statements",
367
+ "path": "eval/tests/test_help.py",
368
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
369
+ "severity": "error",
370
+ "stage": "static_lint"
371
+ }
372
+ ]
373
+ },
374
+ {
375
+ "name": "eval.tests.test_help.test_init_container_help",
376
+ "reasons": [
377
+ {
378
+ "id": "no_assertions",
379
+ "message": "pytest test contains no assert statements",
380
+ "path": "eval/tests/test_help.py",
381
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
382
+ "severity": "error",
383
+ "stage": "static_lint"
384
+ }
385
+ ]
386
+ },
387
+ {
388
+ "name": "eval.tests.test_help.test_list_help",
389
+ "reasons": [
390
+ {
391
+ "id": "no_assertions",
392
+ "message": "pytest test contains no assert statements",
393
+ "path": "eval/tests/test_help.py",
394
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
395
+ "severity": "error",
396
+ "stage": "static_lint"
397
+ }
398
+ ]
399
+ },
400
+ {
401
+ "name": "eval.tests.test_help.test_rm_help",
402
+ "reasons": [
403
+ {
404
+ "id": "no_assertions",
405
+ "message": "pytest test contains no assert statements",
406
+ "path": "eval/tests/test_help.py",
407
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
408
+ "severity": "error",
409
+ "stage": "static_lint"
410
+ }
411
+ ]
412
+ },
413
+ {
414
+ "name": "eval.tests.test_help.test_rmi_help",
415
+ "reasons": [
416
+ {
417
+ "id": "no_assertions",
418
+ "message": "pytest test contains no assert statements",
419
+ "path": "eval/tests/test_help.py",
420
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
421
+ "severity": "error",
422
+ "stage": "static_lint"
423
+ }
424
+ ]
425
+ },
426
+ {
427
+ "name": "eval.tests.test_help.test_root_help_long",
428
+ "reasons": [
429
+ {
430
+ "id": "no_assertions",
431
+ "message": "pytest test contains no assert statements",
432
+ "path": "eval/tests/test_help.py",
433
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
434
+ "severity": "error",
435
+ "stage": "static_lint"
436
+ }
437
+ ]
438
+ },
439
+ {
440
+ "name": "eval.tests.test_help.test_root_help_short",
441
+ "reasons": [
442
+ {
443
+ "id": "no_assertions",
444
+ "message": "pytest test contains no assert statements",
445
+ "path": "eval/tests/test_help.py",
446
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
447
+ "severity": "error",
448
+ "stage": "static_lint"
449
+ }
450
+ ]
451
+ },
452
+ {
453
+ "name": "eval.tests.test_help.test_run_help",
454
+ "reasons": [
455
+ {
456
+ "id": "no_assertions",
457
+ "message": "pytest test contains no assert statements",
458
+ "path": "eval/tests/test_help.py",
459
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
460
+ "severity": "error",
461
+ "stage": "static_lint"
462
+ }
463
+ ]
464
+ },
465
+ {
466
+ "name": "eval.tests.test_loglevel.test_double_verbose_enables_nvidia_log_level",
467
+ "reasons": [
468
+ {
469
+ "id": "short_substring",
470
+ "message": "pytest test uses a too-short substring oracle",
471
+ "path": "eval/tests/test_loglevel.py",
472
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
473
+ "severity": "error",
474
+ "stage": "static_lint"
475
+ }
476
+ ]
477
+ },
478
+ {
479
+ "name": "eval.tests.test_loglevel.test_invalid_log_level_rejected",
480
+ "reasons": [
481
+ {
482
+ "id": "generic_keyword_oracle",
483
+ "message": "pytest test uses a generic keyword oracle",
484
+ "path": "eval/tests/test_loglevel.py",
485
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
486
+ "severity": "error",
487
+ "stage": "static_lint"
488
+ }
489
+ ]
490
+ },
491
+ {
492
+ "name": "eval.tests.test_loglevel.test_verbose_flag_enables_debug_logging",
493
+ "reasons": [
494
+ {
495
+ "id": "short_substring",
496
+ "message": "pytest test uses a too-short substring oracle",
497
+ "path": "eval/tests/test_loglevel.py",
498
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
499
+ "severity": "error",
500
+ "stage": "static_lint"
501
+ }
502
+ ]
503
+ },
504
+ {
505
+ "name": "eval.tests.test_loglevel.test_verbose_long_flag_enables_debug_logging",
506
+ "reasons": [
507
+ {
508
+ "id": "short_substring",
509
+ "message": "pytest test uses a too-short substring oracle",
510
+ "path": "eval/tests/test_loglevel.py",
511
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
512
+ "severity": "error",
513
+ "stage": "static_lint"
514
+ }
515
+ ]
516
+ },
517
+ {
518
+ "name": "eval.tests.test_podman_required.test_bare_invocation_requires_podman",
519
+ "reasons": [
520
+ {
521
+ "id": "no_assertions",
522
+ "message": "pytest test contains no assert statements",
523
+ "path": "eval/tests/test_podman_required.py",
524
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
525
+ "severity": "error",
526
+ "stage": "static_lint"
527
+ }
528
+ ]
529
+ },
530
+ {
531
+ "name": "eval.tests.test_podman_required.test_create_flag_combinations_reach_same_precheck",
532
+ "reasons": [
533
+ {
534
+ "id": "no_assertions",
535
+ "message": "pytest test contains no assert statements",
536
+ "path": "eval/tests/test_podman_required.py",
537
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
538
+ "severity": "error",
539
+ "stage": "static_lint"
540
+ }
541
+ ]
542
+ },
543
+ {
544
+ "name": "eval.tests.test_podman_required.test_create_requires_podman",
545
+ "reasons": [
546
+ {
547
+ "id": "no_assertions",
548
+ "message": "pytest test contains no assert statements",
549
+ "path": "eval/tests/test_podman_required.py",
550
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
551
+ "severity": "error",
552
+ "stage": "static_lint"
553
+ }
554
+ ]
555
+ },
556
+ {
557
+ "name": "eval.tests.test_podman_required.test_enter_requires_podman",
558
+ "reasons": [
559
+ {
560
+ "id": "no_assertions",
561
+ "message": "pytest test contains no assert statements",
562
+ "path": "eval/tests/test_podman_required.py",
563
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
564
+ "severity": "error",
565
+ "stage": "static_lint"
566
+ }
567
+ ]
568
+ },
569
+ {
570
+ "name": "eval.tests.test_podman_required.test_error_goes_to_stderr_not_stdout",
571
+ "reasons": [
572
+ {
573
+ "id": "generic_keyword_oracle",
574
+ "message": "pytest test uses a generic keyword oracle",
575
+ "path": "eval/tests/test_podman_required.py",
576
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
577
+ "severity": "error",
578
+ "stage": "static_lint"
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "name": "eval.tests.test_podman_required.test_help_subcommand_requires_podman",
584
+ "reasons": [
585
+ {
586
+ "id": "no_assertions",
587
+ "message": "pytest test contains no assert statements",
588
+ "path": "eval/tests/test_podman_required.py",
589
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
590
+ "severity": "error",
591
+ "stage": "static_lint"
592
+ }
593
+ ]
594
+ },
595
+ {
596
+ "name": "eval.tests.test_podman_required.test_help_with_target_requires_podman",
597
+ "reasons": [
598
+ {
599
+ "id": "no_assertions",
600
+ "message": "pytest test contains no assert statements",
601
+ "path": "eval/tests/test_podman_required.py",
602
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
603
+ "severity": "error",
604
+ "stage": "static_lint"
605
+ }
606
+ ]
607
+ },
608
+ {
609
+ "name": "eval.tests.test_podman_required.test_init_container_requires_podman",
610
+ "reasons": [
611
+ {
612
+ "id": "no_assertions",
613
+ "message": "pytest test contains no assert statements",
614
+ "path": "eval/tests/test_podman_required.py",
615
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
616
+ "severity": "error",
617
+ "stage": "static_lint"
618
+ }
619
+ ]
620
+ },
621
+ {
622
+ "name": "eval.tests.test_podman_required.test_list_requires_podman",
623
+ "reasons": [
624
+ {
625
+ "id": "no_assertions",
626
+ "message": "pytest test contains no assert statements",
627
+ "path": "eval/tests/test_podman_required.py",
628
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
629
+ "severity": "error",
630
+ "stage": "static_lint"
631
+ }
632
+ ]
633
+ },
634
+ {
635
+ "name": "eval.tests.test_podman_required.test_positional_container_arg_still_fails_on_podman",
636
+ "reasons": [
637
+ {
638
+ "id": "no_assertions",
639
+ "message": "pytest test contains no assert statements",
640
+ "path": "eval/tests/test_podman_required.py",
641
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
642
+ "severity": "error",
643
+ "stage": "static_lint"
644
+ }
645
+ ]
646
+ },
647
+ {
648
+ "name": "eval.tests.test_podman_required.test_rm_requires_podman",
649
+ "reasons": [
650
+ {
651
+ "id": "no_assertions",
652
+ "message": "pytest test contains no assert statements",
653
+ "path": "eval/tests/test_podman_required.py",
654
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
655
+ "severity": "error",
656
+ "stage": "static_lint"
657
+ }
658
+ ]
659
+ },
660
+ {
661
+ "name": "eval.tests.test_podman_required.test_rmi_requires_podman",
662
+ "reasons": [
663
+ {
664
+ "id": "no_assertions",
665
+ "message": "pytest test contains no assert statements",
666
+ "path": "eval/tests/test_podman_required.py",
667
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
668
+ "severity": "error",
669
+ "stage": "static_lint"
670
+ }
671
+ ]
672
+ },
673
+ {
674
+ "name": "eval.tests.test_podman_required.test_run_requires_podman",
675
+ "reasons": [
676
+ {
677
+ "id": "no_assertions",
678
+ "message": "pytest test contains no assert statements",
679
+ "path": "eval/tests/test_podman_required.py",
680
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
681
+ "severity": "error",
682
+ "stage": "static_lint"
683
+ }
684
+ ]
685
+ },
686
+ {
687
+ "name": "eval.tests.test_subcommand_flags.test_create_all_flags_parse_without_flag_error",
688
+ "reasons": [
689
+ {
690
+ "id": "generic_keyword_oracle",
691
+ "message": "pytest test uses a generic keyword oracle",
692
+ "path": "eval/tests/test_subcommand_flags.py",
693
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
694
+ "severity": "error",
695
+ "stage": "static_lint"
696
+ }
697
+ ]
698
+ },
699
+ {
700
+ "name": "eval.tests.test_subcommand_flags.test_enter_flags_parse_without_flag_error",
701
+ "reasons": [
702
+ {
703
+ "id": "generic_keyword_oracle",
704
+ "message": "pytest test uses a generic keyword oracle",
705
+ "path": "eval/tests/test_subcommand_flags.py",
706
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
707
+ "severity": "error",
708
+ "stage": "static_lint"
709
+ }
710
+ ]
711
+ },
712
+ {
713
+ "name": "eval.tests.test_subcommand_flags.test_init_container_without_deprecated_flag_no_warning",
714
+ "reasons": [
715
+ {
716
+ "id": "generic_keyword_oracle",
717
+ "message": "pytest test uses a generic keyword oracle",
718
+ "path": "eval/tests/test_subcommand_flags.py",
719
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
720
+ "severity": "error",
721
+ "stage": "static_lint"
722
+ }
723
+ ]
724
+ }
725
+ ],
726
+ "tests": [
727
+ "eval.tests.test_completion.test_completion_bash_generates_script",
728
+ "eval.tests.test_completion.test_completion_bash_script_will_be_generated_without_error_text",
729
+ "eval.tests.test_completion.test_completion_fish_generates_script",
730
+ "eval.tests.test_completion.test_completion_no_argument_is_rejected",
731
+ "eval.tests.test_completion.test_completion_scripts_differ_only_markers",
732
+ "eval.tests.test_completion.test_completion_shells_are_distinct",
733
+ "eval.tests.test_completion.test_completion_too_many_arguments_rejected",
734
+ "eval.tests.test_completion.test_completion_unrecognized_shell_rejected",
735
+ "eval.tests.test_completion.test_completion_valid_arg_surrounded_by_invalid",
736
+ "eval.tests.test_completion.test_completion_zsh_generates_script",
737
+ "eval.tests.test_environment.test_delay_entry_point_is_logged",
738
+ "eval.tests.test_environment.test_empty_toolbox_path_does_not_break_precheck",
739
+ "eval.tests.test_environment.test_env_handling_does_not_leak_other_vars",
740
+ "eval.tests.test_environment.test_fail_entry_point_is_logged",
741
+ "eval.tests.test_environment.test_toolbox_path_defaults_to_resolved_executable",
742
+ "eval.tests.test_environment.test_toolbox_path_explicit_value_preserved",
743
+ "eval.tests.test_environment.test_toolbox_path_missing_env_is_set_implicitly",
744
+ "eval.tests.test_flag_errors.test_create_authfile_flag_parses",
745
+ "eval.tests.test_flag_errors.test_create_flag_needs_argument_long",
746
+ "eval.tests.test_flag_errors.test_create_flag_needs_argument_shorthand",
747
+ "eval.tests.test_flag_errors.test_create_unknown_long_flag",
748
+ "eval.tests.test_flag_errors.test_create_unknown_shorthand_flag",
749
+ "eval.tests.test_flag_errors.test_enter_unknown_flag",
750
+ "eval.tests.test_flag_errors.test_help_routes_unknown_arg_flag_error_first",
751
+ "eval.tests.test_flag_errors.test_init_container_unknown_flag",
752
+ "eval.tests.test_flag_errors.test_list_unknown_flag",
753
+ "eval.tests.test_flag_errors.test_rm_unknown_flag",
754
+ "eval.tests.test_flag_errors.test_rmi_unknown_flag",
755
+ "eval.tests.test_flag_errors.test_root_unknown_command",
756
+ "eval.tests.test_flag_errors.test_root_unknown_long_flag",
757
+ "eval.tests.test_flag_errors.test_run_unknown_flag",
758
+ "eval.tests.test_flag_errors.test_subcommand_shorthand_flag_value_flag_size",
759
+ "eval.tests.test_help.test_completion_help",
760
+ "eval.tests.test_help.test_create_help",
761
+ "eval.tests.test_help.test_enter_help",
762
+ "eval.tests.test_help.test_help_and_version_flags_cannot_combine_into_error",
763
+ "eval.tests.test_help.test_help_command_help",
764
+ "eval.tests.test_help.test_init_container_help",
765
+ "eval.tests.test_help.test_list_help",
766
+ "eval.tests.test_help.test_rm_help",
767
+ "eval.tests.test_help.test_rmi_help",
768
+ "eval.tests.test_help.test_root_help_long",
769
+ "eval.tests.test_help.test_root_help_short",
770
+ "eval.tests.test_help.test_root_help_text_is_consistent",
771
+ "eval.tests.test_help.test_run_help",
772
+ "eval.tests.test_loglevel.test_assumeyes_flag_parses",
773
+ "eval.tests.test_loglevel.test_assumeyes_shorthand_parses",
774
+ "eval.tests.test_loglevel.test_default_log_level_is_error_no_debug_spam",
775
+ "eval.tests.test_loglevel.test_double_verbose_enables_nvidia_log_level",
776
+ "eval.tests.test_loglevel.test_each_valid_log_level_accepted",
777
+ "eval.tests.test_loglevel.test_invalid_log_level_rejected",
778
+ "eval.tests.test_loglevel.test_log_level_flag_needs_value",
779
+ "eval.tests.test_loglevel.test_log_podman_flag_parses",
780
+ "eval.tests.test_loglevel.test_verbose_flag_enables_debug_logging",
781
+ "eval.tests.test_loglevel.test_verbose_flag_not_needed_for_parse_error",
782
+ "eval.tests.test_loglevel.test_verbose_long_flag_enables_debug_logging",
783
+ "eval.tests.test_podman_required.test_bare_invocation_requires_podman",
784
+ "eval.tests.test_podman_required.test_create_flag_combinations_reach_same_precheck",
785
+ "eval.tests.test_podman_required.test_create_requires_podman",
786
+ "eval.tests.test_podman_required.test_enter_requires_podman",
787
+ "eval.tests.test_podman_required.test_error_goes_to_stderr_not_stdout",
788
+ "eval.tests.test_podman_required.test_help_subcommand_requires_podman",
789
+ "eval.tests.test_podman_required.test_help_with_target_requires_podman",
790
+ "eval.tests.test_podman_required.test_init_container_requires_podman",
791
+ "eval.tests.test_podman_required.test_list_requires_podman",
792
+ "eval.tests.test_podman_required.test_positional_container_arg_still_fails_on_podman",
793
+ "eval.tests.test_podman_required.test_rm_requires_podman",
794
+ "eval.tests.test_podman_required.test_rmi_requires_podman",
795
+ "eval.tests.test_podman_required.test_run_requires_podman",
796
+ "eval.tests.test_subcommand_flags.test_create_all_flags_parse_without_flag_error",
797
+ "eval.tests.test_subcommand_flags.test_enter_flags_parse_without_flag_error",
798
+ "eval.tests.test_subcommand_flags.test_init_container_deprecated_flag_warns",
799
+ "eval.tests.test_subcommand_flags.test_init_container_does_not_print_go_panic",
800
+ "eval.tests.test_subcommand_flags.test_init_container_without_deprecated_flag_no_warning",
801
+ "eval.tests.test_subcommand_flags.test_list_flags_parse",
802
+ "eval.tests.test_subcommand_flags.test_rm_force_flag_parses",
803
+ "eval.tests.test_subcommand_flags.test_rmi_force_flag_parses",
804
+ "eval.tests.test_version.test_no_args_is_not_a_version_print",
805
+ "eval.tests.test_version.test_version_flag_only_available_at_root",
806
+ "eval.tests.test_version.test_version_long_flag_exits_zero",
807
+ "eval.tests.test_version.test_version_reports_semver_build"
808
+ ]
809
+ },
810
+ "generated_module_02": {
811
+ "ignore_reason": "",
812
+ "ignored": false,
813
+ "ignored_tests": [
814
+ {
815
+ "name": "eval.tests.test_cli_errors.test_unknown_subcommand_near_match_suggests_candidate",
816
+ "reasons": [
817
+ {
818
+ "id": "short_substring",
819
+ "message": "pytest test uses a too-short substring oracle",
820
+ "path": "eval/tests/test_cli_errors.py",
821
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
822
+ "severity": "error",
823
+ "stage": "static_lint"
824
+ },
825
+ {
826
+ "id": "generic_keyword_oracle",
827
+ "message": "pytest test uses a generic keyword oracle",
828
+ "path": "eval/tests/test_cli_errors.py",
829
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
830
+ "severity": "error",
831
+ "stage": "static_lint"
832
+ }
833
+ ]
834
+ },
835
+ {
836
+ "name": "eval.tests.test_podman_gate.test_gate_is_before_subcommand_specific_validation",
837
+ "reasons": [
838
+ {
839
+ "id": "no_assertions",
840
+ "message": "pytest test contains no assert statements",
841
+ "path": "eval/tests/test_podman_gate.py",
842
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
843
+ "severity": "error",
844
+ "stage": "static_lint"
845
+ }
846
+ ]
847
+ },
848
+ {
849
+ "name": "eval.tests.test_podman_gate.test_no_subcommand_hits_version_gate",
850
+ "reasons": [
851
+ {
852
+ "id": "no_assertions",
853
+ "message": "pytest test contains no assert statements",
854
+ "path": "eval/tests/test_podman_gate.py",
855
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
856
+ "severity": "error",
857
+ "stage": "static_lint"
858
+ }
859
+ ]
860
+ }
861
+ ],
862
+ "tests": [
863
+ "eval.tests.test_cli_errors.test_invalid_log_level_rejected[bogus]",
864
+ "eval.tests.test_cli_errors.test_invalid_log_level_rejected[empty]",
865
+ "eval.tests.test_cli_errors.test_invalid_log_level_rejected[numeric]",
866
+ "eval.tests.test_cli_errors.test_invalid_log_level_rejected[verbose]",
867
+ "eval.tests.test_cli_errors.test_unknown_long_flag_error[distrotypo]",
868
+ "eval.tests.test_cli_errors.test_unknown_long_flag_error[imagelist]",
869
+ "eval.tests.test_cli_errors.test_unknown_long_flag_error[nope]",
870
+ "eval.tests.test_cli_errors.test_unknown_long_flag_error[podman]",
871
+ "eval.tests.test_cli_errors.test_unknown_short_flag_error[Q]",
872
+ "eval.tests.test_cli_errors.test_unknown_short_flag_error[Z]",
873
+ "eval.tests.test_cli_errors.test_unknown_short_flag_error[x]",
874
+ "eval.tests.test_cli_errors.test_unknown_subcommand_does_not_cross_gate",
875
+ "eval.tests.test_cli_errors.test_unknown_subcommand_error[exit]",
876
+ "eval.tests.test_cli_errors.test_unknown_subcommand_error[images]",
877
+ "eval.tests.test_cli_errors.test_unknown_subcommand_error[init]",
878
+ "eval.tests.test_cli_errors.test_unknown_subcommand_error[nonsense]",
879
+ "eval.tests.test_cli_errors.test_unknown_subcommand_error[start]",
880
+ "eval.tests.test_cli_errors.test_unknown_subcommand_near_match_suggests_candidate",
881
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[debug]",
882
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[error]",
883
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[fatal]",
884
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[info]",
885
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[panic]",
886
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[trace]",
887
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[warn]",
888
+ "eval.tests.test_cli_errors.test_valid_log_level_reaches_gate[warning]",
889
+ "eval.tests.test_help.test_help_flag_and_help_subcommand_differ",
890
+ "eval.tests.test_help.test_help_flag_exits_zero_without_gate[root_long_help]",
891
+ "eval.tests.test_help.test_help_flag_exits_zero_without_gate[root_short_help]",
892
+ "eval.tests.test_help.test_help_subcommand_crosses_gate[help]",
893
+ "eval.tests.test_help.test_help_subcommand_crosses_gate[help_create]",
894
+ "eval.tests.test_help.test_help_subcommand_crosses_gate[help_enter]",
895
+ "eval.tests.test_help.test_help_subcommand_crosses_gate[help_list]",
896
+ "eval.tests.test_help.test_help_subcommand_crosses_gate[help_rm]",
897
+ "eval.tests.test_help.test_help_subcommand_of_unknown_command",
898
+ "eval.tests.test_help.test_subcommand_help_flag_exits_zero_without_gate[create_short]",
899
+ "eval.tests.test_help.test_subcommand_help_flag_exits_zero_without_gate[list_long]",
900
+ "eval.tests.test_help.test_subcommand_help_flag_exits_zero_without_gate[list_short]",
901
+ "eval.tests.test_help.test_subcommand_help_flag_exits_zero_without_gate[rm_long]",
902
+ "eval.tests.test_podman_gate.test_gate_error_goes_only_to_stderr",
903
+ "eval.tests.test_podman_gate.test_gate_is_before_subcommand_specific_validation",
904
+ "eval.tests.test_podman_gate.test_gate_produces_no_config_side_effect",
905
+ "eval.tests.test_podman_gate.test_no_subcommand_hits_version_gate",
906
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create]",
907
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_alias_distro]",
908
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_alias_release]",
909
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_distro]",
910
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_distro_release]",
911
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_image]",
912
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_positional]",
913
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[create_release]",
914
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[enter_flag]",
915
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[enter_named]",
916
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[enter_no_argument]",
917
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[help_enter]",
918
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[help_list]",
919
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[help_rm]",
920
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[help_subcommand]",
921
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list]",
922
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list_containers_and_images]",
923
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list_containers_only]",
924
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list_images_only]",
925
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list_long_containers_only]",
926
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[list_long_images_only]",
927
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[no_subcommand]",
928
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_all]",
929
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_force]",
930
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_force_short]",
931
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_missing_argument]",
932
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_multiple]",
933
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rm_single]",
934
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rmi_all]",
935
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rmi_missing_argument]",
936
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rmi_multiple]",
937
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[rmi_single]",
938
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[run]",
939
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[run_fedora]",
940
+ "eval.tests.test_podman_gate.test_podman_dependent_subcommand_hits_version_gate[run_named]",
941
+ "eval.tests.test_verbose.test_debug_log_reports_config_dir",
942
+ "eval.tests.test_verbose.test_debug_log_reports_toolbox_path",
943
+ "eval.tests.test_verbose.test_default_level_hides_debug_logs",
944
+ "eval.tests.test_verbose.test_log_podman_flag_runs_cleanly_to_gate",
945
+ "eval.tests.test_verbose.test_log_podman_with_debug_shows_diagnostics",
946
+ "eval.tests.test_verbose.test_quiet_level_flags_hide_debug_logs[error]",
947
+ "eval.tests.test_verbose.test_quiet_level_flags_hide_debug_logs[info]",
948
+ "eval.tests.test_verbose.test_quiet_level_flags_hide_debug_logs[warn]",
949
+ "eval.tests.test_verbose.test_verbose_enables_debug_logs[argv0]",
950
+ "eval.tests.test_verbose.test_verbose_enables_debug_logs[argv1]",
951
+ "eval.tests.test_verbose.test_verbose_enables_debug_logs[argv2]",
952
+ "eval.tests.test_verbose.test_verbose_level_flag_shows_debug_logs[debug]",
953
+ "eval.tests.test_verbose.test_verbose_level_flag_shows_debug_logs[trace]",
954
+ "eval.tests.test_verbose.test_verbose_reports_podman_not_found_at_gate",
955
+ "eval.tests.test_version.test_verbose_flag_is_not_version_flag",
956
+ "eval.tests.test_version.test_version_flag_does_not_touch_podman_gate",
957
+ "eval.tests.test_version.test_version_flag_ignores_config_home",
958
+ "eval.tests.test_version.test_version_flag_not_allowed_on_subcommand",
959
+ "eval.tests.test_version.test_version_flag_prints_version",
960
+ "eval.tests.test_version.test_version_subcommand_is_unknown"
961
+ ]
962
+ },
963
+ "generated_module_03": {
964
+ "ignore_reason": "",
965
+ "ignored": false,
966
+ "ignored_tests": [
967
+ {
968
+ "name": "eval.tests.test_reachable_prelude.test_version_flag_banner_matches_0_3",
969
+ "reasons": [
970
+ {
971
+ "id": "generic_keyword_oracle",
972
+ "message": "pytest test uses a generic keyword oracle",
973
+ "path": "eval/tests/test_reachable_prelude.py",
974
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
975
+ "severity": "error",
976
+ "stage": "static_lint"
977
+ }
978
+ ]
979
+ },
980
+ {
981
+ "name": "eval.tests.test_utils_distro_resolution.test_explicit_host_distro_resolves",
982
+ "reasons": [
983
+ {
984
+ "id": "no_assertions",
985
+ "message": "pytest test contains no assert statements",
986
+ "path": "eval/tests/test_utils_distro_resolution.py",
987
+ "repair_hint": "Add concrete assert statements over observable executable behavior.",
988
+ "severity": "error",
989
+ "stage": "static_lint"
990
+ }
991
+ ]
992
+ }
993
+ ],
994
+ "tests": [
995
+ "eval.tests.test_reachable_prelude.test_debug_levels_emit_log_lines_to_stderr[debug]",
996
+ "eval.tests.test_reachable_prelude.test_debug_levels_emit_log_lines_to_stderr[trace]",
997
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[0]",
998
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[VERBOSE]",
999
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[bogus]",
1000
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[debugg]",
1001
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[errorr]",
1002
+ "eval.tests.test_reachable_prelude.test_invalid_log_level_rejected_with_exact_message[panic ]",
1003
+ "eval.tests.test_reachable_prelude.test_quiet_log_levels_emit_no_stderr[error]",
1004
+ "eval.tests.test_reachable_prelude.test_quiet_log_levels_emit_no_stderr[fatal]",
1005
+ "eval.tests.test_reachable_prelude.test_quiet_log_levels_emit_no_stderr[info]",
1006
+ "eval.tests.test_reachable_prelude.test_quiet_log_levels_emit_no_stderr[panic]",
1007
+ "eval.tests.test_reachable_prelude.test_quiet_log_levels_emit_no_stderr[warn]",
1008
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[debug]",
1009
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[error]",
1010
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[fatal]",
1011
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[info]",
1012
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[panic]",
1013
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[trace]",
1014
+ "eval.tests.test_reachable_prelude.test_valid_log_levels_accepted[warn]",
1015
+ "eval.tests.test_reachable_prelude.test_version_flag_banner_matches_0_3",
1016
+ "eval.tests.test_reachable_prelude.test_version_flag_prints_version_banner",
1017
+ "eval.tests.test_utils_config_file.test_config_adding_release_makes_forced_distro_valid",
1018
+ "eval.tests.test_utils_config_file.test_config_distro_overrides_default",
1019
+ "eval.tests.test_utils_config_file.test_default_distro_with_valid_release_resolves",
1020
+ "eval.tests.test_utils_config_file.test_empty_or_comment_only_config_resolves_defaults[empty]",
1021
+ "eval.tests.test_utils_config_file.test_empty_or_comment_only_config_resolves_defaults[multi-comment]",
1022
+ "eval.tests.test_utils_config_file.test_empty_or_comment_only_config_resolves_defaults[one-comment]",
1023
+ "eval.tests.test_utils_config_file.test_malformed_config_reports_parse_error[dangling-equals]",
1024
+ "eval.tests.test_utils_config_file.test_malformed_config_reports_parse_error[missing-value]",
1025
+ "eval.tests.test_utils_config_file.test_malformed_config_reports_parse_error[unclosed-array]",
1026
+ "eval.tests.test_utils_config_file.test_malformed_config_reports_parse_error[unclosed-table]",
1027
+ "eval.tests.test_utils_config_file.test_malformed_config_reports_parse_error[unterminated-string]",
1028
+ "eval.tests.test_utils_distro_resolution.test_default_distro_without_config_resolves[comment-only]",
1029
+ "eval.tests.test_utils_distro_resolution.test_default_distro_without_config_resolves[empty-config-file]",
1030
+ "eval.tests.test_utils_distro_resolution.test_default_distro_without_config_resolves[no-config-file]",
1031
+ "eval.tests.test_utils_distro_resolution.test_explicit_host_distro_resolves",
1032
+ "eval.tests.test_utils_distro_resolution.test_nondefault_optional_release_distro_resolves[arch-empty-release]",
1033
+ "eval.tests.test_utils_distro_resolution.test_nondefault_optional_release_distro_resolves[arch-no-release-config]",
1034
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_with_valid_release_resolves[f-e-4-0]",
1035
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_with_valid_release_resolves[f-e-4-1]",
1036
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_with_valid_release_resolves[r-h-8-.]",
1037
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_with_valid_release_resolves[r-h-9-.]",
1038
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_without_release_rejected[fedora]",
1039
+ "eval.tests.test_utils_distro_resolution.test_nondefault_release_required_distro_without_release_rejected[rhel]",
1040
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[alpine]",
1041
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[centos]",
1042
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[debian]",
1043
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[gentoo]",
1044
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[nosuchdistro]",
1045
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[opensuse]",
1046
+ "eval.tests.test_utils_distro_resolution.test_unsupported_distro_rejected[sles]",
1047
+ "eval.tests.test_utils_release_parse.test_arch_release_invalid[1]",
1048
+ "eval.tests.test_utils_release_parse.test_arch_release_invalid[2024]",
1049
+ "eval.tests.test_utils_release_parse.test_arch_release_invalid[6.1]",
1050
+ "eval.tests.test_utils_release_parse.test_arch_release_invalid[rolling-release]",
1051
+ "eval.tests.test_utils_release_parse.test_arch_release_valid[empty]",
1052
+ "eval.tests.test_utils_release_parse.test_arch_release_valid[latest]",
1053
+ "eval.tests.test_utils_release_parse.test_arch_release_valid[rolling]",
1054
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[+42]",
1055
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[-5]",
1056
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[0]",
1057
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[40.5]",
1058
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[40a]",
1059
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[42 ]",
1060
+ "eval.tests.test_utils_release_parse.test_fedora_release_invalid[forty]",
1061
+ "eval.tests.test_utils_release_parse.test_fedora_release_valid[100]",
1062
+ "eval.tests.test_utils_release_parse.test_fedora_release_valid[1]",
1063
+ "eval.tests.test_utils_release_parse.test_fedora_release_valid[40]",
1064
+ "eval.tests.test_utils_release_parse.test_fedora_release_valid[F40]",
1065
+ "eval.tests.test_utils_release_parse.test_fedora_release_valid[f41]",
1066
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[-1.5]",
1067
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[0.0]",
1068
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[1e3]",
1069
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[9..3]",
1070
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[9.3.1]",
1071
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[9]",
1072
+ "eval.tests.test_utils_release_parse.test_rhel_release_invalid[forty]",
1073
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[0.1]",
1074
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[10.0]",
1075
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[7.9]",
1076
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[8.10]",
1077
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[9.3]",
1078
+ "eval.tests.test_utils_release_parse.test_rhel_release_valid[9.]",
1079
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[ 24.04]",
1080
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[-24.04]",
1081
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[024.04]",
1082
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[04.04]",
1083
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[04.10]",
1084
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[0x10.01]",
1085
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[10.-1]",
1086
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[10.1]",
1087
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[10.4e2]",
1088
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[100.01]",
1089
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[23.13]",
1090
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24.00]",
1091
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24.04.05]",
1092
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24.0]",
1093
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24.13]",
1094
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24.mm]",
1095
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[2404]",
1096
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[24]",
1097
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[3.04]",
1098
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[99.00]",
1099
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[99.13]",
1100
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[empty]",
1101
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_invalid[yy.04]",
1102
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[10.10]",
1103
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[22.04]",
1104
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[24.04]",
1105
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[24.10]",
1106
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[25.01]",
1107
+ "eval.tests.test_utils_release_parse.test_ubuntu_release_valid[99.12]"
1108
+ ]
1109
+ },
1110
+ "generated_module_04": {
1111
+ "ignore_reason": "",
1112
+ "ignored": false,
1113
+ "ignored_tests": [
1114
+ {
1115
+ "name": "eval.tests.test_dispatch.test_completion_bash_contains_generator_body",
1116
+ "reasons": [
1117
+ {
1118
+ "id": "short_substring",
1119
+ "message": "pytest test uses a too-short substring oracle",
1120
+ "path": "eval/tests/test_dispatch.py",
1121
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
1122
+ "severity": "error",
1123
+ "stage": "static_lint"
1124
+ }
1125
+ ]
1126
+ },
1127
+ {
1128
+ "name": "eval.tests.test_dispatch.test_completion_requires_shell_argument",
1129
+ "reasons": [
1130
+ {
1131
+ "id": "generic_keyword_oracle",
1132
+ "message": "pytest test uses a generic keyword oracle",
1133
+ "path": "eval/tests/test_dispatch.py",
1134
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
1135
+ "severity": "error",
1136
+ "stage": "static_lint"
1137
+ }
1138
+ ]
1139
+ },
1140
+ {
1141
+ "name": "eval.tests.test_log_level.test_debug_dataflow_includes_uid_line",
1142
+ "reasons": [
1143
+ {
1144
+ "id": "generic_keyword_oracle",
1145
+ "message": "pytest test uses a generic keyword oracle",
1146
+ "path": "eval/tests/test_log_level.py",
1147
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
1148
+ "severity": "error",
1149
+ "stage": "static_lint"
1150
+ }
1151
+ ]
1152
+ },
1153
+ {
1154
+ "name": "eval.tests.test_log_level.test_empty_log_level_rejected",
1155
+ "reasons": [
1156
+ {
1157
+ "id": "short_substring",
1158
+ "message": "pytest test uses a too-short substring oracle",
1159
+ "path": "eval/tests/test_log_level.py",
1160
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
1161
+ "severity": "error",
1162
+ "stage": "static_lint"
1163
+ }
1164
+ ]
1165
+ },
1166
+ {
1167
+ "name": "eval.tests.test_version_cli.test_version_prefix_is_toolbox_name",
1168
+ "reasons": [
1169
+ {
1170
+ "id": "short_substring",
1171
+ "message": "pytest test uses a too-short substring oracle",
1172
+ "path": "eval/tests/test_version_cli.py",
1173
+ "repair_hint": "Use a longer, specific substring or an exact normalized output comparison.",
1174
+ "severity": "error",
1175
+ "stage": "static_lint"
1176
+ },
1177
+ {
1178
+ "id": "generic_keyword_oracle",
1179
+ "message": "pytest test uses a generic keyword oracle",
1180
+ "path": "eval/tests/test_version_cli.py",
1181
+ "repair_hint": "Replace generic keyword checks with exact diagnostics, structured output, or golden comparisons.",
1182
+ "severity": "error",
1183
+ "stage": "static_lint"
1184
+ }
1185
+ ]
1186
+ }
1187
+ ],
1188
+ "tests": [
1189
+ "eval.tests.test_dispatch.test_commands_abort_on_missing_podman[create]",
1190
+ "eval.tests.test_dispatch.test_commands_abort_on_missing_podman[list]",
1191
+ "eval.tests.test_dispatch.test_commands_abort_on_missing_podman[rm]",
1192
+ "eval.tests.test_dispatch.test_commands_abort_on_missing_podman[rmi]",
1193
+ "eval.tests.test_dispatch.test_commands_abort_on_missing_podman[run]",
1194
+ "eval.tests.test_dispatch.test_completion_bash_contains_generator_body",
1195
+ "eval.tests.test_dispatch.test_completion_bash_script_header",
1196
+ "eval.tests.test_dispatch.test_completion_fish_script_header",
1197
+ "eval.tests.test_dispatch.test_completion_generates_shell_script[bash-# bash completion V2 for toolbox]",
1198
+ "eval.tests.test_dispatch.test_completion_generates_shell_script[fish-# fish completion for toolbox]",
1199
+ "eval.tests.test_dispatch.test_completion_generates_shell_script[zsh-#compdef toolbox]",
1200
+ "eval.tests.test_dispatch.test_completion_rejects_unsupported_shell[bogus]",
1201
+ "eval.tests.test_dispatch.test_completion_rejects_unsupported_shell[powershell]",
1202
+ "eval.tests.test_dispatch.test_completion_rejects_unsupported_shell[tcsh]",
1203
+ "eval.tests.test_dispatch.test_completion_requires_shell_argument",
1204
+ "eval.tests.test_dispatch.test_completion_zsh_uses_compdef",
1205
+ "eval.tests.test_dispatch.test_run_command_missing_podman_error",
1206
+ "eval.tests.test_dispatch.test_run_rejects_unknown_local_flag",
1207
+ "eval.tests.test_dispatch.test_unknown_flag_on_root_rejected",
1208
+ "eval.tests.test_dispatch.test_unknown_shorthand_flag_rejected",
1209
+ "eval.tests.test_dispatch.test_unknown_subcommand_rejected",
1210
+ "eval.tests.test_log_level.test_debug_dataflow_includes_uid_line",
1211
+ "eval.tests.test_log_level.test_debug_dataflow_reports_executable_resolution",
1212
+ "eval.tests.test_log_level.test_debug_verbose_line_count_is_deterministic",
1213
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[error]",
1214
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[fatal]",
1215
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[info]",
1216
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[panic]",
1217
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[trace]",
1218
+ "eval.tests.test_log_level.test_declared_log_levels_accepted[warn]",
1219
+ "eval.tests.test_log_level.test_double_verbose_reaches_nvidia_log_level",
1220
+ "eval.tests.test_log_level.test_empty_log_level_rejected",
1221
+ "eval.tests.test_log_level.test_info_level_is_quiet_but_proceeds",
1222
+ "eval.tests.test_log_level.test_invalid_log_level_rejected[0]",
1223
+ "eval.tests.test_log_level.test_invalid_log_level_rejected[1]",
1224
+ "eval.tests.test_log_level.test_invalid_log_level_rejected[bogus]",
1225
+ "eval.tests.test_log_level.test_invalid_log_level_rejected[invalid]",
1226
+ "eval.tests.test_log_level.test_log_level_parsing_is_case_insensitive[DEBUG]",
1227
+ "eval.tests.test_log_level.test_log_level_parsing_is_case_insensitive[Debug]",
1228
+ "eval.tests.test_log_level.test_log_level_parsing_is_case_insensitive[Info]",
1229
+ "eval.tests.test_log_level.test_log_level_parsing_is_case_insensitive[Panic]",
1230
+ "eval.tests.test_log_level.test_panic_level_suppresses_debug_dataflow",
1231
+ "eval.tests.test_log_level.test_triple_verbose_debug_dataflow",
1232
+ "eval.tests.test_log_level.test_verbose_emits_debug_dataflow",
1233
+ "eval.tests.test_log_level.test_verbose_overrides_explicit_log_level",
1234
+ "eval.tests.test_version_cli.test_verbose_version_still_plain",
1235
+ "eval.tests.test_version_cli.test_version_bypasses_log_level_validation",
1236
+ "eval.tests.test_version_cli.test_version_exact_single_line",
1237
+ "eval.tests.test_version_cli.test_version_flag_accepts_trailing_subcommand_arg",
1238
+ "eval.tests.test_version_cli.test_version_flag_emits_toolbox_version_on_stdout",
1239
+ "eval.tests.test_version_cli.test_version_flag_not_available_on_subcommand",
1240
+ "eval.tests.test_version_cli.test_version_is_not_a_capital_shorthand",
1241
+ "eval.tests.test_version_cli.test_version_is_not_a_subcommand",
1242
+ "eval.tests.test_version_cli.test_version_prefix_is_toolbox_name",
1243
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra0]",
1244
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra1]",
1245
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra2]",
1246
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra3]",
1247
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra4]",
1248
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra5]",
1249
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra6]",
1250
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra7]",
1251
+ "eval.tests.test_version_cli.test_version_short_circuits_before_global_flag_processing[extra8]"
1252
+ ]
1253
+ },
1254
+ "generated_upstream": {
1255
+ "ignore_reason": "",
1256
+ "ignored": false,
1257
+ "ignored_tests": [],
1258
+ "tests": [
1259
+ "eval.tests.test_harvest_cli.test_completion_bash_smoke",
1260
+ "eval.tests.test_harvest_cli.test_completion_fish_smoke",
1261
+ "eval.tests.test_harvest_cli.test_completion_invalid_shell",
1262
+ "eval.tests.test_harvest_cli.test_completion_no_args",
1263
+ "eval.tests.test_harvest_cli.test_completion_two_args",
1264
+ "eval.tests.test_harvest_cli.test_completion_two_invalid_args",
1265
+ "eval.tests.test_harvest_cli.test_completion_unknown_flag",
1266
+ "eval.tests.test_harvest_cli.test_completion_unsupported_shell_powershell",
1267
+ "eval.tests.test_harvest_cli.test_completion_zsh_smoke",
1268
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[create]",
1269
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[enter]",
1270
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[help]",
1271
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[init-container]",
1272
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[list]",
1273
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[rm]",
1274
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[rmi]",
1275
+ "eval.tests.test_harvest_cli.test_subcommand_unknown_flag[run]",
1276
+ "eval.tests.test_harvest_cli.test_unknown_command",
1277
+ "eval.tests.test_harvest_cli.test_unknown_flag_root",
1278
+ "eval.tests.test_harvest_cli.test_version_option"
1279
+ ]
1280
+ }
1281
+ },
1282
+ "commit": "08511795cc370c5b75b59ead7834d87ac9ce4579",
1283
+ "data_source": "synthetic_programgym",
1284
+ "difficulty": "",
1285
+ "difficulty_score": null,
1286
+ "eval_clean_hashes": [
1287
+ "d9e1951ce6e24154cfafad1a3cb6647e187a62d92137277ebd91c4e0e91a029b"
1288
+ ],
1289
+ "input_record": {
1290
+ "commit": "08511795cc370c5b75b59ead7834d87ac9ce4579",
1291
+ "commits": 1638,
1292
+ "contributors": 79,
1293
+ "difficulty": "easy",
1294
+ "difficulty_code_lines": 8547,
1295
+ "difficulty_has_tests": true,
1296
+ "difficulty_product_code_lines": 8547,
1297
+ "difficulty_runtime_deps": 0,
1298
+ "difficulty_score": 1.9318137039591394,
1299
+ "difficulty_test_code_lines": 6070,
1300
+ "full_name": "containers/toolbox",
1301
+ "github_stars": 3447,
1302
+ "input_joern_zip": "go_joern/containers__toolbox.zip",
1303
+ "joern_status": true,
1304
+ "joern_time": 11.527624516980723,
1305
+ "language": "go",
1306
+ "pb_match": [
1307
+ {
1308
+ "pb_fullname": "segmentio/chamber",
1309
+ "rank": 467,
1310
+ "similarity": 0.5198568105697632
1311
+ },
1312
+ {
1313
+ "pb_fullname": "sclevine/yj",
1314
+ "rank": 472,
1315
+ "similarity": 0.4967413544654846
1316
+ },
1317
+ {
1318
+ "pb_fullname": "antonmedv/walk",
1319
+ "rank": 6,
1320
+ "similarity": 0.6531068682670593
1321
+ },
1322
+ {
1323
+ "pb_fullname": "peco/peco",
1324
+ "rank": 7,
1325
+ "similarity": 0.6236509084701538
1326
+ },
1327
+ {
1328
+ "pb_fullname": "mikefarah/yq",
1329
+ "rank": 147,
1330
+ "similarity": 0.570770263671875
1331
+ },
1332
+ {
1333
+ "pb_fullname": "rs/curlie",
1334
+ "rank": 125,
1335
+ "similarity": 0.5517040491104126
1336
+ },
1337
+ {
1338
+ "pb_fullname": "johnkerl/miller",
1339
+ "rank": 622,
1340
+ "similarity": 0.4730730652809143
1341
+ },
1342
+ {
1343
+ "pb_fullname": "guumaster/hostctl",
1344
+ "rank": 52,
1345
+ "similarity": 0.516293466091156
1346
+ },
1347
+ {
1348
+ "pb_fullname": "direnv/direnv",
1349
+ "rank": 51,
1350
+ "similarity": 0.49253755807876587
1351
+ },
1352
+ {
1353
+ "pb_fullname": "JohannesKaufmann/html-to-markdown",
1354
+ "rank": 923,
1355
+ "similarity": 0.46764126420021057
1356
+ },
1357
+ {
1358
+ "pb_fullname": "alecthomas/chroma",
1359
+ "rank": 209,
1360
+ "similarity": 0.5225207209587097
1361
+ },
1362
+ {
1363
+ "pb_fullname": "jesseduffield/lazygit",
1364
+ "rank": 53,
1365
+ "similarity": 0.6299505233764648
1366
+ },
1367
+ {
1368
+ "pb_fullname": "FiloSottile/age",
1369
+ "rank": 313,
1370
+ "similarity": 0.4927942454814911
1371
+ },
1372
+ {
1373
+ "pb_fullname": "boyter/scc",
1374
+ "rank": 403,
1375
+ "similarity": 0.5206068158149719
1376
+ },
1377
+ {
1378
+ "pb_fullname": "rs/jplot",
1379
+ "rank": 609,
1380
+ "similarity": 0.49621883034706116
1381
+ },
1382
+ {
1383
+ "pb_fullname": "multiprocessio/dsq",
1384
+ "rank": 709,
1385
+ "similarity": 0.4687003493309021
1386
+ },
1387
+ {
1388
+ "pb_fullname": "naggie/dstask",
1389
+ "rank": 447,
1390
+ "similarity": 0.4983940124511719
1391
+ },
1392
+ {
1393
+ "pb_fullname": "astaxie/bat",
1394
+ "rank": 82,
1395
+ "similarity": 0.6035112142562866
1396
+ },
1397
+ {
1398
+ "pb_fullname": "noborus/trdsql",
1399
+ "rank": 274,
1400
+ "similarity": 0.529211163520813
1401
+ },
1402
+ {
1403
+ "pb_fullname": "noborus/ov",
1404
+ "rank": 64,
1405
+ "similarity": 0.5930846929550171
1406
+ },
1407
+ {
1408
+ "pb_fullname": "sibprogrammer/xq",
1409
+ "rank": 268,
1410
+ "similarity": 0.5169100761413574
1411
+ },
1412
+ {
1413
+ "pb_fullname": "sheepla/pingu",
1414
+ "rank": 29,
1415
+ "similarity": 0.5721991062164307
1416
+ },
1417
+ {
1418
+ "pb_fullname": "raviqqe/muffet",
1419
+ "rank": 680,
1420
+ "similarity": 0.4705549478530884
1421
+ },
1422
+ {
1423
+ "pb_fullname": "eliukblau/pixterm",
1424
+ "rank": 57,
1425
+ "similarity": 0.5947152376174927
1426
+ },
1427
+ {
1428
+ "pb_fullname": "TheZoraiz/ascii-image-converter",
1429
+ "rank": 60,
1430
+ "similarity": 0.5530563592910767
1431
+ },
1432
+ {
1433
+ "pb_fullname": "cheat/cheat",
1434
+ "rank": 8,
1435
+ "similarity": 0.6371524333953857
1436
+ },
1437
+ {
1438
+ "pb_fullname": "antonmedv/fx",
1439
+ "rank": 64,
1440
+ "similarity": 0.5663456916809082
1441
+ },
1442
+ {
1443
+ "pb_fullname": "dundee/gdu",
1444
+ "rank": 28,
1445
+ "similarity": 0.5997451543807983
1446
+ },
1447
+ {
1448
+ "pb_fullname": "tomnomnom/gron",
1449
+ "rank": 637,
1450
+ "similarity": 0.4854043424129486
1451
+ },
1452
+ {
1453
+ "pb_fullname": "junegunn/fzf",
1454
+ "rank": 12,
1455
+ "similarity": 0.6155176162719727
1456
+ },
1457
+ {
1458
+ "pb_fullname": "zk-org/zk",
1459
+ "rank": 308,
1460
+ "similarity": 0.5665037631988525
1461
+ }
1462
+ ],
1463
+ "repo_age": 7.93,
1464
+ "repo_path": "go/containers__toolbox",
1465
+ "source": "commit:08511795cc370c5b75b59ead7834d87ac9ce4579",
1466
+ "status": "done",
1467
+ "url": "https://github.com/containers/toolbox"
1468
+ },
1469
+ "instance_id": "containers__toolbox.0851179",
1470
+ "language": "go",
1471
+ "module_iterations": [],
1472
+ "repository": "containers/toolbox"
1473
+ }
containers--toolbox.0851179/tests/test.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Verifier exec may not inherit image ENV (Modal/gVisor, login-shell resets).
5
+ export PATH="/usr/local/go/bin:/go/bin:/usr/local/cargo/bin:/root/.cargo/bin:${PATH}"
6
+
7
+ mkdir -p /logs/verifier /logs/artifacts
8
+
9
+ write_failure() {
10
+ local code="$1"
11
+ local details="$2"
12
+ python3 - "$code" "$details" <<'PY'
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ code, details = sys.argv[1:3]
18
+ try:
19
+ metadata = json.loads(Path("/tests/programgym_task.json").read_text())
20
+ n_tests = sum(
21
+ len([
22
+ name for name in info.get("tests", [])
23
+ if name not in {item.get("name") for item in info.get("ignored_tests", [])}
24
+ ])
25
+ for branch, info in metadata.get("branches", {}).items()
26
+ if not info.get("ignored")
27
+ )
28
+ except Exception:
29
+ n_tests = 0
30
+ result = {
31
+ "test_results": [],
32
+ "error_code": code,
33
+ "error_details": details,
34
+ "log": [],
35
+ "solution_branch": "submission",
36
+ "test_branches": [],
37
+ "test_branch_errors": {
38
+ "__infra__": [{"error_code": code, "error_details": details}]
39
+ },
40
+ "executable_hash": None,
41
+ "warnings": [],
42
+ }
43
+ diagnostics = {
44
+ "pass_rate": 0.0,
45
+ "resolved": 0,
46
+ "n_passed": 0,
47
+ "n_tests": n_tests,
48
+ "n_branch_errors": 1,
49
+ "infra_error": 1,
50
+ "executable_hash_present": 0,
51
+ }
52
+ Path("/logs/verifier/programgym_eval.json").write_text(
53
+ json.dumps(result, indent=2, sort_keys=True)
54
+ )
55
+ Path("/logs/verifier/harbor_diagnostics.json").write_text(
56
+ json.dumps(diagnostics, indent=2, sort_keys=True)
57
+ )
58
+ Path("/logs/verifier/reward.json").write_text(
59
+ json.dumps(
60
+ {"reward": 0.0, "resolved": 0.0, "almost_resolved": 0.0},
61
+ indent=2,
62
+ sort_keys=True,
63
+ )
64
+ )
65
+ Path("/logs/verifier/reward.txt").write_text("0.0")
66
+ Path("/logs/verifier/programgym_eval.log").write_text(details)
67
+ PY
68
+ }
69
+
70
+ if ! command -v python3 >/dev/null 2>&1; then
71
+ write_failure "missing_python3" "python3 is required in the cleanroom image"
72
+ exit 0
73
+ fi
74
+
75
+ if ! python3 /tests/programgym_evaluator.py; then
76
+ if [ ! -s /logs/verifier/reward.txt ]; then
77
+ write_failure "evaluator_crashed" \
78
+ "programgym_evaluator.py exited non-zero with no reward written"
79
+ fi
80
+ fi
81
+
82
+ exit 0
containers--toolbox.0851179/tests/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fd726bfe987590e874475802c7eeae270a6e20262dac77f476c5f5d4d9846ea
3
+ size 3226
contribsys--faktory_worker_go.dd/environment/Dockerfile ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
15
+ ENV npm_config_registry="https://registry.npmjs.org/"
16
+ ENV npm_config_strict_ssl=false
17
+ ENV npm_config_cache=/workspace/.cache/npm
18
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
19
+ ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
20
+ ENV PIP_TRUSTED_HOST=""
21
+ ENV HOME=/workspace
22
+ ENV XDG_CACHE_HOME=/workspace/.cache
23
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
24
+ ENV PYTHONUSERBASE=/workspace/.local
25
+ ENV GOROOT=/usr/local/go
26
+ ENV GOPATH=/workspace/.go
27
+ ENV GOCACHE=/workspace/.cache/go-build
28
+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
29
+ ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+ ENV PAGER=cat
31
+ ENV MANPAGER=cat
32
+ ENV LESS=-R
33
+ ENV TQDM_DISABLE=1
34
+ ENV VIRTUAL_ENV=/opt/programgym-venv
35
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
36
+ COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
37
+ RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
38
+ RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
39
+ WORKDIR /workspace
40
+ ADD workspace.tar.gz /workspace/
41
+ COPY executable /workspace/executable
42
+ COPY download.sh /workspace/download.sh
43
+ RUN chmod 755 /workspace/download.sh
44
+ RUN ["bash","-lc","set -euo pipefail; cd /workspace; set -a; source /workspace/download.sh; set +a; python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh\nimport os\nimport re\nimport shlex\nignored = {\"OLDPWD\", \"PWD\", \"SHLVL\", \"_\"}\nvalid_name = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\nfor key in sorted(os.environ):\n if key in ignored or key.startswith(\"BASH_FUNC_\") or not valid_name.fullmatch(key):\n continue\n value = os.environ[key]\n if \"\\n\" in value:\n continue\n print(f\"export {key}={shlex.quote(value)}\")\nPY\n"]
45
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
46
+ RUN chmod 111 /workspace/executable
47
+ WORKDIR /workspace
48
+ # programgym-runtime-workspace-cleanup: v1
49
+ RUN ["bash","-lc","rm -f -- /workspace/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]
50
+ # Harbor synthetic ProgramGym adapter: run the agent as an unprivileged user.
51
+ # Keep tool/runtime state under /home/agent and reserve /workspace for the
52
+ # submission handed to the separate verifier. Keep the reference executable
53
+ # execute-only; the oracle temporarily restores owner read permission.
54
+ RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
55
+ RUN mkdir -p /home/agent \
56
+ && chown -R agent:agent /home/agent /workspace \
57
+ && chown agent:agent /workspace/executable \
58
+ && chmod 111 /workspace/executable
59
+ ENV HOME=/home/agent
60
+ WORKDIR /workspace
contribsys--faktory_worker_go.dd/environment/download.sh ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROGRAMGYM-MANAGED-GO-DOWNLOAD: v1
3
+ # Generated deterministically from repository module metadata; do not edit.
4
+ set -u
5
+ export GOTOOLCHAIN=auto
6
+ mkdir -p /workspace/.programgym_build_env/go-prefetch
7
+ cat > /workspace/.programgym_build_env/go-prefetch/go.mod <<'PROGRAMGYM_GO_MOD_EOF'
8
+ module github.com/contribsys/faktory_worker_go
9
+
10
+ go 1.21
11
+
12
+ require (
13
+ github.com/contribsys/faktory v1.8.0
14
+ github.com/stretchr/testify v1.8.4
15
+ )
16
+
17
+ require (
18
+ github.com/davecgh/go-spew v1.1.1 // indirect
19
+ github.com/pmezard/go-difflib v1.0.0 // indirect
20
+ gopkg.in/yaml.v3 v3.0.1 // indirect
21
+ )
22
+ PROGRAMGYM_GO_MOD_EOF
23
+ cat > /workspace/.programgym_build_env/go-prefetch/go.sum <<'PROGRAMGYM_GO_SUM_EOF'
24
+ github.com/contribsys/faktory v1.8.0 h1:Rkxdph/1Tv9g60J8pyO2F7jKao77sRECh7HDBhgtuvI=
25
+ github.com/contribsys/faktory v1.8.0/go.mod h1:SP+Y2Pr+JqLY9YJL3YNlJhdzTinm/oUe2CcOpwDHQR0=
26
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
27
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
28
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
29
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30
+ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
31
+ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
32
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
33
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
34
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
35
+ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
36
+ PROGRAMGYM_GO_SUM_EOF
37
+ PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY="${GOPROXY:-direct}"
38
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY=""
39
+ case "$PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY" in
40
+ *"|"*|*","*)
41
+ PROGRAMGYM_INTERNAL_GO_FIRST_PROXY="${PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY%%[,|]*}"
42
+ PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER="${PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY#*[,|]}"
43
+ if [[ "$PROGRAMGYM_INTERNAL_GO_FIRST_PROXY" =~ [^[:space:]] ]] && [[ "$PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER" =~ [^[:space:]] ]]; then
44
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY="${PROGRAMGYM_GO_PUBLIC_FALLBACK_PROXY:-${PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER}}"
45
+ fi
46
+ ;;
47
+ esac
48
+ if ! [[ "$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" =~ [^[:space:]] ]]; then
49
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY=""
50
+ fi
51
+ cat > /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py <<'PROGRAMGYM_GO_TIMEOUT_SUPERVISOR_EOF'
52
+ import os
53
+ import signal
54
+ import subprocess
55
+ import sys
56
+ import time
57
+
58
+ sentinel_path, timeout_text, grace_text, proxy, *command = sys.argv[1:]
59
+ if not command:
60
+ raise SystemExit(125)
61
+ environment = os.environ.copy()
62
+ environment["GOPROXY"] = proxy
63
+ process = subprocess.Popen(command, env=environment, start_new_session=True)
64
+ try:
65
+ returncode = process.wait(timeout=float(timeout_text))
66
+ except subprocess.TimeoutExpired:
67
+ with open(sentinel_path, "w", encoding="utf-8") as sentinel:
68
+ sentinel.write("expired\n")
69
+ try:
70
+ os.killpg(process.pid, signal.SIGTERM)
71
+ except ProcessLookupError:
72
+ pass
73
+ deadline = time.monotonic() + float(grace_text)
74
+ group_alive = True
75
+ while time.monotonic() < deadline:
76
+ process.poll()
77
+ try:
78
+ os.killpg(process.pid, 0)
79
+ except ProcessLookupError:
80
+ group_alive = False
81
+ break
82
+ time.sleep(0.05)
83
+ if group_alive:
84
+ try:
85
+ os.killpg(process.pid, signal.SIGKILL)
86
+ except ProcessLookupError:
87
+ pass
88
+ process.wait()
89
+ raise SystemExit(124)
90
+ if returncode < 0:
91
+ returncode = 128 - returncode
92
+ raise SystemExit(returncode)
93
+ PROGRAMGYM_GO_TIMEOUT_SUPERVISOR_EOF
94
+ PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS="${PROGRAMGYM_GO_NEXUS_ATTEMPT_TIMEOUT_SECONDS:-90}"
95
+ if ! [[ "$PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS" =~ ^[1-9][0-9]*$ ]]; then
96
+ printf '%s\n' "download.sh: invalid PROGRAMGYM_GO_NEXUS_ATTEMPT_TIMEOUT_SECONDS=${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}" >&2
97
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
98
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
99
+ return 1
100
+ else
101
+ exit 1
102
+ fi
103
+ fi
104
+ if ! command -v python3 >/dev/null 2>&1; then
105
+ printf '%s\n' 'download.sh: python3 is required for bounded Nexus Go downloads' >&2
106
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
107
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
108
+ return 1
109
+ else
110
+ exit 1
111
+ fi
112
+ fi
113
+ _programgym_go_with_nexus_timeout() {
114
+ local programgym_go_rc
115
+ local programgym_go_timeout_sentinel
116
+ if ! programgym_go_timeout_sentinel="$(mktemp "${TMPDIR:-/tmp}/programgym-go-timeout.XXXXXX")"; then
117
+ return 1
118
+ fi
119
+ if python3 /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py "$programgym_go_timeout_sentinel" "$PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS" "5" "$PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY" "$@"; then
120
+ programgym_go_rc=0
121
+ else
122
+ programgym_go_rc=$?
123
+ fi
124
+ if [ ! -s "$programgym_go_timeout_sentinel" ]; then
125
+ rm -f "$programgym_go_timeout_sentinel"
126
+ return "$programgym_go_rc"
127
+ fi
128
+ rm -f "$programgym_go_timeout_sentinel"
129
+ if [ -z "$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" ]; then
130
+ printf '%s\n' "download.sh: primary Go request exceeded ${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}s; GOPROXY has no explicit non-empty fallback remainder" >&2
131
+ return "$programgym_go_rc"
132
+ fi
133
+ printf '%s\n' "download.sh: Nexus-first Go request exceeded ${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}s; retrying with GOPROXY=${PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY}" >&2
134
+ env GOPROXY="$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" "$@"
135
+ }
136
+ PROGRAMGYM_GO_BASE_GOROOT="$(GOTOOLCHAIN=local go env GOROOT)"
137
+ if ! PROGRAMGYM_GO_RESOLVED_GOROOT="$(cd /workspace/.programgym_build_env/go-prefetch && _programgym_go_with_nexus_timeout env GOTOOLCHAIN=auto go env GOROOT)"; then
138
+ printf '%s\n' 'download.sh: Go toolchain resolution failed' >&2
139
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
140
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
141
+ return 1
142
+ else
143
+ exit 1
144
+ fi
145
+ fi
146
+ if [ "$PROGRAMGYM_GO_RESOLVED_GOROOT" != "$PROGRAMGYM_GO_BASE_GOROOT" ]; then
147
+ PROGRAMGYM_GO_TOOLCHAIN_ROOT=/opt/programgym-go-toolchain
148
+ mkdir -p "$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
149
+ cp -a "$PROGRAMGYM_GO_RESOLVED_GOROOT/." "$PROGRAMGYM_GO_TOOLCHAIN_ROOT/"
150
+ export GOROOT="$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
151
+ else
152
+ export GOROOT="$PROGRAMGYM_GO_BASE_GOROOT"
153
+ fi
154
+ export PATH="$GOROOT/bin:$PATH"
155
+ export GOTOOLCHAIN=local
156
+ if ! (cd /workspace/.programgym_build_env/go-prefetch && _programgym_go_with_nexus_timeout go mod download -modfile=/workspace/.programgym_build_env/go-prefetch/go.mod all); then
157
+ printf '%s\n' 'download.sh: Go dependency prefetch failed' >&2
158
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
159
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
160
+ return 1
161
+ else
162
+ exit 1
163
+ fi
164
+ fi
165
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
166
+ unset -f _programgym_go_with_nexus_timeout
167
+ unset PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY
168
+ unset PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY
169
+ unset PROGRAMGYM_INTERNAL_GO_FIRST_PROXY
170
+ unset PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER
171
+ unset PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS
contribsys--faktory_worker_go.dd/environment/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bf246f11c2cec8cc86ab9700914c2327be4a6921c917b1836fdb59216131078
3
+ size 7148030
contribsys--faktory_worker_go.dd/environment/programgym-go.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39042a078ea9ceebe3ecda4a7188f0f5b96e14a071d27923ba7f40b456e85ae3
3
+ size 59908810
contribsys--faktory_worker_go.dd/environment/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c9e15f55ee1a7d6843720ce1d94ca3bad2429bf67aa49706a1765278151112f
3
+ size 80
contribsys--faktory_worker_go.dd/instruction.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant that can interact with a computer.
2
+
3
+ This is a reverse-engineering benchmark. You are given a compiled binary and its documentation.
4
+ Your job is to write a new, original codebase from scratch that produces an executable with identical behavior.
5
+ You must figure out the behavior solely by running and interacting with the provided binary.
6
+ Writing original code based on observed behavior is the entire point of this benchmark.
7
+
8
+ Any approach that shortcuts this — finding existing source code, wrapping the binary,
9
+ or installing the original tool — does not count as a solution. It will be detected by an
10
+ automated judge, marked as a disqualification, and scored as a failure.
11
+ The trace will be posted to an online wall of shame.
12
+
13
+ <RULES>
14
+ ## What is not allowed
15
+
16
+ ### 1. Obtaining source code
17
+
18
+ The only source of truth about what the executable does is the executable itself and its
19
+ bundled documentation. You must not search the internet, package registries, or any external
20
+ source for information about this project's source code. Even if you recognize what the
21
+ executable is, you must reimplement it from behavioral observation alone.
22
+
23
+ This includes but is not limited to:
24
+ - Cloning or browsing the original GitHub repository, its forks, or mirrors
25
+ - Downloading the project from package registries: `cargo install <project>`, `go get github.com/<org>/<project>`, `pip install <project>`, `apt-get source <project>`, `npm install <project>`, etc.
26
+ - Fetching source tarballs from project websites (e.g., `curl https://lua.org/ftp/lua-5.5.0.tar.gz`)
27
+ - Using a package manager to download the project as a dependency and then reading its cached source (e.g., navigating into `~/.cargo/registry/src/` or `$(go env GOPATH)/pkg/mod/`)
28
+ - Searching the web for the project's source code or implementation details
29
+
30
+ ### 2. Wrapping or reusing the original binary
31
+
32
+ Your submission must be a genuine reimplementation. The provided `./executable` is for
33
+ observation only — your final solution must not depend on it or any other pre-built version
34
+ of the same tool at runtime.
35
+
36
+ This includes but is not limited to:
37
+ - Writing a wrapper script that delegates to the original binary (e.g., `exec zstd "$@"`)
38
+ - Installing the tool from a package manager and shimming to it (e.g., `apt-get install nnn && cp $(which nnn) ./executable`)
39
+ - Writing a `compile.sh` that simply makes the provided binary executable (`chmod +x ./executable`) or copies it (`cp ./executable ./executable`)
40
+ - Building a binary whose main function shells out to an external tool (e.g., `Command::new("miniserve").args(args).exec()`)
41
+ - Re-linking prebuilt `.o` object files found in the workspace without writing new source code
42
+
43
+ ### 3. Binary analysis of the provided executable
44
+
45
+ All information about the provided `./executable` must be obtained by interacting with it
46
+ through its normal user interface (CLI flags, stdin/stdout, etc.).
47
+ - You MUST NOT decompile `./executable` or use disassemblers (objdump, Ghidra, etc.) on it
48
+ - You MUST NOT use strace, ltrace, or similar tracing/instrumentation tools on `./executable`
49
+
50
+ Note: this restriction applies ONLY to the provided `./executable`. You are free to use any
51
+ analysis tools on binaries that you produce yourself during development.
52
+
53
+ ## What IS allowed
54
+
55
+ - Running the executable with any inputs, flags, and arguments to observe its behavior
56
+ - Reading any documentation files bundled in the workspace
57
+ </RULES>
58
+
59
+ ## Task context
60
+
61
+ We want to write the source code for a given executable.
62
+ The executable is located at `./executable` in the workspace root.
63
+
64
+ You also have access to the existing documentation.
65
+
66
+ ## Your task
67
+
68
+ Implement the source code to generate an executable of exactly identical behavior as the original.
69
+
70
+ No project-specific dependencies are pre-installed.
71
+ You do NOT have access to the internet.
72
+ **IMPORTANT**: Make sure that the executable(s) and everything else that is an artifact is not committed, i.e., is in your `.gitignore` file.
73
+ Finally, commit your changes.
74
+
75
+ Make sure that you have a `./compile.sh` file that produces an executable `./executable` in the workspace root.
76
+ `compile.sh` should be executable and should install any dependencies needed to compile the executable.
77
+ If your compile.sh fails to compile on a fresh checkout, your task has failed.
78
+
79
+ ## Important: This is a reverse-engineering benchmark
80
+
81
+ Your goal is to write original code from scratch that reproduces the executable's behavior.
82
+ The only way to learn what the executable does is to run it and read its bundled documentation.
83
+
84
+ Any attempt to obtain source code — whether successful or not — or to wrap/reuse the
85
+ provided binary will be detected by an automated judge, disqualified, and scored as zero.
86
+ See the full rules in the system prompt above. Key points:
87
+
88
+ - Do NOT search the internet, clone repos, or download the project from any package registry
89
+ - Do NOT wrap, shim, or delegate to the provided `./executable` or any installed version of the same tool
90
+ - Do NOT decompile the provided `./executable` or use strace/ltrace on it (analyzing your own binaries is fine)
91
+ - You SHOULD extensively test the executable to understand its behavior before writing code.
92
+ If you are dealing with a TUI, tmux/libtmux has been installed to help you test/inspect/it.
93
+
94
+ ## Recommended Workflow
95
+
96
+ 1. Explore all documentation files
97
+ 2. Play with the executable to understand its behavior (however, you MUST NOT decompile `./executable` or perform any other form of binary or strace/ltrace analysis on it)
98
+ 3. Write the source code to implement the behavior
contribsys--faktory_worker_go.dd/solution/solve.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Oracle-only ceiling check. The reference is execute-only for normal agents;
3
+ # because the oracle runs as the owning `agent` user it can temporarily add read
4
+ # permission and encode the binary for Harbor's normal artifact handoff.
5
+ set -euo pipefail
6
+ test -f ./executable
7
+ chmod u+r ./executable
8
+ python3 - <<'PY'
9
+ import base64
10
+ from pathlib import Path
11
+
12
+ Path(".programgym_oracle_reference").write_bytes(
13
+ base64.b64encode(Path("executable").read_bytes())
14
+ )
15
+ PY
16
+ chmod u-r ./executable
17
+ cat > compile.sh <<'EOF'
18
+ #!/usr/bin/env bash
19
+ set -euo pipefail
20
+ if [ -f ./.programgym_oracle_reference ]; then
21
+ python3 - <<'PY'
22
+ import base64
23
+ from pathlib import Path
24
+
25
+ Path("executable").write_bytes(
26
+ base64.b64decode(Path(".programgym_oracle_reference").read_bytes())
27
+ )
28
+ PY
29
+ fi
30
+ test -f ./executable
31
+ chmod +x ./executable
32
+ EOF
33
+ chmod +x compile.sh
contribsys--faktory_worker_go.dd/task.toml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ source = "ProgramGym"
3
+ artifacts = [
4
+ "/logs/verifier/programgym_eval.json",
5
+ "/logs/verifier/harbor_diagnostics.json",
6
+ "/logs/verifier/programgym_eval.log",
7
+ "/logs/verifier/reward.json",
8
+ "/logs/verifier/reward.txt",
9
+ # Keep agent/runtime state out of the submission handoff. In particular,
10
+ # Claude Code installs an absolute symlink under .local/bin; transferring it
11
+ # makes Python's safe tar extraction reject the entire workspace archive.
12
+ { source = "/workspace", exclude = [
13
+ "executable",
14
+ ".git",
15
+ ".bashrc",
16
+ ".cache",
17
+ ".cc-switch",
18
+ ".claude",
19
+ ".local",
20
+ ] },
21
+ ]
22
+
23
+ [task]
24
+ name = "programgym/contribsys--faktory_worker_go.dd"
25
+ description = "Synthetic ProgramGym cleanroom reconstruction task for contribsys/faktory_worker_go"
26
+ authors = [{ name = "Harbor ProgramGym Synthetic Adapter" }]
27
+ keywords = ["programgym", "synthetic", "reverse-engineering", "cleanroom", "go"]
28
+
29
+ [metadata]
30
+ source = "ProgramGym"
31
+ instance_id = "contribsys__faktory_worker_go.dd0174d"
32
+ repository = "contribsys/faktory_worker_go"
33
+ commit = "dd0174da353f4046679dc4d9a446cae997d95396"
34
+ language = "go"
35
+ difficulty = "easy"
36
+ difficulty_score = 1.7631283767991368
37
+ test_branches = 4
38
+ test_count = 96
39
+
40
+ [agent]
41
+ timeout_sec = 14400
42
+ user = "agent"
43
+ network_mode = "allowlist"
44
+ allowed_hosts = ["api.anthropic.com", "api.openai.com"]
45
+
46
+ [verifier]
47
+ timeout_sec = 7200
48
+ user = "root"
49
+ environment_mode = "separate"
50
+
51
+ [verifier.env]
52
+ PROGRAMGYM_XDIST_WORKERS = "8"
53
+
54
+ [verifier.environment]
55
+ build_timeout_sec = 1800
56
+ cpus = 8
57
+ memory_mb = 16384
58
+ storage_mb = 30720
59
+ gpus = 0
60
+ workdir = "/workspace"
61
+
62
+ [environment]
63
+ network_mode = "public"
64
+ build_timeout_sec = 1800
65
+ cpus = 8
66
+ memory_mb = 16384
67
+ storage_mb = 30720
68
+ gpus = 0
69
+ workdir = "/workspace"
contribsys--faktory_worker_go.dd/tests/Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
15
+ ENV npm_config_registry="https://registry.npmjs.org/"
16
+ ENV npm_config_strict_ssl=false
17
+ ENV npm_config_cache=/workspace/.cache/npm
18
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
19
+ ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
20
+ ENV PIP_TRUSTED_HOST=""
21
+ ENV HOME=/workspace
22
+ ENV XDG_CACHE_HOME=/workspace/.cache
23
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
24
+ ENV PYTHONUSERBASE=/workspace/.local
25
+ ENV GOROOT=/usr/local/go
26
+ ENV GOPATH=/workspace/.go
27
+ ENV GOCACHE=/workspace/.cache/go-build
28
+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
29
+ ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+ ENV PAGER=cat
31
+ ENV MANPAGER=cat
32
+ ENV LESS=-R
33
+ ENV TQDM_DISABLE=1
34
+ ENV VIRTUAL_ENV=/opt/programgym-venv
35
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
36
+ COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
37
+ RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
38
+ RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
39
+ WORKDIR /workspace
40
+ ADD workspace.tar.gz /workspace/
41
+ COPY executable /workspace/executable
42
+ COPY download.sh /workspace/download.sh
43
+ RUN chmod 755 /workspace/download.sh
44
+ RUN ["bash","-lc","set -euo pipefail; cd /workspace; set -a; source /workspace/download.sh; set +a; python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh\nimport os\nimport re\nimport shlex\nignored = {\"OLDPWD\", \"PWD\", \"SHLVL\", \"_\"}\nvalid_name = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\nfor key in sorted(os.environ):\n if key in ignored or key.startswith(\"BASH_FUNC_\") or not valid_name.fullmatch(key):\n continue\n value = os.environ[key]\n if \"\\n\" in value:\n continue\n print(f\"export {key}={shlex.quote(value)}\")\nPY\n"]
45
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
46
+ RUN chmod 111 /workspace/executable
47
+ WORKDIR /workspace
48
+ # programgym-runtime-workspace-cleanup: v1
49
+ RUN ["bash","-lc","rm -f -- /workspace/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]
50
+ # Harbor uses tests/ as the separate verifier build context. Start with the
51
+ # same toolchain as the agent, then remove every cleanroom workspace artifact.
52
+ RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
53
+ && mkdir -p /workspace /tests
54
+
55
+ # Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
56
+ # Installing a newer pytest alone leaves that apt package importable and creates
57
+ # an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
58
+ # Install and constrain the verifier test runner as one coherent pip toolchain.
59
+ RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
60
+ ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
61
+ RUN python3 -m pip install --no-cache-dir --disable-pip-version-check \
62
+ 'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout
63
+
64
+ COPY test.sh /tests/test.sh
65
+ COPY programgym_evaluator.py /tests/programgym_evaluator.py
66
+ COPY programgym_task.json /tests/programgym_task.json
67
+ COPY blobs/ /tests/blobs/
68
+ RUN chmod +x /tests/test.sh
contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_01.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77baec18114535ccd9bdabe190b8c7c776449031b4772dcd46632ddf8007b869
3
+ size 9002
contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_02.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b13fdd847067e0cb80e777d5da8876704667961bced0a89db32afa72aafdd581
3
+ size 13225
contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_03.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:261dbcd50de76dc35c9474c181d2756fb114ea0a1580dce8859ecf879886ff29
3
+ size 7353
contribsys--faktory_worker_go.dd/tests/blobs/tests/generated_module_04.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a0a117613b6371ac07e9beecc19c4cee37b997f6cf3e4903c786e8a7ecb8fd3
3
+ size 8736
contribsys--faktory_worker_go.dd/tests/download.sh ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROGRAMGYM-MANAGED-GO-DOWNLOAD: v1
3
+ # Generated deterministically from repository module metadata; do not edit.
4
+ set -u
5
+ export GOTOOLCHAIN=auto
6
+ mkdir -p /workspace/.programgym_build_env/go-prefetch
7
+ cat > /workspace/.programgym_build_env/go-prefetch/go.mod <<'PROGRAMGYM_GO_MOD_EOF'
8
+ module github.com/contribsys/faktory_worker_go
9
+
10
+ go 1.21
11
+
12
+ require (
13
+ github.com/contribsys/faktory v1.8.0
14
+ github.com/stretchr/testify v1.8.4
15
+ )
16
+
17
+ require (
18
+ github.com/davecgh/go-spew v1.1.1 // indirect
19
+ github.com/pmezard/go-difflib v1.0.0 // indirect
20
+ gopkg.in/yaml.v3 v3.0.1 // indirect
21
+ )
22
+ PROGRAMGYM_GO_MOD_EOF
23
+ cat > /workspace/.programgym_build_env/go-prefetch/go.sum <<'PROGRAMGYM_GO_SUM_EOF'
24
+ github.com/contribsys/faktory v1.8.0 h1:Rkxdph/1Tv9g60J8pyO2F7jKao77sRECh7HDBhgtuvI=
25
+ github.com/contribsys/faktory v1.8.0/go.mod h1:SP+Y2Pr+JqLY9YJL3YNlJhdzTinm/oUe2CcOpwDHQR0=
26
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
27
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
28
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
29
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30
+ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
31
+ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
32
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
33
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
34
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
35
+ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
36
+ PROGRAMGYM_GO_SUM_EOF
37
+ PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY="${GOPROXY:-direct}"
38
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY=""
39
+ case "$PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY" in
40
+ *"|"*|*","*)
41
+ PROGRAMGYM_INTERNAL_GO_FIRST_PROXY="${PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY%%[,|]*}"
42
+ PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER="${PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY#*[,|]}"
43
+ if [[ "$PROGRAMGYM_INTERNAL_GO_FIRST_PROXY" =~ [^[:space:]] ]] && [[ "$PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER" =~ [^[:space:]] ]]; then
44
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY="${PROGRAMGYM_GO_PUBLIC_FALLBACK_PROXY:-${PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER}}"
45
+ fi
46
+ ;;
47
+ esac
48
+ if ! [[ "$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" =~ [^[:space:]] ]]; then
49
+ PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY=""
50
+ fi
51
+ cat > /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py <<'PROGRAMGYM_GO_TIMEOUT_SUPERVISOR_EOF'
52
+ import os
53
+ import signal
54
+ import subprocess
55
+ import sys
56
+ import time
57
+
58
+ sentinel_path, timeout_text, grace_text, proxy, *command = sys.argv[1:]
59
+ if not command:
60
+ raise SystemExit(125)
61
+ environment = os.environ.copy()
62
+ environment["GOPROXY"] = proxy
63
+ process = subprocess.Popen(command, env=environment, start_new_session=True)
64
+ try:
65
+ returncode = process.wait(timeout=float(timeout_text))
66
+ except subprocess.TimeoutExpired:
67
+ with open(sentinel_path, "w", encoding="utf-8") as sentinel:
68
+ sentinel.write("expired\n")
69
+ try:
70
+ os.killpg(process.pid, signal.SIGTERM)
71
+ except ProcessLookupError:
72
+ pass
73
+ deadline = time.monotonic() + float(grace_text)
74
+ group_alive = True
75
+ while time.monotonic() < deadline:
76
+ process.poll()
77
+ try:
78
+ os.killpg(process.pid, 0)
79
+ except ProcessLookupError:
80
+ group_alive = False
81
+ break
82
+ time.sleep(0.05)
83
+ if group_alive:
84
+ try:
85
+ os.killpg(process.pid, signal.SIGKILL)
86
+ except ProcessLookupError:
87
+ pass
88
+ process.wait()
89
+ raise SystemExit(124)
90
+ if returncode < 0:
91
+ returncode = 128 - returncode
92
+ raise SystemExit(returncode)
93
+ PROGRAMGYM_GO_TIMEOUT_SUPERVISOR_EOF
94
+ PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS="${PROGRAMGYM_GO_NEXUS_ATTEMPT_TIMEOUT_SECONDS:-90}"
95
+ if ! [[ "$PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS" =~ ^[1-9][0-9]*$ ]]; then
96
+ printf '%s\n' "download.sh: invalid PROGRAMGYM_GO_NEXUS_ATTEMPT_TIMEOUT_SECONDS=${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}" >&2
97
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
98
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
99
+ return 1
100
+ else
101
+ exit 1
102
+ fi
103
+ fi
104
+ if ! command -v python3 >/dev/null 2>&1; then
105
+ printf '%s\n' 'download.sh: python3 is required for bounded Nexus Go downloads' >&2
106
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
107
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
108
+ return 1
109
+ else
110
+ exit 1
111
+ fi
112
+ fi
113
+ _programgym_go_with_nexus_timeout() {
114
+ local programgym_go_rc
115
+ local programgym_go_timeout_sentinel
116
+ if ! programgym_go_timeout_sentinel="$(mktemp "${TMPDIR:-/tmp}/programgym-go-timeout.XXXXXX")"; then
117
+ return 1
118
+ fi
119
+ if python3 /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py "$programgym_go_timeout_sentinel" "$PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS" "5" "$PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY" "$@"; then
120
+ programgym_go_rc=0
121
+ else
122
+ programgym_go_rc=$?
123
+ fi
124
+ if [ ! -s "$programgym_go_timeout_sentinel" ]; then
125
+ rm -f "$programgym_go_timeout_sentinel"
126
+ return "$programgym_go_rc"
127
+ fi
128
+ rm -f "$programgym_go_timeout_sentinel"
129
+ if [ -z "$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" ]; then
130
+ printf '%s\n' "download.sh: primary Go request exceeded ${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}s; GOPROXY has no explicit non-empty fallback remainder" >&2
131
+ return "$programgym_go_rc"
132
+ fi
133
+ printf '%s\n' "download.sh: Nexus-first Go request exceeded ${PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS}s; retrying with GOPROXY=${PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY}" >&2
134
+ env GOPROXY="$PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY" "$@"
135
+ }
136
+ PROGRAMGYM_GO_BASE_GOROOT="$(GOTOOLCHAIN=local go env GOROOT)"
137
+ if ! PROGRAMGYM_GO_RESOLVED_GOROOT="$(cd /workspace/.programgym_build_env/go-prefetch && _programgym_go_with_nexus_timeout env GOTOOLCHAIN=auto go env GOROOT)"; then
138
+ printf '%s\n' 'download.sh: Go toolchain resolution failed' >&2
139
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
140
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
141
+ return 1
142
+ else
143
+ exit 1
144
+ fi
145
+ fi
146
+ if [ "$PROGRAMGYM_GO_RESOLVED_GOROOT" != "$PROGRAMGYM_GO_BASE_GOROOT" ]; then
147
+ PROGRAMGYM_GO_TOOLCHAIN_ROOT=/opt/programgym-go-toolchain
148
+ mkdir -p "$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
149
+ cp -a "$PROGRAMGYM_GO_RESOLVED_GOROOT/." "$PROGRAMGYM_GO_TOOLCHAIN_ROOT/"
150
+ export GOROOT="$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
151
+ else
152
+ export GOROOT="$PROGRAMGYM_GO_BASE_GOROOT"
153
+ fi
154
+ export PATH="$GOROOT/bin:$PATH"
155
+ export GOTOOLCHAIN=local
156
+ if ! (cd /workspace/.programgym_build_env/go-prefetch && _programgym_go_with_nexus_timeout go mod download -modfile=/workspace/.programgym_build_env/go-prefetch/go.mod all); then
157
+ printf '%s\n' 'download.sh: Go dependency prefetch failed' >&2
158
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
159
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
160
+ return 1
161
+ else
162
+ exit 1
163
+ fi
164
+ fi
165
+ rm -f /workspace/.programgym_build_env/go-prefetch/.programgym_go_timeout_supervisor.py
166
+ unset -f _programgym_go_with_nexus_timeout
167
+ unset PROGRAMGYM_INTERNAL_GO_PRIMARY_PROXY
168
+ unset PROGRAMGYM_INTERNAL_GO_FALLBACK_PROXY
169
+ unset PROGRAMGYM_INTERNAL_GO_FIRST_PROXY
170
+ unset PROGRAMGYM_INTERNAL_GO_PROXY_REMAINDER
171
+ unset PROGRAMGYM_INTERNAL_GO_NEXUS_TIMEOUT_SECONDS
contribsys--faktory_worker_go.dd/tests/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1bf246f11c2cec8cc86ab9700914c2327be4a6921c917b1836fdb59216131078
3
+ size 7148030
contribsys--faktory_worker_go.dd/tests/programgym-go.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39042a078ea9ceebe3ecda4a7188f0f5b96e14a071d27923ba7f40b456e85ae3
3
+ size 59908810
contribsys--faktory_worker_go.dd/tests/programgym_evaluator.py ADDED
@@ -0,0 +1,1201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """In-place ProgramGym evaluator.
3
+
4
+ Mirrors ProgramGym's ``Evaluator`` pipeline as closely as a single-container,
5
+ no-Docker-in-Docker host allows. Run from ``tests/test.sh`` inside the agent's
6
+ cleanroom container after Harbor flips the verifier-phase network policy.
7
+
8
+ Differences from ``programgym.eval.eval.Evaluator`` that are structural to
9
+ running in one container:
10
+
11
+ * No fresh container per branch. ``snapshot_workspace`` / ``restore_workspace``
12
+ copy a post-compile workspace snapshot to a temp directory and restore it
13
+ before each branch; ``cleanup_lingering_processes`` kills leftover branch
14
+ processes between attempts to approximate the fresh-container boundary.
15
+ * No ``docker commit``. The post-compile workspace snapshot serves the same
16
+ role as the committed image upstream.
17
+ * Hidden test blobs are fetched on demand from HuggingFace via
18
+ ``huggingface_hub.snapshot_download`` (matching ``programgym.utils.blob_store``)
19
+ rather than being pre-staged into ``/tests/blobs/``. Override with
20
+ ``PROGRAMGYM_BLOB_DIR`` for offline reruns.
21
+
22
+ Everything else (eval_clean_hashes scrub, deterministic synthetic git seed,
23
+ ``compile.sh`` then stash + hash the executable, best-effort
24
+ ``pytest-rerunfailures``, per-branch test-tar overlay, executable hash
25
+ ``--max-worker-restart=4``, xdist worker-crash retry with serial fallback,
26
+ best-of-N attempt selection, active vs ignored test bookkeeping, scoring) is
27
+ preserved.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import hashlib
33
+ import json
34
+ import os
35
+ import re
36
+ import shlex
37
+ import shutil
38
+ import signal
39
+ import subprocess
40
+ import tempfile
41
+ import time
42
+ import traceback
43
+ import xml.etree.ElementTree as ET
44
+ from pathlib import Path
45
+ from typing import Any
46
+
47
+ WORKSPACE = Path(os.environ.get("PROGRAMGYM_WORKSPACE", "/workspace"))
48
+ STASHED_EXECUTABLE = Path("/opt/programgym-stashed-executable-do-not-modify")
49
+ METADATA_PATH = Path(
50
+ os.environ.get("PROGRAMGYM_METADATA", "/tests/programgym_task.json")
51
+ )
52
+ LOG_DIR = Path(os.environ.get("PROGRAMGYM_LOG_DIR", "/logs/verifier"))
53
+ WORKER_CRASH_PHRASE = "worker '"
54
+ XDIST_COLLAPSE_MARKERS = (
55
+ "maximum crashed workers reached",
56
+ "xdist: maximum crashed",
57
+ )
58
+
59
+ DEFAULT_HF_REPO_ID = "programgym/ProgramGym-Tests"
60
+ DEFAULT_HF_REVISION = "main"
61
+
62
+ # Oracle agent handoff files (see solution/solve.sh). Must not appear in the
63
+ # post-compile workspace snapshot or they pollute tree-scanning tests (dutree).
64
+ _ORACLE_HANDOFF_NAMES = (".programgym_oracle_reference",)
65
+
66
+ _TOOLCHAIN_BIN_DIR_CANDIDATES = (
67
+ "/usr/local/go/bin",
68
+ "/go/bin",
69
+ "/usr/local/cargo/bin",
70
+ "/root/.cargo/bin",
71
+ "/root/.ghcup/bin",
72
+ )
73
+
74
+
75
+ def toolchain_bin_dirs() -> list[str]:
76
+ """Return toolchain bin directories that exist on this image."""
77
+ candidates = list(_TOOLCHAIN_BIN_DIR_CANDIDATES)
78
+ candidates.extend(
79
+ str(path)
80
+ for path in sorted(Path("/usr/lib").glob("go-*/bin"))
81
+ if _is_accessible_dir(path)
82
+ )
83
+ seen: set[str] = set()
84
+ present: list[str] = []
85
+ for path in candidates:
86
+ if path in seen:
87
+ continue
88
+ seen.add(path)
89
+ if _is_accessible_dir(path):
90
+ present.append(path)
91
+ return present
92
+
93
+
94
+ def _is_accessible_dir(path: str | Path) -> bool:
95
+ """Return whether path is a directory without failing on protected homes."""
96
+ try:
97
+ return Path(path).is_dir()
98
+ except OSError:
99
+ return False
100
+
101
+
102
+ def bootstrap_toolchain_path() -> str:
103
+ """Prepend discovered toolchain dirs to PATH (idempotent)."""
104
+ prepend = toolchain_bin_dirs()
105
+ current_parts = [part for part in os.environ.get("PATH", "").split(":") if part]
106
+ merged: list[str] = []
107
+ for path in prepend + current_parts:
108
+ if path not in merged:
109
+ merged.append(path)
110
+ new_path = ":".join(merged)
111
+ os.environ["PATH"] = new_path
112
+ return new_path
113
+
114
+
115
+ def _bash_login_command(command: str) -> str:
116
+ """Run ``command`` under bash -lc with an explicit PATH export."""
117
+ path = bootstrap_toolchain_path()
118
+ return f"export PATH={shlex.quote(path)}; {command}"
119
+
120
+
121
+ def sha256(path: Path) -> str:
122
+ h = hashlib.sha256()
123
+ with path.open("rb") as f:
124
+ for chunk in iter(lambda: f.read(1024 * 1024), b""):
125
+ h.update(chunk)
126
+ return h.hexdigest()
127
+
128
+
129
+ def write_json(path: Path, data: dict[str, Any]) -> None:
130
+ tmp = path.with_suffix(path.suffix + ".tmp")
131
+ tmp.write_text(json.dumps(data, indent=2, sort_keys=True))
132
+ tmp.replace(path)
133
+
134
+
135
+ def _read_log_tail(path: Path | None, max_bytes: int = 65536) -> str:
136
+ if path is None or not path.exists():
137
+ return ""
138
+ data = path.read_bytes()
139
+ if len(data) <= max_bytes:
140
+ return data.decode(errors="replace")
141
+ return data[-max_bytes:].decode(errors="replace")
142
+
143
+
144
+ def _close_pipes(proc: subprocess.Popen[Any]) -> None:
145
+ for stream in (proc.stdout, proc.stderr):
146
+ if stream is not None:
147
+ try:
148
+ stream.close()
149
+ except OSError:
150
+ pass
151
+
152
+
153
+ def _terminate_process_tree(proc: subprocess.Popen[Any]) -> None:
154
+ try:
155
+ os.killpg(proc.pid, signal.SIGKILL)
156
+ except ProcessLookupError:
157
+ pass
158
+ try:
159
+ proc.kill()
160
+ except ProcessLookupError:
161
+ pass
162
+
163
+
164
+ _PKILL_PATTERNS = (
165
+ f"{WORKSPACE}/eval/",
166
+ f"{WORKSPACE}/tests/",
167
+ "tail -f",
168
+ "development.log",
169
+ " less ",
170
+ " less$",
171
+ "/less ",
172
+ )
173
+
174
+
175
+ def _pkill_aggressive() -> str:
176
+ """Best-effort kill of branch pytest/subprocess trees (Modal gVisor fallback)."""
177
+ notes: list[str] = []
178
+ workspace = str(WORKSPACE)
179
+ patterns = list(_PKILL_PATTERNS) + [
180
+ f"pytest.*{workspace}",
181
+ f"xdist.*{workspace}",
182
+ ]
183
+ for pattern in patterns:
184
+ result = subprocess.run(
185
+ ["pkill", "-9", "-f", pattern],
186
+ capture_output=True,
187
+ text=True,
188
+ )
189
+ notes.append(f"pkill -9 -f {pattern!r}: rc={result.returncode}")
190
+ return "\n".join(notes)
191
+
192
+
193
+ def run_step(
194
+ command: str,
195
+ cwd: Path,
196
+ *,
197
+ timeout: int,
198
+ env: dict[str, str] | None = None,
199
+ step: str,
200
+ accept_failure: bool = False,
201
+ log_output: bool | None = None,
202
+ max_output_bytes: int = 65536,
203
+ ) -> dict[str, Any]:
204
+ if log_output is None:
205
+ log_output = step == "run_tests" or timeout >= 60
206
+
207
+ started = time.monotonic()
208
+ stdout_path: Path | None = None
209
+ stderr_path: Path | None = None
210
+ stdout_f = None
211
+ stderr_f = None
212
+
213
+ if log_output:
214
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
215
+ log_id = f"{step}-{int(started * 1000)}"
216
+ stdout_path = LOG_DIR / f"run-step-{log_id}.stdout.log"
217
+ stderr_path = LOG_DIR / f"run-step-{log_id}.stderr.log"
218
+ stdout_f = stdout_path.open("w", encoding="utf-8")
219
+ stderr_f = stderr_path.open("w", encoding="utf-8")
220
+ popen_stdout: Any = stdout_f
221
+ popen_stderr: Any = stderr_f
222
+ else:
223
+ popen_stdout = subprocess.PIPE
224
+ popen_stderr = subprocess.PIPE
225
+
226
+ proc = subprocess.Popen(
227
+ ["bash", "-lc", _bash_login_command(command)],
228
+ cwd=cwd,
229
+ env={**os.environ, **(env or {})},
230
+ stdout=popen_stdout,
231
+ stderr=popen_stderr,
232
+ start_new_session=True,
233
+ text=True,
234
+ )
235
+ timed_out = False
236
+ stdout = ""
237
+ stderr = ""
238
+ try:
239
+ if log_output:
240
+ proc.wait(timeout=timeout)
241
+ else:
242
+ stdout, stderr = proc.communicate(timeout=timeout)
243
+ except subprocess.TimeoutExpired:
244
+ timed_out = True
245
+ _terminate_process_tree(proc)
246
+ cleanup_lingering_processes(aggressive=True)
247
+ try:
248
+ proc.wait(timeout=5)
249
+ except subprocess.TimeoutExpired:
250
+ proc.kill()
251
+ if not log_output:
252
+ _close_pipes(proc)
253
+ finally:
254
+ if stdout_f is not None:
255
+ stdout_f.close()
256
+ if stderr_f is not None:
257
+ stderr_f.close()
258
+
259
+ if timed_out:
260
+ if log_output:
261
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
262
+ stderr_path, max_output_bytes
263
+ )
264
+ else:
265
+ output = ""
266
+ entry = {
267
+ "step": step,
268
+ "command": command,
269
+ "wall_time": time.monotonic() - started,
270
+ "output": output,
271
+ "returncode": 124,
272
+ "exception_info": f"timed out after {timeout}s",
273
+ }
274
+ else:
275
+ if log_output:
276
+ output = _read_log_tail(stdout_path, max_output_bytes) + _read_log_tail(
277
+ stderr_path, max_output_bytes
278
+ )
279
+ else:
280
+ output = stdout + stderr
281
+ entry = {
282
+ "step": step,
283
+ "command": command,
284
+ "wall_time": time.monotonic() - started,
285
+ "output": output,
286
+ "returncode": proc.returncode,
287
+ "exception_info": "",
288
+ }
289
+ if entry["returncode"] and not accept_failure:
290
+ raise RuntimeError(
291
+ f"{step} failed: {entry['exception_info'] or entry['output']}"
292
+ )
293
+ return entry
294
+
295
+
296
+ def cleanup_lingering_processes(*, aggressive: bool = False) -> dict[str, Any]:
297
+ started = time.monotonic()
298
+ patterns = [
299
+ str(WORKSPACE / "executable"),
300
+ f"{WORKSPACE}/eval/",
301
+ f"{WORKSPACE}/tests/",
302
+ # lazygit --logs/-l tests spawn `tail -f` outside /workspace/.
303
+ "tail -f",
304
+ "development.log",
305
+ ]
306
+ killed: list[int] = []
307
+ proc_root = Path("/proc")
308
+ proc_available = proc_root.exists()
309
+ if proc_available:
310
+ for proc_dir in proc_root.iterdir():
311
+ if not proc_dir.name.isdigit():
312
+ continue
313
+ pid = int(proc_dir.name)
314
+ if pid in {os.getpid(), os.getppid()}:
315
+ continue
316
+ try:
317
+ raw = (proc_dir / "cmdline").read_bytes()
318
+ except (FileNotFoundError, PermissionError, ProcessLookupError):
319
+ continue
320
+ cmdline = raw.replace(b"\0", b" ").decode(errors="replace")
321
+ if not any(pattern in cmdline for pattern in patterns):
322
+ continue
323
+ try:
324
+ os.kill(pid, signal.SIGKILL)
325
+ except (PermissionError, ProcessLookupError):
326
+ continue
327
+ killed.append(pid)
328
+ pkill_output = ""
329
+ if aggressive or not proc_available:
330
+ pkill_output = _pkill_aggressive()
331
+ output_parts = []
332
+ if killed:
333
+ output_parts.append("\n".join(str(pid) for pid in killed))
334
+ if pkill_output:
335
+ output_parts.append(pkill_output)
336
+ return {
337
+ "step": "cleanup_lingering_processes",
338
+ "command": "kill leftover branch processes referencing the workspace",
339
+ "wall_time": time.monotonic() - started,
340
+ "output": "\n".join(output_parts),
341
+ "returncode": 0,
342
+ "exception_info": "",
343
+ }
344
+
345
+
346
+ def extract_trusted_blob(tar_path: Path, dest: Path) -> None:
347
+ import tarfile
348
+
349
+ with tarfile.open(tar_path, "r:gz") as tf:
350
+ try:
351
+ tf.extractall(dest, filter="fully_trusted")
352
+ except TypeError:
353
+ tf.extractall(dest)
354
+
355
+
356
+ def find_results_xml() -> Path | None:
357
+ """Return the junit xml path if pytest wrote one."""
358
+ for candidate in (WORKSPACE / "eval" / "results.xml", WORKSPACE / "results.xml"):
359
+ if candidate.exists():
360
+ return candidate
361
+ return None
362
+
363
+
364
+ def remove_oracle_handoff_artifacts() -> list[str]:
365
+ """Drop oracle-agent handoff files from /workspace before snapshot/restore."""
366
+ removed: list[str] = []
367
+ for name in _ORACLE_HANDOFF_NAMES:
368
+ path = WORKSPACE / name
369
+ if path.exists():
370
+ if path.is_dir():
371
+ shutil.rmtree(path)
372
+ else:
373
+ path.unlink()
374
+ removed.append(name)
375
+ return removed
376
+
377
+
378
+ def _remove_tree(path: Path) -> None:
379
+ """Remove a file or directory tree, with a shell fallback for overlay races."""
380
+ if path.is_symlink() or path.is_file():
381
+ path.unlink(missing_ok=True)
382
+ return
383
+ if not path.is_dir():
384
+ path.unlink(missing_ok=True)
385
+ return
386
+ for attempt in range(3):
387
+ try:
388
+ shutil.rmtree(path)
389
+ if not path.exists():
390
+ return
391
+ except OSError:
392
+ if attempt == 2:
393
+ run_step(
394
+ f"rm -rf {shlex.quote(str(path))}",
395
+ path.parent,
396
+ timeout=120,
397
+ step="clear_workspace_fallback",
398
+ accept_failure=True,
399
+ )
400
+ if not path.exists():
401
+ return
402
+ raise
403
+
404
+
405
+ def ensure_workspace_dir() -> None:
406
+ """Guarantee WORKSPACE exists as a writable directory (not a symlink/file)."""
407
+ if WORKSPACE.exists() and not WORKSPACE.is_dir():
408
+ if WORKSPACE.is_symlink() or WORKSPACE.is_file():
409
+ WORKSPACE.unlink()
410
+ else:
411
+ shutil.rmtree(WORKSPACE)
412
+ WORKSPACE.mkdir(parents=True, exist_ok=True)
413
+
414
+
415
+ def clear_workspace() -> None:
416
+ ensure_workspace_dir()
417
+ for path in list(WORKSPACE.iterdir()):
418
+ _remove_tree(path)
419
+
420
+
421
+ def restore_reference_executable() -> None:
422
+ """Write the stashed reference binary into /workspace after a branch overlay.
423
+
424
+ Branch blobs may ship ``executable`` as a dangling symlink into
425
+ ``target/release/...``; ``shutil.copy2`` would follow it and raise
426
+ ``FileNotFoundError``. Drop whatever the blob left and copy the stashed
427
+ reference as a regular file.
428
+ """
429
+ ensure_workspace_dir()
430
+ if not STASHED_EXECUTABLE.is_file():
431
+ raise FileNotFoundError(
432
+ f"missing stashed reference executable at {STASHED_EXECUTABLE}"
433
+ )
434
+ dest = WORKSPACE / "executable"
435
+ if dest.exists() or dest.is_symlink():
436
+ if dest.is_dir():
437
+ shutil.rmtree(dest)
438
+ else:
439
+ dest.unlink(missing_ok=True)
440
+ shutil.copy2(STASHED_EXECUTABLE, dest)
441
+ dest.chmod(0o755)
442
+
443
+
444
+ def snapshot_workspace(dest: Path) -> None:
445
+ if dest.exists():
446
+ shutil.rmtree(dest)
447
+ shutil.copytree(WORKSPACE, dest, symlinks=True)
448
+
449
+
450
+ def restore_workspace(source: Path) -> None:
451
+ clear_workspace()
452
+ shutil.copytree(source, WORKSPACE, dirs_exist_ok=True, symlinks=True)
453
+ ensure_workspace_dir()
454
+
455
+
456
+ def remove_hashed_files(root: Path, hashes: set[str]) -> list[str]:
457
+ removed: list[str] = []
458
+ for path in root.rglob("*"):
459
+ if path.is_file() and not path.is_symlink():
460
+ try:
461
+ if sha256(path) in hashes:
462
+ path.unlink()
463
+ removed.append(str(path.relative_to(root)))
464
+ except OSError:
465
+ continue
466
+ return removed
467
+
468
+
469
+ def branch_tests(branch_info: dict[str, Any]) -> list[str]:
470
+ ignored = {
471
+ item["name"] for item in branch_info.get("ignored_tests", []) if "name" in item
472
+ }
473
+ return [name for name in branch_info.get("tests", []) if name not in ignored]
474
+
475
+
476
+ def ignored_tests(metadata: dict[str, Any]) -> set[str]:
477
+ result: set[str] = set()
478
+ for branch, info in metadata.get("branches", {}).items():
479
+ result.update(
480
+ f"{branch}/{item['name']}"
481
+ for item in info.get("ignored_tests", [])
482
+ if "name" in item
483
+ )
484
+ return result
485
+
486
+
487
+ def active_tests(metadata: dict[str, Any]) -> set[str]:
488
+ active: set[str] = set()
489
+ for branch, info in metadata.get("branches", {}).items():
490
+ if info.get("ignored"):
491
+ continue
492
+ ignored = {
493
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
494
+ }
495
+ active.update(
496
+ f"{branch}/{name}" for name in info.get("tests", []) if name not in ignored
497
+ )
498
+ return active
499
+
500
+
501
+ def inject_not_run(
502
+ result: dict[str, Any], branch: str, tests: list[str], error_code: str
503
+ ) -> None:
504
+ result["test_results"].extend(
505
+ {
506
+ "name": name,
507
+ "branch": branch,
508
+ "status": "not_run",
509
+ "extra": {"error_code": error_code},
510
+ }
511
+ for name in tests
512
+ )
513
+
514
+
515
+ def testcase_name(case: ET.Element) -> str:
516
+ classname = case.attrib.get("classname", "")
517
+ name = case.attrib.get("name", "")
518
+ return f"{classname}.{name}" if classname else name
519
+
520
+
521
+ # Only these tags under <testcase> represent a result. <system-out> /
522
+ # <system-err> are stdout/stderr captures and must not be treated as results
523
+ # (a leading <system-out> followed by <failure> would otherwise be classified
524
+ # as a stdout-only "passed").
525
+ JUNIT_RESULT_TAGS = {"skipped", "failure", "error"}
526
+
527
+
528
+ def parse_junit(
529
+ raw_xml: str, branch: str, expected: list[str], ignored: set[str]
530
+ ) -> tuple[list[dict[str, Any]], list[str]]:
531
+ root = ET.fromstring(raw_xml)
532
+ got: set[str] = set()
533
+ results: list[dict[str, Any]] = []
534
+ for case in root.iter("testcase"):
535
+ name = testcase_name(case)
536
+ got.add(name)
537
+ extra: dict[str, Any] = {}
538
+ if "time" in case.attrib:
539
+ try:
540
+ extra["time"] = float(case.attrib["time"])
541
+ except ValueError:
542
+ extra["time"] = case.attrib["time"]
543
+ result_children = [c for c in case if c.tag in JUNIT_RESULT_TAGS]
544
+ # Collapse duplicate same-tag result children. Pytest's
545
+ # "pytest.internal" pseudo-test sometimes emits two identical <error>
546
+ # entries; treating that as a system_error would over-flag a real
547
+ # single failure. Mirrors upstream eval.py:816-820.
548
+ if len(result_children) > 1 and len({c.tag for c in result_children}) == 1:
549
+ result_children = [result_children[0]]
550
+ if not result_children:
551
+ status = "passed"
552
+ elif len(result_children) != 1:
553
+ status = "system_error"
554
+ extra["error_details"] = (
555
+ f"Expected 1 result for {name}, got {len(result_children)}: "
556
+ f"{[c.tag for c in result_children]}"
557
+ )
558
+ else:
559
+ first = result_children[0]
560
+ status = first.tag # "skipped" | "failure" | "error"
561
+ extra["message"] = first.attrib.get("message") or ""
562
+ if first.text:
563
+ extra["text"] = first.text
564
+ results.append(
565
+ {"name": name, "branch": branch, "status": status, "extra": extra}
566
+ )
567
+
568
+ active_expected = [name for name in expected if name not in ignored]
569
+ missing = [name for name in active_expected if name not in got]
570
+ results.extend(
571
+ {
572
+ "name": name,
573
+ "branch": branch,
574
+ "status": "not_run",
575
+ "extra": {"error_code": "missing_from_junit_xml"},
576
+ }
577
+ for name in missing
578
+ )
579
+ unexpected = got - set(expected) - ignored
580
+ warnings = (
581
+ [f"Branch {branch}: {len(unexpected)} test(s) in JUnit XML not in tests.json"]
582
+ if unexpected
583
+ else []
584
+ )
585
+ return results, warnings
586
+
587
+
588
+ def count_worker_crashes(raw_xml: str) -> int:
589
+ if WORKER_CRASH_PHRASE not in raw_xml:
590
+ return 0
591
+ try:
592
+ root = ET.fromstring(raw_xml)
593
+ except ET.ParseError:
594
+ return 0
595
+ crashes = 0
596
+ for case in root.iter("testcase"):
597
+ for child in case:
598
+ text = (child.get("message") or "") + " " + (child.text or "")
599
+ if (
600
+ child.tag in {"error", "failure"}
601
+ and WORKER_CRASH_PHRASE in text
602
+ and "crashed" in text
603
+ ):
604
+ crashes += 1
605
+ break
606
+ return crashes
607
+
608
+
609
+ def run_output_indicates_xdist_collapse(output: str) -> bool:
610
+ lower = output.lower()
611
+ return any(marker in lower for marker in XDIST_COLLAPSE_MARKERS)
612
+
613
+
614
+ def count_junit_failures(raw_xml: str) -> int:
615
+ try:
616
+ root = ET.fromstring(raw_xml)
617
+ except ET.ParseError:
618
+ return 0
619
+ failures = 0
620
+ for case in root.iter("testcase"):
621
+ for child in case:
622
+ if child.tag in {"failure", "error"}:
623
+ failures += 1
624
+ break
625
+ return failures
626
+
627
+
628
+ def count_junit_passed(raw_xml: str) -> int:
629
+ try:
630
+ root = ET.fromstring(raw_xml)
631
+ except ET.ParseError:
632
+ return 0
633
+ passed = 0
634
+ for case in root.iter("testcase"):
635
+ if not any(child.tag in JUNIT_RESULT_TAGS for child in case):
636
+ passed += 1
637
+ return passed
638
+
639
+
640
+ def branch_attempt_metrics(
641
+ raw_xml: str, *, run_output: str, expected_tests: int
642
+ ) -> tuple[int, int, int, int]:
643
+ """Return (crashes, n_testcases, failures, missing_from_xml)."""
644
+ crashes = count_worker_crashes(raw_xml)
645
+ if run_output_indicates_xdist_collapse(run_output):
646
+ crashes = max(crashes, 1)
647
+ n_tests = count_testcases(raw_xml)
648
+ failures = count_junit_failures(raw_xml)
649
+ missing = max(0, expected_tests - n_tests)
650
+ return crashes, n_tests, failures, missing
651
+
652
+
653
+ def needs_serial_retry(
654
+ *,
655
+ serial: bool,
656
+ crashes: int,
657
+ missing: int,
658
+ failures: int,
659
+ n_tests: int,
660
+ expected_tests: int,
661
+ run_output: str,
662
+ ) -> bool:
663
+ if serial:
664
+ return False
665
+ high_failure_rate = (
666
+ expected_tests > 0 and n_tests >= expected_tests and failures / n_tests >= 0.8
667
+ )
668
+ return (
669
+ crashes > 0
670
+ or missing > 0
671
+ or high_failure_rate
672
+ or run_output_indicates_xdist_collapse(run_output)
673
+ )
674
+
675
+
676
+ def count_testcases(raw_xml: str) -> int:
677
+ try:
678
+ return sum(1 for _ in ET.fromstring(raw_xml).iter("testcase"))
679
+ except ET.ParseError:
680
+ return 0
681
+
682
+
683
+ def scored_results(
684
+ result: dict[str, Any], metadata: dict[str, Any]
685
+ ) -> list[dict[str, Any]]:
686
+ active = active_tests(metadata)
687
+ by_key = {
688
+ f"{test['branch']}/{test['name']}": test
689
+ for test in result["test_results"]
690
+ if f"{test['branch']}/{test['name']}" in active
691
+ }
692
+ return [
693
+ by_key.get(
694
+ key,
695
+ {
696
+ "branch": key.split("/", 1)[0],
697
+ "name": key.split("/", 1)[1],
698
+ "status": "not_run",
699
+ "extra": {"error_code": "missing_from_results"},
700
+ },
701
+ )
702
+ for key in sorted(active)
703
+ ]
704
+
705
+
706
+ def summarize(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
707
+ scored = scored_results(result, metadata)
708
+ n_passed = sum(t["status"] == "passed" for t in scored)
709
+ n_tests = len(scored)
710
+ pass_rate = n_passed / n_tests if n_tests else 0.0
711
+ # Multi-key reward: Harbor's default Mean aggregates each key independently
712
+ # (see harbor.metrics.base.aggregate_reward_dicts), so mean("resolved") is
713
+ # the proportion of tasks scoring a perfect pass-rate and mean of
714
+ # "almost_resolved" is the proportion scoring >= 0.95. "reward" stays the
715
+ # per-task pass-rate whose mean is the overall mean reward.
716
+ return {
717
+ "reward": pass_rate,
718
+ "resolved": 1.0 if pass_rate >= 1.0 else 0.0,
719
+ "almost_resolved": 1.0 if pass_rate >= 0.95 else 0.0,
720
+ }
721
+
722
+
723
+ def diagnostics(result: dict[str, Any], metadata: dict[str, Any]) -> dict[str, Any]:
724
+ scored = scored_results(result, metadata)
725
+ n_passed = sum(t["status"] == "passed" for t in scored)
726
+ n_tests = len(scored)
727
+ pass_rate = n_passed / n_tests if n_tests else 0.0
728
+ return {
729
+ "pass_rate": pass_rate,
730
+ "resolved": int(
731
+ bool(
732
+ n_tests
733
+ and n_passed == n_tests
734
+ and not result["test_branch_errors"]
735
+ and not result["error_code"]
736
+ )
737
+ ),
738
+ "n_passed": n_passed,
739
+ "n_tests": n_tests,
740
+ "n_branch_errors": len(result["test_branch_errors"]),
741
+ "infra_error": int(bool(result["error_code"] or result["test_branch_errors"])),
742
+ "executable_hash_present": int(bool(result.get("executable_hash"))),
743
+ }
744
+
745
+
746
+ def use_script_pty() -> bool:
747
+ return os.environ.get("PROGRAMGYM_SCRIPT_PTY", "").strip() == "1"
748
+
749
+
750
+ def script_pty_available() -> bool:
751
+ return shutil.which("script") is not None
752
+
753
+
754
+ def branch_env(
755
+ *,
756
+ serial: bool,
757
+ has_rerunfailures: bool,
758
+ extras: dict[str, str] | None = None,
759
+ ) -> dict[str, str]:
760
+ addopts = ["--max-worker-restart=4"]
761
+ # A serial fallback is already a complete second execution. Re-running each
762
+ # failing test two more times makes large, failure-heavy suites prohibitively
763
+ # slow and adds little signal.
764
+ if has_rerunfailures and not serial:
765
+ addopts.extend(["--reruns=2", "--reruns-delay=1"])
766
+ env = {
767
+ "PYTEST_ADDOPTS": " ".join(addopts),
768
+ # Match upstream non-TTY regression environments (dirble log format, etc.).
769
+ "NO_COLOR": "1",
770
+ "TERM": "dumb",
771
+ "CLICOLOR": "0",
772
+ "CLICOLOR_FORCE": "0",
773
+ "COLORTERM": "",
774
+ }
775
+ if extras:
776
+ env.update(extras)
777
+ xdist_workers = os.environ.get("PROGRAMGYM_XDIST_WORKERS")
778
+ if serial:
779
+ xdist_workers = "1"
780
+ if xdist_workers:
781
+ env["PYTEST_XDIST_AUTO_NUM_WORKERS"] = xdist_workers
782
+ return env
783
+
784
+
785
+ _SERIAL_RUN_SH = ".programgym_run_serial.sh"
786
+ # ``eval/run.sh`` usually passes ``-n auto`` on the command line, which overrides
787
+ # ``PYTEST_ADDOPTS``. Rewrite to ``-n 0`` in a verifier-local copy for retries.
788
+ _RUN_SH_XDIST_RE = re.compile(r"-n\s*(?:auto|\d+)")
789
+
790
+
791
+ def prepare_serial_run_sh(run_sh: Path) -> Path:
792
+ """Write a serial-only copy of ``eval/run.sh`` with xdist disabled."""
793
+ serial_sh = run_sh.with_name(_SERIAL_RUN_SH)
794
+ patched = _RUN_SH_XDIST_RE.sub("-n 0", run_sh.read_text())
795
+ serial_sh.write_text(patched)
796
+ serial_sh.chmod(0o755)
797
+ return serial_sh
798
+
799
+
800
+ def run_tests_command(*, serial: bool) -> str:
801
+ if serial:
802
+ inner = f"chmod +x ./eval/{_SERIAL_RUN_SH} && ./eval/{_SERIAL_RUN_SH}"
803
+ else:
804
+ inner = "chmod +x ./eval/run.sh && ./eval/run.sh"
805
+ if use_script_pty() and script_pty_available():
806
+ return f"script -q -c {shlex.quote(inner)} /dev/null"
807
+ return inner
808
+
809
+
810
+ BAKED_BLOB_DIR = Path(os.environ.get("PROGRAMGYM_BAKED_BLOB_DIR", "/tests/blobs"))
811
+
812
+
813
+ def resolve_blob_dir(instance_id: str, metadata: dict[str, Any]) -> Path:
814
+ """Locate the per-instance blob directory.
815
+
816
+ Resolution order:
817
+
818
+ 1. ``/tests/blobs/`` if pre-fetched into the task at generation time
819
+ (``programgym-adapter --download-blobs``). Verifier-only mount, so
820
+ agent never sees these.
821
+ 2. ``PROGRAMGYM_BLOB_DIR`` env override pointing at an HF-cache-shaped
822
+ tree on disk (``<dir>/<instance_id>/tests/<branch>.tar.gz``). Useful
823
+ for offline reruns sharing a cache across many tasks.
824
+ 3. ``huggingface_hub.snapshot_download`` from
825
+ ``programgym/ProgramGym-Tests`` (default repo, ``main`` revision).
826
+
827
+ The returned directory contains ``tests/<branch>.tar.gz`` per active
828
+ branch — same shape as ``programgym/ProgramGym-Tests/<instance_id>/``
829
+ on HF.
830
+ """
831
+ if BAKED_BLOB_DIR.exists() and (BAKED_BLOB_DIR / "tests").exists():
832
+ return BAKED_BLOB_DIR
833
+
834
+ local = os.environ.get("PROGRAMGYM_BLOB_DIR", "").strip()
835
+ if local:
836
+ candidate = Path(local) / instance_id
837
+ if candidate.exists():
838
+ return candidate
839
+ raise FileNotFoundError(
840
+ f"PROGRAMGYM_BLOB_DIR set but {candidate} does not exist"
841
+ )
842
+
843
+ repo_id = os.environ.get("PROGRAMGYM_HF_REPO") or metadata.get(
844
+ "hf_repo_id", DEFAULT_HF_REPO_ID
845
+ )
846
+ revision = os.environ.get("PROGRAMGYM_HF_REVISION") or metadata.get(
847
+ "hf_revision", DEFAULT_HF_REVISION
848
+ )
849
+
850
+ from huggingface_hub import snapshot_download
851
+
852
+ cache_root = Path(
853
+ snapshot_download(
854
+ repo_id,
855
+ repo_type="dataset",
856
+ revision=revision,
857
+ allow_patterns=f"{instance_id}/**",
858
+ )
859
+ )
860
+ blob_dir = cache_root / instance_id
861
+ if not blob_dir.exists():
862
+ raise FileNotFoundError(
863
+ f"HF blob directory missing for {instance_id} at {blob_dir}"
864
+ )
865
+ return blob_dir
866
+
867
+
868
+ def evaluate(metadata: dict[str, Any]) -> dict[str, Any]:
869
+ bootstrap_toolchain_path()
870
+ branches = metadata.get("branches", {})
871
+ active_branch_items = [
872
+ (name, info) for name, info in branches.items() if not info.get("ignored")
873
+ ]
874
+ result: dict[str, Any] = {
875
+ "test_results": [],
876
+ "error_code": None,
877
+ "error_details": None,
878
+ "log": [],
879
+ "solution_branch": "submission",
880
+ "test_branches": [name for name, _ in active_branch_items],
881
+ "test_branch_errors": {},
882
+ "executable_hash": None,
883
+ "warnings": [],
884
+ }
885
+
886
+ instance_id = metadata["instance_id"]
887
+
888
+ compile_timeout = int(os.environ.get("PROGRAMGYM_COMPILE_TIMEOUT", "900"))
889
+ branch_timeout = int(os.environ.get("PROGRAMGYM_BRANCH_TIMEOUT", "3600"))
890
+
891
+ def fail_all(error_code: str, details: str) -> dict[str, Any]:
892
+ result["error_code"] = error_code
893
+ result["error_details"] = details
894
+ for branch, info in active_branch_items:
895
+ inject_not_run(result, branch, branch_tests(info), error_code)
896
+ return result
897
+
898
+ with tempfile.TemporaryDirectory(prefix="programgym-eval-") as tmp:
899
+ compiled_snapshot = Path(tmp) / "compiled"
900
+
901
+ started = time.monotonic()
902
+ removed = remove_hashed_files(
903
+ WORKSPACE, set(metadata.get("eval_clean_hashes", []))
904
+ )
905
+ result["log"].append(
906
+ {
907
+ "step": "remove_hashed_files",
908
+ "command": "remove files matching eval_clean_hashes",
909
+ "wall_time": time.monotonic() - started,
910
+ "output": "".join(f"removed '{path}'\n" for path in removed),
911
+ "returncode": 0,
912
+ "exception_info": "",
913
+ }
914
+ )
915
+
916
+ compile_sh = WORKSPACE / "compile.sh"
917
+ if not compile_sh.exists():
918
+ return fail_all(
919
+ "missing_compile_sh", "submission did not contain compile.sh"
920
+ )
921
+
922
+ seed = (
923
+ "if [ ! -d .git ]; then "
924
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
925
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
926
+ "git -c init.defaultBranch=gold init -q && "
927
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false add -A && "
928
+ "GIT_AUTHOR_DATE='2000-01-01T00:00:00Z' "
929
+ "GIT_COMMITTER_DATE='2000-01-01T00:00:00Z' "
930
+ "git -c user.email=gold@local -c user.name=gold -c commit.gpgsign=false commit -q --allow-empty -m gold; "
931
+ "fi"
932
+ )
933
+ try:
934
+ result["log"].append(
935
+ run_step(seed, WORKSPACE, timeout=300, step="seed_git")
936
+ )
937
+ compile_log = run_step(
938
+ "chmod +x ./compile.sh && ./compile.sh",
939
+ WORKSPACE,
940
+ timeout=compile_timeout,
941
+ step="compile",
942
+ accept_failure=True,
943
+ )
944
+ result["log"].append(compile_log)
945
+ if compile_log["returncode"]:
946
+ return fail_all("compile_failed", compile_log["output"])
947
+ executable = WORKSPACE / "executable"
948
+ if not executable.exists():
949
+ return fail_all(
950
+ "missing_executable",
951
+ "compile.sh completed but did not create ./executable",
952
+ )
953
+ STASHED_EXECUTABLE.parent.mkdir(parents=True, exist_ok=True)
954
+ # `move` (not copy) so /workspace doesn't keep a parallel copy of
955
+ # the agent's executable during the stash→restore window. Mirrors
956
+ # upstream `mv ./executable {STASHED}` (eval.py:472).
957
+ shutil.move(str(executable), STASHED_EXECUTABLE)
958
+ result["executable_hash"] = sha256(STASHED_EXECUTABLE)
959
+ result["log"].append(
960
+ run_step(
961
+ "pip3 install -q --disable-pip-version-check pytest-rerunfailures",
962
+ WORKSPACE,
963
+ timeout=120,
964
+ step="install_rerunfailures",
965
+ accept_failure=True,
966
+ )
967
+ )
968
+ has_rerunfailures = result["log"][-1]["returncode"] == 0
969
+ handoff_removed = remove_oracle_handoff_artifacts()
970
+ if handoff_removed:
971
+ result["log"].append(
972
+ {
973
+ "step": "remove_oracle_handoff",
974
+ "command": "remove oracle handoff artifacts from workspace",
975
+ "wall_time": 0.0,
976
+ "output": "".join(
977
+ f"removed '{name}'\n" for name in handoff_removed
978
+ ),
979
+ "returncode": 0,
980
+ "exception_info": "",
981
+ }
982
+ )
983
+ snapshot_workspace(compiled_snapshot)
984
+ except Exception as exc:
985
+ return fail_all(type(exc).__name__, str(exc))
986
+
987
+ try:
988
+ blob_dir = resolve_blob_dir(instance_id, metadata)
989
+ except Exception as exc:
990
+ details = f"{type(exc).__name__}: {exc}"
991
+ for branch, info in active_branch_items:
992
+ result["test_branch_errors"][branch] = [
993
+ {
994
+ "error_code": "blob_resolution_failed",
995
+ "error_details": details,
996
+ }
997
+ ]
998
+ inject_not_run(
999
+ result, branch, branch_tests(info), "blob_resolution_failed"
1000
+ )
1001
+ return result
1002
+
1003
+ for branch, info in active_branch_items:
1004
+ tests = branch_tests(info)
1005
+ blob = blob_dir / "tests" / f"{branch}.tar.gz"
1006
+ if not blob.exists():
1007
+ result["test_branch_errors"][branch] = [
1008
+ {"error_code": "missing_test_blob", "error_details": blob.name}
1009
+ ]
1010
+ inject_not_run(result, branch, tests, "missing_test_blob")
1011
+ continue
1012
+
1013
+ best_xml = ""
1014
+ # Prefer a complete, clean XML result, then the result covering the
1015
+ # most expected tests, and only then the one with the most passes.
1016
+ # Pass-count-only ranking can retain a partial xdist result over a
1017
+ # complete serial result.
1018
+ best_quality = (-1, -1, -1)
1019
+ serial = bool(metadata.get("force_serial_branches"))
1020
+ branch_log: list[dict[str, Any]] = []
1021
+ branch_ignored = {
1022
+ item["name"] for item in info.get("ignored_tests", []) if "name" in item
1023
+ }
1024
+ n_expected = len([name for name in tests if name not in branch_ignored])
1025
+
1026
+ def merge_best_xml(raw_xml: str) -> None:
1027
+ try:
1028
+ parsed, warnings = parse_junit(
1029
+ raw_xml, branch, list(info.get("tests", [])), branch_ignored
1030
+ )
1031
+ except Exception as exc:
1032
+ result["test_branch_errors"][branch] = [
1033
+ {"error_code": "xml_parse_error", "error_details": str(exc)}
1034
+ ]
1035
+ inject_not_run(result, branch, tests, "xml_parse_error")
1036
+ else:
1037
+ result["test_results"].extend(parsed)
1038
+ result["warnings"].extend(warnings)
1039
+
1040
+ while True:
1041
+ branch_log.append(cleanup_lingering_processes())
1042
+ restore_workspace(compiled_snapshot)
1043
+ extract_trusted_blob(blob, WORKSPACE)
1044
+ restore_reference_executable()
1045
+ actual_hash = sha256(WORKSPACE / "executable")
1046
+ if actual_hash != result["executable_hash"]:
1047
+ result["test_branch_errors"][branch] = [
1048
+ {
1049
+ "error_code": "executable_hash_mismatch",
1050
+ "error_details": (
1051
+ f"expected {result['executable_hash']}, got {actual_hash}"
1052
+ ),
1053
+ }
1054
+ ]
1055
+ inject_not_run(result, branch, tests, "executable_hash_mismatch")
1056
+ break
1057
+ run_sh = WORKSPACE / "eval" / "run.sh"
1058
+ if not run_sh.exists():
1059
+ result["test_branch_errors"][branch] = [
1060
+ {
1061
+ "error_code": "missing_run_sh",
1062
+ "error_details": "eval/run.sh missing",
1063
+ }
1064
+ ]
1065
+ inject_not_run(result, branch, tests, "missing_run_sh")
1066
+ break
1067
+ # Upstream rewrites thread→signal so xdist workers fail cleanly
1068
+ # instead of os._exit(1) on timeout. That works in fresh
1069
+ # containers per branch; here we reuse one container and
1070
+ # signal timeouts leave TUI/log-watcher subprocesses alive
1071
+ # (e.g. lazygit --logs + tail -f), wedging pytest for up to
1072
+ # branch_timeout. Keep the blob's thread method and rely on
1073
+ # cleanup_lingering_processes + serial fallback after crashes.
1074
+ env = branch_env(
1075
+ serial=serial,
1076
+ has_rerunfailures=has_rerunfailures,
1077
+ extras=metadata.get("branch_env"),
1078
+ )
1079
+ branch_log.append(
1080
+ run_step(
1081
+ "rm -f eval/results.xml results.xml",
1082
+ WORKSPACE,
1083
+ timeout=120,
1084
+ step="clean_stale_results",
1085
+ accept_failure=True,
1086
+ )
1087
+ )
1088
+ if serial:
1089
+ prepare_serial_run_sh(run_sh)
1090
+ run_entry = run_step(
1091
+ run_tests_command(serial=serial),
1092
+ WORKSPACE,
1093
+ timeout=branch_timeout,
1094
+ env=env,
1095
+ step="run_tests",
1096
+ accept_failure=True,
1097
+ )
1098
+ branch_log.append(run_entry)
1099
+ branch_log.append(cleanup_lingering_processes())
1100
+ xml_path = find_results_xml()
1101
+ if xml_path is None:
1102
+ if best_xml:
1103
+ merge_best_xml(best_xml)
1104
+ break
1105
+ if serial:
1106
+ result["test_branch_errors"][branch] = [
1107
+ {
1108
+ "error_code": "missing_results_xml",
1109
+ "error_details": "eval/results.xml was not produced",
1110
+ }
1111
+ ]
1112
+ inject_not_run(result, branch, tests, "missing_results_xml")
1113
+ break
1114
+ serial = True
1115
+ continue
1116
+ raw_xml = xml_path.read_text(errors="replace")
1117
+ crashes, n_tests, failures, missing = branch_attempt_metrics(
1118
+ raw_xml,
1119
+ run_output=run_entry.get("output", ""),
1120
+ expected_tests=n_expected,
1121
+ )
1122
+ useful = count_junit_passed(raw_xml)
1123
+ quality = (
1124
+ int(crashes == 0 and missing == 0),
1125
+ n_tests,
1126
+ useful,
1127
+ )
1128
+ if quality > best_quality:
1129
+ best_xml = raw_xml
1130
+ best_quality = quality
1131
+ retry = needs_serial_retry(
1132
+ serial=serial,
1133
+ crashes=crashes,
1134
+ missing=missing,
1135
+ failures=failures,
1136
+ n_tests=n_tests,
1137
+ expected_tests=n_expected,
1138
+ run_output=run_entry.get("output", ""),
1139
+ )
1140
+ if not retry:
1141
+ merge_best_xml(best_xml)
1142
+ break
1143
+ serial = True
1144
+ for entry in branch_log:
1145
+ entry["branch"] = branch
1146
+ result["log"].extend(branch_log)
1147
+
1148
+ return result
1149
+
1150
+
1151
+ def write_outputs(result: dict[str, Any], metadata: dict[str, Any]) -> None:
1152
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1153
+ write_json(LOG_DIR / "programgym_eval.json", result)
1154
+ write_json(LOG_DIR / "harbor_diagnostics.json", diagnostics(result, metadata))
1155
+ rewards = summarize(result, metadata)
1156
+ write_json(LOG_DIR / "reward.json", rewards)
1157
+ (LOG_DIR / "reward.txt").write_text(str(rewards["reward"]))
1158
+
1159
+
1160
+ def main() -> None:
1161
+ LOG_DIR.mkdir(parents=True, exist_ok=True)
1162
+ log_path = LOG_DIR / "programgym_eval.log"
1163
+ metadata = json.loads(METADATA_PATH.read_text())
1164
+ branches = metadata.get("branches", {})
1165
+ try:
1166
+ result = evaluate(metadata)
1167
+ except Exception as exc:
1168
+ error_code = type(exc).__name__
1169
+ result = {
1170
+ "test_results": [],
1171
+ "error_code": error_code,
1172
+ "error_details": str(exc),
1173
+ "log": [
1174
+ {
1175
+ "step": "evaluator_exception",
1176
+ "exception_info": traceback.format_exc(),
1177
+ "returncode": 1,
1178
+ }
1179
+ ],
1180
+ "solution_branch": "submission",
1181
+ "test_branches": [
1182
+ name for name, info in branches.items() if not info.get("ignored")
1183
+ ],
1184
+ "test_branch_errors": {
1185
+ "__evaluator__": [{"error_code": error_code, "error_details": str(exc)}]
1186
+ },
1187
+ "executable_hash": None,
1188
+ "warnings": [],
1189
+ }
1190
+ for branch, info in branches.items():
1191
+ if info.get("ignored"):
1192
+ continue
1193
+ inject_not_run(result, branch, branch_tests(info), error_code)
1194
+ log_path.write_text(traceback.format_exc())
1195
+ else:
1196
+ log_path.write_text("")
1197
+ write_outputs(result, metadata)
1198
+
1199
+
1200
+ if __name__ == "__main__":
1201
+ main()
contribsys--faktory_worker_go.dd/tests/programgym_task.json ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "branches": {
3
+ "generated_module_01": {
4
+ "ignore_reason": "",
5
+ "ignored": false,
6
+ "ignored_tests": [],
7
+ "tests": [
8
+ "eval.tests.test_config.test_config_error_does_not_break_lifecycle",
9
+ "eval.tests.test_config.test_default_target_when_no_env",
10
+ "eval.tests.test_config.test_faktory_url_overrides_default_port",
11
+ "eval.tests.test_config.test_malformed_faktory_url_dials_empty_address",
12
+ "eval.tests.test_config.test_provider_non_url_referenced_value_dials_empty_addr",
13
+ "eval.tests.test_config.test_provider_precedence_over_faktory_url",
14
+ "eval.tests.test_config.test_provider_referencing_unset_var_errors",
15
+ "eval.tests.test_config.test_provider_transitive_url_target",
16
+ "eval.tests.test_config.test_provider_with_colon_is_not_a_url",
17
+ "eval.tests.test_construction.test_ready_banner_contains_client_api_version",
18
+ "eval.tests.test_construction.test_ready_banner_contains_package_version",
19
+ "eval.tests.test_construction.test_ready_banner_contains_running_pid",
20
+ "eval.tests.test_construction.test_startup_default_connection_target_7419",
21
+ "eval.tests.test_dump.test_ttin_dump_does_not_terminate",
22
+ "eval.tests.test_dump.test_ttin_dump_includes_goroutine_stack",
23
+ "eval.tests.test_dump.test_ttin_emits_thread_dump_header",
24
+ "eval.tests.test_lifecycle_state_machine.test_double_dump_emits_two_headers",
25
+ "eval.tests.test_lifecycle_state_machine.test_double_terminate_is_idempotent",
26
+ "eval.tests.test_lifecycle_state_machine.test_dump_does_not_block_shutdown",
27
+ "eval.tests.test_lifecycle_state_machine.test_dump_then_quiet_then_terminate",
28
+ "eval.tests.test_lifecycle_state_machine.test_dump_while_quiet_is_non_terminating",
29
+ "eval.tests.test_lifecycle_state_machine.test_quiet_after_terminate_is_noop",
30
+ "eval.tests.test_lifecycle_state_machine.test_quiet_then_quiet_then_terminate_single_shutdown",
31
+ "eval.tests.test_lifecycle_state_machine.test_sighup_not_handled_kills_by_signal",
32
+ "eval.tests.test_lifecycle_state_machine.test_terminate_then_other_terminate_signal_single_exit[15-2]",
33
+ "eval.tests.test_lifecycle_state_machine.test_terminate_then_other_terminate_signal_single_exit[2-15]",
34
+ "eval.tests.test_quiet.test_double_quiet_is_idempotent",
35
+ "eval.tests.test_quiet.test_quiet_does_not_log_goodbye",
36
+ "eval.tests.test_quiet.test_quiet_does_not_terminate",
37
+ "eval.tests.test_quiet.test_quiet_logs_quieting",
38
+ "eval.tests.test_quiet.test_quiet_then_terminate_exits_zero",
39
+ "eval.tests.test_quiet.test_quiet_then_terminate_logs_goodbye",
40
+ "eval.tests.test_terminate.test_terminate_exit_code_zero[SIGINT]",
41
+ "eval.tests.test_terminate.test_terminate_exit_code_zero[SIGTERM]",
42
+ "eval.tests.test_terminate.test_terminate_logs_goodbye[SIGINT]",
43
+ "eval.tests.test_terminate.test_terminate_logs_goodbye[SIGTERM]",
44
+ "eval.tests.test_terminate.test_terminate_logs_shutting_down[SIGINT]",
45
+ "eval.tests.test_terminate.test_terminate_logs_shutting_down[SIGTERM]",
46
+ "eval.tests.test_terminate.test_terminate_shutdown_precedes_goodbye[SIGINT]",
47
+ "eval.tests.test_terminate.test_terminate_shutdown_precedes_goodbye[SIGTERM]"
48
+ ]
49
+ },
50
+ "generated_module_02": {
51
+ "ignore_reason": "",
52
+ "ignored": false,
53
+ "ignored_tests": [],
54
+ "tests": [
55
+ "eval.tests.test_heartbeat.test_heartbeat_quiet_state_transition",
56
+ "eval.tests.test_heartbeat.test_heartbeat_reports_state_in_beat_request",
57
+ "eval.tests.test_heartbeat.test_heartbeat_unknown_worker_self_terminate",
58
+ "eval.tests.test_io_config.test_faktory_url_redirects_target",
59
+ "eval.tests.test_io_config.test_produce_reports_connection_refused",
60
+ "eval.tests.test_io_config.test_unreachable_server_keeps_run_loop_responsive",
61
+ "eval.tests.test_processing.test_empty_fetch_keeps_pooling",
62
+ "eval.tests.test_processing.test_fetch_queue_names_strict_order",
63
+ "eval.tests.test_processing.test_job_custom_args_dispatched",
64
+ "eval.tests.test_processing.test_job_dispatched_success_error_nil_logged",
65
+ "eval.tests.test_processing.test_multiple_jobs_processed_and_acked",
66
+ "eval.tests.test_processing.test_registered_job_is_dispatched_and_acked[fast-job-registered]",
67
+ "eval.tests.test_processing.test_registered_job_is_dispatched_and_acked[somejob-registered]",
68
+ "eval.tests.test_processing.test_unregistered_job_is_failed",
69
+ "eval.tests.test_processing.test_unregistered_job_message_mentions_jobtype",
70
+ "eval.tests.test_processing.test_worker_sends_fail_with_jid_and_message",
71
+ "eval.tests.test_runloop_sequences.test_inflight_job_acked_on_term_shutdown",
72
+ "eval.tests.test_runloop_sequences.test_quiet_stops_polling",
73
+ "eval.tests.test_runloop_sequences.test_ready_banner_emitted_once",
74
+ "eval.tests.test_runloop_sequences.test_thread_dump_lists_main_goroutine",
75
+ "eval.tests.test_runloop_sequences.test_unknown_handler_message_is_not_duplicated_each_poll",
76
+ "eval.tests.test_shutdown_grace.test_long_job_context_canceled_on_shutdown",
77
+ "eval.tests.test_shutdown_grace.test_shutdown_banners_ordered",
78
+ "eval.tests.test_signal_lifecycle.test_no_server_startup_logs_client_api",
79
+ "eval.tests.test_signal_lifecycle.test_quiet_then_terminate_sequence",
80
+ "eval.tests.test_signal_lifecycle.test_sigterm_graceful_exit_zero",
81
+ "eval.tests.test_signal_lifecycle.test_sigtstp_quiet",
82
+ "eval.tests.test_signal_lifecycle.test_sigtstp_repeat_is_idempotent",
83
+ "eval.tests.test_signal_lifecycle.test_sigttin_repeat_dumps",
84
+ "eval.tests.test_signal_lifecycle.test_sigttin_thread_dump",
85
+ "eval.tests.test_signal_lifecycle.test_startup_banner_has_pid_and_version",
86
+ "eval.tests.test_signal_lifecycle.test_terminate_signals[SIGINT-terminates]",
87
+ "eval.tests.test_signal_lifecycle.test_terminate_signals[SIGTERM-terminates]"
88
+ ]
89
+ },
90
+ "generated_module_03": {
91
+ "ignore_reason": "",
92
+ "ignored": false,
93
+ "ignored_tests": [],
94
+ "tests": [
95
+ "eval.tests.test_context_middleware.test_bid_absent_returns_empty_string",
96
+ "eval.tests.test_context_middleware.test_bid_present_returns_custom_bid",
97
+ "eval.tests.test_context_middleware.test_fast_handler_runs_through_chain_without_helper",
98
+ "eval.tests.test_context_middleware.test_import_image_success_batch_callback_with_bid",
99
+ "eval.tests.test_context_middleware.test_long_handler_exposes_helper_and_enters_context_select",
100
+ "eval.tests.test_context_middleware.test_middleware_chain_and_helper_for_jid",
101
+ "eval.tests.test_context_middleware.test_middleware_passes_full_custom_map[custom0-single_reserved_key]",
102
+ "eval.tests.test_context_middleware.test_middleware_passes_full_custom_map[custom1-bid_plus_other]",
103
+ "eval.tests.test_context_middleware.test_middleware_reports_registered_type_field",
104
+ "eval.tests.test_context_middleware.test_multiple_jobs_processed_in_sequence",
105
+ "eval.tests.test_context_middleware.test_unregistered_jobtype_failed_without_dispatch"
106
+ ]
107
+ },
108
+ "generated_module_04": {
109
+ "ignore_reason": "",
110
+ "ignored": false,
111
+ "ignored_tests": [],
112
+ "tests": [
113
+ "eval.tests.test_logging.test_stdlogger_lines_use_utc_microsecond_timestamp_prefix",
114
+ "eval.tests.test_logging.test_worker_boot_emits_infof_and_debugf_lines",
115
+ "eval.tests.test_logging.test_worker_connection_refused_is_logged_via_debug",
116
+ "eval.tests.test_logging.test_worker_connects_to_faktory_url_config",
117
+ "eval.tests.test_logging.test_worker_dispatches_registered_job_and_acks",
118
+ "eval.tests.test_logging.test_worker_fails_unregistered_job_type",
119
+ "eval.tests.test_logging.test_worker_fetches_strict_priority_queues",
120
+ "eval.tests.test_logging.test_worker_sigquit_quiet_logs_quieting_via_info",
121
+ "eval.tests.test_logging.test_worker_sigterm_shutdown_logs_goodbye_via_info",
122
+ "eval.tests.test_logging.test_worker_sigttin_dump_logs_thread_dump_via_info",
123
+ "eval.tests.test_logging_heartbeat.test_worker_error_on_heartbeat_generic_failure",
124
+ "eval.tests.test_logging_heartbeat.test_worker_warn_and_error_on_heartbeat_unknown_worker"
125
+ ]
126
+ }
127
+ },
128
+ "commit": "dd0174da353f4046679dc4d9a446cae997d95396",
129
+ "data_source": "synthetic_programgym",
130
+ "difficulty": "easy",
131
+ "difficulty_score": 1.7631283767991368,
132
+ "eval_clean_hashes": [
133
+ "1bf246f11c2cec8cc86ab9700914c2327be4a6921c917b1836fdb59216131078"
134
+ ],
135
+ "input_record": {
136
+ "commit": "dd0174da353f4046679dc4d9a446cae997d95396",
137
+ "commits": 153,
138
+ "contributors": 14,
139
+ "difficulty": "easy",
140
+ "difficulty_code_lines": 966,
141
+ "difficulty_has_tests": true,
142
+ "difficulty_product_code_lines": 966,
143
+ "difficulty_runtime_deps": 5,
144
+ "difficulty_score": 1.7631283767991368,
145
+ "difficulty_test_code_lines": 623,
146
+ "full_name": "contribsys/faktory_worker_go",
147
+ "github_stars": 247,
148
+ "input_joern_zip": "go_joern/contribsys__faktory_worker_go.zip",
149
+ "joern_status": true,
150
+ "joern_time": 7.503613873152062,
151
+ "language": "go",
152
+ "pb_match": [
153
+ {
154
+ "pb_fullname": "go-critic/go-critic",
155
+ "rank": 910,
156
+ "similarity": 0.5037322044372559
157
+ },
158
+ {
159
+ "pb_fullname": "mibk/dupl",
160
+ "rank": 733,
161
+ "similarity": 0.518513023853302
162
+ },
163
+ {
164
+ "pb_fullname": "cweill/gotests",
165
+ "rank": 526,
166
+ "similarity": 0.5360835194587708
167
+ },
168
+ {
169
+ "pb_fullname": "incu6us/goimports-reviser",
170
+ "rank": 406,
171
+ "similarity": 0.5130929946899414
172
+ },
173
+ {
174
+ "pb_fullname": "kisielk/errcheck",
175
+ "rank": 692,
176
+ "similarity": 0.5412095785140991
177
+ }
178
+ ],
179
+ "repo_age": 8.85,
180
+ "repo_path": "go/contribsys__faktory_worker_go",
181
+ "source": "commit:dd0174da353f4046679dc4d9a446cae997d95396",
182
+ "status": "done",
183
+ "url": "https://github.com/contribsys/faktory_worker_go"
184
+ },
185
+ "instance_id": "contribsys__faktory_worker_go.dd0174d",
186
+ "language": "go",
187
+ "module_iterations": [
188
+ {
189
+ "actual_iterations": 5,
190
+ "branch_name": "generated_module_01",
191
+ "iteration_limit": 5,
192
+ "module_index": 1,
193
+ "module_kind": "source",
194
+ "termination_reason": "max_iterations"
195
+ },
196
+ {
197
+ "actual_iterations": 5,
198
+ "branch_name": "generated_module_02",
199
+ "iteration_limit": 5,
200
+ "module_index": 2,
201
+ "module_kind": "source",
202
+ "termination_reason": "max_iterations"
203
+ },
204
+ {
205
+ "actual_iterations": 5,
206
+ "branch_name": "generated_module_03",
207
+ "iteration_limit": 5,
208
+ "module_index": 3,
209
+ "module_kind": "source",
210
+ "termination_reason": "max_iterations"
211
+ },
212
+ {
213
+ "actual_iterations": 5,
214
+ "branch_name": "generated_module_04",
215
+ "iteration_limit": 5,
216
+ "module_index": 4,
217
+ "module_kind": "source",
218
+ "termination_reason": "max_iterations"
219
+ }
220
+ ],
221
+ "repository": "contribsys/faktory_worker_go"
222
+ }
contribsys--faktory_worker_go.dd/tests/test.sh ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Verifier exec may not inherit image ENV (Modal/gVisor, login-shell resets).
5
+ export PATH="/usr/local/go/bin:/go/bin:/usr/local/cargo/bin:/root/.cargo/bin:${PATH}"
6
+
7
+ mkdir -p /logs/verifier /logs/artifacts
8
+
9
+ write_failure() {
10
+ local code="$1"
11
+ local details="$2"
12
+ python3 - "$code" "$details" <<'PY'
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ code, details = sys.argv[1:3]
18
+ try:
19
+ metadata = json.loads(Path("/tests/programgym_task.json").read_text())
20
+ n_tests = sum(
21
+ len([
22
+ name for name in info.get("tests", [])
23
+ if name not in {item.get("name") for item in info.get("ignored_tests", [])}
24
+ ])
25
+ for branch, info in metadata.get("branches", {}).items()
26
+ if not info.get("ignored")
27
+ )
28
+ except Exception:
29
+ n_tests = 0
30
+ result = {
31
+ "test_results": [],
32
+ "error_code": code,
33
+ "error_details": details,
34
+ "log": [],
35
+ "solution_branch": "submission",
36
+ "test_branches": [],
37
+ "test_branch_errors": {
38
+ "__infra__": [{"error_code": code, "error_details": details}]
39
+ },
40
+ "executable_hash": None,
41
+ "warnings": [],
42
+ }
43
+ diagnostics = {
44
+ "pass_rate": 0.0,
45
+ "resolved": 0,
46
+ "n_passed": 0,
47
+ "n_tests": n_tests,
48
+ "n_branch_errors": 1,
49
+ "infra_error": 1,
50
+ "executable_hash_present": 0,
51
+ }
52
+ Path("/logs/verifier/programgym_eval.json").write_text(
53
+ json.dumps(result, indent=2, sort_keys=True)
54
+ )
55
+ Path("/logs/verifier/harbor_diagnostics.json").write_text(
56
+ json.dumps(diagnostics, indent=2, sort_keys=True)
57
+ )
58
+ Path("/logs/verifier/reward.json").write_text(
59
+ json.dumps(
60
+ {"reward": 0.0, "resolved": 0.0, "almost_resolved": 0.0},
61
+ indent=2,
62
+ sort_keys=True,
63
+ )
64
+ )
65
+ Path("/logs/verifier/reward.txt").write_text("0.0")
66
+ Path("/logs/verifier/programgym_eval.log").write_text(details)
67
+ PY
68
+ }
69
+
70
+ if ! command -v python3 >/dev/null 2>&1; then
71
+ write_failure "missing_python3" "python3 is required in the cleanroom image"
72
+ exit 0
73
+ fi
74
+
75
+ if ! python3 /tests/programgym_evaluator.py; then
76
+ if [ ! -s /logs/verifier/reward.txt ]; then
77
+ write_failure "evaluator_crashed" \
78
+ "programgym_evaluator.py exited non-zero with no reward written"
79
+ fi
80
+ fi
81
+
82
+ exit 0
contribsys--faktory_worker_go.dd/tests/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c9e15f55ee1a7d6843720ce1d94ca3bad2429bf67aa49706a1765278151112f
3
+ size 80
corunb--dirscan.ca089be/environment/Dockerfile ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
15
+ ENV npm_config_registry="https://registry.npmjs.org/"
16
+ ENV npm_config_strict_ssl=false
17
+ ENV npm_config_cache=/workspace/.cache/npm
18
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
19
+ ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
20
+ ENV PIP_TRUSTED_HOST=""
21
+ ENV HOME=/workspace
22
+ ENV XDG_CACHE_HOME=/workspace/.cache
23
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
24
+ ENV PYTHONUSERBASE=/workspace/.local
25
+ ENV GOROOT=/usr/local/go
26
+ ENV GOPATH=/workspace/.go
27
+ ENV GOCACHE=/workspace/.cache/go-build
28
+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
29
+ ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+ ENV PAGER=cat
31
+ ENV MANPAGER=cat
32
+ ENV LESS=-R
33
+ ENV TQDM_DISABLE=1
34
+ ENV VIRTUAL_ENV=/opt/programgym-venv
35
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
36
+ COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
37
+ RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
38
+ RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
39
+ WORKDIR /workspace
40
+ ADD workspace.tar.gz /workspace/
41
+ COPY executable /workspace/executable
42
+ COPY download.sh /workspace/download.sh
43
+ RUN chmod 755 /workspace/download.sh
44
+ RUN ["bash","-lc","set -euo pipefail; cd /workspace; set -a; source /workspace/download.sh; set +a; python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh\nimport os\nimport re\nimport shlex\nignored = {\"OLDPWD\", \"PWD\", \"SHLVL\", \"_\"}\nvalid_name = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\nfor key in sorted(os.environ):\n if key in ignored or key.startswith(\"BASH_FUNC_\") or not valid_name.fullmatch(key):\n continue\n value = os.environ[key]\n if \"\\n\" in value:\n continue\n print(f\"export {key}={shlex.quote(value)}\")\nPY\n"]
45
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
46
+ RUN chmod 111 /workspace/executable
47
+ WORKDIR /workspace
48
+ # programgym-runtime-workspace-cleanup: v1
49
+ RUN ["bash","-lc","rm -f -- /workspace/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]
50
+ # Harbor synthetic ProgramGym adapter: run the agent as an unprivileged user.
51
+ # Keep tool/runtime state under /home/agent and reserve /workspace for the
52
+ # submission handed to the separate verifier. Keep the reference executable
53
+ # execute-only; the oracle temporarily restores owner read permission.
54
+ RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
55
+ RUN mkdir -p /home/agent \
56
+ && chown -R agent:agent /home/agent /workspace \
57
+ && chown agent:agent /workspace/executable \
58
+ && chmod 111 /workspace/executable
59
+ ENV HOME=/home/agent
60
+ WORKDIR /workspace
corunb--dirscan.ca089be/environment/download.sh ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # PROGRAMGYM-MANAGED-GO-DOWNLOAD: v1
3
+ # Generated deterministically from repository module metadata; do not edit.
4
+ set -u
5
+ export GOTOOLCHAIN=auto
6
+ mkdir -p /workspace/.programgym_build_env/go-prefetch
7
+ cat > /workspace/.programgym_build_env/go-prefetch/go.mod <<'PROGRAMGYM_GO_MOD_EOF'
8
+ module Dirscan
9
+
10
+ go 1.19
11
+
12
+ require (
13
+ github.com/gookit/color v1.5.2
14
+ golang.org/x/net v0.0.0-20221004154528-8021a29435af
15
+ )
16
+
17
+ require (
18
+ github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
19
+ golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
20
+ )
21
+ PROGRAMGYM_GO_MOD_EOF
22
+ cat > /workspace/.programgym_build_env/go-prefetch/go.sum <<'PROGRAMGYM_GO_SUM_EOF'
23
+ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
24
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
25
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
26
+ github.com/gookit/color v1.5.2 h1:uLnfXcaFjlrDnQDT+NCBcfhrXqYTx/rcCa6xn01Y8yI=
27
+ github.com/gookit/color v1.5.2/go.mod h1:w8h4bGiHeeBpvQVePTutdbERIUf3oJE5lZ8HM0UgXyg=
28
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
29
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30
+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
31
+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
32
+ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
33
+ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
34
+ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
35
+ github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
36
+ github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
37
+ golang.org/x/net v0.0.0-20221004154528-8021a29435af h1:wv66FM3rLZGPdxpYL+ApnDe2HzHcTFta3z5nsc13wI4=
38
+ golang.org/x/net v0.0.0-20221004154528-8021a29435af/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
39
+ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
40
+ golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 h1:OK7RB6t2WQX54srQQYSXMW8dF5C6/8+oA/s5QBmmto4=
41
+ golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
42
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
43
+ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
44
+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
45
+ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
46
+ PROGRAMGYM_GO_SUM_EOF
47
+ PROGRAMGYM_GO_BASE_GOROOT="$(GOTOOLCHAIN=local go env GOROOT)"
48
+ if ! PROGRAMGYM_GO_RESOLVED_GOROOT="$(cd /workspace/.programgym_build_env/go-prefetch && GOTOOLCHAIN=auto go env GOROOT)"; then
49
+ printf '%s\n' 'download.sh: Go toolchain resolution failed' >&2
50
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
51
+ return 1
52
+ else
53
+ exit 1
54
+ fi
55
+ fi
56
+ if [ "$PROGRAMGYM_GO_RESOLVED_GOROOT" != "$PROGRAMGYM_GO_BASE_GOROOT" ]; then
57
+ PROGRAMGYM_GO_TOOLCHAIN_ROOT=/opt/programgym-go-toolchain
58
+ mkdir -p "$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
59
+ cp -a "$PROGRAMGYM_GO_RESOLVED_GOROOT/." "$PROGRAMGYM_GO_TOOLCHAIN_ROOT/"
60
+ export GOROOT="$PROGRAMGYM_GO_TOOLCHAIN_ROOT"
61
+ else
62
+ export GOROOT="$PROGRAMGYM_GO_BASE_GOROOT"
63
+ fi
64
+ export PATH="$GOROOT/bin:$PATH"
65
+ export GOTOOLCHAIN=local
66
+ if ! (cd /workspace/.programgym_build_env/go-prefetch && go mod download -modfile=/workspace/.programgym_build_env/go-prefetch/go.mod all); then
67
+ printf '%s\n' 'download.sh: Go dependency prefetch failed' >&2
68
+ if [ "${BASH_SOURCE[0]}" != "$0" ]; then
69
+ return 1
70
+ else
71
+ exit 1
72
+ fi
73
+ fi
corunb--dirscan.ca089be/environment/executable ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17f1d7f4b6ca910172476d0c121a62fdd32b488a7c18a0e509c9254cb9bbb9b1
3
+ size 9013293
corunb--dirscan.ca089be/environment/programgym-go.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:39042a078ea9ceebe3ecda4a7188f0f5b96e14a071d27923ba7f40b456e85ae3
3
+ size 59908810
corunb--dirscan.ca089be/environment/workspace.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:550c38b1d8ef4581d67c13a33df5f64936805856c39faee452846c5bd8e1f857
3
+ size 142257
corunb--dirscan.ca089be/instruction.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant that can interact with a computer.
2
+
3
+ This is a reverse-engineering benchmark. You are given a compiled binary and its documentation.
4
+ Your job is to write a new, original codebase from scratch that produces an executable with identical behavior.
5
+ You must figure out the behavior solely by running and interacting with the provided binary.
6
+ Writing original code based on observed behavior is the entire point of this benchmark.
7
+
8
+ Any approach that shortcuts this — finding existing source code, wrapping the binary,
9
+ or installing the original tool — does not count as a solution. It will be detected by an
10
+ automated judge, marked as a disqualification, and scored as a failure.
11
+ The trace will be posted to an online wall of shame.
12
+
13
+ <RULES>
14
+ ## What is not allowed
15
+
16
+ ### 1. Obtaining source code
17
+
18
+ The only source of truth about what the executable does is the executable itself and its
19
+ bundled documentation. You must not search the internet, package registries, or any external
20
+ source for information about this project's source code. Even if you recognize what the
21
+ executable is, you must reimplement it from behavioral observation alone.
22
+
23
+ This includes but is not limited to:
24
+ - Cloning or browsing the original GitHub repository, its forks, or mirrors
25
+ - Downloading the project from package registries: `cargo install <project>`, `go get github.com/<org>/<project>`, `pip install <project>`, `apt-get source <project>`, `npm install <project>`, etc.
26
+ - Fetching source tarballs from project websites (e.g., `curl https://lua.org/ftp/lua-5.5.0.tar.gz`)
27
+ - Using a package manager to download the project as a dependency and then reading its cached source (e.g., navigating into `~/.cargo/registry/src/` or `$(go env GOPATH)/pkg/mod/`)
28
+ - Searching the web for the project's source code or implementation details
29
+
30
+ ### 2. Wrapping or reusing the original binary
31
+
32
+ Your submission must be a genuine reimplementation. The provided `./executable` is for
33
+ observation only — your final solution must not depend on it or any other pre-built version
34
+ of the same tool at runtime.
35
+
36
+ This includes but is not limited to:
37
+ - Writing a wrapper script that delegates to the original binary (e.g., `exec zstd "$@"`)
38
+ - Installing the tool from a package manager and shimming to it (e.g., `apt-get install nnn && cp $(which nnn) ./executable`)
39
+ - Writing a `compile.sh` that simply makes the provided binary executable (`chmod +x ./executable`) or copies it (`cp ./executable ./executable`)
40
+ - Building a binary whose main function shells out to an external tool (e.g., `Command::new("miniserve").args(args).exec()`)
41
+ - Re-linking prebuilt `.o` object files found in the workspace without writing new source code
42
+
43
+ ### 3. Binary analysis of the provided executable
44
+
45
+ All information about the provided `./executable` must be obtained by interacting with it
46
+ through its normal user interface (CLI flags, stdin/stdout, etc.).
47
+ - You MUST NOT decompile `./executable` or use disassemblers (objdump, Ghidra, etc.) on it
48
+ - You MUST NOT use strace, ltrace, or similar tracing/instrumentation tools on `./executable`
49
+
50
+ Note: this restriction applies ONLY to the provided `./executable`. You are free to use any
51
+ analysis tools on binaries that you produce yourself during development.
52
+
53
+ ## What IS allowed
54
+
55
+ - Running the executable with any inputs, flags, and arguments to observe its behavior
56
+ - Reading any documentation files bundled in the workspace
57
+ </RULES>
58
+
59
+ ## Task context
60
+
61
+ We want to write the source code for a given executable.
62
+ The executable is located at `./executable` in the workspace root.
63
+
64
+ You also have access to the existing documentation.
65
+
66
+ ## Your task
67
+
68
+ Implement the source code to generate an executable of exactly identical behavior as the original.
69
+
70
+ No project-specific dependencies are pre-installed.
71
+ You do NOT have access to the internet.
72
+ **IMPORTANT**: Make sure that the executable(s) and everything else that is an artifact is not committed, i.e., is in your `.gitignore` file.
73
+ Finally, commit your changes.
74
+
75
+ Make sure that you have a `./compile.sh` file that produces an executable `./executable` in the workspace root.
76
+ `compile.sh` should be executable and should install any dependencies needed to compile the executable.
77
+ If your compile.sh fails to compile on a fresh checkout, your task has failed.
78
+
79
+ ## Important: This is a reverse-engineering benchmark
80
+
81
+ Your goal is to write original code from scratch that reproduces the executable's behavior.
82
+ The only way to learn what the executable does is to run it and read its bundled documentation.
83
+
84
+ Any attempt to obtain source code — whether successful or not — or to wrap/reuse the
85
+ provided binary will be detected by an automated judge, disqualified, and scored as zero.
86
+ See the full rules in the system prompt above. Key points:
87
+
88
+ - Do NOT search the internet, clone repos, or download the project from any package registry
89
+ - Do NOT wrap, shim, or delegate to the provided `./executable` or any installed version of the same tool
90
+ - Do NOT decompile the provided `./executable` or use strace/ltrace on it (analyzing your own binaries is fine)
91
+ - You SHOULD extensively test the executable to understand its behavior before writing code.
92
+ If you are dealing with a TUI, tmux/libtmux has been installed to help you test/inspect/it.
93
+
94
+ ## Recommended Workflow
95
+
96
+ 1. Explore all documentation files
97
+ 2. Play with the executable to understand its behavior (however, you MUST NOT decompile `./executable` or perform any other form of binary or strace/ltrace analysis on it)
98
+ 3. Write the source code to implement the behavior
corunb--dirscan.ca089be/solution/solve.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Oracle-only ceiling check. The reference is execute-only for normal agents;
3
+ # because the oracle runs as the owning `agent` user it can temporarily add read
4
+ # permission and encode the binary for Harbor's normal artifact handoff.
5
+ set -euo pipefail
6
+ test -f ./executable
7
+ chmod u+r ./executable
8
+ python3 - <<'PY'
9
+ import base64
10
+ from pathlib import Path
11
+
12
+ Path(".programgym_oracle_reference").write_bytes(
13
+ base64.b64encode(Path("executable").read_bytes())
14
+ )
15
+ PY
16
+ chmod u-r ./executable
17
+ cat > compile.sh <<'EOF'
18
+ #!/usr/bin/env bash
19
+ set -euo pipefail
20
+ if [ -f ./.programgym_oracle_reference ]; then
21
+ python3 - <<'PY'
22
+ import base64
23
+ from pathlib import Path
24
+
25
+ Path("executable").write_bytes(
26
+ base64.b64decode(Path(".programgym_oracle_reference").read_bytes())
27
+ )
28
+ PY
29
+ fi
30
+ test -f ./executable
31
+ chmod +x ./executable
32
+ EOF
33
+ chmod +x compile.sh
corunb--dirscan.ca089be/task.toml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.3"
2
+ source = "ProgramGym"
3
+ artifacts = [
4
+ "/logs/verifier/programgym_eval.json",
5
+ "/logs/verifier/harbor_diagnostics.json",
6
+ "/logs/verifier/programgym_eval.log",
7
+ "/logs/verifier/reward.json",
8
+ "/logs/verifier/reward.txt",
9
+ # Keep agent/runtime state out of the submission handoff. In particular,
10
+ # Claude Code installs an absolute symlink under .local/bin; transferring it
11
+ # makes Python's safe tar extraction reject the entire workspace archive.
12
+ { source = "/workspace", exclude = [
13
+ "executable",
14
+ ".git",
15
+ ".bashrc",
16
+ ".cache",
17
+ ".cc-switch",
18
+ ".claude",
19
+ ".local",
20
+ ] },
21
+ ]
22
+
23
+ [task]
24
+ name = "programgym/corunb--dirscan.ca089be"
25
+ description = "Synthetic ProgramGym cleanroom reconstruction task for corunb/Dirscan"
26
+ authors = [{ name = "Harbor ProgramGym Synthetic Adapter" }]
27
+ keywords = ["programgym", "synthetic", "reverse-engineering", "cleanroom", "go"]
28
+
29
+ [metadata]
30
+ source = "ProgramGym"
31
+ instance_id = "corunb__Dirscan.ca089be"
32
+ repository = "corunb/Dirscan"
33
+ commit = "ca089be5ebe9b675d4bebbb0910f0c9f565f0bb7"
34
+ language = "go"
35
+ difficulty = "easy"
36
+ difficulty_score = 1.8447877188278463
37
+ test_branches = 4
38
+ test_count = 164
39
+
40
+ [agent]
41
+ timeout_sec = 14400
42
+ user = "agent"
43
+ network_mode = "allowlist"
44
+ allowed_hosts = ["api.anthropic.com", "api.openai.com"]
45
+
46
+ [verifier]
47
+ timeout_sec = 7200
48
+ user = "root"
49
+ environment_mode = "separate"
50
+
51
+ [verifier.env]
52
+ PROGRAMGYM_XDIST_WORKERS = "8"
53
+
54
+ [verifier.environment]
55
+ build_timeout_sec = 1800
56
+ cpus = 8
57
+ memory_mb = 16384
58
+ storage_mb = 30720
59
+ gpus = 0
60
+ workdir = "/workspace"
61
+
62
+ [environment]
63
+ network_mode = "public"
64
+ build_timeout_sec = 1800
65
+ cpus = 8
66
+ memory_mb = 16384
67
+ storage_mb = 30720
68
+ gpus = 0
69
+ workdir = "/workspace"
corunb--dirscan.ca089be/tests/Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ENV DEBIAN_FRONTEND=noninteractive
3
+ ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
4
+ ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
5
+ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
6
+ ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
7
+ ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
8
+ ENV GOPROXY="https://proxy.golang.org,direct"
9
+ ENV GOSUMDB=sum.golang.google.cn
10
+ ENV GOTOOLCHAIN=auto
11
+ ENV UV_INSECURE_HOST=""
12
+ ENV UV_INDEX_URL="https://pypi.org/simple"
13
+ ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ENV UV_CACHE_DIR=/workspace/.cache/uv
15
+ ENV npm_config_registry="https://registry.npmjs.org/"
16
+ ENV npm_config_strict_ssl=false
17
+ ENV npm_config_cache=/workspace/.cache/npm
18
+ ENV PIP_INDEX_URL="https://pypi.org/simple"
19
+ ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
20
+ ENV PIP_TRUSTED_HOST=""
21
+ ENV HOME=/workspace
22
+ ENV XDG_CACHE_HOME=/workspace/.cache
23
+ ENV PIP_CACHE_DIR=/workspace/.cache/pip
24
+ ENV PYTHONUSERBASE=/workspace/.local
25
+ ENV GOROOT=/usr/local/go
26
+ ENV GOPATH=/workspace/.go
27
+ ENV GOCACHE=/workspace/.cache/go-build
28
+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
29
+ ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
30
+ ENV PAGER=cat
31
+ ENV MANPAGER=cat
32
+ ENV LESS=-R
33
+ ENV TQDM_DISABLE=1
34
+ ENV VIRTUAL_ENV=/opt/programgym-venv
35
+ RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
36
+ COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
37
+ RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
38
+ RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
39
+ WORKDIR /workspace
40
+ ADD workspace.tar.gz /workspace/
41
+ COPY executable /workspace/executable
42
+ COPY download.sh /workspace/download.sh
43
+ RUN chmod 755 /workspace/download.sh
44
+ RUN ["bash","-lc","set -euo pipefail; cd /workspace; set -a; source /workspace/download.sh; set +a; python3 - <<'PY' > /etc/profile.d/programgym_download_env.sh\nimport os\nimport re\nimport shlex\nignored = {\"OLDPWD\", \"PWD\", \"SHLVL\", \"_\"}\nvalid_name = re.compile(r\"^[A-Za-z_][A-Za-z0-9_]*$\")\nfor key in sorted(os.environ):\n if key in ignored or key.startswith(\"BASH_FUNC_\") or not valid_name.fullmatch(key):\n continue\n value = os.environ[key]\n if \"\\n\" in value:\n continue\n print(f\"export {key}={shlex.quote(value)}\")\nPY\n"]
45
+ ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
46
+ RUN chmod 111 /workspace/executable
47
+ WORKDIR /workspace
48
+ # programgym-runtime-workspace-cleanup: v1
49
+ RUN ["bash","-lc","rm -f -- /workspace/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]
50
+ # Harbor uses tests/ as the separate verifier build context. Start with the
51
+ # same toolchain as the agent, then remove every cleanroom workspace artifact.
52
+ RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
53
+ && mkdir -p /workspace /tests
54
+
55
+ # Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
56
+ # Installing a newer pytest alone leaves that apt package importable and creates
57
+ # an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
58
+ # Install and constrain the verifier test runner as one coherent pip toolchain.
59
+ RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
60
+ ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
61
+ RUN python3 -m pip install --no-cache-dir --disable-pip-version-check \
62
+ 'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout
63
+
64
+ COPY test.sh /tests/test.sh
65
+ COPY programgym_evaluator.py /tests/programgym_evaluator.py
66
+ COPY programgym_task.json /tests/programgym_task.json
67
+ COPY blobs/ /tests/blobs/
68
+ RUN chmod +x /tests/test.sh
corunb--dirscan.ca089be/tests/blobs/tests/generated_module_01.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a7da48cd65669c5fb847a5d6b8a246280b56e7a84a68f3a9d7bd6d8fbc46758
3
+ size 10073
corunb--dirscan.ca089be/tests/blobs/tests/generated_module_02.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:848d46f1a7279925701448d008413eae6c2547250f350a11051ff6b03b8bc44f
3
+ size 54905
corunb--dirscan.ca089be/tests/blobs/tests/generated_module_03.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4cd6d55b22abd6a924a96c762d57feb065bbf1c8c8dac46767e811ea64772ed
3
+ size 59014
corunb--dirscan.ca089be/tests/blobs/tests/generated_module_04.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43a022aeb3232106ff692f760513194572dfd823f6f54521facc29aed2e5e755
3
+ size 10341