Skip to content

[Ready for Review] Adapter: securereviewer - #97

Open
YiDanielLu wants to merge 7 commits into
harbor-framework:mainfrom
YiDanielLu:securereviewer-adapter
Open

YiDanielLu wants to merge 7 commits into
harbor-framework:mainfrom
YiDanielLu:securereviewer-adapter

Conversation

@YiDanielLu

@YiDanielLu YiDanielLu commented Nov 15, 2026 •

Copy link
Copy Markdown

Adds an adapter for SecureReviewer (ICSE 2026, arXiv:2510.26457), listed as "securecodereview" in the adapter sheet. Each task gives the agent one code change (a diff hunk) and asks for a security review with four sections: Security type, Description, Impact and Advice. The review is scored against an expert-refined reference with SecureBLEU, the paper's metric.

  • 261 tasks: one per test item that has a security issue. SecureBleu.py skips the 39 No Issue items, so they never count toward the score.
  • Grading runs upstream evaluate/SecureBleu.py unmodified, from a pinned commit, on one item at a time. The review is parsed with upstream's parse_security_review. The reward is SecureBLEU / 100, so Harbor's mean reward × 100 equals the upstream "Average BLEU score".
  • Deterministic grading: nltk only, with no LLM judge and no API keys.

Status:

  • Oracle: 261 trials, 0 exceptions, mean reward 0.807 (SecureBLEU 80.73). Every task's reward equals that item's maximum score, computed separately by running SecureBleu.py on the reference answer outside Harbor. A score of 1.0 isn't possible because of how the metric is built. The reference review gets BLEU 100 and the exact type, but SecureBLEU's keyword-overlap term counts a ratio as 0 when the reference section has nothing to match. So even the reference averages 80.73 (5 of 261 items reach 100). The oracle reaches the maximum score possible on every task. If you'd prefer a different reward normalisation (for example, dividing by each item's ceiling), I'm happy to change it.

  • Parity: done, matching. Plan approved by Xiangning. Haiku via the 2077ai endpoint, tasks on Daytona.

    • Setup: claude-haiku-4-5, on the 25-task parity subset (uv run securereviewer --split parity, stratified by security type, seed 42), 2 runs per side. Both sides send the same prompt in one API call per item (temperature 0, max_tokens 2000).
    • Original side: YiDanielLu/SecureReviewer@harbor-parity. This is upstream 86df98bf plus infer/test_api.py, scored with upstream SecureBleu.py, unmodified.
    • Harbor side: the single-call agent in src/securereviewer/parity/, with the separate verifier.
    Agent Model Metric Runs Dataset Size Original (mean ± SEM) Harbor (mean ± SEM)
    securereviewer-single-call@1.0.0 claude-haiku-4-5 SecureBLEU 2 25 of 261 26.1055 ± 0.1446 26.3495 ± 0.1436

    The runs are original 25.96 and 26.25, and Harbor 26.21 and 26.49 (0 exceptions), so the run ranges overlap. The API cost was about $0.30. Reproduction steps for both sides are in the README.

Oracle screenshot:
Oracle_result

261 tasks, one per scored item of the SecureReviewer test split (ICSE 2026).
Grading runs upstream evaluate/SecureBleu.py unmodified from a pinned commit;
reward = SecureBLEU / 100. Oracle: 261 trials, 0 exceptions, mean 0.807, every
task at its metric ceiling. Parity pending.
@audreina17

Copy link
Copy Markdown
Collaborator

/review-adapter

@github-actions

Copy link
Copy Markdown
Contributor

Structural validation of commit dcd0112 at 2026-11-17 01:27:07 UTC

Adapter contract v1 (docs/adapters.mdx).

❌ Adapter Validation: securereviewer

✅ 30 passed | ❌ 3 errors | ⚠️ 3 warnings

Errors (must fix)

  • ❌ Parity PR link empty: Entry 0: adapter_pr is an empty list. — src/securereviewer/parity_experiment.json:12
  • ❌ Parity PR link empty: Entry 0: dataset_pr is an empty list. — src/securereviewer/parity_experiment.json:13
  • ❌ Parity PR link empty: Entry 0: parity_pr is an empty list. — src/securereviewer/parity_experiment.json:14

Warnings (recommended)

  • ⚠️ ADP-PARITY: insufficient runs: Entry 0, metric 0 (<metric_name>): original_runs needs at least two runs for sample SEM. A single published score does not satisfy the parity contract. — src/securereviewer/parity_experiment.json:21
  • ⚠️ ADP-PARITY: insufficient runs: Entry 0, metric 0 (<metric_name>): harbor_runs needs at least two runs for sample SEM. A single published score does not satisfy the parity contract. — src/securereviewer/parity_experiment.json:22
  • ⚠️ Metadata: parity_costs: parity_costs is missing or null — fill in a USD cost estimate when available (canonical format: a string such as $150). — src/securereviewer/adapter_metadata.json
Passed checks (30)
  • ✅ README.md exists
  • ✅ parity_experiment.json exists
  • ✅ adapter_metadata.json exists
  • ✅ src/securereviewer/ package exists
  • ✅ src/securereviewer/adapter.py exists
  • ✅ src/securereviewer/main.py exists
  • ✅ src/securereviewer/task-template/ directory exists
  • ✅ src/securereviewer/task-template/task.toml exists
  • ✅ src/securereviewer/task-template/instruction.md exists
  • ✅ src/securereviewer/task-template/environment/Dockerfile exists
  • ✅ src/securereviewer/task-template/tests/test.sh exists
  • ✅ src/securereviewer/task-template/solution/solve.sh exists
  • ✅ Template [task].name present
  • ✅ Template [task].authors present
  • ✅ parity_experiment.json is valid JSON array
  • ✅ adapter_metadata.json is valid JSON array
  • ✅ README section Overview present
  • ✅ README section What is present
  • ✅ README section Adapter Features present
  • ✅ README section Generated Task Structure present
  • ✅ README section Run Evaluation present
  • ✅ README section Usage present
  • ✅ README section Parity present
  • ✅ README section Notes & Caveats present
  • ✅ README section Installation / Prerequisites present
  • ✅ README section Citation present
  • ✅ README section Authors & Contributions present
  • ✅ Parity table column count correct
  • ✅ test.sh writes to reward path
  • ✅ No canary strings found

@audreina17

Copy link
Copy Markdown
Collaborator

Quick heads-up: the automated run for dcd01125 stopped at structural validation, so Claude’s code review was skipped. The structural report flags incomplete adapter_pr, dataset_pr, parity_pr links.

If you consider this PR ready for review, please address those structural items before the next full review. If you know it’s still a work in progress or waiting on parity coordination, feel free to ignore this note for now and come back when ready. Thanks!

@audreina17

Copy link
Copy Markdown
Collaborator

On October 19, Harbor updated its new-task template to use a separate verifier by default. I noticed the tasks generated by this adapter still run the grader in the agent’s workspace. Could you switch them to a separate verifier and rerun the oracle on the latest stable Harbor release? Harbor #3712

If you find the full oracle run to be too costly time-wise or compute-wise, maybe you can start with rerunning one representative task? For that task, try the reference solution first, then with a submission you know is wrong. Once you are done, could you please share the task ID and both scores so we can check that the new verifier can grade submissions as expected?

If you’ve already run parity or in the middle of running parity, could you keep the original submissions, agent logs, and grading results, preferably in your Hugging Face fork? If only the grading environment changes and those files contain everything the verifier needs, we may be able to regrade the saved submissions without running the agents again.

Move the SecureBLEU scorer (nltk data + pinned SecureBleu.py) and the
item's reference into tests/Dockerfile and set
[verifier] environment_mode = "separate". The agent image now holds only
patch.diff; /workspace/review.txt is the only declared artifact passed to
the verifier.

Full oracle on Harbor 0.26.0: 261 trials, 0 exceptions, mean 0.807, every
reward identical to the previous shared-verifier run.
@YiDanielLu

YiDanielLu commented Nov 20, 2026 •

Copy link
Copy Markdown
Author

Thanks @audreina17! Switched to a separate verifier in 3b6b7dc:

  • task.toml sets [verifier] environment_mode = "separate" and declares /workspace/review.txt as the only artifact.
  • The scorer (nltk 3.9.1 data plus upstream SecureBleu.py at the pinned commit) and the item's reference now live in tests/Dockerfile. The agent image only contains the diff.

On Harbor 0.26.0, task test-000 (Concurrency):

  • reference solution: 0.835, the same as this item's maximum achievable SecureBLEU in the previous oracle run
  • known-wrong submission (wrong security type, unrelated description): 0.0001

Full oracle on 0.26.0: 261 trials, 0 exceptions, mean 0.807; every task's reward is identical to the previous (shared-verifier) oracle run. Parity hasn't started yet. The plan is waiting for review by @XiangningLin , so there are no saved submissions to regrade.

Add --split parity (25 tasks, stratified by security type, seed 42) and the
single-call agent used for parity. claude-haiku-4-5, 2 runs per side:
original 26.1055 +/- 0.1446, Harbor 26.3495 +/- 0.1436 SecureBLEU.
Generated tasks are now byte-identical on every OS (they were CRLF when
generated on Windows).
@YiDanielLu YiDanielLu changed the title [WIP] Adapter: securereviewer [Ready for Review] Adapter: securereviewer Nov 21, 2026
@YiDanielLu

YiDanielLu commented Nov 21, 2026 •

Copy link
Copy Markdown
Author

@XiangningLin @audreina17 Ready for review, adapter and parity together.

  • Parity: 26.1055 ± 0.1446 (original) vs 26.3495 ± 0.1436 (Harbor) SecureBLEU, with overlapping run ranges. That's claude-haiku-4-5 on the 25-task subset, 2 runs per side.
  • Oracle: 261/261, 0 exceptions.
  • Links: dataset PR Add securereviewer/securereviewer (SecureReviewer, 261 tasks) harbor-datasets#285; parity results in harborframework/parity-experiments#287, mirrored while the Hub file limit blocks uploads.
  • The validator reports 0 errors.

Record the Harbor version (0.26.0, Daytona SDK < 2), the model alias (the
endpoint rejects the dated ID), and the run order; correct the max_tokens
note (upstream's max_length covers prompt plus reply). Add
run_securereviewer_parity.yaml for the Harbor side.
@Azen233 Azen233 mentioned this pull request Nov 22, 2026
3 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants