[fix]. Remove host review fallback
This commit is contained in:
@@ -14,7 +14,7 @@ from typing import Any
|
||||
from gitea_codex_bot.config import Settings
|
||||
from gitea_codex_bot.services.gitea import GiteaClient
|
||||
from gitea_codex_bot.services.repo_config import RepoReviewConfig
|
||||
from gitea_codex_bot.services.reviewer import normalize_review_result, prepare_review_prompt, run_review_for_pr
|
||||
from gitea_codex_bot.services.reviewer import normalize_review_result, prepare_review_prompt
|
||||
from gitea_codex_bot.types import ParsedCommand
|
||||
|
||||
CONTAINER_CODEX_HOME = "/root/.codex"
|
||||
@@ -52,11 +52,8 @@ def run_review_ephemeral(
|
||||
parsed["_meta"] = _extract_result_meta_from_codex_stdout(completed.stdout, settings)
|
||||
return normalize_review_result(parsed), repo_cfg
|
||||
except Exception as exc:
|
||||
if settings.codex_auth_mode == "chatgpt":
|
||||
logger.warning("Ephemeral chatgpt runner failed, skipping API-key fallback: %s", exc)
|
||||
return _chatgpt_runner_failure_result(exc), repo_cfg
|
||||
result, _repo_cfg = run_review_for_pr(settings, gitea, repo, pr_number, command)
|
||||
return result, _repo_cfg
|
||||
logger.warning("Ephemeral runner failed without host fallback: %s", exc)
|
||||
return _ephemeral_runner_failure_result(exc, settings.codex_auth_mode), repo_cfg
|
||||
|
||||
|
||||
def _build_install_and_run_command(settings: Settings) -> str:
|
||||
@@ -121,9 +118,10 @@ def _build_docker_command(settings: Settings, *, container_name: str, install_an
|
||||
return cmd
|
||||
|
||||
|
||||
def _chatgpt_runner_failure_result(exc: Exception) -> dict[str, Any]:
|
||||
def _ephemeral_runner_failure_result(exc: Exception, auth_mode: str) -> dict[str, Any]:
|
||||
message = str(exc).strip() or exc.__class__.__name__
|
||||
summary = f"ChatGPT auth runner failed before review execution. Error: {message}"
|
||||
mode_label = "ChatGPT auth" if auth_mode == "chatgpt" else "API-key auth"
|
||||
summary = f"{mode_label} runner failed before review execution. Error: {message}"
|
||||
return {
|
||||
"verdict": "has_issues",
|
||||
"confidence": 0.6,
|
||||
@@ -134,7 +132,7 @@ def _chatgpt_runner_failure_result(exc: Exception) -> dict[str, Any]:
|
||||
"file": "runner",
|
||||
"line_start": 1,
|
||||
"line_end": 1,
|
||||
"title": "Ephemeral chatgpt review runner failed",
|
||||
"title": "Ephemeral review runner failed",
|
||||
"body": message,
|
||||
"suggestion": "Check ephemeral runner logs for model/auth/network issues, then rerun @codex review.",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user