[refactor]. Remove legacy review prompt path
All checks were successful
ci / test (pull_request) Successful in 34s
ci / publish (pull_request) Has been skipped

This commit is contained in:
Space-Banane
2026-05-23 14:03:20 +02:00
parent 01e10abc71
commit 30aa737516
5 changed files with 45 additions and 385 deletions

View File

@@ -12,6 +12,7 @@ from gitea_codex_bot.workers.container_runner import (
RESULT_END_MARKER,
RESULT_START_MARKER,
_build_docker_command,
_build_exec_review_prompt,
_build_install_and_run_command,
_extract_result_meta_from_codex_stdout,
_load_codex_auth_json_b64,
@@ -95,7 +96,7 @@ def test_build_install_command_chatgpt_mode_sets_git_checkout_and_review(monkeyp
settings = get_settings()
pr = _sample_pr()
command = _build_install_and_run_command(settings, pr=pr)
command = _build_install_and_run_command(settings, pr=pr, review_prompt="review: security --full")
assert 'printf "%s" "$CODEX_AUTH_JSON_B64" | base64 -d > /root/.codex/auth.json' in command
assert "git -c http.extraHeader=" in command
@@ -107,7 +108,8 @@ def test_build_install_command_chatgpt_mode_sets_git_checkout_and_review(monkeyp
assert f"git checkout --detach {pr.head_sha}" in command
assert "resolved_head=\"$(git rev-parse HEAD)\"" in command
assert "unset GITEA_TOKEN auth_b64" in command
assert f"codex exec review --base {pr.base_sha}" in command
assert "codex exec --json --output-schema /tmp/codex-review-schema.json -o /tmp/codex-review-result.json" in command
assert "review: security --full" in command
assert "--output-schema /tmp/codex-review-schema.json" in command
assert "-o /tmp/codex-review-result.json" in command
assert "npm install -g @openai/codex@latest" in command
@@ -121,7 +123,7 @@ def test_build_install_command_does_not_include_reasoning_effort_flag() -> None:
settings = get_settings()
pr = _sample_pr()
command = _build_install_and_run_command(settings, pr=pr)
command = _build_install_and_run_command(settings, pr=pr, review_prompt="review: tests")
assert "--reasoning-effort" not in command
@@ -130,7 +132,7 @@ def test_build_install_command_uses_upstream_remote_for_fork_pr_base_fetch() ->
settings = get_settings()
pr = _sample_fork_pr()
command = _build_install_and_run_command(settings, pr=pr)
command = _build_install_and_run_command(settings, pr=pr, review_prompt="review: tests")
assert "base_remote=upstream" in command
assert f"git remote add upstream {pr.base_clone_url}" in command
@@ -320,6 +322,18 @@ def test_parse_review_result_from_stdout_artifact_fails_without_markers() -> Non
_parse_review_result_from_stdout_artifact("no markers here")
def test_build_exec_review_prompt_strips_mention_and_command() -> None:
prompt = _build_exec_review_prompt(
ParsedCommand(name="review", raw="@codex review security --full\nfocus session handling")
)
assert prompt == "review: security --full\nfocus session handling"
def test_build_exec_review_prompt_falls_back_when_no_extra_text() -> None:
prompt = _build_exec_review_prompt(ParsedCommand(name="rerun", raw="@codex rerun"))
assert prompt == "review: review this pull request and report introduced issues."
def test_extract_result_meta_from_codex_stdout_collects_model_and_usage() -> None:
settings = get_settings()
stdout = "\n".join(