Skip to content

ci/ai: make the /investigate agent reliably deliver its findings#172151

Merged
rickystewart merged 1 commit into
cockroachdb:masterfrom
rickystewart:ricky/tttqsmplwpsn
Jun 30, 2026
Merged

ci/ai: make the /investigate agent reliably deliver its findings#172151
rickystewart merged 1 commit into
cockroachdb:masterfrom
rickystewart:ricky/tttqsmplwpsn

Conversation

@rickystewart

Copy link
Copy Markdown
Contributor

The /investigate agent sometimes finished a successful investigation without its analysis ever reaching the issue: instead of writing artifacts/findings.md (which a later workflow step posts), it tried to post the comment itself via gh issue comment — denied by the sandbox — and saved its report under /tmp. The post step then found no file and fell back to "Investigation did not produce findings," forcing a human to copy the analysis out of the workflow run by hand.

Two complementary changes:

  • Reframe the agent prompt so the report file is its sole deliverable and remove every cue that the output becomes a posted comment — the likely source of the temptation to post directly. The feedback footer, the most explicit such cue, moves from the agent's template into the workflow's post step.

  • Add a recovery step that, when artifacts/findings.md is absent, extracts the agent's final summary from the action's execution-output JSON and writes it to the file. This is defense-in-depth: it also covers the agent failing to write the file for unrelated reasons (out of turns, crash mid-write). A missing file now reflects a genuinely empty investigation rather than a misrouted one.

Epic: none
Release note: None

The /investigate agent sometimes finished a successful investigation
without its analysis ever reaching the issue: instead of writing
artifacts/findings.md (which a later workflow step posts), it tried to
post the comment itself via gh issue comment — denied by the sandbox —
and saved its report under /tmp. The post step then found no file and
fell back to "Investigation did not produce findings," forcing a human
to copy the analysis out of the workflow run by hand.

Two complementary changes:

- Reframe the agent prompt so the report file is its sole deliverable
  and remove every cue that the output becomes a posted comment — the
  likely source of the temptation to post directly. The feedback footer,
  the most explicit such cue, moves from the agent's template into the
  workflow's post step.

- Add a recovery step that, when artifacts/findings.md is absent,
  extracts the agent's final summary from the action's execution-output
  JSON and writes it to the file. This is defense-in-depth: it also
  covers the agent failing to write the file for unrelated reasons (out
  of turns, crash mid-write). A missing file now reflects a genuinely
  empty investigation rather than a misrouted one.

Epic: none
Release note: None
@rickystewart rickystewart requested a review from a team as a code owner June 30, 2026 18:53
@rickystewart rickystewart merged commit 8ba72f3 into cockroachdb:master Jun 30, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants