Skip to content

Add bug-agent pipeline with explicit comment trigger#8640

Draft
polmichel wants to merge 14 commits intostablefrom
pmi-20260318-bug-analyst-agent
Draft

Add bug-agent pipeline with explicit comment trigger#8640
polmichel wants to merge 14 commits intostablefrom
pmi-20260318-bug-analyst-agent

Conversation

@polmichel
Copy link
Copy Markdown
Contributor

@polmichel polmichel commented Mar 18, 2026

Why

We need an automated bug triage pipeline using Claude Code agents (analyst → fix → review), but it should not trigger automatically on every bug issue to avoid flooding the project with agent activity.

What changed

  • Three agent prompt files added in .github/bug-agent-pipeline/: analyst.md, fix.md, review.md — structured instructions for each stage of the pipeline
  • Three GitHub Actions workflows in .github/workflows/: bug-agent-analyst.yml, bug-agent-fix.yml, bug-agent-review.yml
  • Analyst trigger changed to explicit opt-in: the analyst workflow only fires when someone posts /bug-analyze as a comment on a bug-labeled issue (not on issue open/label)
  • Fix and review are chained automatically: the fix agent triggers on the AGENT_ANALYSIS_COMPLETE marker, and the review agent triggers on the AGENT_FIX_COMPLETE marker in a PR body
  • Markdown formatting aligned with project guidelines: top-level headings, sequential numbering, no emoji in headings, code-fenced template blocks, consistent punctuation

How to review

  • The workflow files define triggers, permissions, and prompt injection — check that the if conditions are tight enough
  • The prompt files are the agent instructions — review for clarity and safety (no destructive operations, no force pushes)

How to test

  1. Create a test issue with the bug label
  2. Post a comment containing /bug-analyze
  3. Verify the analyst workflow triggers (requires ANTHROPIC_API_KEY secret configured)
  4. The fix and review workflows will chain automatically from there

Impact & rollout

  • Backward compatibility: no breaking changes — new files only
  • Performance: no impact on existing CI; workflows only trigger on specific comment/marker patterns
  • Config/env changes: requires ANTHROPIC_API_KEY secret in the repository
  • Deployment notes: safe to merge — no workflow runs until someone explicitly posts /bug-analyze

Summary by CodeRabbit

  • New Features
    • Added an automated bug pipeline: trigger analysis with /bug-analyze on bug-labeled issues, auto-generate draft fixes when analysis completes, and perform automated reviews for agent-created PRs.
  • Documentation
    • Added workflow guidelines describing agent behaviors, required PR/comment formats, and staged validation steps for analysis, fixes, and reviews.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a multi-stage automated bug pipeline: three GitHub Actions workflows and accompanying agent guidance. New workflows are .github/workflows/bug-agent-analyst.yml (triggers on issue comments containing /bug-analyze for issues labeled bug), .github/workflows/bug-agent-fix.yml (runs when analysis completes), and .github/workflows/bug-agent-review.yml (runs on PRs marked as agent fix complete). Each workflow loads a corresponding prompt document from .github/bug-agent-pipeline/ (analyst.md, fixer.md, reviewer.md) and invokes an AI code-action using a repository secret.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: introduction of a bug-agent pipeline with explicit comment-based trigger mechanism, which is the core objective of the PR.
Description check ✅ Passed The description is comprehensive and well-structured, covering Why, What changed, How to review, How to test, and Impact & rollout sections with sufficient detail for the changeset scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the group/ci Issue related to the CI pipeline label Mar 18, 2026
@polmichel polmichel requested a review from gmazoyer March 18, 2026 14:34
@polmichel polmichel force-pushed the pmi-20260318-bug-analyst-agent branch from c72ed6b to 6812369 Compare March 18, 2026 14:39
@polmichel polmichel changed the base branch from develop to stable March 19, 2026 15:52
@polmichel polmichel force-pushed the pmi-20260318-bug-analyst-agent branch from dbfdf67 to 232dcc7 Compare March 20, 2026 06:21
@polmichel polmichel marked this pull request as ready for review March 20, 2026 06:23
@polmichel polmichel requested a review from a team March 20, 2026 06:23
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/bug-agent-review.yml (1)

31-44: Consider prompt injection risk from PR body interpolation.

The PR body (github.event.pull_request.body) is directly interpolated into the prompt. While the fix agent controls this content in the expected flow, a malicious actor could manually create a PR with AGENT_FIX_COMPLETE in the body and inject adversarial instructions. Consider whether this risk is acceptable given the agent's limited permissions (read + PR comments).

Additionally, pinning anthropics/claude-code-action to a specific version or commit SHA rather than @main would improve reproducibility and protect against upstream changes.

🔒 Proposed version pinning
-      - uses: anthropics/claude-code-action@main
+      - uses: anthropics/claude-code-action@v1  # or pin to specific SHA
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bug-agent-review.yml around lines 31 - 44, The workflow
currently interpolates untrusted github.event.pull_request.body into the Claude
prompt and pins anthropics/claude-code-action to `@main`; to fix, sanitize or
validate the PR body before injection (e.g., strip/escape control tokens like
AGENT_FIX_COMPLETE or any instruction-like lines, or limit insertion to a safe
summary from steps.prompt.outputs.PROMPT) so the prompt cannot be manipulated by
a malicious PR, and pin the action reference (replace
anthropics/claude-code-action@main) to a specific release tag or commit SHA to
avoid upstream changes; update the workflow where steps.prompt.outputs.PROMPT
and github.event.pull_request.body are combined and the uses entry for
anthropics/claude-code-action accordingly.
.github/workflows/bug-agent-analyst.yml (1)

34-46: Consider prompt injection risk and action version pinning.

Similar to the review workflow, the issue body is directly interpolated into the prompt. While less risky since it requires a bug label and explicit /bug-analyze trigger, consider whether adversarial issue content could manipulate the agent.

For consistency across all three workflows, pin anthropics/claude-code-action to a specific version:

🔒 Proposed version pinning
-      - uses: anthropics/claude-code-action@main
+      - uses: anthropics/claude-code-action@v1  # or pin to specific SHA
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bug-agent-analyst.yml around lines 34 - 46, The workflow
currently uses anthropics/claude-code-action@main and injects
github.event.issue.body and steps.prompt.outputs.PROMPT directly into the
`prompt`, creating prompt-injection risk and an unpinned action; change the
action reference from `anthropics/claude-code-action@main` to a specific
released tag (e.g., a stable semver tag) and sanitize/escape or validate
`github.event.issue.body` (and any content fed into
`steps.prompt.outputs.PROMPT`) before interpolation—implement a step that strips
or encodes dangerous characters and enforces the `bug` label and `/bug-analyze`
trigger as preconditions so only validated issue text reaches the `prompt`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bug-agent-analyst.yml:
- Around line 17-21: The workflow's permissions block currently grants
"contents: read" which prevents pushes; update the permissions under the
"permissions:" key by replacing "contents: read" with "contents: write" so the
analyst agent can create a branch, commit, and push as instructed (look for the
"permissions:" stanza and the "contents: read" entry).

---

Nitpick comments:
In @.github/workflows/bug-agent-analyst.yml:
- Around line 34-46: The workflow currently uses
anthropics/claude-code-action@main and injects github.event.issue.body and
steps.prompt.outputs.PROMPT directly into the `prompt`, creating
prompt-injection risk and an unpinned action; change the action reference from
`anthropics/claude-code-action@main` to a specific released tag (e.g., a stable
semver tag) and sanitize/escape or validate `github.event.issue.body` (and any
content fed into `steps.prompt.outputs.PROMPT`) before interpolation—implement a
step that strips or encodes dangerous characters and enforces the `bug` label
and `/bug-analyze` trigger as preconditions so only validated issue text reaches
the `prompt`.

In @.github/workflows/bug-agent-review.yml:
- Around line 31-44: The workflow currently interpolates untrusted
github.event.pull_request.body into the Claude prompt and pins
anthropics/claude-code-action to `@main`; to fix, sanitize or validate the PR body
before injection (e.g., strip/escape control tokens like AGENT_FIX_COMPLETE or
any instruction-like lines, or limit insertion to a safe summary from
steps.prompt.outputs.PROMPT) so the prompt cannot be manipulated by a malicious
PR, and pin the action reference (replace anthropics/claude-code-action@main) to
a specific release tag or commit SHA to avoid upstream changes; update the
workflow where steps.prompt.outputs.PROMPT and github.event.pull_request.body
are combined and the uses entry for anthropics/claude-code-action accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff9231ea-fcb5-47a6-8d61-e711a50d0601

📥 Commits

Reviewing files that changed from the base of the PR and between 59b4752 and b18154f.

📒 Files selected for processing (6)
  • .github/bug-agent-pipeline/analyst.md
  • .github/bug-agent-pipeline/fix.md
  • .github/bug-agent-pipeline/review.md
  • .github/workflows/bug-agent-analyst.yml
  • .github/workflows/bug-agent-fix.yml
  • .github/workflows/bug-agent-review.yml

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bug-agent-analyst.yml:
- Around line 14-16: The current job if condition only checks the comment text
and the 'bug' label and must be hardened to allow only trusted commenters;
update the job-level if to also require that
github.event.comment.author_association is one of OWNER, MEMBER, or COLLABORATOR
(e.g., add checks alongside contains(github.event.comment.body, '/bug-analyze')
and contains(github.event.issue.labels.*.name, 'bug') so the job runs only when
the commenter’s author_association equals 'OWNER' or 'MEMBER' or
'COLLABORATOR').
- Around line 6-8: Add a YAML document start marker and quote the problematic
key to satisfy yamllint: insert a leading `---` at the top of the workflow and
change the unquoted key on: to a quoted key "on": so the existing name: "Bug
analyst agent" and its following on/"on" block remain unchanged; this removes
the `document-start` and `truthy` warnings reported for name and on.
- Line 34: The workflow currently references the GitHub Action as
"anthropics/claude-code-action@main"; replace that mutable ref with an immutable
commit SHA (e.g., "anthropics/claude-code-action@<commit-sha>") to pin the
action; locate the uses: anthropics/claude-code-action@main entry in the
workflow, update the ref to a specific commit SHA, and verify the workflow runs
against that SHA (and optionally add a comment with the chosen tag/PR for future
updates).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b90b72a-d633-4803-bd38-cec75bac3bb6

📥 Commits

Reviewing files that changed from the base of the PR and between b18154f and 3e3d67a.

📒 Files selected for processing (1)
  • .github/workflows/bug-agent-analyst.yml

@ajtmccarty
Copy link
Copy Markdown
Contributor

looks like it could be valuable
do you have a bug issue that you've tested on that could be linked in the description?
also, there's a slight mismatch in the naming of the steps analyst is a noun and fix and review are verbs. should either be analyze, fix, review or analyst, fixer, reviewer

polmichel and others added 6 commits March 23, 2026 09:15
Adds analyst, fix, and review agents as GitHub Actions workflows
triggered by /bug-analyze issue comments. Each agent has a dedicated
prompt file and workflow definition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@polmichel
Copy link
Copy Markdown
Contributor Author

polmichel commented Mar 23, 2026

@ajtmccarty A few minutes ago, I tested the workflow locally on this bug. #8670 / #8620

First feedbacks on my side:

@polmichel polmichel force-pushed the pmi-20260318-bug-analyst-agent branch from d9e87fa to 4f0c631 Compare March 23, 2026 10:01
@polmichel polmichel requested a review from a team as a code owner March 23, 2026 10:01
@github-actions github-actions bot added the group/frontend Issue related to the frontend (React) label Mar 23, 2026
@polmichel polmichel force-pushed the pmi-20260318-bug-analyst-agent branch from 4f0c631 to 1c5f98a Compare March 23, 2026 10:02
@github-actions github-actions bot removed the group/frontend Issue related to the frontend (React) label Mar 23, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/bug-agent-pipeline/fixer.md (1)

15-17: Add an explicit AGENTS.md consultation step

Please add a short instruction near the top to consult repository AGENTS.md guidance before implementation, so fixer behavior stays aligned with project standards.

Based on learnings: Agents should use the AGENTS.md documentation for implementation guidelines and best practices.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/bug-agent-pipeline/fixer.md around lines 15 - 17, Insert a short
step near the top of .github/bug-agent-pipeline/fixer.md instructing the fixer
to consult the repository AGENTS.md before implementing fixes; specifically add
a line immediately above or following the existing "Read the analysis carefully"
step (the block that begins "1. Read the analysis carefully: pay special
attention to the 'Notes for the fix agent' section.") that says something like
"Consult AGENTS.md for repository-specific agent guidance and best practices
before implementing fixes." Ensure the new instruction is brief, prominent, and
references AGENTS.md so fixers follow project standards.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/bug-agent-pipeline/fixer.md:
- Around line 59-68: Renumber the procedural steps so they are sequential (the
current "7." and "8." should follow the previous "5."), e.g., change "7. Open a
**DRAFT Pull Request**..." to "6. Open a **DRAFT Pull Request**..." and change
the following "8. Post a comment..." to "7. Post a comment..." (and update any
other downstream step numbers if present), while keeping the PR-body
instructions and the hidden marker `<!-- AGENT_FIX_COMPLETE -->` unchanged.
- Around line 32-37: Replace direct directory changes that leak state by running
those commands in isolated subshells; specifically, change the invocation that
uses "cd frontend/app && npx biome check --write ." so the directory change is
scoped (use a subshell or pushd/popd) and does not affect subsequent phases, and
apply the same pattern to the other sequential commands mentioned around lines
39-50 so each phase runs with its own working directory isolation.

---

Nitpick comments:
In @.github/bug-agent-pipeline/fixer.md:
- Around line 15-17: Insert a short step near the top of
.github/bug-agent-pipeline/fixer.md instructing the fixer to consult the
repository AGENTS.md before implementing fixes; specifically add a line
immediately above or following the existing "Read the analysis carefully" step
(the block that begins "1. Read the analysis carefully: pay special attention to
the 'Notes for the fix agent' section.") that says something like "Consult
AGENTS.md for repository-specific agent guidance and best practices before
implementing fixes." Ensure the new instruction is brief, prominent, and
references AGENTS.md so fixers follow project standards.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 426d9f01-b407-449f-bfd1-19a811f52d2c

📥 Commits

Reviewing files that changed from the base of the PR and between d9e87fa and 1c5f98a.

📒 Files selected for processing (6)
  • .github/bug-agent-pipeline/analyst.md
  • .github/bug-agent-pipeline/fixer.md
  • .github/bug-agent-pipeline/reviewer.md
  • .github/workflows/bug-agent-analyst.yml
  • .github/workflows/bug-agent-fix.yml
  • .github/workflows/bug-agent-review.yml
✅ Files skipped from review due to trivial changes (4)
  • .github/bug-agent-pipeline/reviewer.md
  • .github/bug-agent-pipeline/analyst.md
  • .github/workflows/bug-agent-review.yml
  • .github/workflows/bug-agent-fix.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/bug-agent-analyst.yml

@gmazoyer
Copy link
Copy Markdown
Contributor

* additional CI pre-checks are required to streamline the process and avoid classic CI failures (maybe ask the bug fixer agent to use the /pre-ci command? [Add Claude Code slash commands: pre-ci, feedback, audit-docs #8608](https://github.com/opsmill/infrahub/pull/8608))

Calling such command seems overkill. This is fine from a user perspective as it is some sort of shortcut for us. However, it's litteraly about calling ruff, mypy, ty and all these commands. Since we have invoke commands to run these one after the other, we should just add to the instructions that uv run invoke backend.lint should be called prior to creating any commit/PR.

@polmichel
Copy link
Copy Markdown
Contributor Author

polmichel commented Mar 23, 2026

uv run invoke backend.lint

This may be overkill yes, however as the fix could include front-end code, schema modification, maybe backend.lint is not enough?

@gmazoyer
Copy link
Copy Markdown
Contributor

gmazoyer commented Mar 23, 2026

uv run invoke backend.lint

This may be overkill yes, however as the fix could include front-end code, schema modification, maybe backend.lint is not enough?

All our linting commands should produce idempotent results (if they do not then we have bugs). So we should just call them one after the other not matter what was changed. I'm not in favour of having some agent depend on a claude command (because LLM do not operate in a idempotent way). But that's a personal take, I'll accept that I can be wrong if other people feel comfortable with using a claude slash command instead.

@polmichel
Copy link
Copy Markdown
Contributor Author

uv run invoke backend.lint

This may be overkill yes, however as the fix could include front-end code, schema modification, maybe backend.lint is not enough?

All our linting commands should produce idempotent results (if they do not then we have bugs). So we should just call them one after the other not matter what was changed. I'm not in favour of having some agent depend on a claude command (because LLM do not operate in a idempotent way). But that's a personal take, I'll accept that I can be wrong if other people feel comfortable with using a claude slash command instead.

But besides the Claude command, on which I agree with you, would we need commands other than just backend.lint? For now, I have put these commands into the bug fixer file.

  1. Run pre-CI checks before pushing. Fix any issues they surface and amend your commit.

    Phase 1 — Auto-fix formatting (sequential, in this order):

    uv run invoke format
    uv run invoke docs.format
    (cd frontend/app && npx biome check --write .)

    Phase 2 — Fast checks (run all 3 in parallel):

    • uv run invoke main.lint
    • uv lock --check (if it fails, run uv lock and commit the updated lockfile)
    • (cd frontend/app && npm run codegen:graphql) (if files change, stage them)

    Phase 3 — Slow checks (run all 6 in parallel):

    • uv run invoke backend.lint
    • (cd frontend/app && npx betterer)
    • uv run invoke docs.lint
    • uv run invoke backend.validate-generated
    • uv run invoke schema.validate-graphqlschema
    • uv run invoke schema.validate-jsonschema

    Phase 4 — Unit tests:

    uv run invoke backend.test-unit

@gmazoyer
Copy link
Copy Markdown
Contributor

gmazoyer commented Mar 23, 2026

Not sure if we should call validate commands as we are going to review the PR anyway. Maybe we just want to run the generate commands and see what they give us. I would call all of these, but could be I miss some:

  • invoke main.scan
  • invoke backend.format-and-lint
  • invoke schema.generate-graphqlschema
  • invoke schema.generate-jsonschema
  • invoke docs.generate
  • invoke docs.lint
  • npm run codegen:graphql
  • npm run codegen:openapi
  • npm run betterer --update

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
.github/bug-agent-pipeline/fixer.md (3)

48-48: Consider consistent error handling guidance for all Phase 2 commands.

Line 48 provides explicit fallback instructions for uv lock --check (run uv lock and commit), but other commands in Phase 2—especially the generate commands (lines 43-47)—lack similar guidance. If backend.generate or schema.generate-graphqlschema fails or produces unexpected changes, the agent may be uncertain how to proceed.

Adding a general note like "If any generate command fails, review the error, fix the root cause, and re-run" would improve consistency and agent confidence.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/bug-agent-pipeline/fixer.md at line 48, Add consistent fallback
guidance for Phase 2 generate and lock steps: for commands like
`backend.generate`, `schema.generate-graphqlschema`, and `uv lock --check`
instruct the agent that if any generate command fails or yields unexpected
changes it should inspect the error/output, fix the root cause (e.g.,
dependency, schema, or config issue), re-run the failing command, and if `uv
lock --check` reports change, run `uv lock` and commit the updated lockfile;
include a short general note covering these steps so all Phase 2 commands have
the same error-handling guidance.

3-11: Consider referencing AGENTS.md for additional context.

Based on learnings, agent-related documents should reference AGENTS.md for implementation guidelines and best practices. Adding a brief note directing the agent to consult AGENTS.md (if it exists in the repository) would align with project conventions and provide the agent with additional context.

Based on learnings: "Agents should use the AGENTS.md documentation for implementation guidelines and best practices."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/bug-agent-pipeline/fixer.md around lines 3 - 11, Add a short note
under the "Before proceeding" or "Your role" section instructing the bug analyst
agent to consult AGENTS.md (if present) for implementation guidelines and best
practices; update the .github/bug-agent-pipeline/fixer.md content to include a
single sentence like "See AGENTS.md for agent implementation guidelines and best
practices (if present in the repository)" so agents know to reference that
document when working on the branch referenced by the "Before proceeding"
instructions.

39-52: Clarify parallel execution syntax for the AI agent.

Line 39 instructs the agent to "run all in parallel," but the bullet-point list provides no explicit parallelization mechanism (e.g., bash & with wait, GNU parallel, or xargs -P). An AI agent may interpret this as sequential execution, which would miss the intended performance benefit.

Consider adding explicit parallel execution syntax or a note like: "Use background jobs (&) and wait, or run with xargs -P to execute concurrently."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/bug-agent-pipeline/fixer.md around lines 39 - 52, The "Phase 2 —
Regenerate & lint (run all in parallel)" step is ambiguous because the listed
commands (e.g., `uv run invoke main.scan`, `uv run invoke main.lint`, `uv run
invoke backend.lint`, `uv run invoke backend.generate`, `uv run invoke
schema.generate-graphqlschema`, `uv run invoke schema.generate-jsonschema`, `uv
run invoke docs.generate`, `uv run invoke docs.lint`, `uv lock --check`, `(cd
frontend/app && npm run codegen:graphql)`, `(cd frontend/app && npm run
codegen:openapi)`, `(cd frontend/app && npx betterer --update)`) lack explicit
parallelization syntax; update the docs to show how to run them concurrently
(for example instruct the agent to run each command as a background job with `&`
and then `wait`, or provide an alternative using `xargs -P`/GNU `parallel`) and
include a short example or note stating which method is preferred so the agent
will not execute them sequentially.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/bug-agent-pipeline/fixer.md:
- Line 48: Add consistent fallback guidance for Phase 2 generate and lock steps:
for commands like `backend.generate`, `schema.generate-graphqlschema`, and `uv
lock --check` instruct the agent that if any generate command fails or yields
unexpected changes it should inspect the error/output, fix the root cause (e.g.,
dependency, schema, or config issue), re-run the failing command, and if `uv
lock --check` reports change, run `uv lock` and commit the updated lockfile;
include a short general note covering these steps so all Phase 2 commands have
the same error-handling guidance.
- Around line 3-11: Add a short note under the "Before proceeding" or "Your
role" section instructing the bug analyst agent to consult AGENTS.md (if
present) for implementation guidelines and best practices; update the
.github/bug-agent-pipeline/fixer.md content to include a single sentence like
"See AGENTS.md for agent implementation guidelines and best practices (if
present in the repository)" so agents know to reference that document when
working on the branch referenced by the "Before proceeding" instructions.
- Around line 39-52: The "Phase 2 — Regenerate & lint (run all in parallel)"
step is ambiguous because the listed commands (e.g., `uv run invoke main.scan`,
`uv run invoke main.lint`, `uv run invoke backend.lint`, `uv run invoke
backend.generate`, `uv run invoke schema.generate-graphqlschema`, `uv run invoke
schema.generate-jsonschema`, `uv run invoke docs.generate`, `uv run invoke
docs.lint`, `uv lock --check`, `(cd frontend/app && npm run codegen:graphql)`,
`(cd frontend/app && npm run codegen:openapi)`, `(cd frontend/app && npx
betterer --update)`) lack explicit parallelization syntax; update the docs to
show how to run them concurrently (for example instruct the agent to run each
command as a background job with `&` and then `wait`, or provide an alternative
using `xargs -P`/GNU `parallel`) and include a short example or note stating
which method is preferred so the agent will not execute them sequentially.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33e1618b-e2b6-4fe7-8b27-ead0b0180dd2

📥 Commits

Reviewing files that changed from the base of the PR and between 1c5f98a and 94d4b29.

📒 Files selected for processing (1)
  • .github/bug-agent-pipeline/fixer.md

@polmichel
Copy link
Copy Markdown
Contributor Author

@ajtmccarty A few minutes ago, I tested the workflow locally on this bug. #8670 / #8620

First feedbacks on my side:

I will close this PR and do another test with the new feedbacks incorporated

@polmichel
Copy link
Copy Markdown
Contributor Author

First test

#8670 (contains the initial comment of the analysis deleted from the issue)

Second test

PR: #8677 / #8620

@ajtmccarty
Copy link
Copy Markdown
Contributor

root cause analysis review

  • see this comment on bug: noisy and irrelevant error messages in the neo4j logs #8620
  • this analysis is factually correct, but it suggests a fix that we should not execute (my reasoning below)
  • mentions an added test file, which I found kind of confusing b/c there is code associated with the bug report like there is for a PR. I think that the bug report could describe a test to reproduce the problem, but I don't think that it should include a test file name from a PR

suggested fix review

  • see Local test AI Bug pipeline #2: suppress Neo4j warnings for optional relationship types (closes #8620) #8677
  • this does correctly implement the fix suggested in the root cause analysis above, but I don't think this is the correct fix for the issue
  • moving the edge types out of the query path and into a filter using the type() function (ie MATCH ()-[e:HAS_SOURCE]->() to MATCH ()-[e]->() WHERE type(e) IN ["HAS_SOURCE"]) makes it so that the query planner cannot include the edge type when planning how to execute the query, which can negatively impact performance
  • the right fix is to find a way to suppress this log message w/o updating the queries

conclusion

seems like the LLM did a fine job of reviewing and trying to fix the bug. I think that this approach would work, but we shouldn't do it. it might give a better result on a different bug

@polmichel polmichel marked this pull request as draft March 23, 2026 21:09
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
)
runs-on: ubuntu-latest
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should run these actions on our bigger runners to allow the agent to run the tests

contents: write

steps:
- uses: actions/checkout@v4
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.

should be v6

cat .github/bug-agent-pipeline/analyst.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- uses: anthropics/claude-code-action@6062f3709600659be5e47fcddf2cf76993c235c2 # main 2026-03-23
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.

Prefer the release version instead

pull-requests: write

steps:
- uses: actions/checkout@v4
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.

same

cat .github/bug-agent-pipeline/fix.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- uses: anthropics/claude-code-action@main
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.

same

pull-requests: write

steps:
- uses: actions/checkout@v4
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.

same

cat .github/bug-agent-pipeline/review.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- uses: anthropics/claude-code-action@main
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.

same


"on":
pull_request:
types: [opened, ready_for_review]
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.

That's not a draft PR based on those types.
Also, we could limit the target branch as well, to avoid starting it for nothing until the job gets cancelled due to missing the AGENT_FIX_COMPLETE

id: prompt
run: |
echo "PROMPT<<EOF" >> $GITHUB_OUTPUT
cat .github/bug-agent-pipeline/fix.md >> $GITHUB_OUTPUT
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.

Workflow files reference fix.md / review.md but files were renamed to fixer.md / reviewer.md — fixer and reviewer will fail at runtime

id: prompt
run: |
echo "PROMPT<<EOF" >> $GITHUB_OUTPUT
cat .github/bug-agent-pipeline/review.md >> $GITHUB_OUTPUT
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.

Workflow files reference fix.md / review.md but files were renamed to fixer.md / reviewer.md — fixer and reviewer will fail at runtime

- `uv run invoke docs.generate`
- `uv run invoke docs.lint`
- `uv lock --check` (if it fails, run `uv lock` and commit the updated lockfile)
- `(cd frontend/app && npm run codegen:graphql)`
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.

should be using pnpm

fix:
if: |
contains(github.event.comment.body, 'AGENT_ANALYSIS_COMPLETE') &&
contains(github.event.issue.labels.*.name, 'bug')
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.

Fixer workflow has no author_association guard


jobs:
review:
if: contains(github.event.pull_request.body, 'AGENT_FIX_COMPLETE')
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.

Review workflow triggers on any PR containing the marker — no author check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/ci Issue related to the CI pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants