{"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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/verifiers-codewhale/codewhale_harness/harness.py#L85-L121","documentation":"_validate_config enforces that the optional max_turns cap is between 1 and 10000 inclusive. max_turns limits the model-step count passed to the CLI as --max-turns, and zero, negative, or absurdly large values would be meaningless or rejected by the binary.","triggerScenarios":"Constructing CodewhaleHarnessConfig with max_turns=0, a negative integer, or an integer above 10000, then calling setup() or launch().","commonSituations":"Attempting to disable the turn cap with max_turns=0 instead of None; off-by-one when computing a budget; forgetting the upper bound of 10000.","solutions":["Pass max_turns=None to leave rollouts unlimited (the default)","Set max_turns to an integer in 1..10000, e.g. max_turns=50","If the intent was 'no limit', delete the max_turns field rather than using 0"],"exampleFix":"// before\nCodewhaleHarnessConfig(max_turns=0)\n// after\nCodewhaleHarnessConfig(max_turns=None)  # unlimited\n# or\nCodewhaleHarnessConfig(max_turns=100)","handlingStrategy":"validation","validationCode":"if cfg.max_turns is not None and not (1 <= cfg.max_turns <= 10_000):\n    raise ValueError(\"max_turns must be between 1 and 10000\")","typeGuard":null,"tryCatchPattern":"try:\n    await harness.setup(runtime)\nexcept ValueError as e:\n    if \"max_turns\" in str(e):\n        cfg.max_turns = None  # fall back to unlimited\n    else:\n        raise","preventionTips":["Use None (omit the field) to disable the cap; never use 0","Clamp computed budgets: max_turns = max(1, min(budget, 10_000))"],"tags":["validation","config","range"],"backgroundTag":"value-out-of-range","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}