Skip to content

ci(review): count only a completed review, not one that stated its mode - #740

Merged
aibex-agent[bot] merged 2 commits into
mainfrom
aibex/t_eVbybkTmSASFeq990X6ljk67
Dec 4, 2026
Merged

aibex-agent[bot] merged 2 commits into
mainfrom
aibex/t_eVbybkTmSASFeq990X6ljk67

Conversation

@aibex-agent

@aibex-agent aibex-agent Bot commented Dec 4, 2026

Copy link
Copy Markdown

The on-demand review's verify step passed any bot comment that cited this run and contained Review mode:. On taskless/taskless #619 (run 47226766621) the model wrote that line into its progress checklist early, stopped after 11 turns and 2 Bash denials with no inline comments and no summary, and the action still rewrote the header to "Claude finished ... View job". The comment ended on ### Review in progress with unchecked items, and the status said "Review posted".

Change

  • The prompt requires Review status: complete as the last line of the top-level comment, written only in the final update.
  • The verify step keeps its @json / run-id anchoring / Bot-only filtering, and now passes a comment only if it has the mode line, ends on the completion line, and shows no unchecked - [ ] item and no #-heading containing "in progress" outside fenced code. It logs reason codes, never comment text, and fails closed.
  • The marker is plain text, not an HTML comment: the action's update_claude_comment tool runs the body through sanitizeContent, which strips <!-- --> (checked at the pinned 0a8d3c94).
  • claude-code-focus-on-demand.yml gets the same fix with Focus status: complete, since the two copies are meant to stay in step.

Tested by extracting each step's run: script and running it against fixture comments with gh stubbed: a #619-shaped partial body, a marker written early, a numeric-prefix run id, and a partial body beside an older completed review are rejected; a complete body, a bold marker with CRLF, and a complete body quoting a task list in a fence are accepted. CI-only change, so no changeset.

The verify step passed any bot comment citing this run that contained
'Review mode:'. On taskless/taskless #619 (run 47226766621) the model wrote
that line into its progress checklist, stopped after 11 turns, and the
action still rewrote the header to 'Claude finished', so an unfinished
review reported success.

The prompt now requires 'Review status: complete' as the last line of the
top-level comment, and the step accepts a comment only if it ends on that
line and shows no unchecked '- [ ]' item and no 'in progress' heading
outside fenced code. The marker is plain text because the action's
update_claude_comment tool strips HTML comments. The focus workflow's copy
of the step gets the same fix with 'Focus status: complete'.
@aibex-agent

aibex-agent Bot commented Dec 4, 2026

Copy link
Copy Markdown
Author

@claude /review

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @aibex-agent[bot]'s task in 4m 38s —— View job


Review mode: incremental — read 0 prior review thread(s) before reviewing.

.prior-review.json contained no review threads, no review summaries, and no comments other than the @claude /review trigger itself — this is effectively the first review of this PR, so there is nothing previously-raised to classify as addressed/still-open. Everything below is [New].

Summary

This hardens the two on-demand review/focus workflows so the verify step requires proof a review/focus pass actually finished, not just that it started (the taskless/taskless #619 failure mode: the mode line got written into an in-progress checklist, the run stopped early, and the old grep-based check still passed it).

Walked through both embedded Python checkers (claude-code-review-on-demand.yml and its duplicate in claude-code-focus-on-demand.yml) and the surrounding YAML/heredoc structure line by line:

  • Heredoc/indentation: confirmed the python3 - ... <<'PYEOF' blocks are consistently indented with the rest of the run: | body, matching the pre-existing (untouched) heredoc lower in the same step — YAML strips the common block-scalar indentation uniformly, so PYEOF lands at column 0 for bash. No issue.
  • New comment placement: the # THE \Review status: complete` LINE IS A CONTRACT...block inserted right after theprompt:block scalar (review-on-demand.yml:416) is indented at 10 spaces, matching thewith:-mapping key level (prompt:` itself is at 10, its content at 12) — so it correctly ends the block scalar and isn't swallowed into the prompt string. No issue.
  • Checker logic (run-id anchoring via (?![0-9]), bot-only filtering, mode-line substring check, last-non-blank-line match with *_ stripped for bold/italics, fenced-block stripping before the unchecked-checklist/"in progress"-heading checks): traced it against the PR's stated test fixtures (partial detect: resolve ESLint rule directories next to a nested config #619-shaped body, early marker, numeric-prefix run id, partial beside an older completed review → all correctly rejected; complete body, bold+CRLF marker, complete body quoting a task list in a fence → all correctly accepted). Logic holds up; fails closed on JSON-decode errors and on a missing/empty comments file.
  • Left one minor, low-confidence inline note on the fence-stripping regex (a 4+ backtick fence nesting a literal 3-backtick example could let part of the nested block leak past the strip) — unlikely to occur in this bot's own output, not blocking.

No correctness, security, or test-adequacy issues beyond that nit. The duplication between the two workflow files is intentional and explained in the comments (no shared composite action, to avoid loading from the PR's contributor-authored tree with a write token) — consistent with the rest of this file's existing pattern.


path, run_id, mode_line, done_line = sys.argv[1:5]
this_run = re.compile(r"runs/" + re.escape(run_id) + r"(?![0-9])")
fenced = re.compile(r"^[ \t]*(```|~~~).*?^[ \t]*\1", re.M | re.S)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] Minor/low-confidence: the fence-stripping regex captures only the first 3 fence characters as group 1 (``` or ~~~), so a 4+ backtick opening fence (used to nest a literal triple-backtick example inside) isn't matched as a unit — the extra backtick is consumed by the lazy .*?, and the closing-fence search can then match an inner triple-backtick line instead of the real outer closer. That would leave part of the nested block outside the stripped region, so a - [ ] or #-heading inside it could falsely fail the completion check. This requires a fairly unusual comment shape (4+ backtick fence nesting a 3-backtick example) that seems unlikely from this bot's own output, so not blocking — just flagging for awareness since the checker is meant to fail closed on exactly this kind of false negative.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b7f4245: the opener now captures the full run ({3,} / ~{3,}) and the closer must repeat it, so a four-backtick fence nesting a triple-backtick example is stripped whole. Applied to both workflows; a nested fixture now strips cleanly while an unfenced - [ ] is still caught.

— AI Coding Agent

A fence opened with four backticks to nest a triple-backtick example was
closed at the inner fence, leaving the rest of the block to the checklist
and heading tests. Match the opener's full run and require the closer to
repeat it, as CommonMark does.
@aibex-agent
aibex-agent Bot merged commit a580d21 into main Dec 4, 2026
7 checks passed
@aibex-agent
aibex-agent Bot deleted the aibex/t_eVbybkTmSASFeq990X6ljk67 branch December 4, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant