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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Reproduction Instructions

This submission is for the PatchEval Location Oracle setting. The generator is a direct LLM edit harness rather than an interactive agent: it reads the official PatchEval problem statement and vulnerable file contents, asks `openai/gpt-5-codex` through OpenRouter for exact search/replace edits, applies those edits in a temporary Git worktree, and emits `git diff` patches.

## Environment

1. Clone the public reproduction harness from `https://github.com/samarmstrong/patcheval-direct-edit` and enter its repository root.
2. Clone the PatchEval source repository from `https://github.com/bytedance/PatchEval` into `patcheval-upstream` inside the reproduction repository.
3. Set up the PatchEval evaluation environment according to its README.
4. Create a Python environment for the reproduction scripts with `python3 -m venv .venv`, then install the PatchEval requirements.
5. Download the 230 PatchEval Docker images with `scripts/prefetch_full230_images.sh`.
6. Set `OPENROUTER_API_KEY` in the environment. Do not print or commit the key.
7. Use model id `openai/gpt-5-codex` through OpenRouter.

## Generation And Validation

From the `patcheval-direct-edit` repository root, use fresh output names so the submitted artifacts in `outputs/` remain available for comparison:

```bash
scripts/prefetch_full230_images.sh

PYTHONUNBUFFERED=1 .venv/bin/python \
scripts/generate_edit_patches_v2.py \
--upstream patcheval-upstream \
--model openai/gpt-5-codex \
--cve-file full230_cves.txt \
--output outputs/reproduction_patches.json \
--usage-output outputs/reproduction_usage.json \
--raw-output outputs/reproduction_raw.json \
--request-timeout-seconds 1200 \
--max-generation-retries 2

PYTHONUNBUFFERED=1 .venv/bin/python \
scripts/run_disk_safe_validation.py \
--upstream patcheval-upstream \
--patch-file outputs/reproduction_patches.json \
--output reproduction_initial \
--cve-file full230_cves.txt

PYTHONUNBUFFERED=1 .venv/bin/python \
scripts/generate_compile_feedback_repairs.py \
--upstream patcheval-upstream \
--model openai/gpt-5-codex \
--validation-output patcheval-upstream/patcheval/evaluation/evaluation_output/reproduction_initial \
--base-patch-file outputs/reproduction_patches.json \
--output outputs/reproduction_compile_repairs.json \
--usage-output outputs/reproduction_compile_repairs_usage.json \
--raw-output outputs/reproduction_compile_repairs_raw.json \
--request-timeout-seconds 1200
```

Merge compile repairs into the final patch file with the same logic used by `scripts/supervise_full230_v2_pipeline.sh`, validate the repaired-only patches, and merge that validation over the initial validation output:

```bash
PYTHONUNBUFFERED=1 .venv/bin/python \
scripts/run_disk_safe_validation.py \
--upstream patcheval-upstream \
--patch-file outputs/reproduction_final_patches.json \
--output reproduction_final \
--cve-file full230_cves.txt
```

The canonical orchestration script for the full run is:

```bash
scripts/supervise_full230_v2_pipeline.sh
```

The submitted final run produced `77/230 = 33.48%` strict PoC+Unit success and `82/230 = 35.65%` PoC-only success, with returned OpenRouter usage of about `$0.181/CVE`.

## Notes

- Generation used the official problem statement and did not use PoC output, unit-test output, or validation failure feedback.
- The single repair round was limited to compiler/build failures and used compiler feedback only.
- On macOS/Colima, the upstream evaluator needed local Docker/bind-mount fixes so `/workspace/fix.patch` remained available after container startup. The submitted patches are plain diffs and do not depend on those local harness changes.
- Positive controls using embedded reference patches passed 3/3 strict locally.
- LLM generation is not guaranteed bit-for-bit deterministic; expect possible variance of roughly 1-2 CVEs on a fresh generation run.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[PoC RESULT]: False
[PoC MSG]:
============================== Run PoC ==============================
------------------------------ Standard Output ------------------------------
============================= test session starts ==============================
platform linux -- Python 3.6.13, pytest-7.0.1, pluggy-1.0.0
rootdir: /workspace/python-dbusmock
collected 1 item

tests/test_api.py F [100%]

=================================== FAILURES ===================================
___________________________ TestTemplates.test_local ___________________________

self = <test_api.TestTemplates testMethod=test_local>

def test_local(self):
'''Load a local template *.py file'''

with tempfile.NamedTemporaryFile(prefix='answer_', suffix='.py') as my_template:
my_template.write(b'''import dbus
BUS_NAME = 'universe.Ultimate'
MAIN_OBJ = '/'
MAIN_IFACE = 'universe.Ultimate'
SYSTEM_BUS = False

def load(mock, parameters):
mock.AddMethods(MAIN_IFACE, [('Answer', '', 'i', 'ret = 42')])
''')
my_template.flush()
(p_mock, dbus_ultimate) = self.spawn_server_template(
my_template.name, stdout=subprocess.PIPE)
self.addCleanup(p_mock.wait)
self.addCleanup(p_mock.terminate)
self.addCleanup(p_mock.stdout.close)

# ensure that we don't use/write any .pyc files, they are dangerous
# in a world-writable directory like /tmp
self.assertFalse(os.path.exists(my_template.name + 'c'))
try:
from importlib.util import cache_from_source
> self.assertFalse(os.path.exists(cache_from_source(my_template.name)))
E AssertionError: True is not false

tests/test_api.py:600: AssertionError
=========================== short test summary info ============================
FAILED tests/test_api.py::TestTemplates::test_local - AssertionError: True is...
======================== 1 failed, 2 warnings in 2.39s =========================

------------------------------ Finish Evaluation ------------------------------


[UnitTest RESULT]: None
[UnitTest MSG]:
None

[Validation TYPE]: validation_fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/dbusmock/mockobject.py b/dbusmock/mockobject.py
index 29f790e..bbd294b 100644
--- a/dbusmock/mockobject.py
+++ b/dbusmock/mockobject.py
@@ -38,6 +38,15 @@ if sys.version_info[0] >= 3:
unicode = str


+def _ensure_source_module(module, template_name):
+ module_file = getattr(module, '__file__', None)
+ if not module_file or os.path.splitext(module_file)[1] != '.py':
+ sys.modules.pop(module.__name__, None)
+ raise ImportError(
+ 'Refusing to load template %s: only .py source files are supported' %
+ template_name)
+
+
def load_module(name):
if os.path.exists(name) and os.path.splitext(name)[1] == '.py':
sys.path.insert(0, os.path.dirname(os.path.abspath(name)))
@@ -47,9 +56,12 @@ def load_module(name):
finally:
sys.path.pop(0)

+ _ensure_source_module(module, name)
return module

- return importlib.import_module('dbusmock.templates.' + name)
+ module = importlib.import_module('dbusmock.templates.' + name)
+ _ensure_source_module(module, name)
+ return module


class DBusMockObject(dbus.service.Object):
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
[PoC RESULT]: False
[PoC MSG]:
============================== Run PoC ==============================
------------------------------ Standard Output ------------------------------


markdown-it
commonmark_extras.txt
✔ line 1 (53ms)
✔ line 12
✔ line 20
✔ line 31
✔ line 40
✔ line 54
✔ line 65
✔ line 73
✔ line 83
✔ line 91
✔ line 99
✔ line 113
✔ line 121
✔ line 134
✔ line 147
✔ line 152
✔ line 159
✔ line 166
✔ line 174
✔ line 182
✔ line 192
fatal.txt
✔ line 1
✔ line 9
✔ line 17
✔ line 25
✔ line 36
linkify.txt
✔ line 1 (46ms)
✔ line 9
✔ line 17
✔ line 25
✔ line 33
✔ line 41 (64ms)
✔ line 52
normalize.txt
✔ line 3
✔ line 9
✔ line 17
✔ line 23
✔ line 31
✔ line 39
✔ line 47
✔ line 55
✔ line 63
✔ line 71
✔ line 77
✔ line 83
✔ line 89
✔ line 95
proto.txt
✔ line 0
✔ line 9
smartquotes.txt
✔ line 1
✔ line 12
✔ line 20
✔ line 28
✔ line 40
✔ line 53
✔ line 61
✔ line 69
✔ line 77
✔ line 85
✔ line 93
strikethrough.txt
✔ line 0
✔ line 6
✔ line 12
✔ line 18
✔ line 26
✔ line 37
✔ line 48
✔ line 59
✔ line 70
✔ line 78
✔ line 100
tables.txt
✔ line 1
✔ line 29
✔ line 63
✔ line 97
✔ line 124
✔ line 152
✔ line 173
✔ line 187
✔ line 199
✔ line 211
✔ line 223
✔ line 235
✔ line 247
✔ line 259
✔ line 284
✔ line 303
✔ line 331
typographer.txt
✔ line 0
✔ line 8
✔ line 16
✔ line 24
✔ line 32
✔ line 40
✔ line 48
✔ line 56
✔ line 64
xss.txt
✔ line 0
✔ line 8
✔ line 27
✔ line 42
1) line 48
2) line 56
✔ line 62
✔ line 71
✔ line 79
✔ line 90
✔ line 101


106 passing (831ms)
2 failing

1) markdown-it
xss.txt
line 48:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/workspace/markdown-it/test/markdown-it.js)
at process.processImmediate (node:internal/timers:491:21)

2) markdown-it
xss.txt
line 56:

AssertionError: expected '<p>![](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)</p>\n' to equal '<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt=""></p>\n'
+ expected - actual

-<p>![](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)</p>
+<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt=""></p>

at assert.strictEqual (node_modules/markdown-it-testgen/node_modules/chai/lib/chai/interface/assert.js:169:32)
at Context.<anonymous> (node_modules/markdown-it-testgen/index.js:196:26)
at process.processImmediate (node:internal/timers:491:21)




------------------------------ Finish Evaluation ------------------------------


[UnitTest RESULT]: None
[UnitTest MSG]:
None

[Validation TYPE]: validation_fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/lib/index.js b/lib/index.js
index abc1525..8743ba4 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -21,7 +21,7 @@ var config = {
};


-var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file' ];
+var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file', 'data' ];

function validateLink(url) {
// url should be normalized at this point, and existing entities are decoded
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[PoC RESULT]: False
[PoC MSG]:
============================== Run PoC ==============================
------------------------------ Standard Output ------------------------------
Testing against Django installed in '/workspace/django/django' with up to 6 processes
Creating test database for alias 'default'...
Creating test database for alias 'other'...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

------------------------------ Standard Error ------------------------------
E
======================================================================
ERROR: test_format_arbitrary_settings (i18n.tests.FormattingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspace/django/tests/i18n/tests.py", line 1253, in test_format_arbitrary_settings
self.assertEqual(get_format('DEBUG'), 'DEBUG')
File "/workspace/django/django/utils/formats.py", line 143, in get_format
return _get_format_from_settings(format_type)
File "/workspace/django/django/utils/formats.py", line 52, in _get_format_from_settings
raise KeyError(format_type)
KeyError: 'DEBUG'

----------------------------------------------------------------------
Ran 1 test in 0.024s

FAILED (errors=1)

------------------------------ Finish Evaluation ------------------------------


[UnitTest RESULT]: None
[UnitTest MSG]:
None

[Validation TYPE]: validation_fail
Loading