[fix]. Restore PR-scoped review + remove fix cmd
This commit is contained in:
@@ -14,7 +14,6 @@ from gitea_codex_bot.services.comments import upsert_persistent_review_comment_i
|
||||
from gitea_codex_bot.services.gitea import GiteaClient
|
||||
from gitea_codex_bot.services.jobs import claim_next_job, finish_job
|
||||
from gitea_codex_bot.services.review_format import format_disabled_ack, format_result_comment
|
||||
from gitea_codex_bot.services.reviewer import create_fix_branch, create_fix_patch_note
|
||||
from gitea_codex_bot.types import ParsedCommand
|
||||
from gitea_codex_bot.workers.container_runner import run_review_ephemeral
|
||||
|
||||
@@ -24,7 +23,7 @@ logger = logging.getLogger(__name__)
|
||||
def _command_from_job(job: ReviewJob) -> ParsedCommand:
|
||||
args = job.command_args.split() if job.command_args else []
|
||||
raw = (job.trigger_comment_body or "").strip() or f"@codex {job.command}"
|
||||
return ParsedCommand(name=job.command, raw=raw, arguments=args, full="--full" in args, branch_fix="--branch" in args)
|
||||
return ParsedCommand(name=job.command, raw=raw, arguments=args, full="--full" in args)
|
||||
|
||||
|
||||
def _handle_non_review_command(
|
||||
@@ -61,23 +60,10 @@ def _handle_non_review_command(
|
||||
message = "## Codex Explain\n\nNo previous result found for this command."
|
||||
gitea.post_issue_comment(job.repo, job.pr_number, message)
|
||||
return True, True, {"summary": message}, None
|
||||
if command.name == "fix":
|
||||
if not settings.enable_fix_commands:
|
||||
message = "⚠️ `@codex fix` is disabled on this bot instance."
|
||||
gitea.post_issue_comment(job.repo, job.pr_number, message)
|
||||
return True, True, {"summary": message}, None
|
||||
note = create_fix_patch_note(command)
|
||||
if command.branch_fix:
|
||||
try:
|
||||
pr = gitea.get_pull_request(job.repo, job.pr_number)
|
||||
branch = create_fix_branch(pr, note=note, arguments=command.arguments)
|
||||
message = f"## Codex Fix\n\n{note}\n\nCreated branch `{branch}`."
|
||||
gitea.post_issue_comment(job.repo, job.pr_number, message)
|
||||
return True, True, {"summary": note, "mode": "branch", "branch": branch}, None
|
||||
except Exception as exc:
|
||||
return True, False, None, f"Failed to create fix branch: {exc}"
|
||||
gitea.post_issue_comment(job.repo, job.pr_number, f"## Codex Fix\n\n{note}\n\nPatch suggestion mode.")
|
||||
return True, True, {"summary": note, "mode": "patch"}, None
|
||||
if str(command.name).lower() == "fix":
|
||||
message = "⚠️ `@codex fix` is no longer supported on this bot."
|
||||
gitea.post_issue_comment(job.repo, job.pr_number, message)
|
||||
return True, True, {"summary": message}, None
|
||||
return False, False, None, None
|
||||
|
||||
|
||||
@@ -120,13 +106,11 @@ def _build_help_comment(settings: Settings, session: Session, gitea: GiteaClient
|
||||
"- `@codex review [security|performance|tests] [--full]`",
|
||||
"- `@codex rerun`",
|
||||
"- `@codex explain`",
|
||||
"- `@codex fix [--branch ...]`",
|
||||
"- `@codex ignore`",
|
||||
"- `@codex -h` / `@codex --help` / `@codex help`",
|
||||
"",
|
||||
"Status note:",
|
||||
f"- Pending jobs on this PR: `{pending_count}`",
|
||||
f"- Fix command enabled: `{str(settings.enable_fix_commands).lower()}`",
|
||||
f"- {latest_status_line}",
|
||||
"",
|
||||
f"Discussion summary ({comment_summaries['total']} comments, human `{comment_summaries['human']}`, bot `{comment_summaries['bot']}`):",
|
||||
|
||||
Reference in New Issue
Block a user