{"record":{"id":"d2f48287a60a6210","repo":"Hmbown/CodeWhale","slug":"max-turns-must-be-between-1-and-10000","errorCode":null,"errorMessage":"max_turns must be between 1 and 10000","messagePattern":"max_turns must be between 1 and 10000","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"integrations/verifiers-codewhale/codewhale_harness/harness.py","lineNumber":103,"sourceCode":"    sandbox: Literal[\"auto\", \"read-only\", \"workspace-write\", \"external-sandbox\"] = (\n        \"auto\"\n    )\n    \"\"\"`auto` keeps subprocess runs workspace-bound and trusts isolated runtimes.\"\"\"\n\n\nclass CodewhaleHarness(Harness[CodewhaleHarnessConfig]):\n    APPENDS_SYSTEM_PROMPT = True\n    SUPPORTS_MCP = True\n    SUPPORTS_USER_SIM = False\n\n    def _validate_config(self) -> None:\n        if not _VERSION.fullmatch(self.config.version):\n            raise ValueError(\"version must be a semantic release identifier\")\n        if (\n            self.config.max_turns is not None\n            and not 1 <= self.config.max_turns <= 10_000\n        ):\n            raise ValueError(\"max_turns must be between 1 and 10000\")\n        invalid = [\n            tool\n            for tool in self.config.disabled_tools or []\n            if not _TOOL.fullmatch(tool)\n        ]\n        if invalid:\n            raise ValueError(\n                \"disabled_tools must use Codewhale catalog identifiers: \"\n                + \", \".join(repr(tool) for tool in invalid)\n            )\n\n    @property\n    def binary(self) -> str:\n        configured = (self.config.binary_path or \"\").strip()\n        return configured or DEFAULT_BINARY\n\n    async def setup(self, runtime: Runtime) -> None:\n        self._validate_config()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/integrations/verifiers-codewhale/codewhale_harness/harness.py#L85-L121","documentation":"max_turns is an optional model-step ceiling forwarded as --max-turns to the codewhale exec run; None (the default) means unlimited. _validate_config() rejects any value outside 1..10000 so a typo cannot silently become a no-op or an unrunnable rollout.","triggerScenarios":"Setting max_turns=0, max_turns=-5, or max_turns=10001 in CodewhaleHarnessConfig.","commonSituations":"Raising the ceiling for long-horizon benchmarks and overshooting; configs ported from tools where 0 means unlimited; mixing token budgets into a turn count.","solutions":["Pick a value in 1..10000, e.g. 200 for typical tasks","Set max_turns=None (or omit it) for unlimited rollouts","Clamp sourced values: max_turns = min(10_000, max(1, value))"],"exampleFix":"# before\nconfig = CodewhaleHarnessConfig(version='0.9.1', max_turns=100000)\n# after\nconfig = CodewhaleHarnessConfig(version='0.9.1', max_turns=10000)","handlingStrategy":"validation","validationCode":"if max_turns is not None:\n    max_turns = min(10_000, max(1, int(max_turns)))\nconfig = CodewhaleHarnessConfig(version='0.9.1', max_turns=max_turns)","typeGuard":"def valid_max_turns(v):\n    return v is None or (isinstance(v, int) and not isinstance(v, bool) and 1 <= v <= 10_000)","tryCatchPattern":null,"preventionTips":["Remember 0 does not mean unlimited here; use None","Keep turn budgets explicit per benchmark","Validate config values once at load time, not per rollout"],"tags":["config","validation","python","harness"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}