Add independent-agent SWE prompt-ablation pilot

This commit is contained in:
pj committed 2026-09-15 16:25:27 +05:30
1 parent b896955d3e
commit b3c935fbfa
13 files changed
+673 -12

No files matched your search

+45 -1
View File
@@ -7,7 +7,12 @@ import json
from pathlib import Path
import subprocess
from messageboardbench.swe_board import build_population_plan, load_records, plan_hash
from messageboardbench.swe_board import (
NO_STOP_PROMPT_POLICY,
build_population_plan,
load_records,
plan_hash,
)
from messageboardbench.board import MESSAGEBOARD_V2_INTERFACE_VERSION
from messageboardbench.swe_validation import DATASET
@@ -35,11 +40,25 @@ def main() -> int:
"--messageboard-v2", action="store_true",
help="freeze the send_message/read_messages plus organizer-feedback interface",
)
parser.add_argument(
"--reuse-selection-plan", type=Path,
help="reuse the exact selected task IDs from an earlier frozen plan",
)
parser.add_argument(
"--no-stop-prompt", action="store_true",
help="retain DO NOT MODIFY THE TESTS but omit the extra stop/carve-out text",
)
args = parser.parse_args()
if args.messageboard_v2 and args.sample_size is None:
parser.error("--messageboard-v2 requires --sample-size")
if args.exclude_plan is not None and args.sample_size is None:
parser.error("--exclude-plan requires --sample-size")
if args.reuse_selection_plan is not None and args.sample_size is not None:
parser.error("--reuse-selection-plan cannot be combined with --sample-size")
if args.reuse_selection_plan is not None and args.exclude_plan is not None:
parser.error("--reuse-selection-plan cannot be combined with --exclude-plan")
if args.no_stop_prompt and not args.messageboard_v2:
parser.error("--no-stop-prompt requires --messageboard-v2")
upstream = (ROOT.parent / "impossiblebench").resolve()
commit = subprocess.run(
["git", "rev-parse", "HEAD"], cwd=upstream, check=True,
@@ -47,6 +66,20 @@ def main() -> int:
).stdout.strip()
records = load_records(args.revision, "conflicting")
selected = None
reused_plan_bytes = None
reused_plan = None
if args.reuse_selection_plan is not None:
reused_plan_bytes = args.reuse_selection_plan.read_bytes()
reused_plan = json.loads(reused_plan_bytes)
selected = reused_plan.get("selection", {}).get("instance_ids")
if (reused_plan.get("status") != "frozen"
or reused_plan.get("plan_sha256") != plan_hash(reused_plan)
or reused_plan.get("dataset") != {
"path": DATASET, "revision": args.revision, "split": "conflicting",
}
or not isinstance(selected, list) or not selected
or len(selected) != len(set(selected)) or not set(selected) <= set(records)):
parser.error("--reuse-selection-plan is not a valid matching frozen plan")
if args.sample_size is not None:
if not 1 <= args.sample_size <= len(records):
parser.error("--sample-size must be between 1 and the split size")
@@ -82,6 +115,7 @@ def main() -> int:
upstream_git_commit=commit, teams=args.teams, cohorts=args.cohorts,
seed=args.seed, selected_instance_ids=selected,
tool_interface=(MESSAGEBOARD_V2_INTERFACE_VERSION if args.messageboard_v2 else None),
prompt_policy=(NO_STOP_PROMPT_POLICY if args.no_stop_prompt else None),
)
if selected is not None:
plan["selection"].update({
@@ -95,6 +129,16 @@ def main() -> int:
} if args.exclude_plan is not None else None),
})
plan["plan_sha256"] = plan_hash(plan)
if reused_plan is not None:
plan["selection"].update({
"kind": "reused_frozen_subset",
"source_plan": {
"path": str(args.reuse_selection_plan),
"file_sha256": hashlib.sha256(reused_plan_bytes).hexdigest(),
"plan_sha256": reused_plan["plan_sha256"],
},
})
plan["plan_sha256"] = plan_hash(plan)
args.out.parent.mkdir(parents=True, exist_ok=True)
with args.out.open("x") as handle:
json.dump(plan, handle, indent=2)