| 1 | """A real agent can only pass a task whose required answer the prompt states.
|
| 2 |
|
| 3 | The 2026-11-09 cloud canary scored 0/2 because the wide_config_refactor oracle
|
| 4 | required `timeout_ms = 3000` while the prompt never named the value. Every
|
| 5 | exact value a trusted oracle demands must be derivable from the prompt.
|
| 6 | """
|
| 7 |
|
| 8 | from __future__ import annotations
|
| 9 |
|
| 10 | import sys
|
| 11 | import tempfile
|
| 12 | import unittest
|
| 13 | from pathlib import Path
|
| 14 |
|
| 15 | sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
| 16 |
|
| 17 | import agent_workflow # noqa: E402
|
| 18 | import workflow_ab # noqa: E402
|
| 19 | from oakbench import workflow_oracles # noqa: E402
|
| 20 | from oakbench.subjects import Subject # noqa: E402
|
| 21 |
|
| 22 | SUBJECTS = [Subject(name="git", kind="git", label="git", bin=Path("git")),
|
| 23 | Subject(name="oak", kind="oak", label="oak", bin=Path("oak"))]
|
| 24 |
|
| 25 |
|
| 26 | class PromptStatesOracleAnswerTest(unittest.TestCase):
|
| 27 | def test_wide_config_prompt_names_the_value_the_oracle_requires(self) -> None:
|
| 28 | workflow = workflow_ab.WORKFLOWS["wide_config_refactor"]
|
| 29 | with tempfile.TemporaryDirectory() as tmp:
|
| 30 | repo = Path(tmp)
|
| 31 | workflow_ab.make_wide_config_fixture(repo)
|
| 32 | # The oracle's answer: a migrated config differs only in its timeout line.
|
| 33 | before = (repo / "services/service-0000/config.toml").read_text()
|
| 34 | path = repo / "services/service-0000/config.toml"
|
| 35 | for i in range(0, 600, 3):
|
| 36 | p = repo / f"services/service-{i:04d}/config.toml"
|
| 37 | p.write_text(p.read_text().replace("timeout_ms = 2500", "timeout_ms = 3000"))
|
| 38 | self.assertIsNone(workflow_oracles._config_failure(repo))
|
| 39 | required = next(line for line in path.read_text().splitlines() if line not in before.splitlines())
|
| 40 | for subject in SUBJECTS:
|
| 41 | for level in ("zero-shot", "cheat-sheet", "full-docs"):
|
| 42 | prompt = agent_workflow.build_prompt(subject, workflow, "agent-default", level)
|
| 43 | self.assertIn(required, prompt, f"{subject.kind}/{level} prompt hides the oracle's required value")
|
| 44 |
|
| 45 |
|
| 46 | if __name__ == "__main__":
|
| 47 | unittest.main()
|