[fix]. Remove host review fallback
All checks were successful
ci / test (push) Successful in 35s
ci / publish (push) Successful in 55s

This commit is contained in:
Space-Banane
2026-05-23 00:10:53 +02:00
parent 0ab2d62609
commit 328c7f2290
3 changed files with 35 additions and 15 deletions

View File

@@ -117,11 +117,6 @@ def test_run_review_ephemeral_chatgpt_does_not_fallback_to_api_key_path(
lambda *_args, **_kwargs: (_ for _ in ()).throw(RuntimeError("docker unavailable")),
)
def _api_fallback_should_not_run(*_args, **_kwargs):
raise AssertionError("API-key fallback should not run in chatgpt mode")
monkeypatch.setattr("gitea_codex_bot.workers.container_runner.run_review_for_pr", _api_fallback_should_not_run)
from gitea_codex_bot.types import ParsedCommand
result, _repo_cfg = run_review_ephemeral(
@@ -135,6 +130,33 @@ def test_run_review_ephemeral_chatgpt_does_not_fallback_to_api_key_path(
assert "ChatGPT auth runner failed" in result["summary"]
def test_run_review_ephemeral_api_key_mode_does_not_fallback_to_host(monkeypatch: pytest.MonkeyPatch) -> None:
get_settings.cache_clear()
settings = get_settings()
monkeypatch.setattr(
"gitea_codex_bot.workers.container_runner.prepare_review_prompt",
lambda *_args, **_kwargs: ("prompt", {"diff": ""}, object()),
)
monkeypatch.setattr("gitea_codex_bot.workers.container_runner.GiteaClient", lambda _settings: object())
monkeypatch.setattr(
"gitea_codex_bot.workers.container_runner.subprocess.run",
lambda *_args, **_kwargs: (_ for _ in ()).throw(RuntimeError("docker unavailable")),
)
from gitea_codex_bot.types import ParsedCommand
result, _repo_cfg = run_review_ephemeral(
settings,
repo="acme/repo",
pr_number=1,
command=ParsedCommand(name="review", raw="@codex review"),
)
assert result["verdict"] == "has_issues"
assert "API-key auth runner failed" in result["summary"]
def test_parse_codex_exec_stdout_from_stream_item_text_json() -> None:
stdout = '\n'.join(
[