Skip to content

Commit 8b38d35

Browse files
authored
Merge pull request #2 from PrimeIntellect-ai/feat/tmax-tasks
Add tmax task corpus
2 parents 257b678 + f6bb7b8 commit 8b38d35

105,293 files changed

Lines changed: 3183856 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

datasets/tmax/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# tmax
2+
3+
TMax Harbor task corpus (`tmax@2026-07-01` in the research-environments registry), 14,600 tasks with prebuilt Prime container images (`prime/primeintellect/tmax:<task-dir>`).
4+
5+
Moved from `PrimeIntellect-ai/research-environments` `environments/tmax_v1/tasks` at commit `e2064ba32` (PR #609 branch, includes the `task_004697_bd627cb1` numpy<2 build fix).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:22.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV LC_ALL=C.UTF-8
5+
ENV LANG=C.UTF-8
6+
ENV GOPATH=/home/user/go
7+
ENV PATH=/home/user/go/bin:/home/user/.cargo/bin:$PATH
8+
9+
COPY base_install.sh /tmp/base_install.sh
10+
RUN bash /tmp/base_install.sh && rm /tmp/base_install.sh
11+
12+
COPY _fixtures/app/fixtures/image.png /app/fixtures/image.png
13+
14+
COPY post_install.sh /tmp/post_install.sh
15+
RUN bash /tmp/post_install.sh && rm /tmp/post_install.sh
2.02 KB
Loading
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
apt-get update && apt-get install -y --no-install-recommends \
2+
python3 python3-pip python3-venv \
3+
coreutils findutils gawk sed grep \
4+
curl wget git \
5+
build-essential gcc g++ make cmake \
6+
pkg-config autoconf automake libtool \
7+
nodejs npm \
8+
sqlite3 libsqlite3-dev \
9+
valgrind gdb \
10+
jq \
11+
sudo \
12+
golang-go \
13+
rustc cargo \
14+
nasm \
15+
ffmpeg \
16+
tesseract-ocr tesseract-ocr-eng \
17+
upx-ucl binutils file xxd \
18+
libjpeg-dev libpng-dev libtiff-dev libwebp-dev \
19+
libfreetype6-dev liblapack-dev libopenblas-dev \
20+
imagemagick \
21+
espeak espeak-ng libespeak-ng-dev \
22+
redis-server redis-tools \
23+
nginx \
24+
netcat-openbsd socat \
25+
openmpi-bin libopenmpi-dev \
26+
postgresql-client mariadb-client \
27+
postfix mailutils \
28+
expect inotify-tools \
29+
unzip zip xz-utils \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Core scientific Python stack — picks CPU-only torch via the dedicated
33+
# PyPI index URL to avoid pulling the ~2 GB CUDA wheels.
34+
#
35+
# Includes a small set of common build / packaging / domain-specific
36+
# helpers that v2 task deltas frequently invoke:
37+
# * pyinstaller — compile Python → standalone binary
38+
# (caught by smoke: tasks asking the agent to package a CLI tool)
39+
# * cython — C extension building from Python sources
40+
# * pybind11 / cffi — C/C++ FFI for fixture-shipped binaries
41+
# * sympy — symbolic math for metric_threshold verifiers
42+
# * networkx — graph algorithms (debugging / scientific tasks)
43+
# * cryptography — crypto / security tasks beyond pure stdlib
44+
pip3 install --no-cache-dir \
45+
pytest \
46+
flask requests pyyaml toml \
47+
numpy scipy scikit-learn pandas \
48+
Pillow imageio matplotlib \
49+
biopython \
50+
beautifulsoup4 lxml \
51+
pyinstaller cython pybind11 cffi \
52+
sympy networkx cryptography \
53+
redis psycopg2-binary pyserial paramiko
54+
55+
pip3 install --no-cache-dir \
56+
--index-url https://download.pytorch.org/whl/cpu \
57+
torch torchvision
58+
59+
# NOTE on the agent loop: rl_data.generator.vanillux_solver runs the
60+
# mini-swe-agent-style harness ENTIRELY ON THE HOST (in our solver
61+
# process). Only bash actions cross into this container via
62+
# InteractiveContainerEnvironment.exec(). That means this SIF only
63+
# needs bash + the build/ML/RE deps installed above — no swe-agent
64+
# CLI, no Python 3.11 venv, no extra ~200 MB layer. As a bonus, the
65+
# vanillux harness now also works on every legacy per-domain base
66+
# SIF without modification.
67+
68+
useradd -m -s /bin/bash user || true
69+
chmod 755 /home/user
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
apt-get update && apt-get install -y python3 python3-pip git gcc make imagemagick tesseract-ocr fonts-dejavu-core
2+
pip3 install pytest
3+
4+
mkdir -p /app
5+
convert -size 600x150 xc:white -font DejaVu-Sans -pointsize 24 -fill black -draw "text 10,40 'FATAL_OFFSET:0x1A4F\nTRACE: thread_worker -> extract_dump'" /app/bug_report.png
6+
7+
useradd -m -s /bin/bash user || true
8+
mkdir -p /home/user/telemetry_repo
9+
cd /home/user/telemetry_repo
10+
git init
11+
git config user.email "dev@local"
12+
git config user.name "Dev"
13+
14+
cat << 'EOF' > telemetry.c
15+
#include <stdio.h>
16+
#include <stdlib.h>
17+
#include <string.h>
18+
#include <pthread.h>
19+
20+
char buffer[1024];
21+
pthread_mutex_t buffer_lock = PTHREAD_MUTEX_INITIALIZER;
22+
23+
void* thread_worker(void* arg) {
24+
char* input = (char*)arg;
25+
pthread_mutex_lock(&buffer_lock);
26+
strncpy(buffer, input, sizeof(buffer)-1);
27+
buffer[sizeof(buffer)-1] = '\0';
28+
pthread_mutex_unlock(&buffer_lock);
29+
return NULL;
30+
}
31+
32+
int main(int argc, char** argv) {
33+
if (argc < 2) return 1;
34+
pthread_t t1;
35+
pthread_create(&t1, NULL, thread_worker, argv[1]);
36+
pthread_join(t1, NULL);
37+
printf("%s\n", buffer);
38+
return 0;
39+
}
40+
EOF
41+
42+
cat << 'EOF' > Makefile
43+
all:
44+
gcc -o telemetry telemetry.c -lpthread
45+
EOF
46+
47+
git add telemetry.c Makefile
48+
git commit -m "Commit 1"
49+
50+
for i in $(seq 2 149); do
51+
echo "// commit $i" >> telemetry.c
52+
git commit -am "Commit $i"
53+
done
54+
55+
make
56+
cp telemetry /app/oracle_parser
57+
strip /app/oracle_parser
58+
59+
cat << 'EOF' > telemetry.c
60+
#include <stdio.h>
61+
#include <stdlib.h>
62+
#include <string.h>
63+
#include <pthread.h>
64+
65+
char buffer[1024];
66+
pthread_mutex_t buffer_lock = PTHREAD_MUTEX_INITIALIZER;
67+
68+
void* thread_worker(void* arg) {
69+
char* input = (char*)arg;
70+
strncpy(buffer, input, sizeof(buffer)-1);
71+
buffer[sizeof(buffer)-1] = '\0';
72+
return NULL;
73+
}
74+
75+
int main(int argc, char** argv) {
76+
if (argc < 2) return 1;
77+
pthread_t t1;
78+
pthread_create(&t1, NULL, thread_worker, argv[1]);
79+
pthread_join(t1, NULL);
80+
printf("%s\n", buffer);
81+
return 0;
82+
}
83+
EOF
84+
85+
cat << 'EOF' > Makefile
86+
all:
87+
gcc -o telemetry telemetry.c
88+
EOF
89+
90+
echo "// commit 150" >> telemetry.c
91+
git commit -am "Commit 150"
92+
93+
for i in $(seq 151 200); do
94+
echo "// commit $i" >> telemetry.c
95+
git commit -am "Commit $i"
96+
done
97+
98+
chown -R user:user /home/user/telemetry_repo
99+
chmod -R 777 /home/user
100+
chmod -R 777 /app
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
You are tasked with resolving a critical concurrency regression in our C-based multithreaded telemetry parser.
2+
3+
A bug was recently introduced in our repository, causing race conditions that lead to memory corruption and invalid string extraction from system memory dumps. A user submitted a screenshot of the kernel panic and stack trace, but they didn't specify which commit caused it.
4+
5+
Here is your multi-step mission:
6+
7+
1. **Analyze the Bug Report**: An image artifact is located at `/app/bug_report.png`. Use OCR (e.g., `tesseract`) to read the image. It contains a hidden configuration string and a specific memory offset (formatted like `FATAL_OFFSET:0x...`) that you will need to properly configure the lock boundaries in the code.
8+
2. **Bisect the Regression**: Navigate to the git repository at `/home/user/telemetry_repo`. There are exactly 200 commits. The earlier commits work flawlessly, but a recent commit introduced a race condition in `telemetry.c` and a subtle build configuration failure in the `Makefile`. Use bisection to find the offending commit.
9+
3. **Diagnose and Fix**: Once you identify the bad commit, analyze the concurrency bug (a missing mutex lock around the string extraction buffer). Fix the race condition in `telemetry.c` and resolve the build failure.
10+
4. **Compile the Target**: Your final, fixed C program must be compiled and placed at exactly `/home/user/fixed_parser`.
11+
12+
**Verification:**
13+
Your compiled executable `/home/user/fixed_parser` will be subjected to rigorous fuzz testing. It must be bit-exact equivalent in its standard output to our reference oracle binary for thousands of randomly generated memory dump strings. The executable should accept a single command-line argument (the memory string) and print the safely extracted output.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
schema_version = "1.1"
2+
3+
[task]
4+
name = "tmax/task_000000_c19dda5b"
5+
description = "developer bisecting a regression across 200 commits"
6+
7+
[metadata]
8+
source = "v2"
9+
base_image = "intricate"
10+
domain = "debugging"
11+
skill_type = "Algorithmic"
12+
primitive_skills = ["Memory dump analysis and string extraction", "Race condition and concurrency debugging", "Build failure diagnosis", "Fuzz testing"]
13+
task_complexity = "intricate task (multi-stage workflow combining (a) environment setup or package configuration, (b) primary implementation across multiple files or languages, (c) iterative refinement against a quantitative or adversarial verifier, and (d) a final integration step. Expect 30-60 commands.)"
14+
command_complexity = "bash, code, and system services (shell commands, scripts, package installation, service configuration, networking, and containers)"
15+
scenario = "developer bisecting a regression across 200 commits"
16+
language = "C"
17+
18+
[agent]
19+
timeout_sec = 600.0
20+
21+
[verifier]
22+
timeout_sec = 120.0
23+
24+
[environment]
25+
docker_image = "prime/primeintellect/tmax:task_000000_c19dda5b"
26+
cpus = 1
27+
memory_mb = 2048
28+
allow_internet = true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
mkdir -p /logs/verifier
5+
6+
cd /tests
7+
python3 -m pytest test_final_state.py -v 2>&1 | tee /logs/verifier/test-stdout.txt
8+
TEST_EXIT=${PIPESTATUS[0]}
9+
10+
if [ $TEST_EXIT -eq 0 ]; then
11+
echo 1 > /logs/verifier/reward.txt
12+
else
13+
echo 0 > /logs/verifier/reward.txt
14+
fi
15+
16+
exit 0
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# test_final_state.py
2+
3+
import os
4+
import random
5+
import string
6+
import subprocess
7+
import pytest
8+
9+
def test_fixed_parser_exists_and_executable():
10+
path = "/home/user/fixed_parser"
11+
assert os.path.exists(path), f"Expected file {path} does not exist. Did you compile your fixed C program?"
12+
assert os.path.isfile(path), f"Expected {path} to be a file."
13+
assert os.access(path, os.X_OK), f"Expected {path} to be executable."
14+
15+
def test_oracle_parser_exists():
16+
path = "/app/oracle_parser"
17+
assert os.path.exists(path), f"Reference oracle {path} is missing."
18+
assert os.path.isfile(path), f"Reference oracle {path} is not a file."
19+
assert os.access(path, os.X_OK), f"Reference oracle {path} is not executable."
20+
21+
def test_fuzz_equivalence():
22+
agent_bin = "/home/user/fixed_parser"
23+
oracle_bin = "/app/oracle_parser"
24+
25+
if not os.path.exists(agent_bin) or not os.access(agent_bin, os.X_OK):
26+
pytest.fail(f"Cannot run fuzzing: {agent_bin} is missing or not executable.")
27+
if not os.path.exists(oracle_bin) or not os.access(oracle_bin, os.X_OK):
28+
pytest.fail(f"Cannot run fuzzing: {oracle_bin} is missing or not executable.")
29+
30+
random.seed(42)
31+
charset = string.ascii_letters + string.digits + string.punctuation + " "
32+
33+
N = 5000
34+
35+
for i in range(N):
36+
length = random.randint(10, 256)
37+
test_input = "".join(random.choices(charset, k=length))
38+
39+
try:
40+
oracle_proc = subprocess.run(
41+
[oracle_bin, test_input],
42+
capture_output=True,
43+
text=True,
44+
timeout=2
45+
)
46+
oracle_out = oracle_proc.stdout
47+
except subprocess.TimeoutExpired:
48+
pytest.fail(f"Oracle timed out on input: {test_input!r}")
49+
except Exception as e:
50+
pytest.fail(f"Oracle failed to run on input: {test_input!r}. Error: {e}")
51+
52+
try:
53+
agent_proc = subprocess.run(
54+
[agent_bin, test_input],
55+
capture_output=True,
56+
text=True,
57+
timeout=2
58+
)
59+
agent_out = agent_proc.stdout
60+
except subprocess.TimeoutExpired:
61+
pytest.fail(f"Your parser timed out on input: {test_input!r}")
62+
except Exception as e:
63+
pytest.fail(f"Your parser failed to run on input: {test_input!r}. Error: {e}")
64+
65+
assert agent_out == oracle_out, (
66+
f"Output mismatch on input: {test_input!r}\n"
67+
f"Expected (Oracle): {oracle_out!r}\n"
68+
f"Got (Agent): {agent_out!r}"
69+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ubuntu:22.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
COPY post_install.sh /tmp/post_install.sh
6+
RUN bash /tmp/post_install.sh && rm /tmp/post_install.sh

0 commit comments

Comments
 (0)