AdithyaSK HF Staff commited on
Commit
36b3cb8
·
verified ·
1 Parent(s): e75e43f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/format-code-task-000003/environment/Dockerfile +3 -0
  2. tasks/format-code-task-000003/environment/setup/files/blocklist +33 -0
  3. tasks/format-code-task-000003/environment/setup/setup.sh +34 -0
  4. tasks/format-code-task-000003/tests/test.patch +70 -0
  5. tasks/format-code-task-000003/tests/test.sh +39 -0
  6. tasks/format-code-task-000003/tests/test_command.sh +1 -0
  7. tasks/format-code-task-000004/environment/Dockerfile +3 -0
  8. tasks/format-code-task-000004/environment/setup/files/blocklist +33 -0
  9. tasks/format-code-task-000004/environment/setup/setup.sh +34 -0
  10. tasks/format-code-task-000004/tests/test.patch +59 -0
  11. tasks/format-code-task-000004/tests/test.sh +39 -0
  12. tasks/format-code-task-000004/tests/test_command.sh +1 -0
  13. tasks/format-code-task-000050/environment/Dockerfile +3 -0
  14. tasks/format-code-task-000050/environment/setup/files/blocklist +33 -0
  15. tasks/format-code-task-000050/environment/setup/setup.sh +34 -0
  16. tasks/format-code-task-000050/tests/test.patch +279 -0
  17. tasks/format-code-task-000050/tests/test.sh +40 -0
  18. tasks/format-code-task-000050/tests/test_command.sh +1 -0
  19. tasks/format-code-task-000057/environment/Dockerfile +3 -0
  20. tasks/format-code-task-000057/environment/setup/files/blocklist +33 -0
  21. tasks/format-code-task-000057/environment/setup/setup.sh +34 -0
  22. tasks/format-code-task-000057/tests/test.patch +103 -0
  23. tasks/format-code-task-000057/tests/test.sh +39 -0
  24. tasks/format-code-task-000057/tests/test_command.sh +1 -0
  25. tasks/format-code-task-000059/environment/Dockerfile +3 -0
  26. tasks/format-code-task-000059/environment/setup/files/blocklist +33 -0
  27. tasks/format-code-task-000059/environment/setup/setup.sh +34 -0
  28. tasks/format-code-task-000059/tests/test.patch +336 -0
  29. tasks/format-code-task-000059/tests/test.sh +40 -0
  30. tasks/format-code-task-000059/tests/test_command.sh +1 -0
  31. tasks/format-code-task-000092/environment/Dockerfile +3 -0
  32. tasks/format-code-task-000092/environment/setup/files/blocklist +33 -0
  33. tasks/format-code-task-000092/environment/setup/setup.sh +34 -0
  34. tasks/format-code-task-000092/tests/test.patch +167 -0
  35. tasks/format-code-task-000092/tests/test.sh +39 -0
  36. tasks/format-code-task-000092/tests/test_command.sh +1 -0
  37. tasks/format-code-task-000095/environment/Dockerfile +3 -0
  38. tasks/format-code-task-000095/environment/setup/files/blocklist +33 -0
  39. tasks/format-code-task-000095/environment/setup/setup.sh +34 -0
  40. tasks/format-code-task-000095/tests/test.patch +153 -0
  41. tasks/format-code-task-000095/tests/test.sh +39 -0
  42. tasks/format-code-task-000095/tests/test_command.sh +1 -0
  43. tasks/format-code-task-000113/environment/Dockerfile +3 -0
  44. tasks/format-code-task-000113/environment/setup/files/blocklist +33 -0
  45. tasks/format-code-task-000113/environment/setup/setup.sh +34 -0
  46. tasks/format-code-task-000113/tests/test.patch +70 -0
  47. tasks/format-code-task-000113/tests/test.sh +39 -0
  48. tasks/format-code-task-000113/tests/test_command.sh +1 -0
  49. tasks/format-code-task-000122/environment/Dockerfile +3 -0
  50. tasks/format-code-task-000122/environment/setup/files/blocklist +33 -0
tasks/format-code-task-000003/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:89d2302961adfe5b768b28b72e5c7a227e24e32d923f2a996b077c85fa3bc428
tasks/format-code-task-000003/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000003/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000003/tests/test.patch ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/test_bitwise.py b/tests/test_bitwise.py
2
+ index 8e76db2..60aacdc 100644
3
+ --- a/tests/test_bitwise.py
4
+ +++ b/tests/test_bitwise.py
5
+ @@ -1,6 +1,6 @@
6
+ from smol_evm.constants import MAX_UINT256
7
+ from smol_evm.context import ExecutionContext
8
+ -from smol_evm.opcodes import SHR
9
+ +from smol_evm.opcodes import SHL, SHR
10
+
11
+ import pytest
12
+
13
+ @@ -10,6 +10,37 @@
14
+ def context() -> ExecutionContext:
15
+ return ExecutionContext()
16
+
17
+ +
18
+ +def test_shl_simple(context):
19
+ + SHL.execute(with_stack_contents(context, [16, 1]))
20
+ + assert context.stack.pop() == 32
21
+ +
22
+ +
23
+ +def test_shl_big(context):
24
+ + SHL.execute(with_stack_contents(context, [16, 5]))
25
+ + assert context.stack.pop() == 512
26
+ +
27
+ +
28
+ +def test_shl_by_zero(context):
29
+ + SHL.execute(with_stack_contents(context, [16, 0]))
30
+ + assert context.stack.pop() == 16
31
+ +
32
+ +
33
+ +def test_shl_non_power_of_two(context):
34
+ + SHL.execute(with_stack_contents(context, [15, 1]))
35
+ + assert context.stack.pop() == 30
36
+ +
37
+ +
38
+ +def test_shl_max(context):
39
+ + SHL.execute(with_stack_contents(context, [2 ** 256 - 1, 1]))
40
+ + assert context.stack.pop() == (2 ** 256 - 1) - 1
41
+ +
42
+ +
43
+ +def test_shl_by_max(context):
44
+ + SHL.execute(with_stack_contents(context, [2 ** 256 - 1, 2 ** 256 - 1]))
45
+ + assert context.stack.pop() == 0
46
+ +
47
+ +
48
+ def test_shr_simple(context):
49
+ SHR.execute(with_stack_contents(context, [16, 1]))
50
+ assert context.stack.pop() == 8
51
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
52
+ new file mode 100644
53
+ --- /dev/null
54
+ +++ b/mimo_build_env.tar.gz.b64
55
+ @@ -0,0 +1,4 @@
56
+ +H4sIAAAAAAAAA+3STQrCMBCG4ax7irmANbFNexyxtmDB/mCi4u2NdVER1E2LiO+zyAxJIANf4uJY
57
+ +78t11Z6Wai46yK0davBch97YlTG5XiWJUdoYm6dK7GwTPTg6vzmIqEPX+Xf3Pp3/qHjM31fOr7dd
58
+ +02zaMna76d74mH+Wj/nrLOSfZsYq0dON8Nqf578tZQi+qMqov/hd1yayaCS0YVNui7t/jKL259pV
59
+ +cX+RxSn69tgAAAAAAAAAAAAAAAAAgiu4iUYAACgAAA==
60
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
61
+ new file mode 100755
62
+ --- /dev/null
63
+ +++ b/mimo_test_command.sh
64
+ @@ -0,0 +1,6 @@
65
+ +#!/usr/bin/env bash
66
+ +
67
+ +set -uo pipefail
68
+ +cd /testbed || exit 1
69
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
70
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000003/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ tests/test_bitwise.py
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000003/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000004/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2777136eb50329705f24b2400b691aade6b6942117011fbb9399aa3ad3cc1bd0
tasks/format-code-task-000004/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000004/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000004/tests/test.patch ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/api/tests/unit/application/organizations/index_test.js b/api/tests/unit/application/organizations/index_test.js
2
+ index 7617d3b3ca3..070ae31847e 100644
3
+ --- a/api/tests/unit/application/organizations/index_test.js
4
+ +++ b/api/tests/unit/application/organizations/index_test.js
5
+ @@ -26,10 +26,10 @@ describe('Unit | Router | organization-router', () => {
6
+
7
+ describe('GET /api/organizations', () => {
8
+
9
+ - it('should exist', async () => {
10
+ + it('should return OK (200) when request is valid', async () => {
11
+ // given
12
+ const method = 'GET';
13
+ - const url = '/api/organizations?filter[name]=DRA&filter[type]=AZ&filter[type]=SCO&page[number]=3&page[size]=25';
14
+ + const url = '/api/organizations?filter[id]=&filter[name]=DRA&filter[type]=SCO&page[number]=3&page[size]=25';
15
+
16
+ // when
17
+ const response = await httpTestServer.request(method, url);
18
+ @@ -37,6 +37,19 @@ describe('Unit | Router | organization-router', () => {
19
+ // then
20
+ expect(response.statusCode).to.equal(200);
21
+ });
22
+ +
23
+ + it('should return BadRequest (400) when request is invalid', async () => {
24
+ +
25
+ + const method = 'GET';
26
+ + const idNotNumeric = 'foo';
27
+ + const url = `/api/organizations?filter[id]=${idNotNumeric}`;
28
+ +
29
+ +
30
+ + const response = await httpTestServer.request(method, url);
31
+ +
32
+ +
33
+ + expect(response.statusCode).to.equal(400);
34
+ + });
35
+ });
36
+
37
+ describe('POST /api/organizations/{id}/invitations', () => {
38
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
39
+ new file mode 100644
40
+ --- /dev/null
41
+ +++ b/mimo_build_env.tar.gz.b64
42
+ @@ -0,0 +1,6 @@
43
+ +H4sIAAAAAAAAA+3SQU+DMBgGYM77FTWeRweBceKAGTczE4dem0Ibqdla0haz+OvtOKgx0V22LIvv
44
+ +c/kK/Voa3sbtqLaCSf1Go3NZBEWeTzX4WadxkqdJssyyrAh9YZSkEcnPdqJvRue5JSSyxvi/+o7N
45
+ +X6n4K38vnWed2e24FrHrT/eNY/mnafGZ/yLNQv7ZMskjsjjdEX73z/O/vaGt0rTlrp91gkyXoJWC
46
+ +8kHN1g+rmtXr5/LwkjT1pmGrqqnuqk3Nnh7vy5YLNtot0cOe7EzXczKfy73yoVg5GOulLYXx5LDc
47
+ +0VErH7YdtqrjXhlNjX3hWr1PD44qLeSeHVrjVze79G8BAAAAAAAAAAAAAAAAAAAAALgKH3/Xkb4A
48
+ +KAAA
49
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
50
+ new file mode 100755
51
+ --- /dev/null
52
+ +++ b/mimo_test_command.sh
53
+ @@ -0,0 +1,6 @@
54
+ +#!/usr/bin/env bash
55
+ +
56
+ +set -uo pipefail
57
+ +cd /testbed || exit 1
58
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
59
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000004/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ api/tests/unit/application/organizations/index_test.js
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000004/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000050/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5c76dad6079c8df3a423a02bbde6d2127bec286baff71f3de5411b1ebade3ffc
tasks/format-code-task-000050/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000050/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000050/tests/test.patch ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/__init__.py b/tests/__init__.py
2
+ new file mode 100644
3
+ index 00000000..e69de29b
4
+ diff --git a/tests/core/__init__.py b/tests/core/__init__.py
5
+ new file mode 100644
6
+ index 00000000..e69de29b
7
+ diff --git a/tests/core/test_config.py b/tests/core/test_config.py
8
+ new file mode 100644
9
+ index 00000000..57bcea73
10
+ --- /dev/null
11
+ +++ b/tests/core/test_config.py
12
+ @@ -0,0 +1,226 @@
13
+ +
14
+ +import asyncio
15
+ +import itertools
16
+ +
17
+ +import pytest
18
+ +
19
+ +from core.config import Config
20
+ +
21
+ +
22
+ +
23
+ +_counter = itertools.count()
24
+ +
25
+ +
26
+ +def make_conf(force_registration=False):
27
+ + name = "TestCog{}".format(next(_counter))
28
+ + return Config.get_conf(name, unique_identifier=next(_counter),
29
+ + force_registration=force_registration)
30
+ +
31
+ +
32
+ +def run(coro):
33
+ +
34
+ + loop = asyncio.new_event_loop()
35
+ + try:
36
+ + return loop.run_until_complete(coro)
37
+ + finally:
38
+ + loop.close()
39
+ +
40
+ +
41
+ +class FakeIdObject:
42
+ + def __init__(self, id):
43
+ + self.id = id
44
+ +
45
+ +
46
+ +
47
+ +
48
+ +def test_global_default_returned_when_unset():
49
+ + conf = make_conf()
50
+ + conf.register_global(foo=42, bar="baz")
51
+ + assert conf.foo() == 42
52
+ + assert conf.bar() == "baz"
53
+ +
54
+ +
55
+ +def test_global_set_then_read():
56
+ + conf = make_conf()
57
+ + conf.register_global(foo=42)
58
+ + run(conf.set("foo", 100))
59
+ + assert conf.foo() == 100
60
+ +
61
+ +
62
+ +def test_unregistered_read_returns_none_without_strict():
63
+ + conf = make_conf()
64
+ + assert conf.nonexistent() is None
65
+ +
66
+ +
67
+ +def test_set_unregistered_allowed_without_strict():
68
+ + conf = make_conf()
69
+ + run(conf.set("dynamic", 7))
70
+ + assert conf.dynamic() == 7
71
+ +
72
+ +
73
+ +
74
+ +
75
+ +def test_guild_default_and_set():
76
+ + conf = make_conf()
77
+ + conf.register_guild(prefix="!")
78
+ + assert conf.guild(1).prefix() == "!"
79
+ + run(conf.guild(1).set("prefix", "?"))
80
+ + assert conf.guild(1).prefix() == "?"
81
+ +
82
+ +
83
+ +def test_guild_isolation_between_ids():
84
+ + conf = make_conf()
85
+ + conf.register_guild(prefix="!")
86
+ + run(conf.guild(1).set("prefix", "?"))
87
+ + assert conf.guild(1).prefix() == "?"
88
+ + assert conf.guild(2).prefix() == "!"
89
+ +
90
+ +
91
+ +def test_guild_does_not_leak_into_global():
92
+ + conf = make_conf()
93
+ + conf.register_global(value=0)
94
+ + conf.register_guild(value=0)
95
+ + run(conf.guild(1).set("value", 99))
96
+ + assert conf.value() == 0
97
+ + assert conf.guild(2).value() == 0
98
+ +
99
+ +
100
+ +def test_scopes_have_independent_keysets():
101
+ + conf = make_conf()
102
+ + conf.register_global(only_global=1)
103
+ + conf.register_guild(only_guild=2)
104
+ + assert conf.only_global() == 1
105
+ + assert conf.guild(1).only_global() is None
106
+ + assert conf.guild(1).only_guild() == 2
107
+ + assert conf.only_guild() is None
108
+ +
109
+ +
110
+ +
111
+ +
112
+ +def test_channel_role_user_scopes():
113
+ + conf = make_conf()
114
+ + conf.register_channel(a=1)
115
+ + conf.register_role(b=2)
116
+ + conf.register_user(c=3)
117
+ +
118
+ + assert conf.channel(10).a() == 1
119
+ + assert conf.role(10).b() == 2
120
+ + assert conf.user(10).c() == 3
121
+ +
122
+ + run(conf.channel(10).set("a", 11))
123
+ + run(conf.role(10).set("b", 22))
124
+ + run(conf.user(10).set("c", 33))
125
+ +
126
+ + assert conf.channel(10).a() == 11
127
+ + assert conf.channel(99).a() == 1
128
+ + assert conf.role(10).b() == 22
129
+ + assert conf.role(99).b() == 2
130
+ + assert conf.user(10).c() == 33
131
+ + assert conf.user(99).c() == 3
132
+ +
133
+ +
134
+ +
135
+ +
136
+ +def test_member_default_and_set():
137
+ + conf = make_conf()
138
+ + conf.register_member(points=0)
139
+ + assert conf.member(1, 5).points() == 0
140
+ + run(conf.member(1, 5).set("points", 50))
141
+ + assert conf.member(1, 5).points() == 50
142
+ +
143
+ +
144
+ +def test_member_composite_isolation():
145
+ + conf = make_conf()
146
+ + conf.register_member(points=0)
147
+ + run(conf.member(1, 5).set("points", 50))
148
+ +
149
+ + assert conf.member(2, 5).points() == 0
150
+ +
151
+ + assert conf.member(1, 6).points() == 0
152
+ + assert conf.member(1, 5).points() == 50
153
+ +
154
+ +
155
+ +
156
+ +
157
+ +def test_id_object_equivalent_to_int():
158
+ + conf = make_conf()
159
+ + conf.register_guild(prefix="!")
160
+ + run(conf.guild(123).set("prefix", "$"))
161
+ + assert conf.guild(FakeIdObject(123)).prefix() == "$"
162
+ + run(conf.guild(FakeIdObject(123)).set("prefix", "%"))
163
+ + assert conf.guild(123).prefix() == "%"
164
+ +
165
+ +
166
+ +def test_member_id_objects():
167
+ + conf = make_conf()
168
+ + conf.register_member(points=0)
169
+ + run(conf.member(FakeIdObject(1), FakeIdObject(5)).set("points", 7))
170
+ + assert conf.member(1, 5).points() == 7
171
+ +
172
+ +
173
+ +
174
+ +
175
+ +def test_clear_resets_scope_to_defaults():
176
+ + conf = make_conf()
177
+ + conf.register_guild(prefix="!")
178
+ + run(conf.guild(1).set("prefix", "?"))
179
+ + assert conf.guild(1).prefix() == "?"
180
+ + run(conf.guild(1).clear())
181
+ + assert conf.guild(1).prefix() == "!"
182
+ +
183
+ +
184
+ +def test_clear_only_affects_target_scope():
185
+ + conf = make_conf()
186
+ + conf.register_guild(prefix="!")
187
+ + run(conf.guild(1).set("prefix", "?"))
188
+ + run(conf.guild(2).set("prefix", "."))
189
+ + run(conf.guild(1).clear())
190
+ + assert conf.guild(1).prefix() == "!"
191
+ + assert conf.guild(2).prefix() == "."
192
+ +
193
+ +
194
+ +
195
+ +
196
+ +def test_register_merges_and_overrides():
197
+ + conf = make_conf()
198
+ + conf.register_global(a=1, b=2)
199
+ + conf.register_global(b=20, c=3)
200
+ + assert conf.a() == 1
201
+ + assert conf.b() == 20
202
+ + assert conf.c() == 3
203
+ +
204
+ +
205
+ +
206
+ +
207
+ +def test_strict_read_unregistered_raises():
208
+ + conf = make_conf(force_registration=True)
209
+ + conf.register_global(known=1)
210
+ + with pytest.raises(AttributeError):
211
+ + conf.unknown()
212
+ +
213
+ +
214
+ +def test_strict_set_unregistered_raises():
215
+ + conf = make_conf(force_registration=True)
216
+ + conf.register_global(known=1)
217
+ + with pytest.raises(AttributeError):
218
+ + run(conf.set("unknown", 5))
219
+ +
220
+ +
221
+ +def test_strict_registered_key_works():
222
+ + conf = make_conf(force_registration=True)
223
+ + conf.register_global(known=1)
224
+ + conf.register_guild(gkey=2)
225
+ + assert conf.known() == 1
226
+ + run(conf.set("known", 9))
227
+ + assert conf.known() == 9
228
+ + assert conf.guild(1).gkey() == 2
229
+ + run(conf.guild(1).set("gkey", 8))
230
+ + assert conf.guild(1).gkey() == 8
231
+ +
232
+ +
233
+ +def test_strict_is_per_scope():
234
+ + conf = make_conf(force_registration=True)
235
+ + conf.register_global(known=1)
236
+ +
237
+ + with pytest.raises(AttributeError):
238
+ + conf.guild(1).known()
239
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
240
+ new file mode 100755
241
+ --- /dev/null
242
+ +++ b/mimo_test_command.sh
243
+ @@ -0,0 +1,36 @@
244
+ +#!/usr/bin/env bash
245
+ +
246
+ +
247
+ +
248
+ +set -euo pipefail
249
+ +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
250
+ +cd /testbed
251
+ +
252
+ +
253
+ +
254
+ +
255
+ +
256
+ +
257
+ +
258
+ +
259
+ +
260
+ +SP="$PWD/.venv/lib/python3.12/site-packages"
261
+ +if [ ! -f "$SP/pytest/__init__.pyc" ]; then
262
+ + find "$SP" -type d -name __pycache__ | while read -r d; do
263
+ + parent="$(dirname "$d")"
264
+ + for f in "$d"/*.cpython-312.pyc; do
265
+ + [ -e "$f" ] || continue
266
+ + base="$(basename "$f" .cpython-312.pyc)"
267
+ + [ -e "$parent/$base.pyc" ] || cp "$f" "$parent/$base.pyc"
268
+ + done
269
+ + done
270
+ +fi
271
+ +export PYTHONPATH="$SP"
272
+ +
273
+ +
274
+ +
275
+ +
276
+ +python3 -c "import core, core.json_io, core.utils.chat_formatting"
277
+ +
278
+ +
279
+ +python3 -m pytest tests/core/test_config.py -q
tasks/format-code-task-000050/tests/test.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ tests/__init__.py
25
+ tests/core/__init__.py
26
+ tests/core/test_config.py
27
+ mimo_test_command.sh
28
+ EOF_RESET_TEST_FILES
29
+
30
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
31
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
32
+ cat "$V/apply.log" >&2
33
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
34
+ exit 1
35
+ fi
36
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
37
+ RC=$?
38
+ tail -c 12000 "$V/test_output.log"
39
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
40
+ echo "test command exited $RC"
tasks/format-code-task-000050/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000057/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9e1d3d6484d0d443aca802000639cf5901c142a256071f20732052cfb972204b
tasks/format-code-task-000057/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000057/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000057/tests/test.patch ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/pkg/logs/internal/decoder/auto_multiline_detection/user_samples_test.go b/pkg/logs/internal/decoder/auto_multiline_detection/user_samples_test.go
2
+ index db74b9efe4d554..db348cef768b93 100644
3
+ --- a/pkg/logs/internal/decoder/auto_multiline_detection/user_samples_test.go
4
+ +++ b/pkg/logs/internal/decoder/auto_multiline_detection/user_samples_test.go
5
+ @@ -80,6 +80,36 @@ logs_config:
6
+ assert.Equal(t, aggregate, samples.samples[2].label)
7
+ }
8
+
9
+ +func TestUserPatternsJSON(t *testing.T) {
10
+ +
11
+ + mockConfig := mock.New(t)
12
+ + mockConfig.SetWithoutSource("logs_config.auto_multi_line_detection_custom_samples", `[{"sample": "1", "label": "start_group"}, {"regex": "\\d\\w", "label": "no_aggregate"}, {"sample": "3", "match_threshold": 0.1}]`)
13
+ +
14
+ + samples := NewUserSamples(mockConfig)
15
+ + assert.Equal(t, 3, len(samples.samples))
16
+ + assert.Equal(t, startGroup, samples.samples[0].label)
17
+ + assert.Equal(t, "1", samples.samples[0].Sample)
18
+ + assert.Equal(t, noAggregate, samples.samples[1].label)
19
+ + assert.Equal(t, "\\d\\w", samples.samples[1].Regex)
20
+ + assert.Equal(t, "3", samples.samples[2].Sample)
21
+ + assert.Equal(t, 0.1, samples.samples[2].matchThreshold)
22
+ +}
23
+ +
24
+ +func TestUserPatternsJSONEnv(t *testing.T) {
25
+ +
26
+ + mockConfig := mock.New(t)
27
+ + t.Setenv("DD_LOGS_CONFIG_AUTO_MULTI_LINE_DETECTION_CUSTOM_SAMPLES", `[{"sample": "1", "label": "start_group"}, {"regex": "\\d\\w", "label": "no_aggregate"}, {"sample": "3", "match_threshold": 0.1}]`)
28
+ +
29
+ + samples := NewUserSamples(mockConfig)
30
+ + assert.Equal(t, 3, len(samples.samples))
31
+ + assert.Equal(t, startGroup, samples.samples[0].label)
32
+ + assert.Equal(t, "1", samples.samples[0].Sample)
33
+ + assert.Equal(t, noAggregate, samples.samples[1].label)
34
+ + assert.Equal(t, "\\d\\w", samples.samples[1].Regex)
35
+ + assert.Equal(t, "3", samples.samples[2].Sample)
36
+ + assert.Equal(t, 0.1, samples.samples[2].matchThreshold)
37
+ +}
38
+ +
39
+ func TestUserPatternsMatchThreshold(t *testing.T) {
40
+
41
+ datadogYaml := `
42
+ @@ -221,6 +251,40 @@ logs_config:
43
+ }
44
+ }
45
+
46
+ +func TestOnlyLegacyPatterns(t *testing.T) {
47
+ +
48
+ + datadogYaml := `
49
+ +logs_config:
50
+ + auto_multi_line_extra_patterns:
51
+ + - "le\\wacy"
52
+ +`
53
+ +
54
+ + mockConfig := mock.NewFromYAML(t, datadogYaml)
55
+ + samples := NewUserSamples(mockConfig)
56
+ + tokenizer := NewTokenizer(60)
57
+ +
58
+ + tests := []struct {
59
+ + expectedLabel Label
60
+ + shouldStop bool
61
+ + input string
62
+ + }{
63
+ + {startGroup, false, "legacy pattern should match me"},
64
+ + {startGroup, false, "leAacy pattern should match me"},
65
+ + {startGroup, false, "leVacy pattern should match me"},
66
+ + }
67
+ +
68
+ + for _, test := range tests {
69
+ + context := &messageContext{
70
+ + rawMessage: []byte(test.input),
71
+ + label: aggregate,
72
+ + }
73
+ +
74
+ + assert.True(t, tokenizer.ProcessAndContinue(context))
75
+ + assert.Equal(t, test.shouldStop, samples.ProcessAndContinue(context), "Expected stop %v, got %v", test.shouldStop, samples.ProcessAndContinue(context))
76
+ + assert.Equal(t, test.expectedLabel, context.label, "Expected label %v, got %v", test.expectedLabel, context.label)
77
+ + }
78
+ +}
79
+ +
80
+ func TestUserPatternsProcessRegexCustomSettings(t *testing.T) {
81
+
82
+ datadogYaml := `
83
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
84
+ new file mode 100644
85
+ --- /dev/null
86
+ +++ b/mimo_build_env.tar.gz.b64
87
+ @@ -0,0 +1,5 @@
88
+ +H4sIAAAAAAAAA+3RTU7DMBAFYK97Cl+g8Q/YWXGWKLWtYOF4UDLu+QlZAEKCbloh1PdtZiSP5Bm9
89
+ +7tRyiUOqZyVuRW965/a6+V733jhrrO6tN15oY7x+ENLdbKMv2srjIqVYiPi3uUvv/1T3mT+nlYdA
90
+ +8zzW2K3P1/vjUv7G+o/8Xb/NmUdvrZD6eiv87M7zD1HuwZ9SPEwk31vZqdeXSRWaVpUrp6WORcUU
91
+ +KKZFjY1pmFvhXHJNQ0ycAmeqSh7P8hioVX4yh7++CgAAAAAAAAAAAAAAAAAAAADgPrwBnZTdPwAo
92
+ +AAA=
93
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
94
+ new file mode 100755
95
+ --- /dev/null
96
+ +++ b/mimo_test_command.sh
97
+ @@ -0,0 +1,6 @@
98
+ +#!/usr/bin/env bash
99
+ +
100
+ +set -uo pipefail
101
+ +cd /testbed || exit 1
102
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
103
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000057/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ pkg/logs/internal/decoder/auto_multiline_detection/user_samples_test.go
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000057/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000059/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:bd1d7cd57d1a31aa1b5c6a49553932a1c321d040c15b0b962045f5a25a859667
tasks/format-code-task-000059/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000059/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000059/tests/test.patch ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/apis/datadoghq/v2alpha1/datadogagent_update_strategy_schema_test.go b/apis/datadoghq/v2alpha1/datadogagent_update_strategy_schema_test.go
2
+ new file mode 100644
3
+ index 00000000..482aa990
4
+ --- /dev/null
5
+ +++ b/apis/datadoghq/v2alpha1/datadogagent_update_strategy_schema_test.go
6
+ @@ -0,0 +1,115 @@
7
+ +package v2alpha1
8
+ +
9
+ +import (
10
+ + "os"
11
+ + "path/filepath"
12
+ + "testing"
13
+ +
14
+ + "github.com/stretchr/testify/assert"
15
+ + "github.com/stretchr/testify/require"
16
+ + "sigs.k8s.io/yaml"
17
+ +)
18
+ +
19
+ +func TestDatadogAgentOverrideUpdateStrategyIsExposedInCRDSchema(t *testing.T) {
20
+ +
21
+ + crdPath := filepath.Join("..", "..", "..", "config", "crd", "bases", "v1", "datadoghq.com_datadogagents.yaml")
22
+ + raw, err := os.ReadFile(crdPath)
23
+ + require.NoError(t, err)
24
+ +
25
+ + var crd map[string]interface{}
26
+ + require.NoError(t, yaml.Unmarshal(raw, &crd))
27
+ +
28
+ + var updateStrategySchema map[string]interface{}
29
+ + for _, candidate := range findObjectProperties(crd, "updateStrategy") {
30
+ + candidateProperties := properties(candidate)
31
+ + rollingUpdate, hasRollingUpdate := candidateProperties["rollingUpdate"]
32
+ + rollingProperties := properties(rollingUpdate)
33
+ + if _, hasType := candidateProperties["type"]; hasType && hasRollingUpdate && rollingProperties["maxUnavailable"] != nil && rollingProperties["maxSurge"] != nil {
34
+ + updateStrategySchema = candidate
35
+ + break
36
+ + }
37
+ + }
38
+ + require.NotNil(t, updateStrategySchema, "component override schema should expose updateStrategy with rollingUpdate limits")
39
+ +
40
+ + strategyType, ok := properties(updateStrategySchema)["type"]
41
+ + require.True(t, ok, "updateStrategy should expose a strategy type")
42
+ + assert.Equal(t, "string", fieldString(strategyType, "type"))
43
+ +
44
+ + rollingUpdate, ok := properties(updateStrategySchema)["rollingUpdate"]
45
+ + require.True(t, ok, "updateStrategy should expose rollingUpdate limits")
46
+ +
47
+ + rollingProperties := properties(rollingUpdate)
48
+ + assertIntOrStringSchema(t, rollingProperties["maxUnavailable"], "maxUnavailable")
49
+ + assertIntOrStringSchema(t, rollingProperties["maxSurge"], "maxSurge")
50
+ +}
51
+ +
52
+ +func findObjectProperties(node interface{}, property string) []map[string]interface{} {
53
+ + switch value := node.(type) {
54
+ + case map[string]interface{}:
55
+ + var matches []map[string]interface{}
56
+ + if props := properties(value); props != nil {
57
+ + if found, ok := props[property].(map[string]interface{}); ok {
58
+ + matches = append(matches, found)
59
+ + }
60
+ + }
61
+ + for _, child := range value {
62
+ + matches = append(matches, findObjectProperties(child, property)...)
63
+ + }
64
+ + return matches
65
+ + case []interface{}:
66
+ + var matches []map[string]interface{}
67
+ + for _, child := range value {
68
+ + matches = append(matches, findObjectProperties(child, property)...)
69
+ + }
70
+ + return matches
71
+ + default:
72
+ + return nil
73
+ + }
74
+ +}
75
+ +
76
+ +func properties(schema interface{}) map[string]interface{} {
77
+ + value, ok := schema.(map[string]interface{})
78
+ + if !ok {
79
+ + return nil
80
+ + }
81
+ + props, ok := value["properties"].(map[string]interface{})
82
+ + if !ok {
83
+ + return nil
84
+ + }
85
+ + return props
86
+ +}
87
+ +
88
+ +func assertIntOrStringSchema(t *testing.T, schema interface{}, field string) {
89
+ + t.Helper()
90
+ +
91
+ + value := requireMap(t, schema, field)
92
+ +
93
+ + assert.Equal(t, true, value["x-kubernetes-int-or-string"], "%s should preserve Kubernetes IntOrString schema semantics", field)
94
+ +
95
+ + branches, ok := value["anyOf"].([]interface{})
96
+ + require.True(t, ok, "%s should allow integer and string branches", field)
97
+ +
98
+ + seen := map[string]bool{}
99
+ + for _, branch := range branches {
100
+ + seen[fieldString(branch, "type")] = true
101
+ + }
102
+ + assert.True(t, seen["integer"], "%s should allow integer values", field)
103
+ + assert.True(t, seen["string"], "%s should allow string values", field)
104
+ +}
105
+ +
106
+ +func requireMap(t *testing.T, value interface{}, name string) map[string]interface{} {
107
+ + t.Helper()
108
+ +
109
+ + result, ok := value.(map[string]interface{})
110
+ + require.True(t, ok, "%s should be an object schema", name)
111
+ + return result
112
+ +}
113
+ +
114
+ +func fieldString(value interface{}, field string) string {
115
+ + object, ok := value.(map[string]interface{})
116
+ + if !ok {
117
+ + return ""
118
+ + }
119
+ + text, _ := object[field].(string)
120
+ + return text
121
+ +}
122
+ diff --git a/controllers/datadogagent/override/daemonset_test.go b/controllers/datadogagent/override/daemonset_test.go
123
+ new file mode 100644
124
+ index 00000000..22511049
125
+ --- /dev/null
126
+ +++ b/controllers/datadogagent/override/daemonset_test.go
127
+ @@ -0,0 +1,96 @@
128
+ +package override
129
+ +
130
+ +import (
131
+ + "encoding/json"
132
+ + "testing"
133
+ +
134
+ + "github.com/DataDog/datadog-operator/apis/datadoghq/v2alpha1"
135
+ + "github.com/stretchr/testify/assert"
136
+ + "github.com/stretchr/testify/require"
137
+ + appsv1 "k8s.io/api/apps/v1"
138
+ + "k8s.io/apimachinery/pkg/util/intstr"
139
+ +)
140
+ +
141
+ +func TestDaemonSetAppliesUpdateStrategyFromJSONOverride(t *testing.T) {
142
+ + tests := []struct {
143
+ + name string
144
+ + overrideJSON string
145
+ + expectedType appsv1.DaemonSetUpdateStrategyType
146
+ + expectedUnavailable *intstr.IntOrString
147
+ + expectedSurge *intstr.IntOrString
148
+ + }{
149
+ + {
150
+ + name: "rolling update keeps percentage limits",
151
+ + overrideJSON: `{
152
+ + "updateStrategy": {
153
+ + "type": "RollingUpdate",
154
+ + "rollingUpdate": {
155
+ + "maxUnavailable": "30%",
156
+ + "maxSurge": "20%"
157
+ + }
158
+ + }
159
+ + }`,
160
+ + expectedType: appsv1.RollingUpdateDaemonSetStrategyType,
161
+ + expectedUnavailable: intOrStringPtr(intstr.FromString("30%")),
162
+ + expectedSurge: intOrStringPtr(intstr.FromString("20%")),
163
+ + },
164
+ + {
165
+ + name: "rolling update keeps numeric limits",
166
+ + overrideJSON: `{
167
+ + "updateStrategy": {
168
+ + "type": "RollingUpdate",
169
+ + "rollingUpdate": {
170
+ + "maxUnavailable": 3,
171
+ + "maxSurge": 2
172
+ + }
173
+ + }
174
+ + }`,
175
+ + expectedType: appsv1.RollingUpdateDaemonSetStrategyType,
176
+ + expectedUnavailable: intOrStringPtr(intstr.FromInt(3)),
177
+ + expectedSurge: intOrStringPtr(intstr.FromInt(2)),
178
+ + },
179
+ + {
180
+ + name: "non rolling strategy keeps the requested type",
181
+ + overrideJSON: `{
182
+ + "updateStrategy": {
183
+ + "type": "OnDelete"
184
+ + }
185
+ + }`,
186
+ + expectedType: appsv1.OnDeleteDaemonSetStrategyType,
187
+ + },
188
+ + }
189
+ +
190
+ + for _, tt := range tests {
191
+ + t.Run(tt.name, func(t *testing.T) {
192
+ + daemonSet := appsv1.DaemonSet{}
193
+ + override := componentOverrideFromJSON(t, tt.overrideJSON)
194
+ +
195
+ + DaemonSet(&daemonSet, &override)
196
+ +
197
+ + assert.Equal(t, tt.expectedType, daemonSet.Spec.UpdateStrategy.Type)
198
+ + if tt.expectedUnavailable != nil || tt.expectedSurge != nil {
199
+ + require.NotNil(t, daemonSet.Spec.UpdateStrategy.RollingUpdate)
200
+ + }
201
+ + if tt.expectedUnavailable != nil {
202
+ + require.NotNil(t, daemonSet.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable)
203
+ + assert.Equal(t, *tt.expectedUnavailable, *daemonSet.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable)
204
+ + }
205
+ + if tt.expectedSurge != nil {
206
+ + require.NotNil(t, daemonSet.Spec.UpdateStrategy.RollingUpdate.MaxSurge)
207
+ + assert.Equal(t, *tt.expectedSurge, *daemonSet.Spec.UpdateStrategy.RollingUpdate.MaxSurge)
208
+ + }
209
+ + })
210
+ + }
211
+ +}
212
+ +
213
+ +func componentOverrideFromJSON(t *testing.T, payload string) v2alpha1.DatadogAgentComponentOverride {
214
+ + t.Helper()
215
+ +
216
+ + var override v2alpha1.DatadogAgentComponentOverride
217
+ + require.NoError(t, json.Unmarshal([]byte(payload), &override))
218
+ + return override
219
+ +}
220
+ +
221
+ +func intOrStringPtr(value intstr.IntOrString) *intstr.IntOrString {
222
+ + return &value
223
+ +}
224
+ diff --git a/controllers/datadogagent/override/deploymentspec_test.go b/controllers/datadogagent/override/deploymentspec_test.go
225
+ index 2d6a165a..5f4218a3 100644
226
+ --- a/controllers/datadogagent/override/deploymentspec_test.go
227
+ +++ b/controllers/datadogagent/override/deploymentspec_test.go
228
+ @@ -11,10 +11,84 @@ import (
229
+ "github.com/DataDog/datadog-operator/apis/datadoghq/v2alpha1"
230
+ apiutils "github.com/DataDog/datadog-operator/apis/utils"
231
+ "github.com/stretchr/testify/assert"
232
+ + "github.com/stretchr/testify/require"
233
+ v1 "k8s.io/api/apps/v1"
234
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
235
+ + "k8s.io/apimachinery/pkg/util/intstr"
236
+ )
237
+
238
+ +func TestDeploymentAppliesUpdateStrategyFromJSONOverride(t *testing.T) {
239
+ + tests := []struct {
240
+ + name string
241
+ + overrideJSON string
242
+ + expectedType v1.DeploymentStrategyType
243
+ + expectedUnavailable *intstr.IntOrString
244
+ + expectedSurge *intstr.IntOrString
245
+ + }{
246
+ + {
247
+ + name: "rolling update keeps percentage limits",
248
+ + overrideJSON: `{
249
+ + "updateStrategy": {
250
+ + "type": "RollingUpdate",
251
+ + "rollingUpdate": {
252
+ + "maxUnavailable": "25%",
253
+ + "maxSurge": "15%"
254
+ + }
255
+ + }
256
+ + }`,
257
+ + expectedType: v1.RollingUpdateDeploymentStrategyType,
258
+ + expectedUnavailable: intOrStringPtr(intstr.FromString("25%")),
259
+ + expectedSurge: intOrStringPtr(intstr.FromString("15%")),
260
+ + },
261
+ + {
262
+ + name: "rolling update keeps numeric limits",
263
+ + overrideJSON: `{
264
+ + "updateStrategy": {
265
+ + "type": "RollingUpdate",
266
+ + "rollingUpdate": {
267
+ + "maxUnavailable": 1,
268
+ + "maxSurge": 4
269
+ + }
270
+ + }
271
+ + }`,
272
+ + expectedType: v1.RollingUpdateDeploymentStrategyType,
273
+ + expectedUnavailable: intOrStringPtr(intstr.FromInt(1)),
274
+ + expectedSurge: intOrStringPtr(intstr.FromInt(4)),
275
+ + },
276
+ + {
277
+ + name: "non rolling strategy keeps the requested type",
278
+ + overrideJSON: `{
279
+ + "updateStrategy": {
280
+ + "type": "Recreate"
281
+ + }
282
+ + }`,
283
+ + expectedType: v1.RecreateDeploymentStrategyType,
284
+ + },
285
+ + }
286
+ +
287
+ + for _, tt := range tests {
288
+ + t.Run(tt.name, func(t *testing.T) {
289
+ + deployment := v1.Deployment{}
290
+ + override := componentOverrideFromJSON(t, tt.overrideJSON)
291
+ +
292
+ + Deployment(&deployment, &override)
293
+ +
294
+ + assert.Equal(t, tt.expectedType, deployment.Spec.Strategy.Type)
295
+ + if tt.expectedUnavailable != nil || tt.expectedSurge != nil {
296
+ + require.NotNil(t, deployment.Spec.Strategy.RollingUpdate)
297
+ + }
298
+ + if tt.expectedUnavailable != nil {
299
+ + require.NotNil(t, deployment.Spec.Strategy.RollingUpdate.MaxUnavailable)
300
+ + assert.Equal(t, *tt.expectedUnavailable, *deployment.Spec.Strategy.RollingUpdate.MaxUnavailable)
301
+ + }
302
+ + if tt.expectedSurge != nil {
303
+ + require.NotNil(t, deployment.Spec.Strategy.RollingUpdate.MaxSurge)
304
+ + assert.Equal(t, *tt.expectedSurge, *deployment.Spec.Strategy.RollingUpdate.MaxSurge)
305
+ + }
306
+ + })
307
+ + }
308
+ +}
309
+ +
310
+ func TestDeployment(t *testing.T) {
311
+ deployment := v1.Deployment{
312
+ ObjectMeta: metav1.ObjectMeta{
313
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
314
+ new file mode 100755
315
+ --- /dev/null
316
+ +++ b/mimo_test_command.sh
317
+ @@ -0,0 +1,19 @@
318
+ +#!/bin/bash
319
+ +set -euo pipefail
320
+ +cd /testbed
321
+ +
322
+ +
323
+ +
324
+ +case "${1:-}" in
325
+ + base)
326
+ + go test ./controllers/datadogagent/override/ -run '^TestDeployment$' -v
327
+ + ;;
328
+ + new)
329
+ + go test ./apis/datadoghq/v2alpha1 -run '^TestDatadogAgentOverrideUpdateStrategyIsExposedInCRDSchema$' -v
330
+ + go test ./controllers/datadogagent/override/ -run '^(TestDaemonSetAppliesUpdateStrategyFromJSONOverride|TestDeploymentAppliesUpdateStrategyFromJSONOverride)$' -v
331
+ + ;;
332
+ + *)
333
+ + echo "usage: $0 base|new"
334
+ + exit 2
335
+ + ;;
336
+ +esac
tasks/format-code-task-000059/tests/test.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ apis/datadoghq/v2alpha1/datadogagent_update_strategy_schema_test.go
25
+ controllers/datadogagent/override/daemonset_test.go
26
+ controllers/datadogagent/override/deploymentspec_test.go
27
+ mimo_test_command.sh
28
+ EOF_RESET_TEST_FILES
29
+
30
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
31
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
32
+ cat "$V/apply.log" >&2
33
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
34
+ exit 1
35
+ fi
36
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
37
+ RC=$?
38
+ tail -c 12000 "$V/test_output.log"
39
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
40
+ echo "test command exited $RC"
tasks/format-code-task-000059/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh base && bash /testbed/mimo_test_command.sh new
tasks/format-code-task-000092/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:689f861f0175a0e356d19d8bf071331e73210ea6be904fa1a01db3a997964718
tasks/format-code-task-000092/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000092/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000092/tests/test.patch ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test_commands.json b/test_commands.json
2
+ new file mode 100644
3
+ index 00000000..9554664c
4
+ --- /dev/null
5
+ +++ b/test_commands.json
6
+ @@ -0,0 +1,3 @@
7
+ +{
8
+ + "test_commands": ["python -m pytest tests/gpflow/experimental/check_shapes/test_multi_varrank.py -v"]
9
+ +}
10
+ diff --git a/tests/gpflow/experimental/check_shapes/test_multi_varrank.py b/tests/gpflow/experimental/check_shapes/test_multi_varrank.py
11
+ new file mode 100644
12
+ index 00000000..365311c6
13
+ --- /dev/null
14
+ +++ b/tests/gpflow/experimental/check_shapes/test_multi_varrank.py
15
+ @@ -0,0 +1,139 @@
16
+ +
17
+ +
18
+ +
19
+ +
20
+ +
21
+ +
22
+ +
23
+ +
24
+ +
25
+ +
26
+ +import pytest
27
+ +
28
+ +from gpflow.experimental.check_shapes import ShapeChecker, check_shapes
29
+ +from gpflow.experimental.check_shapes.exceptions import ShapeMismatchError
30
+ +from gpflow.experimental.check_shapes.parser import parse_tensor_spec
31
+ +from gpflow.experimental.check_shapes.specs import ParsedShapeSpec
32
+ +
33
+ +from .utils import t
34
+ +
35
+ +
36
+ +def test_parse_multi_varrank_spec_does_not_assert() -> None:
37
+ +
38
+ + spec = parse_tensor_spec("[a..., b...]", None)
39
+ +
40
+ + assert isinstance(spec.shape, ParsedShapeSpec)
41
+ + n_varrank = sum(d.variable_rank for d in spec.shape.dims)
42
+ + assert n_varrank == 2
43
+ +
44
+ +
45
+ +def test_parse_three_varrank_spec_does_not_assert() -> None:
46
+ +
47
+ + spec = parse_tensor_spec("[a..., b..., c...]", None)
48
+ + n_varrank = sum(d.variable_rank for d in spec.shape.dims)
49
+ + assert n_varrank == 3
50
+ +
51
+ +
52
+ +def test_check_multi_varrank_resolves_when_ranks_known_in_order() -> None:
53
+ +
54
+ +
55
+ + c = ShapeChecker()
56
+ + c.check_shape(t(2), "[a...]")
57
+ + c.check_shape(t(3), "[b...]")
58
+ + c.check_shape(t(2, 3), "[a..., b...]")
59
+ +
60
+ +
61
+ +def test_check_multi_varrank_resolves_deferred() -> None:
62
+ +
63
+ +
64
+ + c = ShapeChecker()
65
+ + c.check_shape(t(2, 3), "[a..., b...]")
66
+ + c.check_shape(t(2), "[a...]")
67
+ + c.check_shape(t(3), "[b...]")
68
+ +
69
+ +
70
+ +
71
+ +def test_check_multi_varrank_mismatch_raises() -> None:
72
+ +
73
+ +
74
+ + c = ShapeChecker()
75
+ + c.check_shape(t(2), "[a...]")
76
+ + c.check_shape(t(3), "[b...]")
77
+ + with pytest.raises(ShapeMismatchError):
78
+ + c.check_shape(t(2, 4), "[a..., b...]")
79
+ +
80
+ +
81
+ +def test_check_multi_varrank_total_too_short_raises() -> None:
82
+ +
83
+ +
84
+ + c = ShapeChecker()
85
+ + with pytest.raises(ShapeMismatchError):
86
+ + c.check_shape(t(), "[a..., b..., 3]")
87
+ +
88
+ +
89
+ +def test_check_multi_varrank_unresolved_does_not_raise() -> None:
90
+ +
91
+ +
92
+ + c = ShapeChecker()
93
+ +
94
+ + c.check_shape(t(2, 3), "[a..., b...]")
95
+ +
96
+ +
97
+ +def test_check_multi_varrank_in_single_check_shapes_call() -> None:
98
+ +
99
+ +
100
+ + checker = ShapeChecker()
101
+ + checker.check_shapes(
102
+ + [
103
+ + (t(2, 3), "[a..., b...]"),
104
+ + (t(2), "[a...]"),
105
+ + (t(3), "[b...]"),
106
+ + ]
107
+ + )
108
+ +
109
+ +
110
+ +def test_check_multi_varrank_in_single_check_shapes_call_mismatch() -> None:
111
+ +
112
+ + checker = ShapeChecker()
113
+ + with pytest.raises(ShapeMismatchError):
114
+ + checker.check_shapes(
115
+ + [
116
+ + (t(2, 4), "[a..., b...]"),
117
+ + (t(2), "[a...]"),
118
+ + (t(3), "[b...]"),
119
+ + ]
120
+ + )
121
+ +
122
+ +
123
+ +def test_decorator_with_multi_varrank_in_return_spec_issue_example() -> None:
124
+ +
125
+ +
126
+ +
127
+ + @check_shapes(
128
+ + "a: [a_shape...]",
129
+ + "b: [b_shape...]",
130
+ + "return: [a_shape..., b_shape...]",
131
+ + )
132
+ + def broadcasting_elementwise(a, b):
133
+ + return t(*(a.test_shape + b.test_shape))
134
+ +
135
+ +
136
+ + out = broadcasting_elementwise(t(2, 3), t(4, 5, 6))
137
+ + assert out.test_shape == (2, 3, 4, 5, 6)
138
+ +
139
+ +
140
+ +def test_decorator_with_multi_varrank_in_return_spec_bad_return() -> None:
141
+ +
142
+ +
143
+ +
144
+ + @check_shapes(
145
+ + "a: [a_shape...]",
146
+ + "b: [b_shape...]",
147
+ + "return: [a_shape..., b_shape...]",
148
+ + )
149
+ + def bad(a, b):
150
+ +
151
+ + return t(2, 3, 4, 6)
152
+ +
153
+ + with pytest.raises(ShapeMismatchError):
154
+ + bad(t(2, 3), t(4, 5))
155
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
156
+ new file mode 100755
157
+ --- /dev/null
158
+ +++ b/mimo_test_command.sh
159
+ @@ -0,0 +1,8 @@
160
+ +#!/usr/bin/env bash
161
+ +
162
+ +set -uo pipefail
163
+ +cd /testbed
164
+ +rc=0
165
+ +python -m pytest tests/gpflow/experimental/check_shapes/test_multi_varrank.py -v
166
+ +rc=$(( rc | $? ))
167
+ +exit $rc
tasks/format-code-task-000092/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test_commands.json
25
+ tests/gpflow/experimental/check_shapes/test_multi_varrank.py
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000092/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000095/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:86ec6b56381405942ed2696a198684c25d858aa46cd9df3f85fc77607440eee0
tasks/format-code-task-000095/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000095/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000095/tests/test.patch ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/test/test.js b/test/test.js
2
+ index af060c2..17a5e90 100644
3
+ --- a/test/test.js
4
+ +++ b/test/test.js
5
+ @@ -445,4 +445,126 @@ describe('generateRuntimeCaching', function() {
6
+ }]);
7
+ assert.equal(code, '\ntoolbox.router.get(/test/, toolbox.testHandler, {});');
8
+ });
9
+ +
10
+ +
11
+ +
12
+ + function evalRuntimeCaching(code) {
13
+ + var calls = [];
14
+ + var routerMethod = function(pattern, handler, options) {
15
+ + calls.push({pattern: pattern, handler: handler, options: options});
16
+ + };
17
+ + var toolbox = {
18
+ + router: {
19
+ + get: routerMethod,
20
+ + post: routerMethod,
21
+ + put: routerMethod,
22
+ + delete: routerMethod,
23
+ + head: routerMethod,
24
+ + any: routerMethod
25
+ + },
26
+ +
27
+ +
28
+ + networkFirst: 'networkFirstHandler',
29
+ + fastest: 'fastestHandler',
30
+ + testHandler: 'testHandlerValue'
31
+ + };
32
+ + /* eslint-disable no-new-func */
33
+ + var fn = new Function('toolbox', code);
34
+ + /* eslint-enable no-new-func */
35
+ + fn(toolbox);
36
+ + return calls;
37
+ + }
38
+ +
39
+ + it('should serialize a RegExp origin option as a regex literal, not an empty object', function() {
40
+ + var code = generateRuntimeCaching([{
41
+ + urlPattern: /\/articles\//,
42
+ + handler: 'fastest',
43
+ + options: {origin: /twitter\.com/}
44
+ + }]);
45
+ +
46
+ + assert.equal(code.indexOf('"origin":{}'), -1,
47
+ + 'origin must NOT be serialized as empty object');
48
+ + assert.equal(code.indexOf('"origin": {}'), -1,
49
+ + 'origin must NOT be serialized as empty object (with space)');
50
+ +
51
+ + assert(code.indexOf('/twitter\\.com/') !== -1,
52
+ + 'expected regex literal /twitter\\.com/ in output, got: ' + code);
53
+ + });
54
+ +
55
+ + it('should produce code that evaluates a RegExp origin to a RegExp instance', function() {
56
+ + var code = generateRuntimeCaching([{
57
+ + urlPattern: /\/articles\//,
58
+ + handler: 'fastest',
59
+ + options: {origin: /twitter\.com/}
60
+ + }]);
61
+ + var calls = evalRuntimeCaching(code);
62
+ + assert.equal(calls.length, 1);
63
+ + assert(calls[0].options.origin instanceof RegExp,
64
+ + 'options.origin should be a RegExp, got: ' +
65
+ + Object.prototype.toString.call(calls[0].options.origin));
66
+ + assert.strictEqual(calls[0].options.origin.source, 'twitter\\.com');
67
+ + assert(calls[0].options.origin.test('https://twitter.com/foo'),
68
+ + 'regex should match twitter.com URLs');
69
+ + });
70
+ +
71
+ + it('should handle the exact runtimeCaching example from the issue', function() {
72
+ + var code = generateRuntimeCaching([{
73
+ + urlPattern: /^https:\/\/example\.com\/api/,
74
+ + handler: 'networkFirst'
75
+ + }, {
76
+ + urlPattern: /\/articles\//,
77
+ + handler: 'fastest',
78
+ + options: {origin: /twitter\.com/}
79
+ + }]);
80
+ + var calls = evalRuntimeCaching(code);
81
+ + assert.equal(calls.length, 2);
82
+ +
83
+ +
84
+ + assert(calls[0].pattern instanceof RegExp);
85
+ + assert.strictEqual(calls[0].pattern.source, '^https:\\/\\/example\\.com\\/api');
86
+ + assert.deepEqual(calls[0].options, {});
87
+ +
88
+ +
89
+ + assert(calls[1].pattern instanceof RegExp);
90
+ + assert.strictEqual(calls[1].pattern.source, '\\/articles\\/');
91
+ + assert(calls[1].options.origin instanceof RegExp,
92
+ + 'second route options.origin must be a RegExp');
93
+ + assert.strictEqual(calls[1].options.origin.source, 'twitter\\.com');
94
+ + });
95
+ +
96
+ + it('should keep a string origin as a string', function() {
97
+ + var code = generateRuntimeCaching([{
98
+ + urlPattern: /test/,
99
+ + handler: 'testHandler',
100
+ + options: {origin: 'https://example.com'}
101
+ + }]);
102
+ + var calls = evalRuntimeCaching(code);
103
+ + assert.equal(calls.length, 1);
104
+ + assert.strictEqual(typeof calls[0].options.origin, 'string');
105
+ + assert.strictEqual(calls[0].options.origin, 'https://example.com');
106
+ + });
107
+ +
108
+ + it('should preserve non-RegExp options alongside other fields', function() {
109
+ + var code = generateRuntimeCaching([{
110
+ + urlPattern: /test/,
111
+ + handler: 'testHandler',
112
+ + options: {networkTimeoutSeconds: 5}
113
+ + }]);
114
+ + var calls = evalRuntimeCaching(code);
115
+ + assert.equal(calls.length, 1);
116
+ + assert.strictEqual(calls[0].options.networkTimeoutSeconds, 5);
117
+ + });
118
+ +
119
+ + it('should produce syntactically valid JavaScript when origin is a RegExp', function() {
120
+ + var code = generateRuntimeCaching([{
121
+ + urlPattern: /\/articles\//,
122
+ + handler: 'fastest',
123
+ + options: {origin: /twitter\.com/}
124
+ + }]);
125
+ + assert.doesNotThrow(function() {
126
+ + /* eslint-disable no-new, no-new-func */
127
+ + new Function(code);
128
+ + /* eslint-enable no-new, no-new-func */
129
+ + }, 'generated code must be parseable as JavaScript');
130
+ + });
131
+ });
132
+ diff --git a/test_commands.json b/test_commands.json
133
+ new file mode 100644
134
+ index 0000000..ff99813
135
+ --- /dev/null
136
+ +++ b/test_commands.json
137
+ @@ -0,0 +1,3 @@
138
+ +{
139
+ + "test_commands": ["./node_modules/.bin/mocha test/test.js --grep \"generateRuntimeCaching\""]
140
+ +}
141
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
142
+ new file mode 100755
143
+ --- /dev/null
144
+ +++ b/mimo_test_command.sh
145
+ @@ -0,0 +1,8 @@
146
+ +#!/usr/bin/env bash
147
+ +
148
+ +set -uo pipefail
149
+ +cd /testbed
150
+ +rc=0
151
+ +./node_modules/.bin/mocha test/test.js --grep "generateRuntimeCaching"
152
+ +rc=$(( rc | $? ))
153
+ +exit $rc
tasks/format-code-task-000095/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ test/test.js
25
+ test_commands.json
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000095/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000113/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:241b4d1ab25e07bfaab833c028a53faa95df25201f12aabd9c5a57e5f1a5b294
tasks/format-code-task-000113/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com
tasks/format-code-task-000113/environment/setup/setup.sh ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Code: mimoagent environments/datasets/opensource_code.py + base.py, as the explorer runs it (app/runner/domains.py Code).
12
+ CWD=/testbed
13
+ git config --global --add safe.directory "$CWD"
14
+ cd "$CWD" || fail "no working directory $CWD"
15
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then # a bare source tree: give it a baseline commit
16
+ git init -q && git add -A && git -c user.name=mimo -c user.email=mimo@localhost commit -q -m baseline --allow-empty
17
+ fi
18
+ BASE=$(git rev-parse HEAD 2>/dev/null)
19
+ [ ${#BASE} -eq 40 ] || fail "could not resolve the base commit in $CWD"
20
+ echo "$BASE" > "$M/base"
21
+ # Images are built with history truncated at the base. If one is not, the fix could be read out of git log,
22
+ # so .git is hidden while the agent works and put back for grading.
23
+ LATER=$(git rev-list --all --not "$BASE" 2>/dev/null | head -n 5 | grep -c . || true)
24
+ rm -f /tmp/fail.log /tmp/pass.log /tmp/patch.diff /tmp/test_patch.diff /tmp/*.log 2>/dev/null; rm -rf /tmp/claude-0 /tmp/claude-* /tmp/testem-* /tmp/puppeteer_dev_chrome_profile-* 2>/dev/null; rm -f /tmp/test_files.json 2>/dev/null; rm -rf /tmp/jest_* /tmp/jest-* /tmp/build /tmp/build_env 2>/dev/null; rm -rf /tmp/pytest-of-root /tmp/pytest-* /tmp/.pytest_cache /tmp/__pycache__ 2>/dev/null; rm -rf /tmp/go-build* /tmp/standards /tmp/wordpress /tmp/zig-* /tmp/testbase /tmp/testbed 2>/dev/null; rm -f /tmp/tmp*.tmp /tmp/*.bak /tmp/expect* /tmp/butwas* 2>/dev/null; rm -rf /root/.cache/go-build 2>/dev/null; rm -rf /tests 2>/dev/null; find /logs -mindepth 1 -delete 2>/dev/null; mkdir -p /logs/agent /logs/verifier /logs/artifacts; chmod 777 /logs/agent /logs/verifier /logs/artifacts; find /var/log -type f -delete 2>/dev/null || true; rm -rf /var/lib/postgresql/*/*/log /var/lib/postgresql/*/*/pg_log 2>/dev/null || true; find /var/lib/mysql /var/lib/mongodb -type f -name '*.log' -delete 2>/dev/null || true; rm -rf /root/.npm/_logs /root/.babel.json /root/.pytest_cache 2>/dev/null || true; find / -maxdepth 4 -xdev -name task_description.md -path '*/.build_env/*' -delete 2>/dev/null || true; true
25
+ git clean -fdx --exclude=node_modules --exclude=bower_components --exclude=.husky --exclude=vendor --exclude=third_party --exclude=_deps --exclude=vcpkg_installed --exclude=.venv --exclude=venv --exclude=.gradle --exclude=target --exclude=.build --exclude=lib --exclude=.bundle --exclude=Manifest.toml --exclude=_build --exclude=.stack-work --exclude=dist-newstyle >/dev/null 2>&1
26
+ find /root/.m2 -type f \( -name '*-SNAPSHOT.jar' -o -name '*-SNAPSHOT-sources.jar' -o -name '*-SNAPSHOT-tests.jar' -o -name '*-SNAPSHOT-test-sources.jar' \) -delete 2>/dev/null; rm -rf /root/.julia/compiled 2>/dev/null; rm -rf /root/.gradle/caches/build-cache-* /root/.gradle/daemon 2>/dev/null; rm -rf /root/.gradle/caches/*/scripts /root/.gradle/caches/jars-* 2>/dev/null; rm -rf /root/.cache/bazel 2>/dev/null; true
27
+ if [ "$LATER" -gt 0 ]; then
28
+ mv "$CWD/.git" "$M/git-hidden"
29
+ echo "history not truncated at ${BASE:0:12}: .git hidden while the agent works"
30
+ fi
31
+ write_blocklist
32
+
33
+ touch "$M/ready"
34
+ echo "setup done"
tasks/format-code-task-000113/tests/test.patch ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/mist/master/src/test/scala/io/hydrosphere/mist/master/logging/LogStreamsSpec.scala b/mist/master/src/test/scala/io/hydrosphere/mist/master/logging/LogStreamsSpec.scala
2
+ index 9375ea051..9b9f0c1c6 100644
3
+ --- a/mist/master/src/test/scala/io/hydrosphere/mist/master/logging/LogStreamsSpec.scala
4
+ +++ b/mist/master/src/test/scala/io/hydrosphere/mist/master/logging/LogStreamsSpec.scala
5
+ @@ -9,7 +9,7 @@ import io.hydrosphere.mist.core.MockitoSugar
6
+ import org.mockito.Mockito.verify
7
+ import org.scalatest.{FunSpecLike, Matchers}
8
+
9
+ -import scala.concurrent.duration.Duration
10
+ +import scala.concurrent.duration._
11
+ import scala.concurrent.{Await, Future}
12
+
13
+ class LogStreamsSpec extends TestKit(ActorSystem("log-service-test"))
14
+ @@ -24,7 +24,6 @@ class LogStreamsSpec extends TestKit(ActorSystem("log-service-test"))
15
+ when(writer.write(any[String], any[Seq[LogEvent]]))
16
+ .thenReturn(Future.successful(LogUpdate("jobId", Seq.empty, 1)))
17
+
18
+ -
19
+ val out = Source.single(LogEvent.mkDebug("id", "message"))
20
+ .via(LogStreams.storeFlow(writer))
21
+ .take(1)
22
+ @@ -35,4 +34,26 @@ class LogStreamsSpec extends TestKit(ActorSystem("log-service-test"))
23
+ updates.size shouldBe 1
24
+ verify(writer).write(any[String], any[Seq[LogEvent]])
25
+ }
26
+ +
27
+ + it("should ignore errors") {
28
+ + val event = LogEvent.mkDebug("id", "message")
29
+ + val writer = mock[LogsWriter]
30
+ + when(writer.write(any[String], any[Seq[LogEvent]]))
31
+ + .thenSuccess(LogUpdate("id", Seq(event), 1))
32
+ + .thenFailure(new RuntimeException("error"))
33
+ + .thenSuccess(LogUpdate("id", Seq(event), 1))
34
+ + .thenFailure(new RuntimeException("error"))
35
+ + .thenSuccess(LogUpdate("id", Seq(event), 1))
36
+ +
37
+ + val in = (1 to 5).map(i => LogEvent.mkDebug(s"job-$i", "message"))
38
+ + val future = Source(in)
39
+ + .via(LogStreams.storeFlow(writer))
40
+ + .take(3)
41
+ + .toMat(Sink.seq)(Keep.right).run()
42
+ +
43
+ +
44
+ + val updates = Await.result(future, Duration.Inf)
45
+ + updates.flatMap(_.events).size shouldBe 3
46
+ + }
47
+ +
48
+ }
49
+ diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
50
+ new file mode 100644
51
+ --- /dev/null
52
+ +++ b/mimo_build_env.tar.gz.b64
53
+ @@ -0,0 +1,6 @@
54
+ +H4sIAAAAAAAAA+3SQUvDMBQH8J77KWLddUlb206EHXYQhigTJl5Hu4Q2s2lGkg737e0qUxF0l40h
55
+ +/n8QEpL3kpAXWrSy5gvRbJh3KmFnlKZ93/ne9+MojcM4S9I0ib0wirIw80h6sht90VqXG0I8o7X7
56
+ +Le7Q+h9FP+vvhHWLpVYqbzi11fHOOFT/eHS1r3+Yjrr5KMni0CPh8a7ws39e/8sLVsiGFbmt/CUn
57
+ +/ScoBPfF61obR+4mz5PFdPZwO2atNayWBVttVBelWiOb4fVwxV+GueJZss94nDxNx8HgI3G3/c1g
58
+ +Nxv4lNnC7RoJVG6dMP1xs6beEqlpteVG23UljKBKWkffY2ity1I2Jb3X5dwZkSs7X4tl4J/76QAA
59
+ +AAAAAAAAAAAAAAAAAAAAzu4Nucdz4QAoAAA=
60
+ diff --git a/mimo_test_command.sh b/mimo_test_command.sh
61
+ new file mode 100755
62
+ --- /dev/null
63
+ +++ b/mimo_test_command.sh
64
+ @@ -0,0 +1,6 @@
65
+ +#!/usr/bin/env bash
66
+ +
67
+ +set -uo pipefail
68
+ +cd /testbed || exit 1
69
+ +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1
70
+ +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'
tasks/format-code-task-000113/tests/test.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Code grading, mimoagent opensource_code.py: reset the files the hidden test patch touches, apply it, run the
3
+ # task's test command; reward 1 when it exits 0. A testbed failure (reset or apply) writes no reward: not scored.
4
+ M=/var/lib/mimo
5
+ CWD=/testbed
6
+ V=/logs/verifier
7
+ mkdir -p "$V"
8
+ BASE=$(cat "$M/base" 2>/dev/null) || { echo "setup never ran (no $M/base)" >&2; exit 1; }
9
+ cd "$CWD" || exit 1
10
+ if [ -d "$M/git-hidden" ]; then rm -rf "$CWD/.git"; mv "$M/git-hidden" "$CWD/.git"; fi
11
+ # the agent's change against the base, so its own commits count too
12
+ git add -A >/dev/null 2>&1 && git -c core.fileMode=false diff --cached "$BASE" > "$V/agent.diff"
13
+ git reset -q
14
+ if ! (
15
+ while IFS= read -r tf; do
16
+ [ -z "$tf" ] && continue
17
+ if git cat-file -e $BASE:"$tf" 2>/dev/null; then
18
+ git checkout $BASE -- "$tf" 2>/dev/null || true
19
+ else
20
+ git rm -f --cached "$tf" >/dev/null 2>&1 || true
21
+ rm -f "$tf"
22
+ fi
23
+ done <<'EOF_RESET_TEST_FILES'
24
+ mist/master/src/test/scala/io/hydrosphere/mist/master/logging/LogStreamsSpec.scala
25
+ mimo_build_env.tar.gz.b64
26
+ mimo_test_command.sh
27
+ EOF_RESET_TEST_FILES
28
+
29
+ ); then echo "could not reset the test files (testbed problem, not scored)" >&2; exit 1; fi
30
+ if ! git apply --verbose /tests/test.patch > "$V/apply.log" 2>&1; then
31
+ cat "$V/apply.log" >&2
32
+ echo "the hidden tests could not be applied (testbed problem, not scored)" >&2
33
+ exit 1
34
+ fi
35
+ timeout 1800 sh -c "$(cat /tests/test_command.sh)" > "$V/test_output.log" 2>&1
36
+ RC=$?
37
+ tail -c 12000 "$V/test_output.log"
38
+ if [ $RC -eq 0 ]; then echo 1 > "$V/reward.txt"; else echo 0 > "$V/reward.txt"; fi
39
+ echo "test command exited $RC"
tasks/format-code-task-000113/tests/test_command.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ bash /testbed/mimo_test_command.sh
tasks/format-code-task-000122/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:b6a3eade23a0a3814976f10f3fe08961353b2c518b825d0644b1375438573537
tasks/format-code-task-000122/environment/setup/files/blocklist ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mimo answer-leak blocklist (mimoagent)
2
+ 0.0.0.0 github.com
3
+ 0.0.0.0 www.github.com
4
+ 0.0.0.0 api.github.com
5
+ 0.0.0.0 raw.githubusercontent.com
6
+ 0.0.0.0 codeload.github.com
7
+ 0.0.0.0 objects.githubusercontent.com
8
+ 0.0.0.0 gist.github.com
9
+ 0.0.0.0 gist.githubusercontent.com
10
+ 0.0.0.0 gitlab.com
11
+ 0.0.0.0 bitbucket.org
12
+ 0.0.0.0 sourceforge.net
13
+ 0.0.0.0 git.kernel.org
14
+ 0.0.0.0 chromium.googlesource.com
15
+ 0.0.0.0 android.googlesource.com
16
+ 0.0.0.0 sourcegraph.com
17
+ 0.0.0.0 bugs.chromium.org
18
+ 0.0.0.0 issues.oss-fuzz.com
19
+ 0.0.0.0 oss-fuzz.com
20
+ 0.0.0.0 osv.dev
21
+ 0.0.0.0 api.osv.dev
22
+ 0.0.0.0 bugzilla.mozilla.org
23
+ 0.0.0.0 proxy.golang.org
24
+ 0.0.0.0 sum.golang.org
25
+ 0.0.0.0 pkg.go.dev
26
+ 0.0.0.0 google.com
27
+ 0.0.0.0 www.google.com
28
+ 0.0.0.0 bing.com
29
+ 0.0.0.0 www.bing.com
30
+ 0.0.0.0 duckduckgo.com
31
+ 0.0.0.0 html.duckduckgo.com
32
+ 0.0.0.0 search.brave.com
33
+ 0.0.0.0 stackoverflow.com