{"record":{"id":"8cbcc02a4c5eb1b5","repo":"datawhalechina/hello-agents","slug":"unsupported-reviewer-mode-review-mode","errorCode":null,"errorMessage":"Unsupported reviewer mode: {review_mode}","messagePattern":"Unsupported reviewer mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/prompts.py","lineNumber":193,"sourceCode":"  - 数据概览\n  - 方法说明\n  - 统计学治理说明\n  - 核心假设检验结论\n  - 结果解释\n  - 讨论\n  - 清洗后数据路径\n  - 图表引用 such as ![图表]({figures_dir}/chart.png)\n  - If any hypothesis test was run, the report must include the test statistic, p-value, effect size, and 95% CI together.\n  - If more than two groups were compared pairwise, the report must state the multiple-comparison correction method explicitly.\n\"\"\"\n\n\ndef build_reviewer_prompt(review_mode: str, *, focus_major_issues: bool = False) -> str:\n    \"\"\"Return the system prompt for the reviewer agent.\"\"\"\n\n    normalized_mode = review_mode.strip().lower()\n    if normalized_mode not in {\"standard\", \"publication\"}:\n        raise ValueError(f\"Unsupported reviewer mode: {review_mode}\")\n\n    if normalized_mode == \"publication\":\n        reviewer_role = \"You are an exceptionally strict reviewer from a top-tier journal ecosystem such as Nature, Science, or Cell.\"\n        checklist = \"\"\"Review checklist:\n- Verify that figure references are present, coherent, and point to this run's actual figure paths.\n- If Generated artifacts evidence confirms that figures were saved in this run and artifact validation is green, do not reject solely because the compressed execution trace omits plotting details.\n- Verify that any hypothesis test is reported with the test statistic, p-value, effect size, and 95% CI together.\n- Verify that multi-group pairwise comparisons explicitly mention Bonferroni correction or Tukey HSD when required.\n- Verify that the report does not confuse correlation with causation.\n- Verify that there are no obvious logical leaps, implausible claims, over-interpretation relative to the sample size, or conclusions that contradict the execution trace.\n- Verify that the report does not cite files, figures, or cleaned-data paths outside the current run directory contract.\n- Verify that the chosen methods match the data structure, including dependency, repeated measures, or time-series risks when present.\n\"\"\"\n        decision_policy = \"\"\"Decision policy:\n- Return \"Accept\" only if the report is publication-grade, internally coherent, statistically defensible, and adequately grounded in the supplied evidence.\n- Return \"Reject\" if any major statistical, logical, citation, artifact, or interpretation issue remains.\n- You must not invent new results, new p-values, or new evidence that does not appear in the candidate report or the supplied review context.\n\"\"\"","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/datawhalechina/hello-agents/blob/606a07d341a47be773fab7f4b71177f53f96b2c3/Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/prompts.py#L175-L211","documentation":"build_reviewer_prompt accepts only the reviewer modes \"standard\" and \"publication\"; any other string (after strip+lowercase) raises ValueError. The mode selects the reviewer persona and checklist used to critique analysis reports, so an unknown mode has no prompt template to return.","triggerScenarios":"Calling build_reviewer_prompt(review_mode=\"strict\"), \"fast\", \"Publication \" (works, normalized) vs. typo'd values like \"pubilcation\", or passing a user-supplied config value that was never validated upstream.","commonSituations":"Typos in configuration files or CLI flags; new reviewer modes expected by callers after a version change; user-facing UI letting free-text mode input through to the prompt builder.","solutions":["Use one of the two supported literals: \"standard\" or \"publication\" (case/whitespace insensitive).","Validate/whitelist the mode at the API or config boundary before it reaches the prompt builder.","Check for typos in the config key carrying the mode (e.g. review_mode vs reviewer_mode).","If you need a new mode, add it to the {\"standard\", \"publication\"} set in prompts.py and supply its checklist."],"exampleFix":"# before\nprompt = build_reviewer_prompt(review_mode=requested_mode)  # may raise\n\n# after\nALLOWED_MODES = {\"standard\", \"publication\"}\nmode = requested_mode.strip().lower()\nif mode not in ALLOWED_MODES:\n    raise ValueError(f\"review_mode must be one of {sorted(ALLOWED_MODES)}, got '{requested_mode}'\")\nprompt = build_reviewer_prompt(review_mode=mode)","handlingStrategy":"validation","validationCode":"ALLOWED_REVIEW_MODES = {\"standard\", \"publication\"}\nmode = raw_mode.strip().lower()\nif mode not in ALLOWED_REVIEW_MODES:\n    raise ValueError(f\"review_mode must be one of {sorted(ALLOWED_REVIEW_MODES)}, got {raw_mode!r}\")\nprompt = build_reviewer_prompt(review_mode=mode)","typeGuard":"def is_valid_review_mode(mode: str) -> bool:\n    return isinstance(mode, str) and mode.strip().lower() in {\"standard\", \"publication\"}","tryCatchPattern":"try:\n    prompt = build_reviewer_prompt(review_mode=mode)\nexcept ValueError:\n    prompt = build_reviewer_prompt(review_mode=\"standard\")  # explicit fallback, logged","preventionTips":["Constrain reviewer mode inputs with an enum/dropdown in the UI instead of free text.","Whitelist modes at the API boundary, not deep in the prompt builder.","Document the two supported modes in the request schema (Literal type)."],"tags":["validation","prompt-engineering","configuration","python"],"backgroundTag":null,"analyzedSha":"606a07d341a47be773fab7f4b71177f53f96b2c3","analyzedAt":"2026-08-14T22:57:27.446Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}