File size: 31,505 Bytes
d61821a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | """Command-line entry point for configuration and model preflight."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
import subprocess
import sys
from .analysis import AnalysisError, analyze_pilot_report
from .backend_experiment import BackendExperimentError, run_backend_experiment
from .confirmatory_retrieval import ConfirmatoryRetrievalError, run_confirmatory_retrieval
from .lm_studio import LMStudioClient, LMStudioError
from .lm_studio_embeddings import EmbeddingStudioError, LMStudioEmbeddingClient
from .interactive_experiment import (
InteractiveExperimentError,
run_iterative_final,
run_one_shot_and_queries,
run_refined_retrieval,
)
from .llm_localization import LocalizationError, run_localization
from .live_agent_experiment import LiveAgentExperimentError, run_live_agent_experiment
from .lm_studio_management import LMStudioManagementError
from .pilot import PilotError, run_static_retrieval_pilot
from .protocol_experiment import (
ProtocolExperimentError,
run_protocol_experiment,
run_retrieval_protocol_experiment,
run_study4_ancillary,
)
from .repair_experiment import RepairExperimentError, run_repair_experiment
from .robustness_experiment import RobustnessExperimentError, run_robustness_experiment
from .study2_experiment import (
Study2ExperimentError,
run_study2_experiment,
run_study2_reliability,
)
from .study5_experiment import Study5ExperimentError, run_study5_experiment
from .specs import (
SpecError,
load_embeddings,
load_experiments,
load_harnesses,
load_models,
load_task_split,
project_root,
validate_configuration_tree,
)
def _root(value: str | None) -> Path:
return Path(value).resolve() if value else project_root()
def command_validate(args: argparse.Namespace) -> int:
root = _root(args.root)
errors, warnings = validate_configuration_tree(root)
for warning in warnings:
print(f"WARNING: {warning}")
for error in errors:
print(f"ERROR: {error}", file=sys.stderr)
if errors:
return 1
print(f"Configuration tree is valid: {root}")
return 0
def command_list_harnesses(args: argparse.Namespace) -> int:
for spec in load_harnesses(_root(args.root)).values():
print(
f"{spec.harness_id}\t{spec.name}\t{spec.config_hash[:12]}\t"
f"L={int(spec.lexical)} S={int(spec.syntax == 'tree_sitter')} "
f"D={int(spec.dense)} G={spec.graph_hops} Q={spec.query_policy} "
f"I={spec.interface} P={spec.packing} C={spec.control}"
)
return 0
def command_plan(args: argparse.Namespace) -> int:
root = _root(args.root)
experiments = load_experiments(root)
try:
experiment = experiments[args.experiment]
except KeyError:
print(f"Unknown experiment {args.experiment}; choices: {sorted(experiments)}", file=sys.stderr)
return 1
manifest_path = root / "configs" / "study5" / f"{experiment.experiment_id}_cells.json"
manifest = (
json.loads(manifest_path.read_text(encoding="utf-8"))
if manifest_path.is_file()
else None
)
per_task = experiment.cells_per_task()
total_cells = per_task * args.tasks
if manifest is not None:
manifest_tasks = {item["task_id"] for item in manifest["cells"]}
if args.tasks != len(manifest_tasks):
print(
f"Study 5 manifest fixes task_count={len(manifest_tasks)}; "
f"ignoring requested --tasks={args.tasks}",
file=sys.stderr,
)
per_task = int(manifest["planned_cells"]) // len(manifest_tasks)
total_cells = int(manifest["planned_cells"])
result = {
"experiment_id": experiment.experiment_id,
"mode": experiment.mode,
"harness_count": len(experiment.harness_ids),
"backend_ids": experiment.backend_ids,
"model_ids": experiment.model_ids,
"context_budgets": experiment.context_budgets,
"seeds": experiment.seeds,
"repetitions": experiment.repetitions,
"cells_per_task": per_task,
"task_count": len(manifest_tasks) if manifest is not None else args.tasks,
"total_cells": total_cells,
"manifest": str(manifest_path) if manifest is not None else None,
}
print(json.dumps(result, indent=2))
return 0
def command_probe_model(args: argparse.Namespace) -> int:
models = load_models(_root(args.root))
try:
spec = models[args.model]
client = LMStudioClient(spec, timeout_seconds=args.timeout)
discovery, resolved = client.resolve()
output: dict[str, object] = {
"expected_model": spec.canonical_name,
"model_config_hash": spec.config_hash,
"resolved": resolved.to_dict(),
"discovery_errors": discovery.endpoint_errors,
}
if args.infer:
output["inference_probe"] = client.inference_probe(resolved.inference_key)
print(json.dumps(output, indent=2, sort_keys=True))
return 0
except (KeyError, SpecError, LMStudioError) as exc:
print(f"MODEL PREFLIGHT FAILED: {exc}", file=sys.stderr)
return 1
def command_probe_embedding(args: argparse.Namespace) -> int:
embeddings = load_embeddings(_root(args.root))
try:
spec = embeddings[args.embedding]
client = LMStudioEmbeddingClient(spec, timeout_seconds=args.timeout)
output: dict[str, object] = {
"embedding_id": spec.embedding_id,
"embedding_config_hash": spec.config_hash,
"resolved": client.resolve(),
}
if args.infer:
output["inference_probe"] = client.probe().to_dict()
# Capture the actual loaded-instance context after possible JIT load.
output["resolved"] = client.resolve()
print(json.dumps(output, indent=2, sort_keys=True))
return 0
except (KeyError, SpecError, EmbeddingStudioError) as exc:
print(f"EMBEDDING PREFLIGHT FAILED: {exc}", file=sys.stderr)
return 1
def command_doctor(args: argparse.Namespace) -> int:
root = _root(args.root)
errors, warnings = validate_configuration_tree(root)
if args.experiment:
experiments = load_experiments(root)
harnesses = load_harnesses(root)
embeddings = load_embeddings(root)
experiment = experiments.get(args.experiment)
if experiment is None:
errors.append(f"unknown experiment {args.experiment}")
else:
split_path = root / "tasks" / "splits" / f"{experiment.task_split}.txt"
if not load_task_split(split_path):
errors.append(
f"{experiment.experiment_id} cannot run until task split "
f"{experiment.task_split} contains eligible task IDs"
)
if any(harnesses[item].dense for item in experiment.harness_ids):
embedding = embeddings[experiment.embedding_id]
if embedding.status != "ready":
errors.append(
f"{experiment.experiment_id} cannot run dense treatments until "
f"{embedding.embedding_id} is configured"
)
for warning in warnings:
print(f"WARNING: {warning}")
for error in errors:
print(f"ERROR: {error}", file=sys.stderr)
return 1 if errors else 0
def command_run_pilot(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
summary = run_static_retrieval_pilot(
root=root,
repository=Path(args.repository).resolve(),
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
candidate_limit=args.candidate_limit,
)
print(json.dumps(summary, indent=2, sort_keys=True))
return 0
except (PilotError, EmbeddingStudioError) as exc:
print(f"PILOT FAILED: {exc}", file=sys.stderr)
return 1
def command_summarize_pilot(args: argparse.Namespace) -> int:
root = _root(args.root)
report_path = Path(args.report).resolve()
try:
revision_result = subprocess.run(
["git", "rev-parse", "HEAD"],
cwd=root,
check=True,
capture_output=True,
text=True,
timeout=30,
)
summary = analyze_pilot_report(root, report_path, revision_result.stdout.strip())
rendered = json.dumps(summary, indent=2, sort_keys=True) + "\n"
if args.output:
output = Path(args.output).resolve()
output.parent.mkdir(parents=True, exist_ok=True)
with output.open("x", encoding="utf-8") as handle:
handle.write(rendered)
print(rendered, end="")
return 0
except (AnalysisError, OSError, subprocess.SubprocessError) as exc:
print(f"ANALYSIS FAILED: {exc}", file=sys.stderr)
return 1
def command_run_localization(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_localization(
root=root,
repository=Path(args.repository).resolve(),
ranking_path=Path(args.ranking).resolve(),
task_id=args.task,
harness_id=args.harness,
experiment_id=args.experiment,
candidate_limit=args.candidate_limit,
timeout_seconds=args.timeout,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (LocalizationError, LMStudioError, PilotError, OSError) as exc:
print(f"LOCALIZATION FAILED: {exc}", file=sys.stderr)
return 1
def command_run_confirmatory_retrieval(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_confirmatory_retrieval(
root=root,
repository=Path(args.repository).resolve(),
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
candidate_limit=args.candidate_limit,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (ConfirmatoryRetrievalError, EmbeddingStudioError, PilotError, OSError) as exc:
print(f"CONFIRMATORY RETRIEVAL FAILED: {exc}", file=sys.stderr)
return 1
def command_run_backend_experiment(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_backend_experiment(
root=root,
repository=Path(args.repository).resolve(),
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
backend_filter=set(args.backend) if args.backend else None,
harness_filter=set(args.harness) if args.harness else None,
candidate_limit=args.candidate_limit,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (BackendExperimentError, EmbeddingStudioError, OSError) as exc:
print(f"BACKEND EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_interactive(args: argparse.Namespace) -> int:
root = _root(args.root)
kwargs = {
"root": root,
"repository": Path(args.repository).resolve(),
"task_filter": set(args.task) if args.task else None,
"harness_filter": set(args.harness) if args.harness else None,
}
try:
if args.phase in {"one_shot", "query"}:
result = run_one_shot_and_queries(phase=args.phase, **kwargs)
elif args.phase == "refined_retrieval":
result = run_refined_retrieval(**kwargs)
elif args.phase == "iterative_final":
result = run_iterative_final(**kwargs)
else:
raise InteractiveExperimentError(f"unknown phase {args.phase}")
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (InteractiveExperimentError, LMStudioError, EmbeddingStudioError, OSError) as exc:
print(f"INTERACTIVE EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_repairs(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_repair_experiment(
root=root,
repository=Path(args.repository).resolve(),
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (RepairExperimentError, LMStudioError, OSError, subprocess.SubprocessError) as exc:
print(f"REPAIR EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_robustness(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_robustness_experiment(
root=root,
repository=Path(args.repository).resolve(),
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
seed_filter=set(args.seed) if args.seed else None,
candidate_limit=args.candidate_limit,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (RobustnessExperimentError, EmbeddingStudioError, PilotError, OSError) as exc:
print(f"ROBUSTNESS EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_live_agent(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_live_agent_experiment(
root=root,
repository=Path(args.repository).resolve(),
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
)
print(json.dumps(result, indent=2, sort_keys=True))
return 0
except (
LiveAgentExperimentError,
LMStudioManagementError,
LMStudioError,
EmbeddingStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"LIVE AGENT EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_study2(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_study2_experiment(
root=root,
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
treatment_filter=set(args.treatment) if args.treatment else None,
model_filter=set(args.model) if args.model else None,
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
Study2ExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
EmbeddingStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"STUDY 2 EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_study2_reliability(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_study2_reliability(
root=root,
manifest_path=Path(args.manifest).resolve() if args.manifest else None,
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
Study2ExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
EmbeddingStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"STUDY 2 RELIABILITY RUN FAILED: {exc}", file=sys.stderr)
return 1
def command_run_protocol(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_protocol_experiment(
root=root,
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
interface_filter=set(args.interface) if args.interface else None,
model_filter=set(args.model) if args.model else None,
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"accepted_edit_count": result["accepted_edit_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
ProtocolExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"PROTOCOL EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_retrieval_protocol(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_retrieval_protocol_experiment(
root=root,
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
model_filter=set(args.model) if args.model else None,
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"accepted_edit_count": result["accepted_edit_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
ProtocolExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"RETRIEVAL PROTOCOL EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def command_run_study4_ancillary(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_study4_ancillary(
root=root,
manifest_path=Path(args.manifest).resolve(),
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"accepted_edit_count": result["accepted_edit_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
ProtocolExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
EmbeddingStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"STUDY 4 ANCILLARY FAILED: {exc}", file=sys.stderr)
return 1
def command_run_study5(args: argparse.Namespace) -> int:
root = _root(args.root)
try:
result = run_study5_experiment(
root=root,
experiment_id=args.experiment,
task_filter=set(args.task) if args.task else None,
harness_filter=set(args.harness) if args.harness else None,
interface_filter=set(args.interface) if args.interface else None,
model_filter=set(args.model) if args.model else None,
stop_server_when_complete=not args.keep_server_running,
)
print(
json.dumps(
{
"experiment_id": result["experiment_id"],
"code_revision": result["code_revision"],
"run_count": result["run_count"],
"accepted_edit_count": result["accepted_edit_count"],
"applicable_patch_count": result["applicable_patch_count"],
"resolved_count": result["resolved_count"],
"report_path": result["report_path"],
},
indent=2,
sort_keys=True,
)
)
return 0
except (
Study5ExperimentError,
ProtocolExperimentError,
PilotError,
LMStudioManagementError,
LMStudioError,
EmbeddingStudioError,
OSError,
subprocess.SubprocessError,
) as exc:
print(f"STUDY 5 EXPERIMENT FAILED: {exc}", file=sys.stderr)
return 1
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="harness-research")
parser.add_argument("--root", help="project root (defaults to the installed source tree)")
subparsers = parser.add_subparsers(dest="command", required=True)
validate = subparsers.add_parser("validate", help="validate all configuration files")
validate.set_defaults(func=command_validate)
listing = subparsers.add_parser("list-harnesses", help="list immutable harness identities")
listing.set_defaults(func=command_list_harnesses)
plan = subparsers.add_parser("plan", help="expand experiment cells without running them")
plan.add_argument("--experiment", required=True)
plan.add_argument("--tasks", type=int, default=1)
plan.set_defaults(func=command_plan)
probe = subparsers.add_parser("probe-model", help="discover and verify Qwen in LM Studio")
probe.add_argument("--model", default="M001")
probe.add_argument("--timeout", type=float, default=10.0)
probe.add_argument("--infer", action="store_true", help="also run a semantic completion probe")
probe.set_defaults(func=command_probe_model)
embedding_probe = subparsers.add_parser(
"probe-embedding",
help="discover and verify the pinned LM Studio embedding model",
)
embedding_probe.add_argument("--embedding", default="EMB001")
embedding_probe.add_argument("--timeout", type=float, default=30.0)
embedding_probe.add_argument(
"--infer",
action="store_true",
help="also verify vector dimensions, normalization, and distinctness",
)
embedding_probe.set_defaults(func=command_probe_embedding)
doctor = subparsers.add_parser("doctor", help="check whether an experiment is runnable")
doctor.add_argument("--experiment")
doctor.set_defaults(func=command_doctor)
pilot = subparsers.add_parser("run-pilot", help="run the immutable E00 retrieval pilot")
pilot.add_argument("--experiment", default="E00")
pilot.add_argument("--repository", default="data/repos/gitlab-runner")
pilot.add_argument("--task", action="append", help="limit to a task ID; repeatable")
pilot.add_argument("--harness", action="append", help="limit to a harness ID; repeatable")
pilot.add_argument("--candidate-limit", type=int, default=200)
pilot.set_defaults(func=command_run_pilot)
summarize = subparsers.add_parser("summarize-pilot", help="audit and summarize an E00 report")
summarize.add_argument("--report", required=True)
summarize.add_argument("--output")
summarize.set_defaults(func=command_summarize_pilot)
localization = subparsers.add_parser(
"run-localization", help="run one blinded Qwen localization cell"
)
localization.add_argument("--experiment", default="E06")
localization.add_argument("--repository", default="data/repos/gitlab-runner")
localization.add_argument("--ranking", required=True)
localization.add_argument("--task", required=True)
localization.add_argument("--harness", required=True)
localization.add_argument("--candidate-limit", type=int, default=10)
localization.add_argument("--timeout", type=float, default=900.0)
localization.set_defaults(func=command_run_localization)
confirmatory = subparsers.add_parser(
"run-confirmatory-retrieval", help="run frozen E01 retrieval treatments"
)
confirmatory.add_argument("--experiment", default="E01")
confirmatory.add_argument("--repository", default="data/repos/gitlab-runner")
confirmatory.add_argument("--task", action="append")
confirmatory.add_argument("--harness", action="append")
confirmatory.add_argument("--candidate-limit", type=int, default=200)
confirmatory.set_defaults(func=command_run_confirmatory_retrieval)
backend = subparsers.add_parser("run-backends", help="run frozen E05 backend cells")
backend.add_argument("--experiment", default="E05")
backend.add_argument("--repository", default="data/repos/gitlab-runner")
backend.add_argument("--task", action="append")
backend.add_argument("--backend", action="append")
backend.add_argument("--harness", action="append")
backend.add_argument("--candidate-limit", type=int, default=200)
backend.set_defaults(func=command_run_backend_experiment)
interactive = subparsers.add_parser("run-interactive", help="run one phase of E02")
interactive.add_argument(
"--phase", required=True,
choices=("one_shot", "query", "refined_retrieval", "iterative_final"),
)
interactive.add_argument("--repository", default="data/repos/gitlab-runner")
interactive.add_argument("--task", action="append")
interactive.add_argument("--harness", action="append")
interactive.set_defaults(func=command_run_interactive)
repairs = subparsers.add_parser("run-repairs", help="run frozen E03 repair cells")
repairs.add_argument("--repository", default="data/repos/gitlab-runner")
repairs.add_argument("--task", action="append")
repairs.add_argument("--harness", action="append")
repairs.set_defaults(func=command_run_repairs)
robustness = subparsers.add_parser("run-robustness", help="run frozen E04 robustness cells")
robustness.add_argument("--experiment", default="E04")
robustness.add_argument("--repository", default="data/repos/gitlab-runner")
robustness.add_argument("--task", action="append")
robustness.add_argument("--harness", action="append")
robustness.add_argument("--seed", action="append", type=int)
robustness.add_argument("--candidate-limit", type=int, default=200)
robustness.set_defaults(func=command_run_robustness)
live_agent = subparsers.add_parser(
"run-live-agent", help="run the frozen E07 live search/read/edit/test agent"
)
live_agent.add_argument("--experiment", default="E07")
live_agent.add_argument("--repository", default="data/repos/gitlab-runner")
live_agent.add_argument("--task", action="append")
live_agent.add_argument("--harness", action="append")
live_agent.set_defaults(func=command_run_live_agent)
study2 = subparsers.add_parser(
"run-study2", help="run/resume the prospective E08 multi-repository study"
)
study2.add_argument("--experiment", default="E08")
study2.add_argument("--task", action="append")
study2.add_argument("--treatment", action="append")
study2.add_argument("--model", action="append")
study2.add_argument("--keep-server-running", action="store_true")
study2.set_defaults(func=command_run_study2)
reliability = subparsers.add_parser(
"run-study2-reliability",
help="run/resume the frozen E08 stochastic reliability cells",
)
reliability.add_argument("--manifest")
reliability.add_argument("--keep-server-running", action="store_true")
reliability.set_defaults(func=command_run_study2_reliability)
protocol = subparsers.add_parser(
"run-protocol-study",
help="run/resume the prospective E09 model-by-edit-interface study",
)
protocol.add_argument("--experiment", default="E09")
protocol.add_argument("--task", action="append")
protocol.add_argument("--interface", action="append")
protocol.add_argument("--model", action="append")
protocol.add_argument("--keep-server-running", action="store_true")
protocol.set_defaults(func=command_run_protocol)
retrieval_protocol = subparsers.add_parser(
"run-retrieval-protocol-study",
help="run/resume the prospective E10 fresh-task retrieval study",
)
retrieval_protocol.add_argument("--experiment", default="E10")
retrieval_protocol.add_argument("--task", action="append")
retrieval_protocol.add_argument("--harness", action="append")
retrieval_protocol.add_argument("--model", action="append")
retrieval_protocol.add_argument("--keep-server-running", action="store_true")
retrieval_protocol.set_defaults(func=command_run_retrieval_protocol)
study4_ancillary = subparsers.add_parser(
"run-study4-ancillary",
help="run/resume a frozen Study 4 reliability or context manifest",
)
study4_ancillary.add_argument("--manifest", required=True)
study4_ancillary.add_argument("--keep-server-running", action="store_true")
study4_ancillary.set_defaults(func=command_run_study4_ancillary)
study5 = subparsers.add_parser(
"run-study5",
help="run/resume a frozen manifest-driven Study 5 harness experiment",
)
study5.add_argument("--experiment", required=True, choices=("E13", "E14", "E15", "E16"))
study5.add_argument("--task", action="append")
study5.add_argument("--harness", action="append")
study5.add_argument("--interface", action="append")
study5.add_argument("--model", action="append")
study5.add_argument("--keep-server-running", action="store_true")
study5.set_defaults(func=command_run_study5)
return parser
def main(argv: list[str] | None = None) -> int:
parser = build_parser()
args = parser.parse_args(argv)
try:
return int(args.func(args))
except SpecError as exc:
print(f"CONFIGURATION ERROR: {exc}", file=sys.stderr)
return 1
if __name__ == "__main__":
raise SystemExit(main())
|