|
44 | 44 | extract_session_id = OpenCodeAdapter.extract_session_id |
45 | 45 | from exoma import check # noqa: E402 |
46 | 46 | from exoma import cli as main # noqa: E402 |
| 47 | +from exoma.core.prompt import prompt_builder # noqa: E402 |
47 | 48 |
|
48 | 49 | ROWS = [] |
49 | 50 |
|
@@ -417,8 +418,17 @@ def simulate(): |
417 | 418 | ) |
418 | 419 |
|
419 | 420 | # --- S7 task truncation ---------------------------------------------- |
| 421 | + # File and stdin transports (opencode, codex) carry no task cap by default; a cap |
| 422 | + # applies only when EXOMA_MAX_TASK_CHARS_NO_ARGV sets one. That value is read at |
| 423 | + # import and bound into prompt_builder, so the flow sets the module global for this |
| 424 | + # call: it checks the refusal path under a policy cap, not the uncapped default. |
420 | 425 | huge = "analyse this dump " + ("x" * 12000) |
421 | | - truncated = main.run("analyze", huge, "sim-session", work_dir) |
| 426 | + saved_cap = prompt_builder.DEFAULT_MAX_TASK_CHARS_NO_ARGV |
| 427 | + prompt_builder.DEFAULT_MAX_TASK_CHARS_NO_ARGV = 3000 |
| 428 | + try: |
| 429 | + truncated = main.run("analyze", huge, "sim-session", work_dir) |
| 430 | + finally: |
| 431 | + prompt_builder.DEFAULT_MAX_TASK_CHARS_NO_ARGV = saved_cap |
422 | 432 | meta = truncated.get("meta", {}) |
423 | 433 | record( |
424 | 434 | "S7", |
@@ -459,20 +469,40 @@ def simulate(): |
459 | 469 | ) |
460 | 470 |
|
461 | 471 | # --- S10 verify delegated: pass and fail -------------------------------- |
| 472 | + # A pass needs a test request the runtime ran green: without verify/tests.json the |
| 473 | + # runtime records a `tests:` gap and the verdict stays incomplete. |
462 | 474 | config["commands"]["verify_mode"] = "delegated" |
| 475 | + config["commands"]["verify_test_commands"] = [f'"{sys.executable}"'] |
463 | 476 | write_config(project, config) |
| 477 | + tests_request = ( |
| 478 | + workflow_paths(project, "verify-pass-session")["session_dir"] / "verify" / "tests.json" |
| 479 | + ) |
| 480 | + tests_request.parent.mkdir(parents=True, exist_ok=True) |
| 481 | + tests_request.write_text( |
| 482 | + json.dumps( |
| 483 | + { |
| 484 | + "commands": [f'"{sys.executable}" -c "pass"'], |
| 485 | + "reason": "sim: one allowlisted command that exits 0", |
| 486 | + } |
| 487 | + ), |
| 488 | + encoding="utf-8", |
| 489 | + ) |
464 | 490 | adapter.body_for["verify"] = VERIFY_PASS |
465 | 491 | adapter.default_body = VERIFY_PASS |
466 | 492 | vpass = main.run( |
467 | 493 | "verify", "confirm the change landed", "verify-pass-session", work_dir |
468 | 494 | ) |
| 495 | + vmeta = vpass.get("meta", {}) |
| 496 | + test_outcomes = (vmeta.get("runtime_tests") or {}).get("outcomes") or [] |
| 497 | + test_status = test_outcomes[0].get("status") if test_outcomes else None |
469 | 498 | record( |
470 | 499 | "S10", |
471 | 500 | "delegated verify pass", |
472 | | - "meta.verdict=pass, exit code 0", |
473 | | - f"verdict={vpass.get('meta', {}).get('verdict')}, " |
| 501 | + "meta.verdict=pass, runtime test passed, exit code 0", |
| 502 | + f"verdict={vmeta.get('verdict')}, test={test_status}, " |
474 | 503 | f"exit={main._verify_exit_code('verify', vpass, 'verify')}", |
475 | | - vpass.get("meta", {}).get("verdict") == "pass" |
| 504 | + vmeta.get("verdict") == "pass" |
| 505 | + and test_status == "passed" |
476 | 506 | and main._verify_exit_code("verify", vpass, "verify") == 0, |
477 | 507 | ) |
478 | 508 |
|
|
0 commit comments