Skip to content

ci: report why Bob Shell stopped, keep valid findings, and fix triage text - #4799

Merged
dolfim-ibm merged 1 commit into
mainfrom
ci/ai-triage-robust-answers
Oct 13, 2026
Merged

dolfim-ibm merged 1 commit into
mainfrom
ci/ai-triage-robust-answers

Conversation

@dolfim-ibm

Copy link
Copy Markdown
Member

An audit of the AI triage and review runs after #4730 (44 runs, 34 triage comments, 26 reviews with 16 inline findings, each checked against the code) found these problems:

Changes:

  • read_bob_output reads the event lines and reports why Bob Shell stopped (::warning::Bob Shell stopped early: ...). When a limit stops the task, the last message is usually a tool result, so the review is still lost, but the warning says why instead of "Extra data". extract_answer takes the last top-level object that has the answer keys: a draft object or text after the answer no longer breaks the parse, and a nested object of a broken answer is not read as an empty review.
  • A finding with a bad path, line, or severity is dropped with a warning. The other findings stay.
  • The code-span helpers move from ai_pr_review.py to ai_pr_triage.py. The triage renders model text with markdown_inline: code spans stay, the rest is escaped. A pipe in a code span in a table cell is escaped, so the cell does not split.
  • The triage publish step removes ai:review-* labels when the last AI review is not of the head commit. A review of the head in the same run sets its label again after this.
  • Prompts:
    • triage: stricter duplicate, concerns based on a diff line, no internal names or input problems in the answer;
    • review: stricter blocker, one root cause per finding, settle checks instead of handing them to the reviewer, a turn budget, and file references as code.
  • .github/CI_LABELS.md documents the duplicate rule and the review-label reset.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Review evidence:

  • New tests:
    • a limit-stopped output in the real two-line shape reports "stopped early";
    • the last answer object wins over a draft, and a broken answer is not read from a nested object;
    • a bad finding is dropped and the others are kept;
    • code spans and a pipe in a table-cell code span render correctly;
    • stale review labels.
  • A comment with code spans, a table-cell pipe, a link, a fence, and a mention, rendered with the GitHub Markdown API: code spans render as <code>, the cell stays one cell, and the link, fence, and mention stay literal text.
  • pytest tests/test_ai_pr_event.py tests/test_ai_pr_triage.py tests/test_ai_pr_review.py: 38 passed. ruff, ty check .github/scripts, make validate: passed.
  • Not verified: the effect of the prompt changes. This needs a few days of runs.

… text

An audit of 44 AI triage runs and 26 AI reviews after #4730 found these
problems:

- 7 of 26 reviews were lost. When Bob Shell reaches its turn or cost
  limit, it writes an error event before the result. extract parsed the
  output as one JSON document and failed with "Extra data". One finding
  with a path outside the PR also discarded the whole review.
- The triage escaped the backticks of code spans, so every code name in a
  triage comment showed as literal backticks.
- ai:review-* labels of an older commit stayed after a manual run or
  /ai triage, because only a push resets the labels.
- The triage rated a closed PR and a 2-line overlap as duplicates, raised
  CI concerns from guesses, and wrote internal names ("risk.forced") into
  the comment. The review rated small defects as blockers, split one root
  cause into three blockers, asked the human to verify points the code
  already settles, and wrote relative links that break on GitHub.

Changes:

- read_bob_output reads the event lines and reports why Bob Shell stopped.
  extract_answer takes the last top-level object with the answer keys, so
  a draft object or text after the answer does not break the parse, and a
  nested object of a broken answer is not read as an empty answer.
- A finding with a bad path, line, or severity is dropped with a warning.
  The other findings stay.
- The triage renders model text with markdown_inline, which keeps code
  spans and escapes the rest. A pipe in a code span in a table cell is
  escaped, so the cell does not split.
- The triage publish step removes ai:review-* labels when the last AI
  review is not of the head commit.
- The prompts define duplicate and blocker more strictly, ask for evidence
  instead of hand-offs to the reviewer, give the review a turn budget, and
  ask for file references as code.

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @dolfim-ibm, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@dolfim-ibm
dolfim-ibm requested review from cau-git and ceberam October 13, 2026 08:19
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dolfim-ibm
dolfim-ibm merged commit e3842c0 into main Oct 13, 2026
53 checks passed
@dolfim-ibm
dolfim-ibm deleted the ci/ai-triage-robust-answers branch October 13, 2026 08:41
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.

2 participants